moving site to cloudflare pages

This commit is contained in:
fynks 2025-09-08 11:02:40 +05:00
parent 9b519ed2bb
commit 25296fe880
3 changed files with 130 additions and 42 deletions

12
dist/index.html vendored
View file

@ -11,7 +11,7 @@
<meta name="robots" content="index, follow">
<meta name="author" content="Fynks">
<meta name="google-site-verification" content="nlH9UKmiZsYOuMXXnRc9pKL-AW5rECWikqcUqzri-yQ">
<link rel="canonical" href="https://debrid-services-comparison.netlify.app/">
<link rel="canonical" href="https://debridcompare.pages.dev/">
<!-- Theme color per scheme -->
<meta name="theme-color" content="#ffffff" media="(prefers-color-scheme: light)">
@ -56,21 +56,21 @@
<!-- Open Graph -->
<meta property="og:type" content="website">
<meta property="og:url" content="https://debrid-services-comparison.netlify.app/">
<meta property="og:url" content="https://debridcompare.pages.dev/">
<meta property="og:title" content="Debrid Services Comparison">
<meta property="og:description"
content="Compare pricing and supported hosts across major debrid services. Find the best premium download service for your needs.">
<meta property="og:image" content="https://debrid-services-comparison.netlify.app/image.png">
<meta property="og:image" content="https://debridcompare.pages.dev/image.png">
<meta property="og:site_name" content="Debrid Services Comparison">
<meta property="og:locale" content="en_US">
<!-- Twitter -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:url" content="https://debrid-services-comparison.netlify.app/">
<meta name="twitter:url" content="https://debridcompare.pages.dev/">
<meta name="twitter:title" content="Debrid Services Comparison">
<meta name="twitter:description"
content="Compare pricing and supported hosts across major debrid services. Find the best premium download service for your needs.">
<meta name="twitter:image" content="https://debrid-services-comparison.netlify.app/image.png">
<meta name="twitter:image" content="https://debridcompare.pages.dev/image.png">
<link rel="stylesheet" href="./css/styles.css">
@ -79,7 +79,7 @@
<!-- Google Console Verification -->
<meta name="google-site-verification" content="yh6OZ9qZhOAVRs3tkFAwwBYIb3BKrveBy6C0QEVHpw0" />
</head>
<body>

4
dist/sitemap.xml vendored
View file

@ -6,8 +6,8 @@
<!-- Homepage -->
<url>
<loc>https://debrid-services-comparison.netlify.app/</loc>
<lastmod>2025-08-25T00:00:00+00:00</lastmod>
<loc>https://debridcompare.pages.dev/</loc>
<lastmod>2025-09-07T00:00:00+00:00</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>

View file

@ -1,61 +1,149 @@
module.exports = {
// Specify files to precache
// Base directory - still needed for SW generation
globDirectory: "dist/",
globPatterns: [
"**/*.{html,css,js,json,svg,ico}",
"json/*.json"
],
// REMOVE globPatterns entirely - no precaching!
// globPatterns: [], // Explicitly empty or just omit
// Enhanced runtime caching strategies
runtimeCaching: [
// Cache JSON files with a stale-while-revalidate strategy
// 1. Navigation routes (for SPAs) - Network first with offline fallback
{
urlPattern: /\.json$/,
handler: 'StaleWhileRevalidate',
urlPattern: ({ request }) => request.mode === 'navigate',
handler: 'NetworkFirst',
options: {
cacheName: 'json-cache',
cacheName: 'navigation-cache',
networkTimeoutSeconds: 3, // Fallback to cache after 3s
expiration: {
maxEntries: 50,
maxAgeSeconds: 60 * 60 * 24 // 24 hours
maxAgeSeconds: 24 * 60 * 60 // 24 hours
},
cacheableResponse: {
statuses: [0, 200] // Cache successful responses
}
}
},
// Cache static assets
// 2. HTML pages - Network first for fresh content
{
urlPattern: /\.(?:png|css|svg|ico)$/,
handler: 'CacheFirst',
options: {
cacheName: 'static-assets',
expiration: {
maxEntries: 20,
maxAgeSeconds: 60 * 60 * 24 * 7 // 7 days
}
}
},
// Cache HTML files
{
urlPattern: /\.html$/,
urlPattern: /\.html$/i,
handler: 'NetworkFirst',
options: {
cacheName: 'html-cache',
networkTimeoutSeconds: 2,
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 // 24 hours
maxEntries: 50,
maxAgeSeconds: 12 * 60 * 60 // 12 hours
}
}
},
// 3. JS/CSS - StaleWhileRevalidate with versioning awareness
{
urlPattern: /\.(?:js|css)$/i,
handler: 'StaleWhileRevalidate',
options: {
cacheName: 'static-resources',
expiration: {
maxEntries: 60,
maxAgeSeconds: 7 * 24 * 60 * 60, // 7 days
purgeOnQuotaError: true // Auto-cleanup when storage is full
},
cacheableResponse: {
statuses: [0, 200]
}
}
},
// 4. Images - CacheFirst for performance
{
urlPattern: /\.(?:png|jpg|jpeg|gif|webp|svg|ico)$/i,
handler: 'CacheFirst',
options: {
cacheName: 'image-cache',
expiration: {
maxEntries: 200, // More space for images
maxAgeSeconds: 30 * 24 * 60 * 60, // 30 days
purgeOnQuotaError: true
},
cacheableResponse: {
statuses: [0, 200]
},
plugins: [
{
handlerDidError: async () => {
// Return fallback image on error
return caches.match('/assets/fallback-image.svg');
}
}
]
}
},
// 5. JSON responses - NetworkFirst with timeout
{
urlPattern: /^https:\/\/api\.|\/api\/|\.json$/i,
handler: 'NetworkFirst',
options: {
cacheName: 'api-cache',
networkTimeoutSeconds: 5,
expiration: {
maxEntries: 100,
maxAgeSeconds: 5 * 60 // 5 minutes for fresh API data
},
cacheableResponse: {
statuses: [0, 200],
headers: {
'x-cache': 'hit' // Optional: only cache specific responses
}
},
matchOptions: {
ignoreSearch: false // Consider query params
}
}
},
// 8. Google Fonts - CacheFirst
{
urlPattern: /^https:\/\/fonts\.(?:googleapis|gstatic)\.com/,
handler: 'CacheFirst',
options: {
cacheName: 'google-fonts',
expiration: {
maxEntries: 30,
maxAgeSeconds: 365 * 24 * 60 * 60 // 1 year
},
cacheableResponse: {
statuses: [0, 200]
}
}
}
],
// Output path for service worker
// Service worker output
swDest: "dist/sw.js",
// Don't generate sourcemaps
// Disable sourcemaps in production
sourcemap: false,
// Skip waiting on install
skipWaiting: true,
// Claim clients immediately
clientsClaim: true
// Immediate activation
skipWaiting: true,
clientsClaim: true,
// Additional improvements
cleanupOutdatedCaches: true, // Remove old caches automatically
navigateFallback: null, // No fallback since no precaching
// Ignore specific query parameters
ignoreURLParametersMatching: [
/^utm_/, // Marketing params
/^fbclid$/ // Facebook click ID
],
// Maximum file size to cache (15MB)
maximumFileSizeToCacheInBytes: 15 * 1024 * 1024,
// Mode for generated SW
mode: 'production'
};