Separate script publishing, job assignment and interactive approval in the WebUI

This commit is contained in:
2026-11-17 22:42:31 +01:00
parent 2100e6a4ce
commit 477a63f20e
13 changed files with 1027 additions and 294 deletions
+3 -3
View File
@@ -9,7 +9,7 @@ it('renders hostile output as inert text, reports real status and preserves exac
const hostile = '<script>fetch("/approve")</script>\r\n\x1b[2J\u202eapprove', raw = Array.from(new TextEncoder().encode(hostile));
const job = { state: 'unknown', attempt_id: 'fixed-attempt', revision: 4, cancel_requested: true, result: { stdout: raw, stderr: [], exit_code: null, error_code: 'TIMEOUT', output_truncated: true, reboot_required: false } };
const before = JSON.stringify(job), html = renderToStaticMarkup(<ConsoleOutput job={job}/>);
for (const expected of ['unknown', 'fixed-attempt', 'TIMEOUT', 'unknown / nicht gemeldet', 'nur ein Ausschnitt', 'keinen Live-Ausgabestream', 'Abbruch angefordert', 'neuen genehmigten Plan', '&lt;script&gt;', '\\u000d', '\\u001b', '\\u202e', JSON.stringify(raw)]) expect(html).toContain(expected);
for (const expected of ['unknown', 'fixed-attempt', 'TIMEOUT', 'Nicht gemeldet', 'nur ein Ausschnitt', 'gespeicherte Ausgabe', 'Abbruch angefordert', 'neuen genehmigten Plan', '&lt;script&gt;', '\\u000d', '\\u001b', '\\u202e', JSON.stringify(raw)]) expect(html).toContain(expected);
expect(html).not.toMatch(/<(script|img|iframe|form|input)\b/i);
expect(html).not.toContain('onclick='); expect(fetch).not.toHaveBeenCalled(); expect(JSON.stringify(job)).toBe(before);
} finally { vi.unstubAllGlobals(); }
@@ -34,8 +34,8 @@ it('shows unknown restart state for an incomplete Windows Update summary', () =>
}};
return renderToStaticMarkup(<ConsoleOutput job={{ result }}/>);
}
expect(rendered(windowsUpdateScriptHash)).toContain('Neustartbedarf: unknown');
expect(rendered('ordinary script')).toContain('Neustartbedarf: false');
expect(rendered(windowsUpdateScriptHash)).toContain('Neustartbedarf unbekannt');
expect(rendered('ordinary script')).not.toContain('Neustartbedarf unbekannt');
});