nuxt-skew-protection 0.7.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -15,6 +15,11 @@ import { join as join$1, dirname } from 'pathe';
|
|
|
15
15
|
|
|
16
16
|
const logger = useLogger("nuxt-skew-protection");
|
|
17
17
|
|
|
18
|
+
function registerNuxtSeoProModule(registration) {
|
|
19
|
+
const nuxt = useNuxt();
|
|
20
|
+
nuxt._nuxtSeoProModules = nuxt._nuxtSeoProModules || [];
|
|
21
|
+
nuxt._nuxtSeoProModules.push(registration);
|
|
22
|
+
}
|
|
18
23
|
function isStaticPreset(nuxt = useNuxt()) {
|
|
19
24
|
return nuxt.options.nitro?.static || nuxt.options._generate || [
|
|
20
25
|
"static",
|
|
@@ -53,7 +58,7 @@ function hookNuxtSeoProLicense() {
|
|
|
53
58
|
const isBuild = !nuxt.options.dev && !nuxt.options._prepare;
|
|
54
59
|
if (isBuild && !nuxt._isNuxtSeoProVerifying) {
|
|
55
60
|
const license = nuxt.options.runtimeConfig.seoProKey || process.env.NUXT_SEO_PRO_KEY;
|
|
56
|
-
if (isTest) {
|
|
61
|
+
if (isTest || process.env.VITEST) {
|
|
57
62
|
return;
|
|
58
63
|
}
|
|
59
64
|
if (!isCI && !license) {
|
|
@@ -73,9 +78,15 @@ function hookNuxtSeoProLicense() {
|
|
|
73
78
|
spinner.start("\u{1F511} Verifying Nuxt SEO Pro license...");
|
|
74
79
|
const siteUrl = siteConfig.url?.startsWith("http") ? siteConfig.url : void 0;
|
|
75
80
|
const siteName = siteConfig.name || void 0;
|
|
81
|
+
const modules = nuxt._nuxtSeoProModules?.length > 0 ? nuxt._nuxtSeoProModules : void 0;
|
|
76
82
|
const res = await $fetch("https://nuxtseo.com/api/pro/verify", {
|
|
77
83
|
method: "POST",
|
|
78
|
-
body: {
|
|
84
|
+
body: {
|
|
85
|
+
apiKey: license,
|
|
86
|
+
siteUrl,
|
|
87
|
+
siteName,
|
|
88
|
+
modules
|
|
89
|
+
}
|
|
79
90
|
}).catch((err) => {
|
|
80
91
|
if (err?.response?.status === 401) {
|
|
81
92
|
spinner.stop("\u274C Invalid API key");
|
|
@@ -992,6 +1003,21 @@ export {}
|
|
|
992
1003
|
logger.warn(`Strategy "${resolvedStrategy}" requires a server but static generation detected. Falling back to polling.`);
|
|
993
1004
|
resolvedStrategy = "polling";
|
|
994
1005
|
}
|
|
1006
|
+
const adapterName = isAdapter ? options.updateStrategy.name : void 0;
|
|
1007
|
+
registerNuxtSeoProModule({
|
|
1008
|
+
name: "nuxt-skew-protection",
|
|
1009
|
+
version,
|
|
1010
|
+
features: {
|
|
1011
|
+
updateStrategy: adapterName || resolvedStrategy,
|
|
1012
|
+
connectionTracking: !!options.connectionTracking,
|
|
1013
|
+
routeTracking: !!(options.connectionTracking && options.routeTracking),
|
|
1014
|
+
ipTracking: !!(options.connectionTracking && options.ipTracking),
|
|
1015
|
+
bundlePreviousDeploymentChunks: options.bundlePreviousDeploymentChunks !== false,
|
|
1016
|
+
storageDriver: options.storage?.driver || "none",
|
|
1017
|
+
preset: nitroPreset,
|
|
1018
|
+
isStatic
|
|
1019
|
+
}
|
|
1020
|
+
});
|
|
995
1021
|
if (isVercel) {
|
|
996
1022
|
addServerHandler({
|
|
997
1023
|
handler: resolver.resolve("./runtime/server/middleware/vercel-skew"),
|
|
@@ -1004,6 +1030,13 @@ export {}
|
|
|
1004
1030
|
middleware: true
|
|
1005
1031
|
});
|
|
1006
1032
|
}
|
|
1033
|
+
if (options.connectionTracking && !isStatic) {
|
|
1034
|
+
addServerHandler({
|
|
1035
|
+
route: "/_skew/admin/stats",
|
|
1036
|
+
method: "get",
|
|
1037
|
+
handler: resolver.resolve("./runtime/server/routes/_skew/admin/stats.get")
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1007
1040
|
addPlugin({
|
|
1008
1041
|
src: resolver.resolve("./runtime/app/plugins/sw-track-user-modules.client"),
|
|
1009
1042
|
mode: "client"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createError, defineEventHandler, getHeader } from "h3";
|
|
2
|
+
import { useNitroApp, useRuntimeConfig } from "nitropack/runtime";
|
|
3
|
+
export default defineEventHandler(async (event) => {
|
|
4
|
+
const config = useRuntimeConfig(event);
|
|
5
|
+
const seoProKey = config.seoProKey || process.env.NUXT_SEO_PRO_KEY;
|
|
6
|
+
if (!seoProKey) {
|
|
7
|
+
throw createError({ statusCode: 503, message: "SEO Pro key not configured" });
|
|
8
|
+
}
|
|
9
|
+
const authHeader = getHeader(event, "authorization") || "";
|
|
10
|
+
const providedKey = authHeader.startsWith("Bearer ") ? authHeader.slice(7) : authHeader;
|
|
11
|
+
if (providedKey !== seoProKey) {
|
|
12
|
+
throw createError({ statusCode: 401, message: "Unauthorized" });
|
|
13
|
+
}
|
|
14
|
+
return new Promise((resolve) => {
|
|
15
|
+
useNitroApp().hooks.callHook("skew:stats", (stats) => {
|
|
16
|
+
resolve(stats);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-skew-protection",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.4",
|
|
5
5
|
"description": "Solve Nuxt version skews with persistent assets and instant updates.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Harlan Wilton",
|
|
@@ -61,14 +61,14 @@
|
|
|
61
61
|
"pkg-types": "^2.3.0",
|
|
62
62
|
"std-env": "^3.10.0",
|
|
63
63
|
"tinyexec": "^1.0.2",
|
|
64
|
-
"ufo": "^1.6.
|
|
65
|
-
"unstorage": "^1.17.
|
|
64
|
+
"ufo": "^1.6.3",
|
|
65
|
+
"unstorage": "^1.17.4",
|
|
66
66
|
"zod": "^4.3.5"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@antfu/eslint-config": "^
|
|
69
|
+
"@antfu/eslint-config": "^7.0.1",
|
|
70
70
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
71
|
-
"@nuxt/content": "^3.
|
|
71
|
+
"@nuxt/content": "^3.11.0",
|
|
72
72
|
"@nuxt/devtools-ui-kit": "^3.1.1",
|
|
73
73
|
"@nuxt/module-builder": "^1.0.2",
|
|
74
74
|
"@nuxt/test-utils": "^3.23.0",
|
|
@@ -86,15 +86,15 @@
|
|
|
86
86
|
"@vueuse/nuxt": "^14.1.0",
|
|
87
87
|
"ably": "^2.17.0",
|
|
88
88
|
"better-sqlite3": "^12.6.0",
|
|
89
|
-
"bumpp": "^10.
|
|
89
|
+
"bumpp": "^10.4.0",
|
|
90
90
|
"eslint": "^9.39.2",
|
|
91
91
|
"eventsource": "^4.1.0",
|
|
92
92
|
"execa": "^9.6.1",
|
|
93
93
|
"firebase-functions": "^7.0.3",
|
|
94
|
-
"happy-dom": "^20.1
|
|
95
|
-
"ioredis": "^5.9.
|
|
94
|
+
"happy-dom": "^20.3.1",
|
|
95
|
+
"ioredis": "^5.9.2",
|
|
96
96
|
"nuxt": "^4.2.2",
|
|
97
|
-
"nuxt-auth-utils": "^0.5.
|
|
97
|
+
"nuxt-auth-utils": "^0.5.27",
|
|
98
98
|
"playwright-core": "^1.57.0",
|
|
99
99
|
"pusher-js": "^8.4.0",
|
|
100
100
|
"tsx": "^4.21.0",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"vue": "^3.5.26",
|
|
105
105
|
"vue-router": "^4.6.4",
|
|
106
106
|
"vue-tsc": "^3.2.2",
|
|
107
|
-
"wrangler": "^4.
|
|
107
|
+
"wrangler": "^4.59.2",
|
|
108
108
|
"ws": "^8.19.0"
|
|
109
109
|
},
|
|
110
110
|
"resolutions": {
|