mirror of
https://github.com/LukeHagar/sveltekit-electron-adapter.git
synced 2025-12-07 20:57:44 +00:00
[Options] Policy
This commit is contained in:
3
index.d.ts
vendored
3
index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
import { Adapter } from '@sveltejs/kit';
|
||||
import { Adapter } from "@sveltejs/kit";
|
||||
|
||||
export interface AdapterOptions {
|
||||
pages?: string;
|
||||
@@ -6,6 +6,7 @@ export interface AdapterOptions {
|
||||
fallback?: string;
|
||||
precompress?: boolean;
|
||||
strict?: boolean;
|
||||
policy?: string;
|
||||
}
|
||||
|
||||
export default function plugin(options?: AdapterOptions): Adapter;
|
||||
|
||||
15
index.js
15
index.js
@@ -114,6 +114,21 @@ See https://kit.svelte.dev/docs/page-options#prerender for more details`
|
||||
});
|
||||
});
|
||||
|
||||
let regex_input = new RegExp(
|
||||
`http-equiv="content-security-policy" content=""`,
|
||||
"g"
|
||||
);
|
||||
const policy = "";
|
||||
let regex_replace = `http-equiv="content-security-policy" content="${
|
||||
options?.policy ? options.policy : policy
|
||||
}"`;
|
||||
|
||||
await replace.sync({
|
||||
files: [pages + "/**/*.html"],
|
||||
// @ts-ignore
|
||||
processor: (input) => input.replace(regex_input, regex_replace),
|
||||
});
|
||||
|
||||
const HTML_assets = await glob("_app/**/*", {
|
||||
cwd: pages,
|
||||
dot: true,
|
||||
|
||||
Reference in New Issue
Block a user