-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreadme.html
More file actions
763 lines (703 loc) · 36.4 KB
/
readme.html
File metadata and controls
763 lines (703 loc) · 36.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>UltimateServer - A Powerful C# Server</title>
<style>
/* --- General Setup & Theming --- */
:root {
--bg-color: #0d1117;
--content-bg-color: #161b22;
--border-color: #30363d;
--text-color: #c9d1d9;
--heading-color: #f0f6fc;
--link-color: #58a6ff;
--link-hover-color: #79c0ff;
--code-bg-color: #0d1117;
--card-bg-color: #0d1117;
}
html {
scroll-behavior: smooth;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
background-color: var(--bg-color);
color: var(--text-color);
line-height: 1.6;
margin: 0;
padding: 0;
}
/* --- Main Layout --- */
.container {
max-width: 900px;
margin: 20px auto;
padding: 20px 40px;
background-color: var(--content-bg-color);
border: 1px solid var(--border-color);
border-radius: 10px;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
/* --- Header & Hero Section --- */
.header {
text-align: center;
padding-bottom: 20px;
border-bottom: 1px solid var(--border-color);
margin-bottom: 30px;
}
.header img {
max-width: 200px;
height: auto;
margin-bottom: 20px;
}
.header h1 {
font-size: 3em;
font-weight: 600;
color: var(--heading-color);
margin: 0;
}
.header p {
font-size: 1.2em;
max-width: 700px;
margin: 15px auto;
color: #8b949e;
}
.header-links {
margin: 20px 0;
}
.header-links a {
color: var(--link-color);
text-decoration: none;
margin: 0 10px;
font-weight: 500;
}
.header-links a:hover {
color: var(--link-hover-color);
text-decoration: underline;
}
.badges {
margin: 20px 0;
}
.badges span {
background-color: #21262d;
color: var(--text-color);
padding: 5px 10px;
border-radius: 15px;
font-size: 0.85em;
margin: 0 5px;
border: 1px solid var(--border-color);
}
.screenshot {
max-width: 100%;
border-radius: 8px;
border: 1px solid var(--border-color);
margin-top: 20px;
}
/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
color: var(--heading-color);
font-weight: 600;
line-height: 1.25;
margin-top: 24px;
margin-bottom: 16px;
}
h2 {
font-size: 1.75em;
padding-bottom: 0.3em;
border-bottom: 1px solid var(--border-color);
}
h3 {
font-size: 1.4em;
}
p {
margin-bottom: 16px;
}
a {
color: var(--link-color);
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
strong {
color: var(--heading-color);
}
/* --- Table of Contents --- */
.toc {
background-color: var(--card-bg-color);
border: 1px solid var(--border-color);
padding: 20px;
border-radius: 8px;
margin-bottom: 24px;
}
.toc h2 {
margin-top: 0;
border-bottom: none;
font-size: 1.3em;
}
.toc ul {
list-style-type: none;
padding-left: 0;
column-count: 2;
column-gap: 40px;
}
.toc li {
margin-bottom: 8px;
}
@media (max-width: 600px) {
.toc ul { column-count: 1; }
}
/* --- Lists --- */
ul, ol {
padding-left: 30px;
margin-bottom: 16px;
}
li {
margin-bottom: 4px;
}
/* --- Code Blocks --- */
code {
font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
background-color: rgba(110, 118, 129, 0.2);
padding: 0.2em 0.4em;
border-radius: 6px;
font-size: 85%;
}
pre {
background-color: var(--code-bg-color);
border: 1px solid var(--border-color);
border-radius: 8px;
padding: 16px;
overflow-x: auto;
margin-bottom: 16px;
}
pre code {
background-color: transparent;
padding: 0;
font-size: 100%;
line-height: 1.45;
}
/* --- Feature Cards --- */
.feature-list {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 20px;
margin-bottom: 24px;
}
.feature-card {
background-color: var(--card-bg-color);
border: 1px solid var(--border-color);
border-radius: 8px;
padding: 20px;
transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.feature-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}
.feature-card h3 {
margin-top: 0;
font-size: 1.2em;
}
.feature-card ul {
padding-left: 20px;
margin-bottom: 0;
}
.feature-card ul li {
font-size: 0.9em;
}
/* --- Misc --- */
hr {
height: 0.25em;
padding: 0;
margin: 24px 0;
background-color: var(--border-color);
border: 0;
}
</style>
</head>
<body>
<main class="container">
<div class="header">
<img src="https://voidgames.ir/archive/Ultimate%20Server%20Logo.png" alt="UltimateServer Logo">
<h1 id="ultimateserver">UltimateServer</h1>
<p>A powerful, multi-purpose <strong>C# server</strong> built with a modern, service-oriented architecture. Features real-time dashboard, robust user management, a dynamic plugin system, secure video streaming, Single Click Site Creation, and real-time voice chat capabilities. Designed for game servers, monitoring systems, and real-time applications.</p>
<div class="header-links">
<a href="https://dashboard.voidgames.ir" target="_blank"><strong>Live Dashboard</strong></a> •
<a href="https://github.com/VoidbornGames/Ultimate_C_Sharp_Server/wiki">Documentation</a> •
<a href="#installation">Getting Started</a>
</div>
<div class="badges">
<span>.NET 8.0</span>
<span>Platform: Linux</span>
<span>License: MIT</span>
</div>
<p><em>Note: Live dashboard login credentials have been changed due to abuse.</em></p>
<img src="https://voidgames.ir/archive/usshot.png" alt="UltimateServer Dashboard Screenshot" class="screenshot">
</div>
<nav class="toc">
<h2 id="table-of-contents">Table of Contents</h2>
<ul>
<li><a href="https://github.com/VoidbornGames/Ultimate_C_Sharp_Server/wiki">Wiki</a></li>
<li><a href="#features">Features</a></li>
<li><a href="#requirements">Requirements</a></li>
<li><a href="#installation">Installation</a></li>
<li><a href="#plugin-development-tutorial">Plugin Development Tutorial</a></li>
<li><a href="#running-it">Running it</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#api-endpoints">API Endpoints</a></li>
<li><a href="#configuration">Configuration</a></li>
<li><a href="#video-management">Video Management</a></li>
<li><a href="#voice-chat">Voice Chat</a></li>
<li><a href="#logging">Logging</a></li>
<li><a href="#security-features">Security Features</a></li>
<li><a href="#troubleshooting">Troubleshooting</a></li>
<li><a href="#license">License</a></li>
<li><a href="#contributing">Contributing</a></li>
<li><a href="#support">Support</a></li>
</ul>
</nav>
<h2 id="supported-os">Supported OS</h2>
<ul>
<li>Ubuntu 22.04</li>
<li>Ubuntu 24.04</li>
</ul>
<h2 id="features">Features</h2>
<div class="feature-list">
<div class="feature-card">
<h3 id="-modern-architecture">🏗️ Modern Architecture</h3>
<ul>
<li><strong>Service-Oriented Design</strong>: Decoupled services for improved maintainability and testability.</li>
<li><strong>Dependency Injection</strong>: Clean, modular code with clear separation of concerns.</li>
<li><strong>Asynchronous Performance</strong>: Full <code>async/await</code> implementation for high concurrency and non-blocking I/O.</li>
<li><strong>Event-Driven Communication</strong>: A robust in-memory Event Bus for decoupled, scalable inter-service communication.</li>
</ul>
</div>
<div class="feature-card">
<h3 id="-enhanced-security">🔒 Enhanced Security</h3>
<ul>
<li><strong>Advanced Password Hashing</strong>: Securely hashes passwords using PBKDF2 with unique salts.</li>
<li><strong>Account Lockout Policy</strong>: Automatically locks accounts after multiple failed login attempts.</li>
<li><strong>JWT & Refresh Tokens</strong>: Secure, stateless authentication with short-lived access tokens and long-lived refresh tokens.</li>
<li><strong>Comprehensive Input Validation</strong>: Protects against injection attacks and malicious data.</li>
<li><strong>Strong Password Policies</strong>: Enforces configurable password complexity requirements.</li>
</ul>
</div>
<div class="feature-card">
<h3 id="-high-performance-core">🚀 High-Performance Core</h3>
<ul>
<li><strong>In-Memory Caching</strong>: Reduces database/file I/O for frequently accessed data.</li>
<li><strong>HTTP Response Compression</strong>: Automatically compresses responses to save bandwidth.</li>
<li><strong>Connection Pooling Framework</strong>: Efficiently manages and reuses network connections.</li>
<li><strong>Graceful Shutdown</strong>: Ensures data is saved and connections close properly on exit.</li>
</ul>
</div>
<div class="feature-card">
<h3 id="-web-dashboard">🌐 Web Dashboard</h3>
<ul>
<li>Modern, responsive dark-themed interface</li>
<li>Real-time system monitoring (CPU, memory, disk, network)</li>
<li>Live server logs viewer with color-coded levels</li>
<li>Video player with streaming support and progress tracking</li>
<li>Secure user authentication with JWT tokens</li>
<li>Mobile-friendly design</li>
</ul>
</div>
<div class="feature-card">
<h3 id="-advanced-user-management">👥 Advanced User Management</h3>
<ul>
<li>Secure user registration and login system</li>
<li>Role-based access control (RBAC)</li>
<li>Session management with "remember me" functionality</li>
<li>Password reset functionality via email token</li>
<li>Two-Factor Authentication (2FA) support framework</li>
</ul>
</div>
<div class="feature-card">
<h3 id="-system-monitoring">📊 System Monitoring</h3>
<ul>
<li>Real-time CPU usage tracking</li>
<li>Memory consumption monitoring</li>
<li>Disk space usage information</li>
<li>Network traffic statistics</li>
<li>Historical performance charts</li>
</ul>
</div>
<div class="feature-card">
<h3 id="-video-management">🎬 Video Management</h3>
<ul>
<li>Upload videos from URLs with progress tracking</li>
<li>Stream videos directly in the dashboard</li>
<li>Support for multiple video formats (MP4, WebM, OGG, AVI, MOV, MKV)</li>
<li>Video library with thumbnail previews</li>
<li>Secure access control for all video content</li>
</ul>
</div>
<div class="feature-card">
<h3 id="-real-time-voice-chat">🎤 Real-Time Voice Chat</h3>
<ul>
<li><strong>Low-Latency UDP</strong>: Built on UDP for real-time communication with minimal delay.</li>
<li><strong>High-Quality Audio</strong>: Supports clear 16-bit audio at 16kHz for natural-sounding voice.</li>
<li><strong>Multi-Client Support</strong>: Seamlessly connect multiple clients for group conversations.</li>
<li><strong>Robust Client Management</strong>: Automatically handles client connections and disconnections.</li>
<li><strong>Easy-to-Use Client</strong>: A simple C# client library is provided for quick integration into any application.</li>
</ul>
</div>
<div class="feature-card">
<h3 id="-dynamic-plugin-system">🔌 Dynamic Plugin System</h3>
<ul>
<li><strong>Hot-Reloading</strong>: Load, update, and unload plugins at runtime without restarting the server.</li>
<li><strong>Sandboxed Execution</strong>: Plugins run in isolated contexts for security and stability.</li>
<li><strong>Async Lifecycle Hooks</strong>: Plugins can hook into server events with <code>OnLoadAsync</code>, <code>OnUpdateAsync</code>, and <code>OnUnloadAsync</code>.</li>
<li><strong>Easy Development</strong>: Simple C# interface-based development model for extending server functionality.</li>
</ul>
</div>
<div class="feature-card">
<h3 id="-logging-system">📝 Logging System</h3>
<ul>
<li>Automatic log rotation with ZIP compression</li>
<li>Real-time log viewing in dashboard</li>
<li>Multiple log levels (Info, Warning, Error, Security)</li>
<li>Persistent log storage</li>
</ul>
</div>
</div>
<h2 id="requirements">Requirements</h2>
<h3 id="system-requirements">System Requirements</h3>
<ul>
<li>.NET 8.0 SDK or Runtime</li>
<li>PHP 8.3</li>
<li>Nginx</li>
<li>Linux, or Docker-compatible environment</li>
</ul>
<h3 id="network-requirements">Network Requirements</h3>
<ul>
<li>Ports open for connections (default: <code>11001</code> for server, <code>11002</code> for web dashboard)</li>
<li>Port open for UDP connections (default: <code>11003</code> for voice chat)</li>
</ul>
<h2 id="installation">Installation</h2>
<h3 id="option-1-automated-installation-script">Option 1: Automated Installation Script</h3>
<p>Run the install script:</p>
<pre><code class="language-bash">bash <(curl -s https://raw.githubusercontent.com/VoidbornGames/Ultimate_C_Sharp_Server/main/install.sh)</code></pre>
<h3 id="option-2-manual-installation">Option 2: Manual Installation</h3>
<ol>
<li>Clone the repository:
<pre><code class="language-bash">git clone https://github.com/VoidbornGames/Ultimate_C_Sharp_Server.git
cd Ultimate_C_Sharp_Server</code></pre>
</li>
<li>Install dependencies:
<pre><code class="language-bash"># Install .NET 8.0 (if not already installed)
# Install PHP 8.3
# Install Nginx</code></pre>
</li>
<li>Configure Nginx:
<pre><code class="language-bash"># Copy the provided Nginx configuration to your Nginx sites directory
sudo cp nginx-config /etc/nginx/sites-available/ultimateserver
sudo ln -s /etc/nginx/sites-available/ultimateserver /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx</code></pre>
</li>
<li>Build the project:
<pre><code class="language-bash">dotnet build -c Release</code></pre>
</li>
</ol>
<h3 id="option-3-docker-installation-recommended">Option 3: Docker Installation (Recommended)</h3>
<pre><code class="language-bash">docker build -t ultimateserver .
docker run -p 11001:11001 -p 11002:11002 -p 11003:11003/udp ultimateserver</code></pre>
<h2 id="plugin-development-tutorial">Plugin Development Tutorial</h2>
<p>UltimateServer's functionality can be easily extended using a powerful plugin system. This tutorial will guide you through creating your first plugin.</p>
<h3 id="what-is-a-plugin-">What is a Plugin?</h3>
<p>A plugin is a separate .NET assembly (a .dll file) that contains code to extend the server's features. The server automatically loads these assemblies from a designated directory, allowing you to add new commands, integrate with other services, or react to server events without modifying the core server code.</p>
<h3 id="prerequisites">Prerequisites</h3>
<ul>
<li>.NET 8.0 SDK</li>
<li>A C# IDE like Visual Studio 2022, VS Code, or JetBrains Rider.</li>
<li>A copy of the UltimateServer source code.</li>
</ul>
<h3 id="step-1-create-a-new-class-library-project">Step 1: Create a New Class Library Project</h3>
<p>First, create a new project for your plugin. Open your terminal or command prompt and run:</p>
<pre><code class="language-bash">dotnet new classlib -n MyAwesomePlugin
cd MyAwesomePlugin</code></pre>
<p>This will create a new C# class library project named <code>MyAwesomePlugin</code>.</p>
<h3 id="step-2-add-a-reference-to-the-server-project">Step 2: Add a Reference to the Server Project</h3>
<p>Your plugin needs to know about the <code>IPlugin</code> interface. You can do this by adding a project reference to the UltimateServer project.</p>
<pre><code class="language-bash">dotnet add reference ../path/to/UltimateServer/Server.csproj</code></pre>
<p><em>Note: Replace <code>../path/to/UltimateServer/</code> with the actual relative path to the server project file. It's good practice to copy the <code>IPlugin.cs</code> and <code>PluginContext.cs</code> files into your plugin project instead of referencing the whole server project to keep your plugin independent.</em></p>
<h3 id="step-3-implement-the-iplugin-interface">Step 3: Implement the IPlugin Interface</h3>
<p>Now, rename the default <code>Class1.cs</code> to something more descriptive, like <code>MainPlugin.cs</code>. Open the file and implement the <code>IPlugin</code> interface.</p>
<p>Here is a complete example of a simple plugin:</p>
<pre><code class="language-csharp">using System;
using System.Threading.Tasks;
using UltimateServer.Plugins;
namespace MyAwesomePlugin
{
public class MainPlugin : IPlugin
{
// A unique name for your plugin
public string Name => "My Awesome Plugin";
// The version of your plugin
public string Version => "1.0.0";
// This method is called when the plugin is first loaded by the server.
public async Task OnLoadAsync(PluginContext context)
{
context.Logger.Log("Hello from My Awesome Plugin! I have been loaded.");
// You can initialize resources, register commands, etc. here.
await Task.CompletedTask;
}
// This method is called when the server's plugin manager performs an update.
// Useful for reloading configuration or applying hot-fixes.
public async Task OnUpdateAsync(PluginContext context)
{
context.Logger.Log("My Awesome Plugin has been updated.");
await Task.CompletedTask;
}
// This method is called when the plugin is being unloaded (e.g., during shutdown or hot-reload).
public async Task OnUnloadAsync(PluginContext context)
{
context.Logger.Log("Goodbye! My Awesome Plugin is unloading.");
// You should dispose of any resources here.
await Task.CompletedTask;
}
}
}</code></pre>
<h3 id="step-4-build-the-plugin">Step 4: Build the Plugin</h3>
<p>From inside your plugin's directory (<code>MyAwesomePlugin</code>), run the build command:</p>
<pre><code class="language-bash">dotnet build -c Release</code></pre>
<p>This will compile your code and produce a <code>MyAwesomePlugin.dll</code> file inside the <code>bin/Release/net8.0/</code> directory.</p>
<h3 id="step-5-deploy-the-plugin">Step 5: Deploy the Plugin</h3>
<ol>
<li>Navigate to your UltimateServer's root directory.</li>
<li>Create a new folder named <code>plugins</code> if it doesn't already exist.</li>
<li>Copy your plugin's <code>.dll</code> file (e.g., <code>MyAwesomePlugin.dll</code>) into the <code>plugins</code> folder.</li>
</ol>
<h3 id="step-6-load-and-test">Step 6: Load and Test</h3>
<p>That's it! Now, simply run the UltimateServer. You will see your plugin's log message in the console when it starts up.</p>
<pre><code class="language-bash">dotnet Server.dll 11001 11002 11003</code></pre>
<p><strong>Output:</strong></p>
<pre><code>...
🔌 Scanning for plugins in '.../UltimateServer/plugins'
🔌 Found valid assembly: MyAwesomePlugin, Version=1.0.0.0
✅ Loaded plugin: My Awesome Plugin v1.0.0
Hello from My Awesome Plugin! I have been loaded.
🔌 Plugin loading complete. 1 plugins loaded.
...</code></pre>
<p>You can now update your plugin's code, rebuild it, copy the new <code>.dll</code> to the <code>plugins</code> folder, and the server will automatically reload it without needing a restart!</p>
<h2 id="running-it">Running it</h2>
<h3 id="default-configuration">Default Configuration:</h3>
<pre><code class="language-bash">dotnet Server.dll 11001 11002 11003</code></pre>
<h3 id="custom-ports">Custom Ports:</h3>
<pre><code class="language-bash">dotnet Server.dll <Server_Port> <Dashboard_Port> <Voicechat_Port></code></pre>
<h3 id="docker-recommended">Docker (Recommended):</h3>
<pre><code class="language-bash">docker build -t ultimateserver .
docker run -p 11001:11001 -p 11002:11002 -p 11003:11003/udp ultimateserver</code></pre>
<h2 id="usage">Usage</h2>
<h3 id="accessing-the-dashboard">Accessing the Dashboard</h3>
<ol>
<li>Open your web browser and navigate to:
<pre><code>http://your-server-ip:11002</code></pre>
</li>
<li>Login with the default credentials:
<ul>
<li>Username: <code>admin</code></li>
<li>Password: <code>admin123</code></li>
</ul>
</li>
<li>Explore the dashboard features:
<ul>
<li><strong>Stats</strong>: View real-time system performance</li>
<li><strong>Logs</strong>: Monitor server activity</li>
<li><strong>Videos</strong>: Upload and stream videos</li>
</ul>
</li>
</ol>
<h3 id="default-commands">Default Commands</h3>
<p>The server supports several built-in commands that can be sent via TCP:</p>
<ul>
<li><code>createUser</code>: Create a new user account</li>
<li><code>loginUser</code>: Authenticate a user</li>
<li><code>listUsers</code>: Get a list of all users</li>
<li><code>say</code>: Echo a message back to the client</li>
<li><code>makeUUID</code>: Generate a unique identifier</li>
<li><code>stats</code>: Get server statistics</li>
</ul>
<h2 id="api-endpoints">API Endpoints</h2>
<h3 id="authentication">Authentication</h3>
<ul>
<li><code>POST /api/login</code>: Authenticate user and get JWT token
<pre><code class="language-json">{
"username": "admin",
"password": "admin123",
"rememberMe": true
}</code></pre>
</li>
<li><code>POST /api/register</code>: Register a new user
<pre><code class="language-json">{
"username": "newuser",
"email": "[email protected]",
"password": "StrongPassword123!",
"role": "player"
}</code></pre>
</li>
<li><code>POST /api/refresh-token</code>: Get a new access token using a refresh token</li>
<li><code>POST /api/logout</code>: Invalidate the user's refresh token</li>
</ul>
<h3 id="system-information">System Information</h3>
<ul>
<li><code>GET /stats</code>: Get basic server statistics (requires authentication)</li>
<li><code>GET /system</code>: Get detailed system performance data (requires authentication)</li>
<li><code>GET /logs</code>: Get recent server logs (requires authentication)</li>
</ul>
<h3 id="plugin-management-api">Plugin Management</h3>
<ul>
<li><code>POST /api/plugins/reload</code>: Triggers a scan and reload of all plugins in the plugins directory (requires authentication).</li>
</ul>
<h3 id="video-management-api">Video Management</h3>
<ul>
<li><code>GET /videos</code>: List all available videos (requires authentication)</li>
<li><code>POST /upload-url</code>: Upload a video from a URL (requires authentication)</li>
<li><code>GET /videos/{filename}</code>: Stream a video file (requires authentication)</li>
</ul>
<p>All protected endpoints require a valid JWT token in the Authorization header:</p>
<pre><code>Authorization: Bearer <your-jwt-token></code></pre>
<h2 id="configuration">Configuration</h2>
<p>The server uses a <code>config.json</code> file for configuration:</p>
<pre><code class="language-json">{
"Ip": "0.0.0.0",
"MaxConnections": 50,
"PasswordMinLength": 8,
"RequireSpecialChars": true,
"MaxFailedLoginAttempts": 5,
"LockoutDurationMinutes": 30,
"JwtExpiryHours": 24,
"RefreshTokenDays": 7,
"MaxRequestSizeMB": 100,
"EnableCompression": true,
"CacheExpiryMinutes": 15,
"ConnectionPoolSize": 10,
"PluginsDirectory": "plugins"
}</code></pre>
<h3 id="configuration-options">Configuration Options</h3>
<ul>
<li><strong>Ip</strong>: Server IP address to bind to (default: "0.0.0.0")</li>
<li><strong>MaxConnections</strong>: Maximum number of concurrent connections (default: 50)</li>
<li><strong>PasswordMinLength</strong>: Minimum required length for user passwords.</li>
<li><strong>RequireSpecialChars</strong>: Enforces special characters in passwords.</li>
<li><strong>MaxFailedLoginAttempts</strong>: Number of failed attempts before account lockout.</li>
<li><strong>LockoutDurationMinutes</strong>: Duration of the account lockout.</li>
<li><strong>JwtExpiryHours</strong>: Expiration time for JWT access tokens.</li>
<li><strong>RefreshTokenDays</strong>: Expiration time for refresh tokens.</li>
<li><strong>EnableCompression</strong>: Enables Gzip/Deflate compression for HTTP responses.</li>
<li><strong>CacheExpiryMinutes</strong>: Default expiry time for cached items.</li>
<li><strong>ConnectionPoolSize</strong>: The number of connections to keep in the pool.</li>
<li><strong>PluginsDirectory</strong>: The directory where the server scans for plugin DLLs (default: "plugins").</li>
</ul>
<h2 id="video-management">Video Management</h2>
<h3 id="uploading-videos">Uploading Videos</h3>
<ol>
<li>Navigate to the <strong>Videos</strong> tab in the dashboard</li>
<li>Enter a video URL in the upload field</li>
<li>Click <strong>Download</strong> to upload the video to the server</li>
<li>The video will appear in your video library</li>
</ol>
<h3 id="supported-video-formats">Supported Video Formats</h3>
<ul>
<li>MP4 (video/mp4)</li>
<li>WebM (video/webm)</li>
<li>OGG (video/ogg)</li>
<li>AVI (video/x-msvideo)</li>
<li>MOV (video/quicktime)</li>
<li>MKV (video/x-matroska)</li>
</ul>
<h3 id="video-streaming">Video Streaming</h3>
<p>Videos are streamed directly from the server with support for:</p>
<ul>
<li>Range requests for efficient streaming</li>
<li>Proper MIME type handling</li>
<li>Authentication protection</li>
<li>Progress tracking during upload</li>
</ul>
<h2 id="voice-chat">🎤 Real-Time Voice Chat</h2>
<p>UltimateServer includes a high-performance, low-latency voice chat server that allows multiple clients to communicate in real-time.</p>
<h3 id="how-it-works">How It Works</h3>
<p>The voice server runs on a separate UDP port. Clients capture audio from their microphone, compress it, and send it to the server. The server then forwards this audio data to all other connected clients, who play it back through their speakers.</p>
<h3 id="using-the-voice-client">Using the Voice Client</h3>
<p>A sample C# client application is provided to connect to the voice server. You can run multiple instances of this client to simulate a conversation.</p>
<pre><code class="language-bash"># Run the first client
dotnet VoiceClient.dll
# Run the second client (from a different terminal)
dotnet VoiceClient.dll</code></pre>
<p>Ensure you replace the placeholders with your server's IP address and the configured voice port.</p>
<h2 id="logging">Logging</h2>
<p>The server maintains detailed logs in the <code>logs/</code> directory:</p>
<ul>
<li><strong>Log Rotation</strong>: Logs are automatically rotated and compressed when the server restarts</li>
<li><strong>Log Levels</strong>: Information, warnings, errors, and security events are logged with timestamps</li>
<li><strong>Real-time Viewing</strong>: View live logs in the dashboard without needing to access the server files</li>
</ul>
<p>Log files are named with timestamps:</p>
<pre><code>logs/latest_2025-10-01_23-30-45.zip</code></pre>
<h2 id="security-features">Security Features</h2>
<ul>
<li><strong>PBKDF2 Password Hashing</strong>: User passwords are securely hashed with a unique salt.</li>
<li><strong>Account Lockout</strong>: Protects against brute-force attacks.</li>
<li><strong>JWT & Refresh Token Authentication</strong>: Secure, stateless session management.</li>
<li><strong>Input Validation</strong>: All inputs are validated to prevent injection attacks.</li>
<li><strong>File Access Control</strong>: Video files are protected with authentication checks.</li>
<li><strong>CORS Support</strong>: Properly configured Cross-Origin Resource Sharing headers.</li>
</ul>
<h2 id="troubleshooting">Troubleshooting</h2>
<h3 id="server-startup-issues">Server Startup Issues</h3>
<p>If the server fails to start, it's often due to a dependency injection configuration error.</p>
<ul>
<li><strong>Check Logs</strong>: The console output will show the exact error message, such as "Unable to resolve service for type 'System.String'".</li>
<li><strong>Verify Packages</strong>: Ensure the <code>Microsoft.Extensions.DependencyInjection</code> NuGet package is installed.</li>
<li><strong>Check Program.cs</strong>: Make sure all services (like `FilePaths`, `ServerSettings`) are registered in the DI container.</li>
</ul>
<h3 id="voice-chat-issues">Voice Chat Issues</h3>
<ol>
<li><strong>Client Cannot Connect:</strong> Ensure the <code>VoicePort</code> (default 11003) is open in your server's firewall and, if applicable, in your hosting provider's network security group. Remember that UDP traffic must be allowed.</li>
<li><strong>No Audio on Second Client:</strong> This is often caused by <strong>Symmetric NAT</strong> when both clients are on the same local network. For testing, try connecting clients from different networks. The server will log when a client connects and forwards packets.</li>
<li><strong>Poor Audio Quality or Noise:</strong> Ensure the client application has permission to access the microphone in your OS settings. The provided client uses a high-quality format by default; using lower quality formats (like 8-bit) can introduce noise.</li>
<li><strong>Server Receives No Data:</strong> If the server logs show no new client connections, use a network packet sniffer like <code>tcpdump</code> on the server host or <a href="https://www.wireshark.org/">Wireshark</a> on the client to verify if UDP packets are being sent and received.</li>
</ol>
<h3 id="videos-not-loading">Videos Not Loading</h3>
<ol>
<li>Check that the video file exists on the server</li>
<li>Verify the video format is supported</li>
<li>Check browser console for error messages</li>
<li>Ensure your authentication token is valid</li>
</ol>
<h3 id="login-issues">Login Issues</h3>
<ol>
<li>Verify the default credentials: admin/admin123</li>
<li>Check that your browser allows cookies</li>
<li>Clear browser cache and try again</li>
<li>Check server logs for authentication errors</li>
</ol>
<h3 id="performance-issues">Performance Issues</h3>
<ol>
<li>Monitor CPU and memory usage in the dashboard</li>
<li>Check the number of active connections</li>
<li>Review logs for any error messages</li>
<li>Consider increasing <code>MaxConnections</code> or <code>ConnectionPoolSize</code> if needed</li>
</ol>
<h2 id="license">License</h2>
<p>This project is licensed - see the <a href="https://github.com/VoidbornGames/Ultimate_C_Sharp_Server?tab=License-1-ov-file">LICENSE</a> file for details.</p>
<h2 id="contributing">Contributing</h2>
<p>Contributions are welcome! Please feel free to submit a Pull Request.</p>
<ol>
<li>Fork the project</li>
<li>Create your feature branch (<code>git checkout -b feature/AmazingFeature</code>)</li>
<li>Commit your changes (<code>git commit -m 'Add some AmazingFeature'</code>)</li>
<li>Push to the branch (<code>git push origin feature/AmazingFeature</code>)</li>
<li>Open a Pull Request</li>
</ol>
<h2 id="support">Support</h2>
<p>If you need help or have questions:</p>
<ul>
<li>Check the <a href="https://github.com/VoidbornGames/Ultimate_C_Sharp_Server/wiki">Wiki</a> for documentation</li>
<li>Search existing <a href="https://github.com/VoidbornGames/Ultimate_C_Sharp_Server/issues">Issues</a> for answers</li>
<li>Create a new issue if you can't find an answer to your question</li>
</ul>
</main>
</body>
</html>