From 0093ce7577502b61cc89659bfa0d3ac3e6b4bd9f Mon Sep 17 00:00:00 2001 From: loki5512344 Date: Sat, 24 Oct 2026 17:19:52 +0200 Subject: [PATCH] fix(web): set meter widths from script so the CSP does not block them --- src/app.ts | 5 ++++- tests/copy.test.ts | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app.ts b/src/app.ts index 70efef2..02b567a 100644 --- a/src/app.ts +++ b/src/app.ts @@ -77,11 +77,14 @@ function landing() {
${tr("projectTitle", "h2", 'id="project-title"')}${tr("projectText", "p")}
${icon("chat", 24)}
${tr("projectNative", "h3")}${tr("projectNativeText", "p")}
${icon("voice", 24)}
${tr("projectServer", "h3")}${tr("projectServerText", "p")}
${tr("projectCentral", "h3")}${tr("projectCentralText", "p")}
-
${tr("lightTitle", "h2", 'id="light-title"')}${tr("lightText", "p")}
${tr("lightVnoxName")}${tr("lightAbout")} 120 ${tr("lightUnit")}
${tr("lightElectronName")}${tr("lightElectronValue")}
${tr("lightElectronNote", "p", 'class="meter-note"')}
${tr("lightCaption", "p", 'class="small light-caption"')}${tr("lightScale", "p", 'class="small light-caption"')}
+
${tr("lightTitle", "h2", 'id="light-title"')}${tr("lightText", "p")}
${tr("lightVnoxName")}${tr("lightAbout")} 120 ${tr("lightUnit")}
${tr("lightElectronName")}${tr("lightElectronValue")}
${tr("lightElectronNote", "p", 'class="meter-note"')}
${tr("lightCaption", "p", 'class="small light-caption"')}${tr("lightScale", "p", 'class="small light-caption"')}
${tr("clientTitle", "h2", 'id="client-title"')}${tr("clientText", "p")}
${t(${tr("screenshotCaption", "figcaption")}
${tr("appearanceTitle", "h3")}${tr("appearanceText", "p")}
${tr("identityTitle", "h3")}${tr("identityText", "p")}
${tr("roadmapTitle", "h2", 'id="roadmap-title"')}${tr("roadmapText", "p")}

${tr("available")}

  • ${tr("availableOne")}
  • ${tr("availableTwo")}
  • ${tr("availableThree")}
  • ${tr("availableFour")}
  • ${tr("availableFive")}

${tr("next")}

  • ${tr("nextOne")}
  • ${tr("nextTwo")}
  • ${tr("nextThree")}
${tr("downloadNote", "p", 'class="release-note"')}
${tr("faqTitle", "h2", 'id="faq-title"')}
${(["Server", "Central", "Release"] as const).map((key) => `
${tr(`faq${key}`)}${tr(`faq${key}Answer`, "p")}
`).join("")}

${t("statusLoading")}

${tr("openCentral")}${icon("external", 15)}
`; + main + .querySelectorAll("[data-w]") + .forEach((bar) => bar.style.setProperty("--w", bar.dataset.w ?? "0")); renderDiagram(); initMotion(); main.querySelectorAll("[data-tab]").forEach((button) => { diff --git a/tests/copy.test.ts b/tests/copy.test.ts index 4f7ccc3..e88aa1e 100644 --- a/tests/copy.test.ts +++ b/tests/copy.test.ts @@ -99,3 +99,8 @@ test("the long dash is absent from sources, docs, public/ and the browser bundle } assert.deepEqual(bad, []); }); + +test("app templates avoid inline style attributes blocked by the site CSP", async () => { + const source = await Bun.file("src/app.ts").text(); + assert.doesNotMatch(source, /style="/); +});