@stacksjs/server 0.70.113 → 0.70.115

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.
@@ -69,7 +69,8 @@ export declare function bypassCookieValue(secret: string, mode?: SiteMode): stri
69
69
  * 2. Path is always-allowed (the holding page itself, email
70
70
  * subscribe, static assets) → pass through.
71
71
  * 3. Path matches the secret token → set mode-aware bypass cookie,
72
- * redirect home.
72
+ * redirect home (coming-soon lands on `/?preview=<secret>` so the
73
+ * client-side gate unlocks in the same visit when tokens match).
73
74
  * 4. Bypass cookie present OR client IP allowed → pass through.
74
75
  * 5. Otherwise → return the active mode's response (redirect for
75
76
  * coming-soon when a redirect URL is configured; HTML page for
@@ -350,14 +350,16 @@ export async function maintenanceGate(req) {
350
350
  const mode = payload.mode ?? "maintenance", path = new URL(req.url).pathname;
351
351
  if (isAlwaysAllowed(path))
352
352
  return null;
353
- if (payload.secret && isSecretPath(path, payload.secret))
353
+ if (payload.secret && isSecretPath(path, payload.secret)) {
354
+ const location = mode === "coming-soon" ? `/?preview=${encodeURIComponent(payload.secret)}` : "/";
354
355
  return new Response(null, {
355
356
  status: 302,
356
357
  headers: {
357
- Location: "/",
358
+ Location: location,
358
359
  "Set-Cookie": bypassCookieValue(payload.secret, mode)
359
360
  }
360
361
  });
362
+ }
361
363
  const cookies = parseCookieHeader(req.headers.get("cookie")), hasCookie = !!payload.secret && hasValidBypassCookie(cookies, payload.secret, mode), ipAllowed = isAllowedIp(clientIp(req), payload.allowed);
362
364
  if (hasCookie || ipAllowed)
363
365
  return null;
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.113",
5
+ "version": "0.70.115",
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.113",
57
- "better-dx": "^0.2.16",
58
- "@stacksjs/path": "0.70.113",
59
- "@stacksjs/router": "0.70.113",
60
- "@stacksjs/validation": "0.70.113"
56
+ "@stacksjs/config": "0.70.115",
57
+ "better-dx": "catalog:",
58
+ "@stacksjs/path": "0.70.115",
59
+ "@stacksjs/router": "0.70.115",
60
+ "@stacksjs/validation": "0.70.115"
61
61
  },
62
62
  "dependencies": {
63
63
  "bun-plugin-auto-imports": "^0.4.0"