This commit is contained in:
Mateusz Gruszczyński committed 2026-11-07 13:56:11 +01:00
1 parent 672c84bc13
commit 6f52ac3d00
38 files changed
+1183 -221

No files matched your search

+20 -4
View File
@@ -11,6 +11,9 @@ const core = read("src/admin/web/app/core.js");
const cache = read("src/admin/web/cache-panel.js");
const transform = read("src/admin/web/transform-panel.js");
const traffic = read("src/admin/web/traffic-panel.js");
const refresh = read("src/admin/web/app/refresh.js");
const management = read("src/admin/web/management.js");
const loggingApi = read("src/admin/logging_api.rs");
const openapi = JSON.parse(read("src/admin/openapi.json"));
assert.match(settings, /authenticated && name === "certificate-api"[^\n]+rustProxyCertificateApi\?\.load/);
@@ -18,9 +21,18 @@ assert.match(settings, /authenticated && active === "certificate-api"[^\n]+rustP
assert.ok(!/renderCertificateApi\(\);\s*loadCertificateApi\(\);\s*\}\)\(\);\s*$/.test(certificateApi),
"Certificate API must not fetch credentials when its module is initialized");
assert.match(core, /async function refresh\(force = false, includeLogs = false\)/);
assert.match(core, /if \(includeLogs\) tasks\.push\(rustProxyRefresh\.manual\("logs-fallback"\)\)/);
assert.match(core, /refresh\(true, true\)\.catch/);
assert.match(core, /async function refresh\(force = false\)/);
assert.doesNotMatch(core, /includeLogs/);
assert.match(core, /new EventSource\(`\/api\/events\?interval=\$\{seconds\}&logs=false`\)/);
assert.match(loggingApi, /logs: Option<bool>/);
assert.match(loggingApi, /let include_logs = query\.logs\.unwrap_or\(true\)/);
assert.match(loggingApi, /if include_logs[\s\S]+logs_payload\(&state\)[\s\S]+else[\s\S]+live_status_payload/);
assert.match(core, /if \(payload\.logs\) renderLogs\(payload\.logs\)/);
assert.match(refresh, /active: \(\) => !!window\.rustProxyLogs\?\.active\?\.\(\)/);
assert.doesNotMatch(refresh, /manual\("logs-fallback"\).*manual\("system-info"\)/);
assert.match(management, /function active\(\) \{ return dialog\.open && !paused && !expanded; \}/);
assert.match(management, /syncLivePolling\(true\)/);
for (const [name, source, endpoint] of [
["cache", cache, "/api/cache"],
@@ -35,5 +47,9 @@ for (const [name, source, endpoint] of [
assert.deepEqual(view?.schema?.enum, ["live"], `${endpoint} must document view=live`);
}
assert.equal(openapi.info.version, "0.36.0");
const events = openapi.paths["/api/events"].get;
const logsFlag = (events.parameters || []).find(parameter => parameter.name === "logs");
assert.equal(logsFlag?.schema?.type, "boolean");
assert.equal(logsFlag?.schema?.default, true);
assert.equal(openapi.info.version, "0.36.1");
console.log("Panel refresh/API contract checks: OK");