-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsvelte.config.js
More file actions
55 lines (53 loc) · 1.85 KB
/
Copy pathsvelte.config.js
File metadata and controls
55 lines (53 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import adapter from '@sveltejs/adapter-static';
/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
adapter: adapter({
pages: 'dist',
assets: 'dist',
fallback: null,
precompress: false,
strict: true
}),
paths: {
// Base path for GitHub Pages deployment
base: process.env.NODE_ENV === 'production' ? '/ai-model-advisor' : ''
},
// Content Security Policy. Managed by SvelteKit (hash mode) so that the
// framework's own inline hydration script is allowlisted by hash rather
// than by opening up `script-src` to all inline scripts. This keeps
// `'unsafe-inline'` OUT of `script-src`, which is what actually blocks
// injected inline <script> / event-handler XSS. The policy is emitted as
// a <meta http-equiv> tag on the prerendered pages (GitHub Pages can't
// set response headers).
csp: {
mode: 'hash',
directives: {
'default-src': ['self'],
// 'wasm-unsafe-eval' is required to compile the transformers.js
// WASM backend. No 'unsafe-inline' — inline scripts run by hash only.
'script-src': ['self', 'wasm-unsafe-eval'],
'connect-src': [
'self',
'https://huggingface.co',
'https://cdn-lfs.huggingface.co',
'https://cdn-lfs-us-1.huggingface.co',
'https://fonts.googleapis.com',
'https://fonts.gstatic.com'
],
// 'unsafe-inline' stays only for styles: dynamic inline style
// attributes (e.g. progress-bar width) require it and inline
// styles are not a script-execution vector.
'style-src': ['self', 'unsafe-inline', 'https://fonts.googleapis.com'],
'font-src': ['self', 'data:', 'https://fonts.gstatic.com'],
'img-src': ['self', 'data:', 'blob:'],
'worker-src': ['self', 'blob:'],
'child-src': ['self', 'blob:'],
'object-src': ['none'],
'base-uri': ['self'],
'form-action': ['self']
}
}
}
};
export default config;