mirror of
https://github.com/LukeHagar/sveltekit-electron-adapter.git
synced 2025-12-08 12:47:49 +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 {
|
export interface AdapterOptions {
|
||||||
pages?: string;
|
pages?: string;
|
||||||
@@ -6,6 +6,7 @@ export interface AdapterOptions {
|
|||||||
fallback?: string;
|
fallback?: string;
|
||||||
precompress?: boolean;
|
precompress?: boolean;
|
||||||
strict?: boolean;
|
strict?: boolean;
|
||||||
|
policy?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function plugin(options?: AdapterOptions): Adapter;
|
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/**/*", {
|
const HTML_assets = await glob("_app/**/*", {
|
||||||
cwd: pages,
|
cwd: pages,
|
||||||
dot: true,
|
dot: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user