API für Geo Positions Update mit Testscript
This commit is contained in:
1 parent
23a9df66f4
commit
d54a986c14
16 files changed
+1027
-6
No files matched your search
+11
-4
@@ -5,7 +5,7 @@
|
||||
* damit er sowohl die mobilen Views als auch die statischen Assets
|
||||
* kontrolliert. Der Cache-Name wird pro App-Wurzel gebildet.
|
||||
*/
|
||||
const VERSION = 'cmbnet-pwa-v13';
|
||||
const VERSION = 'cmbnet-pwa-v14';
|
||||
const BASE = new URL('./', self.location).href;
|
||||
const SHELL_CACHE = `${VERSION}-shell`;
|
||||
const TILE_CACHE = `${VERSION}-tiles`;
|
||||
@@ -124,16 +124,23 @@ function isTileRequest(url) {
|
||||
|
||||
async function handleNavigation(request) {
|
||||
const cache = await caches.open(SHELL_CACHE);
|
||||
const url = new URL(request.url);
|
||||
|
||||
// Admin-Seiten können sensible Daten wie API-Zugriffstoken enthalten und
|
||||
// werden deshalb nicht im Service-Worker-Cache abgelegt.
|
||||
const cacheable = !url.pathname.includes('/admin/');
|
||||
|
||||
try {
|
||||
const response = await fetch(request);
|
||||
if (response && response.ok) {
|
||||
if (cacheable && response && response.ok) {
|
||||
cache.put(request, response.clone()).catch(() => {});
|
||||
}
|
||||
return response;
|
||||
} catch (error) {
|
||||
const cached = await cache.match(request, {ignoreSearch: true});
|
||||
if (cached) return cached;
|
||||
if (cacheable) {
|
||||
const cached = await cache.match(request, {ignoreSearch: true});
|
||||
if (cached) return cached;
|
||||
}
|
||||
|
||||
return new Response(offlineHtml(), {
|
||||
status: 503,
|
||||
|
||||
Reference in new issue
Block a user