Skip to content

Commit 64e80f9

Browse files
committed
docs: update head config
1 parent 72234af commit 64e80f9

5 files changed

Lines changed: 69 additions & 27 deletions

File tree

.github/workflows/pages.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Deploy Documentation to Pages
33
on:
44
push:
55
branches: [main]
6+
paths:
7+
- 'docs/**'
68

79
workflow_dispatch:
810

@@ -27,15 +29,20 @@ jobs:
2729
with:
2830
node-version: 22
2931
cache: npm
32+
cache-dependency-path: docs/package-lock.json
3033

3134
- name: Setup Pages
3235
uses: actions/configure-pages@v5
3336

3437
- name: Install dependencies
35-
run: npm ci
38+
run: |
39+
cd docs
40+
npm ci
3641
3742
- name: Build with VitePress
38-
run: npm run docs:build
43+
run: |
44+
cd docs
45+
npm run build
3946
4047
- name: Upload artifact
4148
uses: actions/upload-pages-artifact@v4

docs/.vitepress/head.ts

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
import { HeadConfig } from "vitepress/types/shared";
22

3-
export const head: HeadConfig[] = [
4-
['link', { rel: "icon", type: "image/png", sizes: "96x96", href: "/favicon-96x96.png"}],
5-
['link', { rel: "icon", type: "image/svg+xml", href: "/favicon.svg"}],
6-
['link', { rel: "shortcut icon", href: "/favicon.ico"}],
7-
['link', { rel: "apple-touch-icon", sizes: "180x180", href: "/apple-touch-icon.png"}],
8-
['link', { rel: "manifest", href: "/site.webmanifest"}],
9-
['meta', { name: "apple-mobile-web-app-title", content: "JRTC"}],
3+
const isProd = process.env.NODE_ENV === 'production';
104

11-
// Security headers
12-
[
13-
'meta',
5+
const head: HeadConfig[] = [
6+
['link', { rel: "icon", type: "image/png", sizes: "96x96", href: "/favicon-96x96.png" }],
7+
['link', { rel: "icon", type: "image/svg+xml", href: "/favicon.svg" }],
8+
['link', { rel: "shortcut icon", href: "/favicon.ico" }],
9+
['link', { rel: "apple-touch-icon", sizes: "180x180", href: "/apple-touch-icon.png" }],
10+
['link', { rel: "manifest", href: "/site.webmanifest" }],
11+
['meta', { name: "apple-mobile-web-app-title", content: "JRTC" }],
12+
]
13+
14+
if (isProd) {
15+
head.push([
16+
'script',
1417
{
15-
'http-equiv': 'Content-Security-Policy',
16-
content:
17-
"default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' data:; connect-src 'self' https:;",
18+
async: '',
19+
src: 'https://eu.umami.is/script.js',
20+
'data-website-id': '126654a9-5f07-4b57-ad7e-023eda3980ff',
21+
'data-domains': 'jrtc.dev',
22+
'data-do-not-track': 'true'
1823
},
19-
],
20-
['meta', { 'http-equiv': 'X-Content-Type-Options', content: 'nosniff' }],
21-
['meta', { 'http-equiv': 'X-Frame-Options', content: 'SAMEORIGIN' }],
22-
['meta', { 'http-equiv': 'X-XSS-Protection', content: '1; mode=block' }],
23-
['meta', { name: 'referrer', content: 'strict-origin-when-cross-origin' }],
24-
]
24+
])
25+
}
26+
27+
export { head }

docs/package-lock.json

Lines changed: 23 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
{
2-
"name": "webrtc-java",
3-
"description": "Java native interface for WebRTC",
4-
"version": "1.0.0",
5-
"license": "Apache-2.0",
2+
"name": "webrtc-java-docs",
63
"scripts": {
74
"dev": "vitepress dev",
85
"build": "vitepress build",
96
"preview": "vitepress preview"
107
},
118
"devDependencies": {
9+
"@types/node": "^24.3.1",
1210
"vitepress": "^2.0.0-alpha.12"
1311
}
14-
}
12+
}

docs/tsconfig.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"compilerOptions": {
3+
"target": "esnext",
4+
"module": "esnext",
5+
"moduleResolution": "node",
6+
"strict": true,
7+
"jsx": "preserve"
8+
},
9+
"include": [
10+
"**/.vitepress/**/*"
11+
]
12+
}

0 commit comments

Comments
 (0)