Fix: extract goatcounter to update hash

This commit is contained in:
Pieter Vander Vennet 2025-06-04 21:15:53 +02:00
parent 3777fa601a
commit 9725e98e6f
10 changed files with 24 additions and 25 deletions

View file

@ -158,6 +158,14 @@ describe("Code quality", () => {
for (const htmlFile of htmlFiles) {
await validateScriptIntegrityOf(htmlFile)
}
const goatCounter = "https://gc.zgo.at/count.js"
const data: string = (await ScriptUtils.Download(goatCounter))["content"]
const hashed = await webcrypto.subtle.digest("SHA-384", new TextEncoder().encode(data))
const hashedB64 = _arrayBufferToBase64(hashed)
const goatCounterScript = readFileSync("./src/loadGoatcounter.js", "utf-8")
if (goatCounterScript.indexOf(hashedB64) < 0) {
throw "Hash sha-384" + hashedB64 + " not found in 'loadGoatcounter.js'"
}
})
/*
itAsync(
@ -168,7 +176,7 @@ describe("Code quality", () => {
)
)
/*
itAsync(
itAsync(int
"should not contain '[\"default\"]'",
detectInCode('\\[\\"default\\"\\]', "Possible leftover of faulty default import")
)*/