@stacksjs/server 0.70.150 → 0.70.152
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/maintenance.d.ts +1 -1
- package/dist/maintenance.js +3 -3
- package/package.json +5 -5
package/dist/maintenance.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export declare function launch(): Promise<void>;
|
|
|
29
29
|
/**
|
|
30
30
|
* Check if an IP address is allowed during maintenance
|
|
31
31
|
*/
|
|
32
|
-
export declare function isAllowedIp(ip: string, allowed?: string[]): boolean;
|
|
32
|
+
export declare function isAllowedIp(ip: string, allowed?: string[], trustLocalhost?: boolean): boolean;
|
|
33
33
|
/**
|
|
34
34
|
* Check if a request has a valid bypass cookie
|
|
35
35
|
*/
|
package/dist/maintenance.js
CHANGED
|
@@ -124,8 +124,8 @@ export async function launch() {
|
|
|
124
124
|
} else
|
|
125
125
|
log.info("Application is not in coming soon mode.");
|
|
126
126
|
}
|
|
127
|
-
export function isAllowedIp(ip, allowed = []) {
|
|
128
|
-
if (["127.0.0.1", "::1", "localhost"].includes(ip))
|
|
127
|
+
export function isAllowedIp(ip, allowed = [], trustLocalhost = !0) {
|
|
128
|
+
if (trustLocalhost && ["127.0.0.1", "::1", "localhost"].includes(ip))
|
|
129
129
|
return !0;
|
|
130
130
|
if (allowed.length === 0)
|
|
131
131
|
return !1;
|
|
@@ -360,7 +360,7 @@ export async function maintenanceGate(req) {
|
|
|
360
360
|
}
|
|
361
361
|
});
|
|
362
362
|
}
|
|
363
|
-
const cookies = parseCookieHeader(req.headers.get("cookie")), hasCookie = !!payload.secret && hasValidBypassCookie(cookies, payload.secret, mode), ipAllowed = isAllowedIp(clientIp(req), payload.allowed);
|
|
363
|
+
const cookies = parseCookieHeader(req.headers.get("cookie")), hasCookie = !!payload.secret && hasValidBypassCookie(cookies, payload.secret, mode), appEnv = (process.env.APP_ENV || "development").toLowerCase(), trustLocalhost = !["production", "staging"].includes(appEnv), ipAllowed = isAllowedIp(clientIp(req), payload.allowed, trustLocalhost);
|
|
364
364
|
if (hasCookie || ipAllowed)
|
|
365
365
|
return null;
|
|
366
366
|
return siteModeResponse(payload);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/server",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.70.
|
|
5
|
+
"version": "0.70.152",
|
|
6
6
|
"description": "Local development and production-ready.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
"prepublishOnly": "bun run build"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@stacksjs/config": "0.70.
|
|
56
|
+
"@stacksjs/config": "0.70.152",
|
|
57
57
|
"better-dx": "^0.2.17",
|
|
58
|
-
"@stacksjs/path": "0.70.
|
|
59
|
-
"@stacksjs/router": "0.70.
|
|
60
|
-
"@stacksjs/validation": "0.70.
|
|
58
|
+
"@stacksjs/path": "0.70.152",
|
|
59
|
+
"@stacksjs/router": "0.70.152",
|
|
60
|
+
"@stacksjs/validation": "0.70.152"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"bun-plugin-auto-imports": "^0.4.0"
|