@tokenoftrust/storefront-runner 7.6.12 → 7.6.13
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.
|
@@ -30,6 +30,15 @@ import {
|
|
|
30
30
|
|
|
31
31
|
declare const __GIT_SHA__: string | undefined;
|
|
32
32
|
|
|
33
|
+
/** Operational kill-switch env var for preview annotations, preview tours, and the feedback bridge. */
|
|
34
|
+
export const PREVIEW_FEEDBACK_DISABLED_ENV = "PREVIEW_FEEDBACK_DISABLED";
|
|
35
|
+
|
|
36
|
+
/** True for "1" / "on" / "true" / "yes" (case/space-insensitive); false otherwise. */
|
|
37
|
+
export function isPreviewFeedbackDisabled(raw: string | null | undefined): boolean {
|
|
38
|
+
const v = (raw ?? "").trim().toLowerCase();
|
|
39
|
+
return v === "1" || v === "on" || v === "true" || v === "yes";
|
|
40
|
+
}
|
|
41
|
+
|
|
33
42
|
/**
|
|
34
43
|
* A publication capture or materialization request: the capture probe header, or the Worker's
|
|
35
44
|
* materialize binding (`MATERIALIZE_MODE_BINDING`) read as `"1"`. Never decorated, never handed
|
|
@@ -40,6 +49,7 @@ export function isPublicationCapture(headers: Headers, materializeMode: string |
|
|
|
40
49
|
}
|
|
41
50
|
|
|
42
51
|
export interface AnnotationModuleAccess {
|
|
52
|
+
disabled?: boolean;
|
|
43
53
|
cdnForwarded: boolean;
|
|
44
54
|
capture: boolean;
|
|
45
55
|
secret: string | null;
|
|
@@ -53,7 +63,7 @@ export interface AnnotationModuleAccess {
|
|
|
53
63
|
* and a capture or materialization request never qualify.
|
|
54
64
|
*/
|
|
55
65
|
export async function mayLoadAnnotationModule(input: AnnotationModuleAccess): Promise<boolean> {
|
|
56
|
-
if (input.cdnForwarded || input.capture || !input.secret) return false;
|
|
66
|
+
if (input.disabled || input.cdnForwarded || input.capture || !input.secret) return false;
|
|
57
67
|
const cookie = input.cookies.get(PREVIEW_REVIEWER_COOKIE)?.value;
|
|
58
68
|
return (await verifyReviewerCookieValue(input.secret, cookie)) !== null;
|
|
59
69
|
}
|
|
@@ -65,6 +75,7 @@ export function renderingPlatformSha(): string | null {
|
|
|
65
75
|
}
|
|
66
76
|
|
|
67
77
|
export interface PreviewAnnotationDecoration {
|
|
78
|
+
disabled?: boolean;
|
|
68
79
|
request: Request;
|
|
69
80
|
customizationEnv: "live" | "test";
|
|
70
81
|
/** The verified preview token this render rode in on, or null. */
|
|
@@ -107,7 +118,7 @@ async function previewKindAndRevision(
|
|
|
107
118
|
export async function resolvePreviewAnnotationDocument(
|
|
108
119
|
input: PreviewAnnotationDecoration,
|
|
109
120
|
): Promise<{ previewKind: PreviewKind; revision: string } | null> {
|
|
110
|
-
if (input.cdnForwarded || input.request.method !== "GET" || input.capture ||
|
|
121
|
+
if (input.disabled || input.cdnForwarded || input.request.method !== "GET" || input.capture ||
|
|
111
122
|
input.internalPublication || !input.secret) return null;
|
|
112
123
|
const platformSha = input.platformSha === undefined ? renderingPlatformSha() : input.platformSha;
|
|
113
124
|
if (!platformSha || !PLATFORM_SHA_PATTERN.test(platformSha)) return null;
|
|
@@ -38,7 +38,9 @@ import {
|
|
|
38
38
|
} from "@/lib/publication/shared/previewReload";
|
|
39
39
|
import {
|
|
40
40
|
decoratePreviewAnnotations,
|
|
41
|
+
isPreviewFeedbackDisabled,
|
|
41
42
|
isPublicationCapture,
|
|
43
|
+
PREVIEW_FEEDBACK_DISABLED_ENV,
|
|
42
44
|
} from "@/lib/publication/shared/previewAnnotations/renderDecorator";
|
|
43
45
|
import { tenantProtectedPrefixes } from "@/lib/publication/shared/previewAnnotations/protectedSurfaces";
|
|
44
46
|
import {
|
|
@@ -897,6 +899,7 @@ export async function runRenderChain(input: RenderChainInput): Promise<Response>
|
|
|
897
899
|
// decorator marks what it decorates `private, no-store`.
|
|
898
900
|
let sharedRevision: Promise<string | null> | undefined;
|
|
899
901
|
const previewDecoration = {
|
|
902
|
+
disabled: isPreviewFeedbackDisabled(await readEnv(PREVIEW_FEEDBACK_DISABLED_ENV)),
|
|
900
903
|
request,
|
|
901
904
|
customizationEnv: customization.env,
|
|
902
905
|
previewToken,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenoftrust/storefront-runner",
|
|
3
|
-
"version": "7.6.
|
|
3
|
+
"version": "7.6.13",
|
|
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",
|