Skip to content

Commit 3d0aa04

Browse files
committed
update lock
2 parents fe8930a + 1e1fe41 commit 3d0aa04

File tree

14 files changed

+1130
-390
lines changed

14 files changed

+1130
-390
lines changed

.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=""

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: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
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": {
@@ -76,7 +76,7 @@
7676
"@upstash/redis": "1.36.2",
7777
"@vite-pwa/assets-generator": "1.0.2",
7878
"@vite-pwa/nuxt": "1.1.1",
79-
"@voidzero-dev/vite-plus-core": "0.0.0-b1666489.20260220-0254",
79+
"@voidzero-dev/vite-plus-core": "0.0.0-g52709db6.20260226-1136",
8080
"@vueuse/core": "14.2.1",
8181
"@vueuse/integrations": "14.2.1",
8282
"@vueuse/nuxt": "14.2.1",
@@ -87,6 +87,7 @@
8787
"fast-npm-meta": "1.2.1",
8888
"focus-trap": "^8.0.0",
8989
"gray-matter": "4.0.3",
90+
"ipaddr.js": "2.3.0",
9091
"marked": "17.0.3",
9192
"module-replacements": "2.11.0",
9293
"nuxt": "4.3.1",
@@ -108,7 +109,7 @@
108109
"validate-npm-package-name": "7.0.2",
109110
"virtua": "0.48.6",
110111
"vite-plugin-pwa": "1.2.0",
111-
"vite-plus": "0.0.0-833c515fa25cef20905a7f9affb156dfa6f151ab",
112+
"vite-plus": "0.0.0-g52709db6.20260226-1136",
112113
"vue": "3.5.29",
113114
"vue-data-ui": "3.15.8"
114115
},
@@ -121,7 +122,6 @@
121122
"@types/sanitize-html": "2.16.0",
122123
"@types/semver": "7.7.1",
123124
"@types/validate-npm-package-name": "4.0.2",
124-
"@vitest/browser-playwright": "4.0.18",
125125
"@vitest/coverage-v8": "4.0.18",
126126
"@vue/test-utils": "2.4.6",
127127
"axe-core": "4.11.1",
@@ -138,7 +138,7 @@
138138
"schema-dts": "1.1.5",
139139
"simple-git-hooks": "2.13.1",
140140
"typescript": "5.9.3",
141-
"vitest": "npm:@voidzero-dev/vite-plus-test@0.0.0-b1666489.20260220-0254",
141+
"vitest": "npm:@voidzero-dev/vite-plus-test@0.0.0-g52709db6.20260226-1136",
142142
"vitest-environment-nuxt": "1.0.1",
143143
"vue-i18n-extract": "2.0.7",
144144
"vue-tsc": "3.2.5"

0 commit comments

Comments
 (0)