@brightsideoy/kama 0.1.0-alpha.167 → 0.1.0-alpha.169
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/assets/{index-DfRZz82F.css → index-D5W5U152.css} +1 -1
- package/dist/assets/index-aPeJS-BG.js +164 -0
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/templates/astro-starter/src/middleware.ts +17 -6
- package/templates/astro-starter/src/pages/[...slug].astro +8 -4
- package/dist/assets/index-CFVMeS_q.js +0 -164
package/dist/index.html
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<title>KAMA</title>
|
|
7
7
|
<link rel="icon" href="/favicon.png">
|
|
8
8
|
<link rel="apple-touch-icon" sizes="180x180" href="/favicon.png">
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-aPeJS-BG.js"></script>
|
|
10
|
+
<link rel="stylesheet" crossorigin href="/assets/index-D5W5U152.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
|
13
13
|
<div id="app"></div>
|
package/package.json
CHANGED
|
@@ -393,13 +393,24 @@ export const onRequest = defineMiddleware(async (context, next) => {
|
|
|
393
393
|
// 🎯 5. SECURITY HEADERS FOR HTML PAGES
|
|
394
394
|
if (response.headers.get("content-type")?.includes("text/html")) {
|
|
395
395
|
response.headers.set("Strict-Transport-Security", "max-age=31536000; includeSubDomains; preload");
|
|
396
|
-
response.headers.set("X-Frame-Options", "SAMEORIGIN");
|
|
397
396
|
response.headers.set("X-Content-Type-Options", "nosniff");
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
"
|
|
402
|
-
|
|
397
|
+
|
|
398
|
+
// 🎯 DEV FIX: Allow CMS iframe framing in local development
|
|
399
|
+
if (isDev) {
|
|
400
|
+
response.headers.set("X-Frame-Options", "ALLOWALL");
|
|
401
|
+
response.headers.set(
|
|
402
|
+
"Content-Security-Policy",
|
|
403
|
+
"default-src 'self' http: https: data: 'unsafe-inline' 'unsafe-eval'; img-src 'self' http: https: data: blob:; connect-src 'self' http: https: ws: wss:; frame-ancestors *;"
|
|
404
|
+
);
|
|
405
|
+
} else {
|
|
406
|
+
// Production headers
|
|
407
|
+
response.headers.set("X-Frame-Options", "SAMEORIGIN");
|
|
408
|
+
response.headers.set("Cross-Origin-Opener-Policy", "same-origin-allow-popups");
|
|
409
|
+
response.headers.set(
|
|
410
|
+
"Content-Security-Policy",
|
|
411
|
+
"default-src 'self' https: data: 'unsafe-inline' 'unsafe-eval'; img-src 'self' https: data: blob:; connect-src 'self' https:; frame-ancestors 'self';"
|
|
412
|
+
);
|
|
413
|
+
}
|
|
403
414
|
}
|
|
404
415
|
|
|
405
416
|
return response;
|
|
@@ -20,7 +20,7 @@ const revisionId = searchParams.get("revisionId");
|
|
|
20
20
|
// Smart Edge Caching Logic
|
|
21
21
|
const isTimeTraveling = isPreview || !!revisionId;
|
|
22
22
|
|
|
23
|
-
// 🎯
|
|
23
|
+
// 🎯 Allow Cloudflare Edge to revalidate with Worker KV middleware
|
|
24
24
|
Astro.response.headers.set(
|
|
25
25
|
"Cache-Control",
|
|
26
26
|
"public, no-cache, must-revalidate",
|
|
@@ -47,7 +47,6 @@ if (isStaticAsset) {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
// 2. ENV & WORKER RESOLUTION (Safe Dual-Environment)
|
|
50
|
-
// 🎯 Replaced throwing runtime getter with safeEnv from middleware
|
|
51
50
|
const safeEnv = (Astro.locals as any).safeEnv || {};
|
|
52
51
|
const cmsWorker = safeEnv.CMS_WORKER;
|
|
53
52
|
|
|
@@ -86,7 +85,7 @@ const customFetch = async (input: RequestInfo | URL, init?: RequestInit) => {
|
|
|
86
85
|
...init?.headers,
|
|
87
86
|
"Cache-Control": "no-cache, no-store, must-revalidate",
|
|
88
87
|
Pragma: "no-cache",
|
|
89
|
-
// 🎯
|
|
88
|
+
// 🎯 Direct Service Bindings require explicit header flags to bypass CMS KV cache!
|
|
90
89
|
"X-Bypass-Cache": "true",
|
|
91
90
|
};
|
|
92
91
|
|
|
@@ -176,6 +175,7 @@ const isSkeleton = node?.nodeType === "page-skeleton";
|
|
|
176
175
|
isHomePage={isHomePage}
|
|
177
176
|
>
|
|
178
177
|
<BlockRenderer blocks={mainBlocks} contentMap={content} region="main" />
|
|
178
|
+
<KamaLivePreviewListener />
|
|
179
179
|
</SkeletonLayout>
|
|
180
180
|
) : (
|
|
181
181
|
<StandardLayout
|
|
@@ -216,7 +216,9 @@ const isSkeleton = node?.nodeType === "page-skeleton";
|
|
|
216
216
|
</section>
|
|
217
217
|
) : (
|
|
218
218
|
<div class="empty-content">
|
|
219
|
-
<p
|
|
219
|
+
<p data-cms-field="summary">
|
|
220
|
+
{node?.summary || "No content available for this page."}
|
|
221
|
+
</p>
|
|
220
222
|
</div>
|
|
221
223
|
)}
|
|
222
224
|
</div>
|
|
@@ -233,6 +235,8 @@ const isSkeleton = node?.nodeType === "page-skeleton";
|
|
|
233
235
|
</aside>
|
|
234
236
|
)}
|
|
235
237
|
</div>
|
|
238
|
+
|
|
239
|
+
<KamaLivePreviewListener />
|
|
236
240
|
</StandardLayout>
|
|
237
241
|
)
|
|
238
242
|
}
|