Add tests for backend asset handling and frontend boot sequence, remove outdated MOTD script, and add icons.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0ad5b5f44f
commit
7937879ace
34 files changed
+613
-116
No files matched your search
@@ -14,9 +14,12 @@ export type BackendOptions = {
|
||||
healthy?: () => Promise<boolean>;
|
||||
/** The static site of the content, rebuilt by the index job. */
|
||||
site?: () => Site | undefined;
|
||||
/** The theme with its override, read on every request so edits apply right away. */
|
||||
theme?: () => Promise<Buffer | undefined>;
|
||||
};
|
||||
|
||||
const MAX_FRAME_BYTES = 64 * 1024;
|
||||
const THEME_PATH = '/theme.css';
|
||||
const PING_INTERVAL_MS = 30_000;
|
||||
|
||||
// xterm.js creates style elements at runtime, so styles need 'unsafe-inline'.
|
||||
@@ -80,6 +83,9 @@ export function createBackend(config: BackendConfig, hub: SessionHub, options: B
|
||||
return send(response, ok ? 200 : 503, 'text/plain', ok ? 'ok' : 'degraded', { 'Cache-Control': 'no-store' }, head);
|
||||
}
|
||||
|
||||
const theme = path === THEME_PATH ? await options.theme?.() : undefined;
|
||||
if (theme) return send(response, 200, 'text/css; charset=utf-8', theme, { 'Cache-Control': 'no-cache' }, head);
|
||||
|
||||
const asset = assets.get(path);
|
||||
if (asset)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user