Files
IIITB_Menu/scripts/pwaOffline.patch

25 lines
942 B
Diff

--- flutter_service_worker.js.bak 2024-01-28 17:40:14.621116939 +0530
+++ flutter_service_worker.js 2024-01-28 17:41:33.479719944 +0530
@@ -1,4 +1,5 @@
'use strict';
+const BASE_HREF = "IIITB_Menu/";
const MANIFEST = 'flutter-app-manifest';
const TEMP = 'flutter-temp-cache';
const CACHE_NAME = 'flutter-app-cache';
@@ -123,12 +124,13 @@
if (key.indexOf('?v=') != -1) {
key = key.split('?v=')[0];
}
- if (event.request.url == origin || event.request.url.startsWith(origin + '/#') || key == '') {
+ if (event.request.url == origin || event.request.url.startsWith(origin + '/#') || key == '' || key == BASE_HREF) {
key = '/';
}
// If the URL is not the RESOURCE list then return to signal that the
// browser should take over.
- if (!RESOURCES[key]) {
+ var resKey = key.replace(BASE_HREF, "");
+ if (!RESOURCES[resKey]) {
return;
}
// If the URL is the index.html, perform an online-first request.