Add format_transfer_rate() to convert mdstat rates (e.g., 133628K/sec) into readable values like "130.5 MB/s" using 1024-based units. Add format_remaining_time() to convert mdstat durations (e.g., 450.1min) into compact German format like "7 Std. 30 Min." with day/hour/minute components. Update raid_status() to parse member devices directly from array_line in /proc/mdstat to avoid cross
21 lines
807 B
JavaScript
21 lines
807 B
JavaScript
const CACHE_NAME = 'media-max-shell-v2';
|
|
const SHELL = ['/static/media-mark.svg', '/static/manifest.json'];
|
|
|
|
self.addEventListener('install', event => {
|
|
event.waitUntil(caches.open(CACHE_NAME).then(cache => cache.addAll(SHELL)));
|
|
self.skipWaiting();
|
|
});
|
|
|
|
self.addEventListener('activate', event => {
|
|
event.waitUntil(caches.keys().then(keys => Promise.all(keys.filter(key => key !== CACHE_NAME).map(key => caches.delete(key)))));
|
|
self.clients.claim();
|
|
});
|
|
|
|
self.addEventListener('fetch', event => {
|
|
const request = event.request;
|
|
if (request.method !== 'GET') return;
|
|
const url = new URL(request.url);
|
|
if (url.pathname.startsWith('/api/')) return;
|
|
event.respondWith(fetch(request).catch(() => caches.match(request).then(response => response || caches.match('/static/manifest.json'))));
|
|
});
|