web: gated access, anchored viewers, mobile tabs and chat colour
- serve.mjs requires a signed session cookie for every page, artifact and the WebSocket, with a password file, 30-day sessions, login throttling and public brand assets for the sign-in page. - The diff viewer is a fixed-height top-anchored panel whose toolbar (modes, copy, previous, next, close as icons) is its first row; the artifact viewer is likewise a fixed frame so its navigation never moves. - The audit's selected tab uses the app's normal selected surface and bottom accent. Sessions that were not recorded say so plainly. - Chat code blocks are syntax-coloured; graph pinch-zoom works with two fingers while a single pointer still pans and clicks nodes. - Phones always keep the destination bar (pane collapse is wide-only), with the destinations spread evenly and Search on the right; the list default width is narrower; the theme colour matches the app. - Code-format and layout tests, plus the full browser suite, pass.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { highlight } from "../src/highlight.js";
|
||||
|
||||
const kinds = (tokens) => tokens.map((token) => `${token.kind}:${token.text}`);
|
||||
|
||||
test("go strings, comments, numbers and keywords are separated", () => {
|
||||
const tokens = highlight('func main() {\n // note\n x := 42\n s := "hi"\n}', "go");
|
||||
assert.ok(kinds(tokens).includes("keyword:func"));
|
||||
assert.ok(kinds(tokens).includes("comment:// note"));
|
||||
assert.ok(kinds(tokens).includes("number:42"));
|
||||
assert.ok(kinds(tokens).includes('string:"hi"'));
|
||||
assert.ok(kinds(tokens).some((entry) => entry.startsWith("plain: ")));
|
||||
});
|
||||
|
||||
test("shell uses hash comments and javascript-style sharing is avoided", () => {
|
||||
const tokens = highlight("echo hi # note\ncd /tmp", "sh");
|
||||
assert.ok(kinds(tokens).includes("keyword:echo"));
|
||||
assert.ok(kinds(tokens).includes("comment:# note"));
|
||||
});
|
||||
|
||||
test("unknown languages still colour strings and numbers safely", () => {
|
||||
const tokens = highlight('x = "a" + 2', "nonsense");
|
||||
assert.ok(kinds(tokens).includes('string:"a"'));
|
||||
assert.ok(kinds(tokens).includes("number:2"));
|
||||
});
|
||||
|
||||
test("the output is token text only, never markup", () => {
|
||||
const tokens = highlight('<img src=x onerror=alert(1)>', "html");
|
||||
assert.equal(tokens.map((token) => token.text).join(""), '<img src=x onerror=alert(1)>');
|
||||
assert.ok(tokens.every((token) => !("html" in token)));
|
||||
});
|
||||
@@ -2135,6 +2135,7 @@ try {
|
||||
step(`serving web/ on 127.0.0.1:${port} (proxy /connect -> ${pipelines})`);
|
||||
serve = spawn(process.execPath, ["serve.mjs", "--port", String(port), "--pipelines", pipelines], {
|
||||
cwd: ROOT,
|
||||
env: { ...process.env, PIPELINES_WEB_AUTH: "disabled" },
|
||||
stdio: ["ignore", "pipe", "pipe"],
|
||||
});
|
||||
let serveLog = "";
|
||||
|
||||
Reference in New Issue
Block a user