Static frontend with vendored marked/DOMPurify, bounded Markdown pipeline, same-origin mock server with scenario selection, unit, contract and CDP end-to-end tests under frontend/**.
22 lines
600 B
JavaScript
22 lines
600 B
JavaScript
/**
|
|
* Mock Server Dev Toolbar client logic.
|
|
* External module to comply with strict CSP (script-src 'self').
|
|
*/
|
|
(function() {
|
|
const sel = document.getElementById('dev-scenario-select');
|
|
if (sel) {
|
|
sel.addEventListener('change', async function() {
|
|
try {
|
|
await fetch('/dev/scenario', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ scenario: sel.value })
|
|
});
|
|
} catch (err) {
|
|
console.error('Failed to change scenario:', err);
|
|
}
|
|
window.location.reload();
|
|
});
|
|
}
|
|
})();
|