@tokenoftrust/storefront-runner 2.4.43 → 2.4.45
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.
|
@@ -27,18 +27,19 @@ import type { StaffAdmission, TenantMembership } from "@/lib/dashboard/tenantSel
|
|
|
27
27
|
|
|
28
28
|
/** What every viewer of an unpaid store is told in place of the delegate section. */
|
|
29
29
|
export const UNPAID_DELEGATION_NOTE =
|
|
30
|
-
"Developers
|
|
31
|
-
"delegation becomes available once the live
|
|
30
|
+
"Developers you've invited can already add changes and publish them while the store is " +
|
|
31
|
+
"unpaid — no delegation needed. Ship-on-behalf delegation becomes available once the live " +
|
|
32
|
+
"site is activated.";
|
|
32
33
|
|
|
33
34
|
/** The delegate section: an unpaid store's note, or the paid store's {@link DelegateGate}. */
|
|
34
35
|
export type DelegateSection = { mode: "unpaid"; role: null; explanation: string } | DelegateGate;
|
|
35
36
|
|
|
36
37
|
/**
|
|
37
|
-
* Resolve the whole delegate section. Before a store is paid
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* owner included, gets {@link UNPAID_DELEGATION_NOTE}. A paid store
|
|
41
|
-
* {@link resolveDelegateGate} unchanged.
|
|
38
|
+
* Resolve the whole delegate section. Before a store is paid, an invited developer can
|
|
39
|
+
* already add changes AND publish them (both `merge-to-preview` and `publish-live` admit the
|
|
40
|
+
* "unpaid-store-developer" basis, lib/pipeline/admission.ts), so delegation has nothing to
|
|
41
|
+
* grant: every viewer, the owner included, gets {@link UNPAID_DELEGATION_NOTE}. A paid store
|
|
42
|
+
* resolves {@link resolveDelegateGate} unchanged.
|
|
42
43
|
*/
|
|
43
44
|
export function resolveDelegateSection(
|
|
44
45
|
storefrontMode: string | null | undefined,
|
|
@@ -752,11 +752,6 @@ export async function runRenderChain(input: RenderChainInput): Promise<Response>
|
|
|
752
752
|
// store below so cached copies carry them too.
|
|
753
753
|
applySecurityHeaders(response.headers);
|
|
754
754
|
|
|
755
|
-
// Preview (test) output must never be indexed.
|
|
756
|
-
if (customization.noindex) {
|
|
757
|
-
response.headers.set("X-Robots-Tag", "noindex, nofollow");
|
|
758
|
-
}
|
|
759
|
-
|
|
760
755
|
// Strict CSP — now ENFORCED in every environment (Epic S2). The report-only
|
|
761
756
|
// rollout is complete: platform output is CSP-clean — inline styles are
|
|
762
757
|
// externalized (`inlineStylesheets: "never"`), Astro's static inline scripts +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenoftrust/storefront-runner",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.45",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"description": "World-shareable storefront runner: multi-tenant renderer on Astro/Cloudflare. No control plane.",
|
|
6
6
|
"packageManager": "pnpm@11.9.0",
|
|
@@ -15,8 +15,6 @@
|
|
|
15
15
|
* - **Tokens are tenant-bound.** A token minted for tenant A cannot preview
|
|
16
16
|
* tenant B (no cross-tenant leakage).
|
|
17
17
|
* - **Tokens expire.** `exp` is checked against the caller-supplied clock.
|
|
18
|
-
* - **Test is never indexable.** The resolution carries `noindex: true` so the
|
|
19
|
-
* middleware can set `X-Robots-Tag: noindex`.
|
|
20
18
|
*/
|
|
21
19
|
|
|
22
20
|
/** Claims carried by a preview token. */
|
|
@@ -251,8 +249,6 @@ export interface EnvResolutionInput {
|
|
|
251
249
|
|
|
252
250
|
export interface EnvResolution {
|
|
253
251
|
env: CustomizationEnv;
|
|
254
|
-
/** Set `X-Robots-Tag: noindex` when true (test is never indexable). */
|
|
255
|
-
noindex: boolean;
|
|
256
252
|
/** When set, the middleware should short-circuit with this status. */
|
|
257
253
|
reject?: { status: number; message: string };
|
|
258
254
|
}
|
|
@@ -277,12 +273,12 @@ export function isPreviewDispatcherPath(pathname: string): boolean {
|
|
|
277
273
|
|
|
278
274
|
/**
|
|
279
275
|
* Decide which customization environment to serve. A valid, unexpired,
|
|
280
|
-
* tenant-matching `__preview`/`tot_preview` token grants `test`
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
276
|
+
* tenant-matching `__preview`/`tot_preview` token grants `test` on ANY host —
|
|
277
|
+
* the token is checked before the host is, so a signed preview link keeps
|
|
278
|
+
* working even when opened on the tenant's normal (non-`preview.*`) host.
|
|
279
|
+
* Without such a token, production hosts always get `live`; preview hosts
|
|
280
|
+
* are auth-gated and reject a missing/invalid/cross-tenant token. The one
|
|
281
|
+
* exception is the token-dispenser path itself (see
|
|
286
282
|
* {@link isPreviewDispatcherPath}) — it renders the dispatcher's own minimal
|
|
287
283
|
* page, never tenant content, so it's always `live`/no-token regardless of
|
|
288
284
|
* host or token, rather than 401ing on the very request that would otherwise
|
|
@@ -292,7 +288,7 @@ export async function resolveCustomizationEnv(
|
|
|
292
288
|
input: EnvResolutionInput,
|
|
293
289
|
): Promise<EnvResolution> {
|
|
294
290
|
if (isPreviewDispatcherPath(input.pathname ?? "")) {
|
|
295
|
-
return { env: "live"
|
|
291
|
+
return { env: "live" };
|
|
296
292
|
}
|
|
297
293
|
|
|
298
294
|
const tokenResult =
|
|
@@ -300,36 +296,32 @@ export async function resolveCustomizationEnv(
|
|
|
300
296
|
? await verifyPreviewToken(input.secret, input.token, input.nowSeconds)
|
|
301
297
|
: null;
|
|
302
298
|
if (tokenResult?.ok && tokenResult.claims.tenantId === input.tenantId) {
|
|
303
|
-
return { env: "test"
|
|
299
|
+
return { env: "test" };
|
|
304
300
|
}
|
|
305
301
|
|
|
306
302
|
if (!input.isPreviewHost) {
|
|
307
|
-
return { env: "live"
|
|
303
|
+
return { env: "live" };
|
|
308
304
|
}
|
|
309
305
|
if (!input.secret) {
|
|
310
306
|
return {
|
|
311
307
|
env: "live",
|
|
312
|
-
noindex: true,
|
|
313
308
|
reject: { status: 503, message: "Preview is not configured." },
|
|
314
309
|
};
|
|
315
310
|
}
|
|
316
311
|
if (!input.token) {
|
|
317
312
|
return {
|
|
318
313
|
env: "live",
|
|
319
|
-
noindex: true,
|
|
320
314
|
reject: { status: 401, message: "Preview token required." },
|
|
321
315
|
};
|
|
322
316
|
}
|
|
323
317
|
if (!tokenResult!.ok) {
|
|
324
318
|
return {
|
|
325
319
|
env: "live",
|
|
326
|
-
noindex: true,
|
|
327
320
|
reject: { status: 401, message: `Invalid preview token (${tokenResult!.reason}).` },
|
|
328
321
|
};
|
|
329
322
|
}
|
|
330
323
|
return {
|
|
331
324
|
env: "live",
|
|
332
|
-
noindex: true,
|
|
333
325
|
reject: { status: 403, message: "Preview token is for a different tenant." },
|
|
334
326
|
};
|
|
335
327
|
}
|