Drop goatcounter

This commit is contained in:
Pieter Vander Vennet 2025-06-19 16:08:29 +02:00
parent 673cf95119
commit 5851fecffd
12 changed files with 5 additions and 36 deletions

View file

@ -4,7 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="width=device-width, initial-scale=1.0, user-scalable=no" name="viewport"> <meta content="width=device-width, initial-scale=1.0, user-scalable=no" name="viewport">
<meta http-equiv="Content-Security-Policy" <meta http-equiv="Content-Security-Policy"
content="default-src 'self'; script-src 'self' https://gc.zgo.at/; img-src *; connect-src 'self' https://www.openstreetmap.org/ https://api.openstreetmap.org/;"> content="default-src 'self'; script-src 'self' ; img-src *; connect-src 'self' https://www.openstreetmap.org/ https://api.openstreetmap.org/;">
<link href="./css/mobile.css" rel="stylesheet" /> <link href="./css/mobile.css" rel="stylesheet" />
<link href="./css/tagrendering.css" rel="stylesheet" /> <link href="./css/tagrendering.css" rel="stylesheet" />
<link href="./css/index-tailwind-output.css" rel="stylesheet" /> <link href="./css/index-tailwind-output.css" rel="stylesheet" />
@ -41,7 +41,6 @@
<body> <body>
<div id="maindiv" class="h-screen"></div> <div id="maindiv" class="h-screen"></div>
<script type="module" src="./src/notfound.ts"></script> <script type="module" src="./src/notfound.ts"></script>
<script src="./src/loadGoatcounter.js"></script>
</body> </body>
</html> </html>

@ -1 +1 @@
Subproject commit 8a3b8f5ed934c4ab5b15454907ccaa35a4ba552e Subproject commit 1a0e2abf276f356d1c68e828608a4d5342589499

View file

@ -4,7 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport"> <meta content="width=device-width, initial-scale=1.0" name="viewport">
<meta http-equiv="Content-Security-Policy" <meta http-equiv="Content-Security-Policy"
content="default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' https://gc.zgo.at/; img-src * data: ; connect-src 'self' https://www.openstreetmap.org/ https://api.openstreetmap.org/ https://pietervdvn.goatcounter.com/;"> content="default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self'; img-src * data: ; connect-src 'self' https://www.openstreetmap.org/ https://api.openstreetmap.org/;">
<link href="./css/mobile.css" rel="stylesheet" /> <link href="./css/mobile.css" rel="stylesheet" />
<link href="./css/openinghourstable.css" rel="stylesheet" /> <link href="./css/openinghourstable.css" rel="stylesheet" />
<link href="./css/tagrendering.css" rel="stylesheet" /> <link href="./css/tagrendering.css" rel="stylesheet" />
@ -42,7 +42,6 @@
<div id="main"></div> <div id="main"></div>
<script src="./src/Logic/Web/AndroidPolyfill.ts" type="module"></script> <script src="./src/Logic/Web/AndroidPolyfill.ts" type="module"></script>
<script type="module" src="./src/all_themes_index.ts"></script> <script type="module" src="./src/all_themes_index.ts"></script>
<script src="./src/loadGoatcounter.js"></script>
<script async src="./src/InstallServiceWorker.ts" type="module"></script> <script async src="./src/InstallServiceWorker.ts" type="module"></script>

View file

@ -12,7 +12,6 @@
<body> <body>
<div id="main">Loading inspector...</div> <div id="main">Loading inspector...</div>
<script src="./src/UI/InspectorGUI.ts" type="module"></script> <script src="./src/UI/InspectorGUI.ts" type="module"></script>
<script src="./src/loadGoatcounter.js"></script>
</body> </body>
</html> </html>

View file

@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport"> <meta content="width=device-width, initial-scale=1.0" name="viewport">
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' https://gc.zgo.at/; img-src *; connect-src 'self' https://www.openstreetmap.org/ https://api.openstreetmap.org/ https://pietervdvn.goatcounter.com/;"> <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' ; img-src *; connect-src 'self' https://www.openstreetmap.org/ https://api.openstreetmap.org/ ;">
<link href="./css/mobile.css" rel="stylesheet"/> <link href="./css/mobile.css" rel="stylesheet"/>
<link href="./css/openinghourstable.css" rel="stylesheet"/> <link href="./css/openinghourstable.css" rel="stylesheet"/>
<link href="./css/tagrendering.css" rel="stylesheet"/> <link href="./css/tagrendering.css" rel="stylesheet"/>
@ -38,7 +38,5 @@
<div id="main"></div> <div id="main"></div>
<script type="module" src="./src/privacy_index.ts"></script> <script type="module" src="./src/privacy_index.ts"></script>
<script src="./src/loadGoatcounter.js"></script>
</body> </body>
</html> </html>

View file

@ -439,7 +439,6 @@ class GenerateLayouts extends Script {
"style-src": "'self' 'unsafe-inline'", // unsafe-inline is needed to change the default background pin colours "style-src": "'self' 'unsafe-inline'", // unsafe-inline is needed to change the default background pin colours
"script-src": [ "script-src": [
"'self'", "'self'",
"https://gc.zgo.at/count.js",
...(options?.scriptSrcs?.map((s) => "'" + s + "'") ?? []), ...(options?.scriptSrcs?.map((s) => "'" + s + "'") ?? []),
].join(" "), ].join(" "),
"connect-src": "'self' " + connectSrc.join(" "), "connect-src": "'self' " + connectSrc.join(" "),

View file

@ -1,7 +0,0 @@
const script = document.createElement("script")
script.async = true
script.dataset.goatcounter = "https://pietervdvn.goatcounter.com/count"
script.src = "https://gc.zgo.at/count.js"
script.crossOrigin = "anonymous"
script.integrity = "sha384-atnOLvQb9t+jTSipvd75X2yginT4PjVbqDdlJAmxMm+wYElFmeR6EmLP5bYeoRVQ"
document.head.appendChild(script)

View file

@ -12,7 +12,6 @@
<body> <body>
<div id="main">Loading statistics...</div> <div id="main">Loading statistics...</div>
<script src="./src/UI/StatisticsGUI.ts" type="module"></script> <script src="./src/UI/StatisticsGUI.ts" type="module"></script>
<script src="./src/loadGoatcounter.js"></script>
</body> </body>
</html> </html>

View file

@ -13,7 +13,6 @@
<body> <body>
<div id="main"></div> <div id="main"></div>
<script src="./src/UI/StatusGui.ts" type="module"></script> <script src="./src/UI/StatusGui.ts" type="module"></script>
<script src="./src/loadGoatcounter.js"></script>
</body> </body>
</html> </html>

View file

@ -19,7 +19,6 @@
<body> <body>
<div id="main" class="h-full"></div> <div id="main" class="h-full"></div>
<script src="./src/UI/StudioGui.ts" type="module"></script> <script src="./src/UI/StudioGui.ts" type="module"></script>
<script src="./src/loadGoatcounter.js"></script>
</body> </body>
</html> </html>

View file

@ -154,20 +154,7 @@ describe("Code quality", () => {
) )
) )
test("scripts with external sources should have an integrity hash", async () => {
const htmlFiles = ScriptUtils.readDirRecSync(".", 1).filter((f) => f.endsWith(".html"))
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( itAsync(
"should not contain 'import * as name from \"xyz.json\"'", "should not contain 'import * as name from \"xyz.json\"'",

View file

@ -92,9 +92,7 @@
<script src="./src/Logic/Web/AndroidPolyfill.ts" type="module"></script> <script src="./src/Logic/Web/AndroidPolyfill.ts" type="module"></script>
<script async src="./src/InstallServiceWorker.ts" type="module"></script> <script async src="./src/InstallServiceWorker.ts" type="module"></script>
<script defer src="./src/index.ts" type="module"></script> <script defer src="./src/index.ts" type="module"></script>
<script src="./src/loadGoatcounter.js"></script>
</body> </body>
</html> </html>