Skip to content

Commit 114f2e3

Browse files
committed
Merge remote-tracking branch 'origin/feat/og-image-v6' into feat/og-image-v6
2 parents 2cdcc35 + 8e1c597 commit 114f2e3

15 files changed

Lines changed: 1148 additions & 493 deletions

File tree

.env.example

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
#secure password, can use openssl rand -hex 32
2-
NUXT_SESSION_PASSWORD=""
2+
NUXT_SESSION_PASSWORD=""
3+
4+
#HMAC secret for image proxy URL signing, can use openssl rand -hex 32
5+
NUXT_IMAGE_PROXY_SECRET=""

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ jobs:
154154
run: pnpm build:test
155155
env:
156156
VALIDATE_HTML: true
157+
NODE_OPTIONS: --max-old-space-size=6144
157158

158159
- name: 🖥️ Test project (browser)
159160
run: pnpm test:browser:prebuilt
@@ -182,6 +183,8 @@ jobs:
182183

183184
- name: 🏗️ Build project
184185
run: pnpm build:test
186+
env:
187+
NODE_OPTIONS: --max-old-space-size=6144
185188

186189
- name: ♿ Accessibility audit (Lighthouse - ${{ matrix.mode }} mode)
187190
run: pnpm test:a11y:prebuilt

app/components/Package/Versions.vue

Lines changed: 64 additions & 46 deletions
Large diffs are not rendered by default.

modules/image-proxy.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { defineNuxtModule, useNuxt } from 'nuxt/kit'
2+
import process from 'node:process'
3+
import { join } from 'node:path'
4+
import { appendFileSync, existsSync, readFileSync } from 'node:fs'
5+
import { randomUUID } from 'node:crypto'
6+
7+
/**
8+
* Auto-generates `NUXT_IMAGE_PROXY_SECRET` for local development if it is not
9+
* already set. The secret is used to HMAC-sign image proxy URLs so that only
10+
* server-generated URLs are accepted by the proxy endpoint.
11+
*
12+
* In production, `NUXT_IMAGE_PROXY_SECRET` must be set as an environment variable.
13+
*/
14+
export default defineNuxtModule({
15+
meta: {
16+
name: 'image-proxy',
17+
},
18+
setup() {
19+
const nuxt = useNuxt()
20+
21+
if (nuxt.options._prepare || process.env.NUXT_IMAGE_PROXY_SECRET) {
22+
return
23+
}
24+
25+
const envPath = join(nuxt.options.rootDir, '.env')
26+
const hasSecret =
27+
existsSync(envPath) && /^NUXT_IMAGE_PROXY_SECRET=/m.test(readFileSync(envPath, 'utf-8'))
28+
29+
if (!hasSecret) {
30+
// eslint-disable-next-line no-console
31+
console.info('Generating NUXT_IMAGE_PROXY_SECRET for development environment.')
32+
const secret = randomUUID().replace(/-/g, '')
33+
34+
nuxt.options.runtimeConfig.imageProxySecret = secret
35+
appendFileSync(
36+
envPath,
37+
`# generated by image-proxy module\nNUXT_IMAGE_PROXY_SECRET=${secret}\n`,
38+
)
39+
}
40+
},
41+
})

nuxt.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export default defineNuxtConfig({
3434

3535
runtimeConfig: {
3636
sessionPassword: '',
37+
imageProxySecret: '',
3738
github: {
3839
orgToken: '',
3940
},

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030
"mock-connector": "pnpm --filter npmx-connector dev:mock",
3131
"generate-pwa-icons": "pwa-assets-generator",
3232
"preview": "nuxt preview",
33-
"postinstall": "pnpm generate:lexicons && nuxt prepare && pnpm generate:sprite && simple-git-hooks",
33+
"postinstall": "pnpm generate:lexicons && pnpm generate:sprite && nuxt prepare && simple-git-hooks",
3434
"generate:sprite": "node scripts/generate-file-tree-sprite.ts",
3535
"generate:fixtures": "node scripts/generate-fixtures.ts",
3636
"generate:lexicons": "lex build --lexicons lexicons --out shared/types/lexicons --clear",
3737
"generate:jwk": "node scripts/gen-jwk.ts",
38-
"test": "vite test",
38+
"test": "vp test",
3939
"test:a11y": "pnpm build:test && LIGHTHOUSE_COLOR_MODE=dark pnpm test:a11y:prebuilt && LIGHTHOUSE_COLOR_MODE=light pnpm test:a11y:prebuilt",
4040
"test:a11y:prebuilt": "./scripts/lighthouse.sh",
4141
"test:perf": "pnpm build:test && pnpm test:perf:prebuilt",
@@ -44,9 +44,9 @@
4444
"test:browser:prebuilt": "playwright test",
4545
"test:browser:ui": "pnpm build:test && pnpm test:browser:prebuilt --ui",
4646
"test:browser:update": "pnpm build:test && pnpm test:browser:prebuilt --update-snapshots",
47-
"test:nuxt": "vite test --project nuxt",
47+
"test:nuxt": "vp test --project nuxt",
4848
"test:types": "pnpm generate:lexicons && nuxt prepare && vue-tsc -b --noEmit && pnpm --filter npmx-connector test:types",
49-
"test:unit": "vite test --project unit",
49+
"test:unit": "vp test --project unit",
5050
"start:playwright:webserver": "NODE_ENV=test pnpm preview --port 5678"
5151
},
5252
"dependencies": {
@@ -78,7 +78,7 @@
7878
"@upstash/redis": "1.36.2",
7979
"@vite-pwa/assets-generator": "1.0.2",
8080
"@vite-pwa/nuxt": "1.1.1",
81-
"@voidzero-dev/vite-plus-core": "0.0.0-b1666489.20260220-0254",
81+
"@voidzero-dev/vite-plus-core": "0.0.0-g52709db6.20260226-1136",
8282
"@vueuse/core": "14.2.1",
8383
"@vueuse/integrations": "14.2.1",
8484
"@vueuse/nuxt": "14.2.1",
@@ -89,6 +89,7 @@
8989
"fast-npm-meta": "1.2.1",
9090
"focus-trap": "^8.0.0",
9191
"gray-matter": "4.0.3",
92+
"ipaddr.js": "2.3.0",
9293
"marked": "17.0.3",
9394
"module-replacements": "2.11.0",
9495
"nuxt": "4.3.1",
@@ -110,7 +111,7 @@
110111
"validate-npm-package-name": "7.0.2",
111112
"virtua": "0.48.6",
112113
"vite-plugin-pwa": "1.2.0",
113-
"vite-plus": "0.0.0-833c515fa25cef20905a7f9affb156dfa6f151ab",
114+
"vite-plus": "0.0.0-g52709db6.20260226-1136",
114115
"vue": "3.5.29",
115116
"vue-data-ui": "3.15.8"
116117
},
@@ -123,7 +124,6 @@
123124
"@types/sanitize-html": "2.16.0",
124125
"@types/semver": "7.7.1",
125126
"@types/validate-npm-package-name": "4.0.2",
126-
"@vitest/browser-playwright": "4.0.18",
127127
"@vitest/coverage-v8": "4.0.18",
128128
"@vue/test-utils": "2.4.6",
129129
"axe-core": "4.11.1",
@@ -140,7 +140,7 @@
140140
"schema-dts": "1.1.5",
141141
"simple-git-hooks": "2.13.1",
142142
"typescript": "5.9.3",
143-
"vitest": "npm:@voidzero-dev/vite-plus-test@0.0.0-b1666489.20260220-0254",
143+
"vitest": "npm:@voidzero-dev/vite-plus-test@0.0.0-g52709db6.20260226-1136",
144144
"vitest-environment-nuxt": "1.0.1",
145145
"vue-i18n-extract": "2.0.7",
146146
"vue-tsc": "3.2.5"

0 commit comments

Comments
 (0)