From 0336ea1cb29c918bc1c03cb4fd61e41e6304e8dc Mon Sep 17 00:00:00 2001 From: Vendicated Date: Fri, 24 Jan 2025 03:33:29 +0100 Subject: [PATCH] export CspPolicies map so plugins can whitelist themselves --- src/main/csp.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/csp.ts b/src/main/csp.ts index 3e0dececf..44272fbcf 100644 --- a/src/main/csp.ts +++ b/src/main/csp.ts @@ -13,7 +13,7 @@ const CssSrc = ["style-src", "font-src"]; const MediaAndCssSrc = [...MediaSrc, ...CssSrc]; const MediaScriptsAndCssSrc = [...MediaAndCssSrc, "script-src", "worker-src"]; -const Policies: PolicyMap = { +export const CspPolicies: PolicyMap = { "*.github.io": MediaAndCssSrc, // github pages, used by most themes "raw.githubusercontent.com": MediaAndCssSrc, // github raw, used by some themes "*.gitlab.io": MediaAndCssSrc, // gitlab pages, used by some themes @@ -92,7 +92,7 @@ const patchCsp = (headers: Record) => { pushDirective("script-src", "'unsafe-inline'", "'unsafe-eval'"); - for (const [host, directives] of Object.entries(Policies)) { + for (const [host, directives] of Object.entries(CspPolicies)) { for (const directive of directives) { pushDirective(directive, host); }