config upload fix

This commit is contained in:
2026-09-12 19:34:25 -04:00
parent 6ae9004ed2
commit b86b3d5cc1
4 changed files with 86 additions and 16 deletions
+16 -3
View File
@@ -58,16 +58,29 @@
}); });
async function load(): Promise<void> { async function load(): Promise<void> {
try {
const [baselineRes, overlayRes, scopeRes] = await Promise.all([ const [baselineRes, overlayRes, scopeRes] = await Promise.all([
fetch('/api/configs?kind=baseline'), fetch('/api/configs?kind=baseline'),
fetch('/api/configs?kind=config'), fetch('/api/configs?kind=config'),
fetch('/api/scope-options') fetch('/api/scope-options')
]); ]);
baselines = (await baselineRes.json()).scripts; if (!baselineRes.ok || !overlayRes.ok) {
overlays = (await overlayRes.json()).scripts; flash = `configs API returned ${baselineRes.status}/${overlayRes.status}. If this is a dev environment, restart the server so the DB migration runs.`;
scopeOptions = (await scopeRes.json()) as ScopeOptions; baselines = [];
overlays = [];
} else {
baselines = ((await baselineRes.json()) as { scripts?: ArtifactRow[] }).scripts ?? [];
overlays = ((await overlayRes.json()) as { scripts?: ArtifactRow[] }).scripts ?? [];
}
if (scopeRes.ok) {
scopeOptions = ((await scopeRes.json()) as ScopeOptions | undefined) ?? { games: [], mapsByGame: {} };
}
} catch (err) {
flash = `failed to load configs: ${(err as Error).message}`;
} finally {
loading = false; loading = false;
} }
}
onMount(load); onMount(load);
+14 -2
View File
@@ -50,14 +50,26 @@
}); });
async function load(): Promise<void> { async function load(): Promise<void> {
try {
const [pluginRes, scopeRes] = await Promise.all([ const [pluginRes, scopeRes] = await Promise.all([
fetch('/api/plugins'), fetch('/api/plugins'),
fetch('/api/scope-options') fetch('/api/scope-options')
]); ]);
plugins = (await pluginRes.json()).scripts; if (!pluginRes.ok) {
scopeOptions = (await scopeRes.json()) as ScopeOptions; flash = `plugins API returned ${pluginRes.status}. If this is a dev environment, restart the server so the DB migration runs.`;
plugins = [];
} else {
plugins = ((await pluginRes.json()) as { scripts?: ArtifactRow[] }).scripts ?? [];
}
if (scopeRes.ok) {
scopeOptions = ((await scopeRes.json()) as ScopeOptions | undefined) ?? { games: [], mapsByGame: {} };
}
} catch (err) {
flash = `failed to load plugins: ${(err as Error).message}`;
} finally {
loading = false; loading = false;
} }
}
onMount(load); onMount(load);
+16
View File
@@ -0,0 +1,16 @@
//////////////////////////////////////////////////
// GENERAL CONFIGURATION //
//////////////////////////////////////////////////
set g_inactivity "190" // Enable or Disable auto kick feature for idle/AFK players.
set sv_disableClientConsole "0" // Enable or Disable players ability to access server commands
set sv_floodProtect "1" // Chat Spam Protection.
set sv_kickBanTime "300" // Kick Ban Duration.
set sv_voice "1" // Allow Voice Chat?
set sv_voicequality "3" // Voice Quality.
set sp_minplayers "1" // Minimum amount of players.
set scr_allowFileIo "1" // Allow GSC scripts to interact with files?
set scr_kill_infinite_loops "1" // Kill misbehaving threads?
set sv_wwwBaseURL "" // Fast DL URL
set sv_maprotation "map zombie_theater"
+29
View File
@@ -0,0 +1,29 @@
Note: Unnecessary use of -X or --request, POST is already inferred.
* Host localhost:3000 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
␍ 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying [::1]:3000...
* Connected to localhost (::1) port 3000
* using HTTP/1.x
> POST /api/configs HTTP/1.1␍
> Host: localhost:3000␍
> User-Agent: curl/8.15.0␍
> Accept: */*␍
> Content-Length: 1832␍
> Content-Type: multipart/form-data; boundary=------------------------barYWMs19HWi81kFXmt3OX␍
> ␍
} [1832 bytes data]
* upload completely sent off: 1832 bytes
< HTTP/1.1 200 OK␍
< Access-Control-Allow-Origin: *␍
< content-length: 232␍
< content-type: application/json␍
< Date: Sat, 12 Sep 2026 23:27:36 GMT␍
< Connection: keep-alive␍
< Keep-Alive: timeout=5␍
< ␍
{ [232 bytes data]
␍100 2064 100 232 100 1832 49225 379k --:--:-- --:--:-- --:--:-- 503k{"ok":true,"script":{"id":2,"name":"T5 Zombies Baseline","target_rel_path":"dedicated_sp.cfg","scope_type":"game","scope_value":"t5","current_version_id":null,"kind":"baseline","created_at":"2026-09-12T23:27:36.519Z"},"versionId":2}
* Connection #0 to host localhost left intact