feat: Alexander Whitestone landing page + the-matrix dist at /tower
- Root / serves branded landing page (falling amber digit rain, enter button) - /tower serves pre-built the-matrix frontend (Three.js Workshop world) - config.js patched: WS URL auto-detects from window.location.host - No manual ?ws= param needed — works on any domain
This commit is contained in:
@@ -58,7 +58,117 @@ const towerDist = path.join(__dirname, "..", "..", "..", "the-matrix", "dist");
|
||||
app.use("/tower", express.static(towerDist));
|
||||
app.get("/tower/*splat", (_req, res) => res.sendFile(path.join(towerDist, "index.html")));
|
||||
|
||||
app.get("/", (_req, res) => res.redirect("/tower"));
|
||||
app.get("/", (_req, res) => {
|
||||
res.setHeader("Content-Type", "text/html");
|
||||
res.send(`<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<title>Alexander Whitestone</title>
|
||||
<style>
|
||||
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
html, body {
|
||||
height: 100%;
|
||||
background: #050508;
|
||||
color: #e8e8f0;
|
||||
font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
canvas {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 0;
|
||||
opacity: 0.18;
|
||||
}
|
||||
main {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 40px;
|
||||
}
|
||||
h1 {
|
||||
font-family: system-ui, sans-serif;
|
||||
font-size: clamp(1.4rem, 4vw, 2.4rem);
|
||||
font-weight: 300;
|
||||
letter-spacing: 0.25em;
|
||||
text-transform: uppercase;
|
||||
color: #c8c8d8;
|
||||
}
|
||||
h1 em {
|
||||
font-style: normal;
|
||||
color: #f7931a;
|
||||
}
|
||||
p {
|
||||
color: #44445a;
|
||||
font-size: 0.78rem;
|
||||
letter-spacing: 0.15em;
|
||||
max-width: 320px;
|
||||
line-height: 1.8;
|
||||
}
|
||||
a.enter {
|
||||
display: inline-block;
|
||||
padding: 14px 48px;
|
||||
border: 1px solid #2a2a3a;
|
||||
border-radius: 4px;
|
||||
color: #6b6b80;
|
||||
font-size: 0.72rem;
|
||||
letter-spacing: 0.3em;
|
||||
text-transform: uppercase;
|
||||
text-decoration: none;
|
||||
transition: border-color 0.3s, color 0.3s;
|
||||
cursor: pointer;
|
||||
}
|
||||
a.enter:hover {
|
||||
border-color: #f7931a44;
|
||||
color: #f7931a;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="c"></canvas>
|
||||
<main>
|
||||
<h1>Alexander <em>Whitestone</em></h1>
|
||||
<p>AI infrastructure & Lightning-native agents.</p>
|
||||
<a class="enter" href="/tower">enter</a>
|
||||
</main>
|
||||
<script>
|
||||
// Subtle falling-digit rain behind the landing page
|
||||
const canvas = document.getElementById('c');
|
||||
const ctx = canvas.getContext('2d');
|
||||
let cols, drops;
|
||||
function resize() {
|
||||
canvas.width = window.innerWidth;
|
||||
canvas.height = window.innerHeight;
|
||||
cols = Math.floor(canvas.width / 18);
|
||||
drops = Array.from({ length: cols }, () => Math.random() * -80 | 0);
|
||||
}
|
||||
resize();
|
||||
window.addEventListener('resize', resize);
|
||||
setInterval(() => {
|
||||
ctx.fillStyle = 'rgba(5,5,8,0.15)';
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
ctx.fillStyle = '#f7931a';
|
||||
ctx.font = '13px monospace';
|
||||
drops.forEach((y, i) => {
|
||||
const ch = Math.random() > 0.5
|
||||
? String.fromCharCode(0x30A0 + Math.random() * 96 | 0)
|
||||
: (Math.random() * 10 | 0).toString();
|
||||
ctx.fillText(ch, i * 18, y * 18);
|
||||
if (y * 18 > canvas.height && Math.random() > 0.97) drops[i] = 0;
|
||||
else drops[i]++;
|
||||
});
|
||||
}, 60);
|
||||
</script>
|
||||
</body>
|
||||
</html>`);
|
||||
});
|
||||
app.get("/api", (_req, res) => res.redirect("/api/ui"));
|
||||
|
||||
export default app;
|
||||
|
||||
8
the-matrix/dist/.vite/manifest.json
vendored
Normal file
8
the-matrix/dist/.vite/manifest.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"index.html": {
|
||||
"file": "assets/index-DfAySPQq.js",
|
||||
"name": "index",
|
||||
"src": "index.html",
|
||||
"isEntry": true
|
||||
}
|
||||
}
|
||||
4
the-matrix/dist/assets/icon-192-D03UQLgI.svg
vendored
Normal file
4
the-matrix/dist/assets/icon-192-D03UQLgI.svg
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="192" height="192" viewBox="0 0 192 192">
|
||||
<rect width="192" height="192" fill="#000"/>
|
||||
<text x="96" y="138.24" text-anchor="middle" font-family="Courier New, monospace" font-weight="bold" font-size="115.19999999999999" fill="#00ff41" style="text-shadow: 0 0 9.600000000000001px #00ff41">M</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 352 B |
3832
the-matrix/dist/assets/index-DfAySPQq.js
vendored
Normal file
3832
the-matrix/dist/assets/index-DfAySPQq.js
vendored
Normal file
File diff suppressed because one or more lines are too long
11
the-matrix/dist/assets/index-PcMdvHh2.js
vendored
Normal file
11
the-matrix/dist/assets/index-PcMdvHh2.js
vendored
Normal file
File diff suppressed because one or more lines are too long
22
the-matrix/dist/assets/manifest-A0WqSn1w.json
vendored
Normal file
22
the-matrix/dist/assets/manifest-A0WqSn1w.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "Timmy Tower World",
|
||||
"short_name": "Tower World",
|
||||
"description": "3D visualization of the Timmy agent network",
|
||||
"start_url": "/",
|
||||
"display": "standalone",
|
||||
"orientation": "any",
|
||||
"background_color": "#000000",
|
||||
"theme_color": "#000000",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/icons/icon-192.svg",
|
||||
"sizes": "192x192",
|
||||
"type": "image/svg+xml"
|
||||
},
|
||||
{
|
||||
"src": "/icons/icon-512.svg",
|
||||
"sizes": "512x512",
|
||||
"type": "image/svg+xml"
|
||||
}
|
||||
]
|
||||
}
|
||||
3832
the-matrix/dist/assets/three-WpkPEnex.js
vendored
Normal file
3832
the-matrix/dist/assets/three-WpkPEnex.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
the-matrix/dist/favicon.svg
vendored
Normal file
4
the-matrix/dist/favicon.svg
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
<rect width="32" height="32" fill="#000"/>
|
||||
<text x="16" y="23.04" text-anchor="middle" font-family="Courier New, monospace" font-weight="bold" font-size="19.2" fill="#00ff41" style="text-shadow: 0 0 1.6px #00ff41">M</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 317 B |
BIN
the-matrix/dist/icons/icon-192.png
vendored
Normal file
BIN
the-matrix/dist/icons/icon-192.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
BIN
the-matrix/dist/icons/icon-512.png
vendored
Normal file
BIN
the-matrix/dist/icons/icon-512.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
279
the-matrix/dist/index.html
vendored
Normal file
279
the-matrix/dist/index.html
vendored
Normal file
@@ -0,0 +1,279 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta name="description" content="3D visualization of the Timmy agent network" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||
<meta name="apple-mobile-web-app-title" content="Tower World" />
|
||||
<link rel="manifest" href="/assets/manifest-A0WqSn1w.json" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<link rel="apple-touch-icon" href="/assets/icon-192-D03UQLgI.svg" />
|
||||
<title>Timmy Tower World</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body { background: #000; overflow: hidden; font-family: 'Courier New', monospace; }
|
||||
canvas { display: block; }
|
||||
|
||||
/* Loading screen — hidden by main.js after init */
|
||||
#loading-screen {
|
||||
position: fixed; inset: 0; z-index: 100;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
background: #000;
|
||||
color: #00ff41; font-size: 14px; letter-spacing: 4px;
|
||||
text-shadow: 0 0 12px #00ff41;
|
||||
font-family: 'Courier New', monospace;
|
||||
}
|
||||
#loading-screen.hidden { display: none; }
|
||||
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
|
||||
#loading-screen span { animation: blink 1.2s ease-in-out infinite; }
|
||||
|
||||
#ui-overlay {
|
||||
position: fixed; top: 0; left: 0; width: 100%; height: 100%;
|
||||
pointer-events: none; z-index: 10;
|
||||
}
|
||||
#hud {
|
||||
position: fixed; top: 16px; left: 16px;
|
||||
color: #00ff41; font-size: clamp(10px, 1.5vw, 14px); line-height: 1.6;
|
||||
text-shadow: 0 0 8px #00ff41;
|
||||
pointer-events: none;
|
||||
}
|
||||
#hud h1 { font-size: clamp(12px, 2vw, 18px); letter-spacing: clamp(2px, 0.4vw, 4px); margin-bottom: 8px; color: #00ff88; }
|
||||
#status-panel {
|
||||
position: fixed; top: 16px; right: 16px;
|
||||
color: #00ff41; font-size: clamp(9px, 1.2vw, 12px); line-height: 1.8;
|
||||
text-shadow: 0 0 6px #00ff41; max-width: 240px;
|
||||
}
|
||||
#status-panel .label { color: #007722; }
|
||||
#chat-panel {
|
||||
position: fixed; bottom: 52px; left: 16px; right: 16px;
|
||||
max-height: 150px; overflow-y: auto;
|
||||
color: #00ff41; font-size: clamp(9px, 1.2vw, 12px); line-height: 1.6;
|
||||
text-shadow: 0 0 4px #00ff41;
|
||||
pointer-events: none;
|
||||
}
|
||||
.chat-entry { opacity: 0.8; }
|
||||
.chat-entry .agent-name { color: #00ff88; font-weight: bold; }
|
||||
.chat-entry.visitor { opacity: 1; }
|
||||
.chat-entry.visitor .agent-name { color: #888; }
|
||||
|
||||
/* ── Chat input (#40) ── */
|
||||
#chat-input-bar {
|
||||
position: fixed; bottom: 0; left: 0; right: 0;
|
||||
display: flex; align-items: center; gap: 8px;
|
||||
padding: 8px 16px;
|
||||
padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
|
||||
background: rgba(0, 0, 0, 0.85);
|
||||
border-top: 1px solid #003300;
|
||||
z-index: 20;
|
||||
pointer-events: auto;
|
||||
}
|
||||
#chat-input {
|
||||
flex: 1;
|
||||
background: rgba(0, 20, 0, 0.6);
|
||||
border: 1px solid #003300;
|
||||
color: #00ff41;
|
||||
font-family: 'Courier New', monospace;
|
||||
font-size: clamp(12px, 1.5vw, 14px);
|
||||
padding: 8px 12px;
|
||||
border-radius: 2px;
|
||||
outline: none;
|
||||
caret-color: #00ff41;
|
||||
}
|
||||
#chat-input::placeholder { color: #004400; }
|
||||
#chat-input:focus { border-color: #00ff41; box-shadow: 0 0 8px rgba(0, 255, 65, 0.2); }
|
||||
#chat-send {
|
||||
background: transparent;
|
||||
border: 1px solid #003300;
|
||||
color: #00ff41;
|
||||
font-family: 'Courier New', monospace;
|
||||
font-size: 14px;
|
||||
padding: 8px 16px;
|
||||
cursor: pointer;
|
||||
border-radius: 2px;
|
||||
pointer-events: auto;
|
||||
text-shadow: 0 0 6px #00ff41;
|
||||
transition: all 0.15s;
|
||||
}
|
||||
#chat-send:hover, #chat-send:active { background: rgba(0, 255, 65, 0.1); border-color: #00ff41; }
|
||||
|
||||
/* ── Bark display (#42) ── */
|
||||
#bark-container {
|
||||
position: fixed;
|
||||
top: 20%; left: 50%;
|
||||
transform: translateX(-50%);
|
||||
max-width: 600px; width: 90%;
|
||||
z-index: 15;
|
||||
pointer-events: none;
|
||||
display: flex; flex-direction: column; align-items: center; gap: 8px;
|
||||
}
|
||||
.bark {
|
||||
background: rgba(0, 10, 0, 0.85);
|
||||
border: 1px solid #003300;
|
||||
border-left: 3px solid #00ff41;
|
||||
padding: 12px 20px;
|
||||
color: #00ff41;
|
||||
font-family: 'Courier New', monospace;
|
||||
font-size: clamp(13px, 1.8vw, 16px);
|
||||
line-height: 1.5;
|
||||
text-shadow: 0 0 8px #00ff41;
|
||||
opacity: 0;
|
||||
animation: barkIn 0.4s ease-out forwards;
|
||||
max-width: 100%;
|
||||
}
|
||||
.bark .bark-agent {
|
||||
font-size: clamp(9px, 1vw, 11px);
|
||||
color: #007722;
|
||||
margin-bottom: 4px;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
.bark.fade-out {
|
||||
animation: barkOut 0.6s ease-in forwards;
|
||||
}
|
||||
@keyframes barkIn {
|
||||
from { opacity: 0; transform: translateY(-8px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
@keyframes barkOut {
|
||||
from { opacity: 1; transform: translateY(0); }
|
||||
to { opacity: 0; transform: translateY(-8px); }
|
||||
}
|
||||
|
||||
#connection-status {
|
||||
position: fixed; bottom: 52px; right: 16px;
|
||||
font-size: clamp(9px, 1.2vw, 12px); color: #555;
|
||||
}
|
||||
#connection-status.connected { color: #00ff41; text-shadow: 0 0 6px #00ff41; }
|
||||
|
||||
/* ── Presence HUD (#53) ── */
|
||||
#presence-hud {
|
||||
position: fixed; bottom: 180px; right: 16px;
|
||||
background: rgba(0, 5, 0, 0.75);
|
||||
border: 1px solid #002200;
|
||||
border-radius: 2px;
|
||||
padding: 8px 12px;
|
||||
font-family: 'Courier New', monospace;
|
||||
font-size: clamp(9px, 1.1vw, 11px);
|
||||
color: #00ff41;
|
||||
text-shadow: 0 0 4px rgba(0, 255, 65, 0.3);
|
||||
min-width: 180px;
|
||||
z-index: 12;
|
||||
pointer-events: none;
|
||||
}
|
||||
.presence-header {
|
||||
display: flex; justify-content: space-between; align-items: center;
|
||||
margin-bottom: 6px; padding-bottom: 4px;
|
||||
border-bottom: 1px solid #002200;
|
||||
font-size: clamp(8px, 1vw, 10px);
|
||||
letter-spacing: 2px; color: #007722;
|
||||
}
|
||||
.presence-count { color: #00ff41; letter-spacing: 0; }
|
||||
.presence-mode { letter-spacing: 1px; }
|
||||
.presence-row {
|
||||
display: flex; align-items: center; gap: 6px;
|
||||
padding: 2px 0;
|
||||
}
|
||||
.presence-dot {
|
||||
width: 6px; height: 6px;
|
||||
border-radius: 50%;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.presence-dot.online {
|
||||
background: var(--agent-color, #00ff41);
|
||||
box-shadow: 0 0 6px var(--agent-color, #00ff41);
|
||||
animation: presencePulse 2s ease-in-out infinite;
|
||||
}
|
||||
.presence-dot.offline {
|
||||
background: #333;
|
||||
box-shadow: none;
|
||||
}
|
||||
@keyframes presencePulse {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.4; }
|
||||
}
|
||||
.presence-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
|
||||
.presence-state { font-size: clamp(7px, 0.9vw, 9px); min-width: 40px; text-align: center; }
|
||||
.presence-uptime { color: #005500; min-width: 48px; text-align: right; font-variant-numeric: tabular-nums; }
|
||||
|
||||
/* ── Transcript controls (#54) ── */
|
||||
#transcript-controls {
|
||||
position: fixed; top: 16px; right: 260px;
|
||||
display: flex; align-items: center; gap: 6px;
|
||||
font-family: 'Courier New', monospace;
|
||||
font-size: clamp(8px, 1vw, 10px);
|
||||
z-index: 15;
|
||||
pointer-events: auto;
|
||||
}
|
||||
.transcript-label { color: #005500; letter-spacing: 2px; }
|
||||
.transcript-badge {
|
||||
color: #00ff41; background: rgba(0, 20, 0, 0.6);
|
||||
border: 1px solid #003300; border-radius: 2px;
|
||||
padding: 1px 5px; font-variant-numeric: tabular-nums;
|
||||
min-width: 28px; text-align: center;
|
||||
}
|
||||
.transcript-btn {
|
||||
background: transparent; border: 1px solid #003300;
|
||||
color: #00aa44; font-family: 'Courier New', monospace;
|
||||
font-size: clamp(7px, 0.9vw, 9px); padding: 2px 6px;
|
||||
cursor: pointer; border-radius: 2px;
|
||||
transition: all 0.15s;
|
||||
}
|
||||
.transcript-btn:hover { color: #00ff41; border-color: #00ff41; background: rgba(0, 255, 65, 0.08); }
|
||||
.transcript-btn-clear { color: #553300; border-color: #332200; }
|
||||
.transcript-btn-clear:hover { color: #ff6600; border-color: #ff6600; background: rgba(255, 102, 0, 0.08); }
|
||||
|
||||
@media (max-width: 500px) {
|
||||
#presence-hud { bottom: 180px; right: 8px; left: auto; min-width: 150px; padding: 6px 8px; }
|
||||
#transcript-controls { top: auto; bottom: 180px; right: auto; left: 8px; }
|
||||
}
|
||||
|
||||
/* Safe area padding for notched devices */
|
||||
@supports (padding: env(safe-area-inset-top)) {
|
||||
#hud { top: calc(16px + env(safe-area-inset-top)); left: calc(16px + env(safe-area-inset-left)); }
|
||||
#status-panel { top: calc(16px + env(safe-area-inset-top)); right: calc(16px + env(safe-area-inset-right)); }
|
||||
#chat-panel { bottom: calc(52px + env(safe-area-inset-bottom)); left: calc(16px + env(safe-area-inset-left)); right: calc(16px + env(safe-area-inset-right)); }
|
||||
#connection-status { bottom: calc(52px + env(safe-area-inset-bottom)); right: calc(16px + env(safe-area-inset-right)); }
|
||||
#presence-hud { bottom: calc(180px + env(safe-area-inset-bottom)); right: calc(16px + env(safe-area-inset-right)); }
|
||||
}
|
||||
|
||||
/* Stack status panel below HUD on narrow viewports (must come AFTER @supports) */
|
||||
@media (max-width: 500px) {
|
||||
#status-panel { top: 100px !important; left: 16px; right: auto; }
|
||||
}
|
||||
</style>
|
||||
<script type="module" crossorigin src="/assets/index-PcMdvHh2.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="/assets/three-WpkPEnex.js">
|
||||
</head>
|
||||
<body>
|
||||
<div id="loading-screen"><span>INITIALIZING...</span></div>
|
||||
<!-- WebGL context loss overlay (iPad PWA, GPU resets) -->
|
||||
<div id="webgl-recovery-overlay" style="display:none;position:fixed;inset:0;z-index:9999;background:rgba(0,0,0,.9);color:#00ff41;font-family:monospace;align-items:center;justify-content:center;flex-direction:column">
|
||||
<p style="font-size:1.4rem">RECOVERING WebGL CONTEXT…</p>
|
||||
<p style="font-size:.85rem;opacity:.6">GPU was reset. Rebuilding world.</p>
|
||||
</div>
|
||||
<div id="ui-overlay">
|
||||
<div id="hud">
|
||||
<h1>TIMMY TOWER WORLD</h1>
|
||||
<div id="agent-count">AGENTS: 0</div>
|
||||
<div id="active-jobs">JOBS: 0</div>
|
||||
<div id="fps">FPS: --</div>
|
||||
</div>
|
||||
<div id="status-panel">
|
||||
<div id="agent-list"></div>
|
||||
</div>
|
||||
<div id="chat-panel"></div>
|
||||
<button id="chat-clear-btn" title="Clear chat history" style="position:fixed;bottom:60px;right:16px;background:transparent;border:1px solid #003300;color:#00aa00;font-family:monospace;font-size:.7rem;padding:2px 6px;cursor:pointer;z-index:20;opacity:.6">✕ CLEAR</button>
|
||||
<div id="bark-container"></div>
|
||||
<div id="transcript-controls"></div>
|
||||
<div id="presence-hud"></div>
|
||||
<div id="connection-status">OFFLINE</div>
|
||||
</div>
|
||||
<div id="chat-input-bar">
|
||||
<input id="chat-input" type="text" placeholder="Say something to the Workshop..." autocomplete="off" />
|
||||
<button id="chat-send">></button>
|
||||
</div>
|
||||
<!-- SW registration is handled by main.js in production builds only -->
|
||||
</body>
|
||||
</html>
|
||||
24
the-matrix/dist/manifest.json
vendored
Normal file
24
the-matrix/dist/manifest.json
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "The Matrix",
|
||||
"short_name": "The Matrix",
|
||||
"description": "Timmy Tower World — live agent network visualization",
|
||||
"start_url": "/",
|
||||
"display": "standalone",
|
||||
"orientation": "landscape",
|
||||
"background_color": "#000000",
|
||||
"theme_color": "#00ff41",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/icons/icon-192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "any maskable"
|
||||
},
|
||||
{
|
||||
"src": "/icons/icon-512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"purpose": "any maskable"
|
||||
}
|
||||
]
|
||||
}
|
||||
48
the-matrix/dist/sw.js
vendored
Normal file
48
the-matrix/dist/sw.js
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/* sw.js — Matrix PWA service worker
|
||||
* PRECACHE_URLS is replaced at build time by the generate-sw Vite plugin.
|
||||
* Registration is gated to import.meta.env.PROD in main.js, so this template
|
||||
* file is never evaluated by browsers during development.
|
||||
*/
|
||||
const CACHE_NAME = 'timmy-matrix-v1';
|
||||
const PRECACHE_URLS = [
|
||||
"/",
|
||||
"/manifest.json",
|
||||
"/icons/icon-192.svg",
|
||||
"/icons/icon-512.svg",
|
||||
"/assets/three-WpkPEnex.js",
|
||||
"/assets/icon-192-D03UQLgI.svg",
|
||||
"/assets/index-PcMdvHh2.js",
|
||||
"/assets/manifest-A0WqSn1w.json"
|
||||
];
|
||||
|
||||
self.addEventListener('install', event => {
|
||||
event.waitUntil(
|
||||
caches.open(CACHE_NAME).then(cache => cache.addAll(PRECACHE_URLS))
|
||||
);
|
||||
self.skipWaiting();
|
||||
});
|
||||
|
||||
self.addEventListener('activate', event => {
|
||||
event.waitUntil(
|
||||
caches.keys().then(keys =>
|
||||
Promise.all(keys.filter(k => k !== CACHE_NAME).map(k => caches.delete(k)))
|
||||
)
|
||||
);
|
||||
self.clients.claim();
|
||||
});
|
||||
|
||||
self.addEventListener('fetch', event => {
|
||||
if (event.request.method !== 'GET') return;
|
||||
event.respondWith(
|
||||
caches.match(event.request).then(cached => {
|
||||
if (cached) return cached;
|
||||
return fetch(event.request).then(response => {
|
||||
if (!response || response.status !== 200 || response.type !== 'basic') {
|
||||
return response;
|
||||
}
|
||||
caches.open(CACHE_NAME).then(cache => cache.put(event.request, response.clone()));
|
||||
return response;
|
||||
});
|
||||
})
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user