This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
{
|
||||
"name": "UPTIME: Incident Response",
|
||||
"short_name": "UPTIME",
|
||||
"description": "Survive a datacenter night shift by choosing the right incident response.",
|
||||
"id": "uptime-incident-response.html",
|
||||
"start_url": "uptime-incident-response.html",
|
||||
"scope": "./",
|
||||
"display": "standalone",
|
||||
"orientation": "landscape",
|
||||
"background_color": "#04060c",
|
||||
"theme_color": "#04060c",
|
||||
"categories": ["games"],
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon/favicon.svg",
|
||||
"sizes": "any",
|
||||
"type": "image/svg+xml",
|
||||
"purpose": "any"
|
||||
},
|
||||
{
|
||||
"src": "favicon/favicon-192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "any"
|
||||
},
|
||||
{
|
||||
"src": "favicon/favicon-512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"purpose": "any"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -4,12 +4,6 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>UPTIME: Incident Response</title>
|
||||
<meta name="theme-color" content="#04060c">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-title" content="UPTIME">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||
<link rel="manifest" href="manifest.webmanifest">
|
||||
<link rel="icon" href="favicon/favicon.svg" type="image/svg+xml">
|
||||
<link rel="icon" href="favicon/favicon.ico" sizes="any">
|
||||
<link rel="icon" href="favicon/favicon-16.png" type="image/png" sizes="16x16">
|
||||
@@ -1246,12 +1240,6 @@ function endGame(won=false){
|
||||
state = freshState();
|
||||
render();
|
||||
setDifficulty(selectedDifficulty);
|
||||
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', () => {
|
||||
navigator.serviceWorker.register('../../sw.js');
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+1
-13
@@ -4,12 +4,6 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>SysAdmin Arcade</title>
|
||||
<meta name="theme-color" content="#030712">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-title" content="SysAdmin Arcade">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||
<link rel="manifest" href="manifest.webmanifest">
|
||||
<link rel="icon" href="favicon/arcade-favicon.ico" sizes="any">
|
||||
<link rel="icon" href="favicon/arcade-favicon-16.png" type="image/png" sizes="16x16">
|
||||
<link rel="icon" href="favicon/arcade-favicon-32.png" type="image/png" sizes="32x32">
|
||||
@@ -675,14 +669,8 @@
|
||||
})
|
||||
.catch(() => {
|
||||
gameCount.textContent = '?';
|
||||
gameGrid.innerHTML = '<div class="empty-state">Could not load <code>games.json</code>. Serve this directory over HTTP and check the manifest path.</div>';
|
||||
gameGrid.innerHTML = '<div class="empty-state">Could not load <code>games.json</code>. Serve this directory over HTTP and check the games list path.</div>';
|
||||
});
|
||||
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', () => {
|
||||
navigator.serviceWorker.register('sw.js');
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
{
|
||||
"name": "SysAdmin Arcade",
|
||||
"short_name": "Arcade",
|
||||
"description": "A browser arcade for sysadmins, with installable games for quick maintenance-window breaks.",
|
||||
"id": "./",
|
||||
"start_url": "./",
|
||||
"scope": "./",
|
||||
"display": "standalone",
|
||||
"orientation": "any",
|
||||
"background_color": "#030712",
|
||||
"theme_color": "#030712",
|
||||
"categories": ["games", "entertainment"],
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon/arcade-favicon-192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "any"
|
||||
},
|
||||
{
|
||||
"src": "favicon/arcade-favicon-512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"purpose": "any"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,85 +1,13 @@
|
||||
const CACHE_NAME = 'sysadmin-arcade-v2';
|
||||
|
||||
const PRECACHE_URLS = [
|
||||
'./',
|
||||
'./index.html',
|
||||
'./games.json',
|
||||
'./manifest.webmanifest',
|
||||
'./favicon/arcade-favicon.ico',
|
||||
'./favicon/arcade-favicon-16.png',
|
||||
'./favicon/arcade-favicon-32.png',
|
||||
'./favicon/arcade-favicon-180.png',
|
||||
'./favicon/arcade-favicon-192.png',
|
||||
'./favicon/arcade-favicon-512.png',
|
||||
'./games/uptime/uptime-incident-response.html',
|
||||
'./games/uptime/manifest.webmanifest',
|
||||
'./games/uptime/favicon/favicon.svg',
|
||||
'./games/uptime/favicon/favicon.ico',
|
||||
'./games/uptime/favicon/favicon-16.png',
|
||||
'./games/uptime/favicon/favicon-32.png',
|
||||
'./games/uptime/favicon/favicon-180.png',
|
||||
'./games/uptime/favicon/favicon-192.png',
|
||||
'./games/uptime/favicon/favicon-512.png'
|
||||
];
|
||||
|
||||
const cacheUrl = (path) => new URL(path, self.registration.scope).href;
|
||||
|
||||
self.addEventListener('install', (event) => {
|
||||
event.waitUntil(
|
||||
caches.open(CACHE_NAME)
|
||||
.then((cache) => cache.addAll(PRECACHE_URLS.map(cacheUrl)))
|
||||
.then(() => self.skipWaiting())
|
||||
);
|
||||
event.waitUntil(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))
|
||||
))
|
||||
.then(() => self.clients.claim())
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener('fetch', (event) => {
|
||||
const { request } = event;
|
||||
const url = new URL(request.url);
|
||||
|
||||
if (request.method !== 'GET' || url.origin !== self.location.origin) return;
|
||||
|
||||
if (request.mode === 'navigate') {
|
||||
event.respondWith(
|
||||
fetch(request)
|
||||
.then((response) => {
|
||||
const responseCopy = response.clone();
|
||||
caches.open(CACHE_NAME).then((cache) => cache.put(request, responseCopy));
|
||||
return response;
|
||||
})
|
||||
.catch(async () => {
|
||||
const fallback = url.pathname.includes('/games/uptime/')
|
||||
? './games/uptime/uptime-incident-response.html'
|
||||
: './index.html';
|
||||
|
||||
return await caches.match(request) || await caches.match(cacheUrl(fallback));
|
||||
})
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
event.respondWith(
|
||||
caches.match(request).then((cachedResponse) => {
|
||||
if (cachedResponse) return cachedResponse;
|
||||
|
||||
return fetch(request).then((response) => {
|
||||
if (!response || response.status !== 200 || response.type !== 'basic') return response;
|
||||
|
||||
const responseCopy = response.clone();
|
||||
caches.open(CACHE_NAME).then((cache) => cache.put(request, responseCopy));
|
||||
return response;
|
||||
});
|
||||
})
|
||||
.then((keys) => Promise.all(keys.map((key) => caches.delete(key))))
|
||||
.then(() => self.registration.unregister())
|
||||
.then(() => self.clients.matchAll({ type: 'window' }))
|
||||
.then((clients) => clients.forEach((client) => client.navigate(client.url)))
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user