fix(cache): add aggressive no-store middleware, CSP updates, and client-side service worker & cache purge
This commit is contained in:
@@ -31,6 +31,9 @@ export async function generateMetadata(): Promise<Metadata> {
|
||||
};
|
||||
}
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
export const revalidate = 0;
|
||||
|
||||
export default function AppsIndexPage() {
|
||||
const page = getPageConfig('apps');
|
||||
if (!page) notFound();
|
||||
|
||||
@@ -169,6 +169,45 @@ export default function RootLayout({
|
||||
return (
|
||||
<html lang="en" className={`${poppinsFont.variable} ${interFont.variable} ${monoFont.variable} font-sans`}>
|
||||
<head>
|
||||
<meta httpEquiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
|
||||
<meta httpEquiv="Pragma" content="no-cache" />
|
||||
<meta httpEquiv="Expires" content="0" />
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
(function() {
|
||||
try {
|
||||
// 1. Unregister any stale Service Workers on client devices
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.getRegistrations().then(function(registrations) {
|
||||
for (var i = 0; i < registrations.length; i++) {
|
||||
registrations[i].unregister();
|
||||
}
|
||||
});
|
||||
}
|
||||
// 2. Clear stale Cache Storage API entries
|
||||
if ('caches' in window) {
|
||||
caches.keys().then(function(keys) {
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
caches.delete(keys[i]);
|
||||
}
|
||||
});
|
||||
}
|
||||
// 3. Automated cache-bust verification
|
||||
var BUILD_TAG = '20261117_sfpro_v2';
|
||||
var cachedTag = localStorage.getItem('__cre_build_tag');
|
||||
if (cachedTag !== BUILD_TAG) {
|
||||
localStorage.setItem('__cre_build_tag', BUILD_TAG);
|
||||
if (cachedTag !== null && window.location.search.indexOf('v=') === -1) {
|
||||
// Perform clean cache-busting reload once for returning visitors
|
||||
window.location.replace(window.location.pathname + (window.location.search ? window.location.search + '&' : '?') + 'v=' + Date.now());
|
||||
}
|
||||
}
|
||||
} catch(e) {}
|
||||
})();
|
||||
`,
|
||||
}}
|
||||
/>
|
||||
<script
|
||||
type="application/ld+json"
|
||||
dangerouslySetInnerHTML={{ __html: JSON.stringify(organizationJsonLd) }}
|
||||
|
||||
@@ -45,6 +45,9 @@ export async function generateMetadata(): Promise<Metadata> {
|
||||
};
|
||||
}
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
export const revalidate = 0;
|
||||
|
||||
export default function PrivacyPage() {
|
||||
const page = getPageConfig('privacy');
|
||||
if (!page) notFound();
|
||||
|
||||
@@ -45,6 +45,9 @@ export async function generateMetadata(): Promise<Metadata> {
|
||||
};
|
||||
}
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
export const revalidate = 0;
|
||||
|
||||
export default function TrustPage() {
|
||||
const page = getPageConfig('trust');
|
||||
if (!page) notFound();
|
||||
|
||||
Reference in New Issue
Block a user