Add co-op server, deploy docs, e2e suite and wire in the music tracks
- server/: Node (ws) static server + authoritative co-op rooms; dual-stack listen, proxy-aware client IP and Origin check, keep-alive pings, per-socket rate limits, graceful shutdown; 59 node:test tests - docs/DEPLOY.md + deploy/netwall.service: Debian 13 LXC, systemd, nginx Proxy Manager walk-through, path prefix, troubleshooting - e2e/: Playwright suite (smoke, touch, end flow, two-browser co-op incl. reconnect, 14-size layout matrix); npm run e2e - Music: tracks.json now points at the uploaded theme/battle/boss/win/lose files; stingers fade out when a new game starts - PAUSED indicator, refreshed icon Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tb8pW2KAN4oFkh1aK1BfD8
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"_help": "Put your music files in this folder and name them here, for example \"battle\": \"my-song.mp3\". Leave a track as null to use the built-in synth melody.",
|
||||
"theme": null,
|
||||
"battle": null,
|
||||
"boss": null,
|
||||
"win": null,
|
||||
"lose": null
|
||||
"_help": "Name your music files here, for example \"battle\": \"my-song.mp3\". Leave a track as null to use the built-in synth melody.",
|
||||
"theme": "menu.mp3",
|
||||
"battle": "battle.mp3",
|
||||
"boss": "boss.mp3",
|
||||
"win": "win.mp3",
|
||||
"lose": "lose.mp3"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ button.floating { position: absolute; right: 8px; bottom: 8px; background: rgba(
|
|||
.hint.ok { color: var(--green); border-color: #1c6a55; }
|
||||
.hint.bad { color: var(--red); border-color: #6a2336; }
|
||||
.hint.info { color: var(--cyan); }
|
||||
.paused-tag { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 10px 26px; border-radius: 999px; background: rgba(8, 13, 26, .88); border: 1px solid var(--amber); color: var(--amber); font-weight: 800; letter-spacing: .3em; font-size: 18px; pointer-events: none; z-index: 2; }
|
||||
.banner { position: absolute; left: 0; right: 0; top: 34%; text-align: center; pointer-events: none; font-weight: 800; font-size: clamp(22px, 5vw, 44px); letter-spacing: .14em; color: var(--cyan); text-shadow: 0 0 24px rgba(77, 227, 255, .6); opacity: 0; transform: scale(.96); transition: opacity .3s, transform .3s; }
|
||||
.banner.show { opacity: 1; transform: none; }
|
||||
.banner.boss { color: var(--red); text-shadow: 0 0 24px rgba(255, 92, 122, .7); }
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 113 KiB After Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 80 KiB |
|
|
@ -4,20 +4,16 @@
|
|||
</defs>
|
||||
<rect width="512" height="512" rx="112" fill="url(#g)"/>
|
||||
<rect x="20" y="20" width="472" height="472" rx="94" fill="none" stroke="#4de3ff" stroke-opacity=".4" stroke-width="6"/>
|
||||
<!-- firewall bricks with a gap the route squeezes through -->
|
||||
<!-- two wall rows with staggered gaps: the route has to snake through -->
|
||||
<g fill="#12305e" stroke="#5aa9ff" stroke-width="7" stroke-linejoin="round">
|
||||
<rect x="96" y="112" width="96" height="58" rx="10"/><rect x="208" y="112" width="96" height="58" rx="10"/><rect x="320" y="112" width="96" height="58" rx="10"/>
|
||||
<rect x="152" y="186" width="96" height="58" rx="10"/><rect x="264" y="186" width="96" height="58" rx="10"/>
|
||||
<rect x="96" y="260" width="96" height="58" rx="10"/><rect x="320" y="260" width="96" height="58" rx="10"/>
|
||||
<rect x="150" y="126" width="96" height="56" rx="10"/><rect x="258" y="126" width="96" height="56" rx="10"/><rect x="366" y="126" width="96" height="56" rx="10"/>
|
||||
<rect x="46" y="218" width="96" height="56" rx="10"/><rect x="154" y="218" width="96" height="56" rx="10"/><rect x="262" y="218" width="96" height="56" rx="10"/>
|
||||
</g>
|
||||
<!-- the long route -->
|
||||
<path d="M70 372 H256 V288 M256 288 H288 M288 288 V216 M288 216 H128 M128 216 V142 H460" fill="none" stroke="#4de3ff" stroke-width="9" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="2 22" opacity=".0"/>
|
||||
<path d="M66 366 H236 V290 H292 V214 H132 V140 H236 V86" fill="none" stroke="#4de3ff" stroke-width="10" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="1 24" opacity="0"/>
|
||||
<path d="M64 390 H224 V342 H296 V288 H224 V226 H128 V140" fill="none" stroke="#ffd24d" stroke-width="0" />
|
||||
<path d="M60 392 C 150 392 150 340 232 340 S 300 290 300 250 S 120 250 120 214" fill="none" stroke="#4de3ff" stroke-width="11" stroke-linecap="round" stroke-dasharray="1 26" opacity=".95"/>
|
||||
<circle cx="60" cy="392" r="20" fill="#ff5c7a"/><circle cx="60" cy="392" r="9" fill="#2a0c18"/>
|
||||
<!-- the server -->
|
||||
<rect x="396" y="334" width="76" height="96" rx="14" fill="#0d2038" stroke="#4de3ff" stroke-width="8"/>
|
||||
<g stroke="#4de3ff" stroke-width="7" stroke-linecap="round"><path d="M414 358h24M414 380h24M414 402h24"/></g>
|
||||
<g fill="#35e0a1"><circle cx="458" cy="358" r="5"/><circle cx="458" cy="380" r="5"/><circle cx="458" cy="402" r="5"/></g>
|
||||
<path d="M74 404 H414 V200 H98 V74 H388" fill="none" stroke="#4de3ff" stroke-width="11" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="1 25"/>
|
||||
<!-- gateway and server -->
|
||||
<circle cx="74" cy="404" r="22" fill="#ff5c7a"/><circle cx="74" cy="404" r="9" fill="#2a0c18"/>
|
||||
<rect x="392" y="36" width="72" height="84" rx="14" fill="#0d2038" stroke="#4de3ff" stroke-width="8"/>
|
||||
<g stroke="#4de3ff" stroke-width="7" stroke-linecap="round"><path d="M410 60h22M410 78h22M410 96h22"/></g>
|
||||
<g fill="#35e0a1"><circle cx="448" cy="60" r="4.5"/><circle cx="448" cy="78" r="4.5"/><circle cx="448" cy="96" r="4.5"/></g>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 1.5 KiB |
|
|
@ -59,6 +59,7 @@
|
|||
<canvas id="board" aria-label="Game board" role="img"></canvas>
|
||||
<div id="hint" class="hint" hidden></div>
|
||||
<div id="banner" class="banner" aria-live="polite"></div>
|
||||
<div id="pausedTag" class="paused-tag" hidden>PAUSED</div>
|
||||
<div id="toasts" aria-live="polite"></div>
|
||||
<button id="btnFit" class="icon floating" aria-label="Reset zoom" hidden><svg class="ic"><use href="#i-fit"/></svg></button>
|
||||
<div id="confirm" class="confirm" hidden>
|
||||
|
|
|
|||
|
|
@ -242,6 +242,7 @@
|
|||
|
||||
function applyMusic() {
|
||||
if (!unlocked) return;
|
||||
if (wanted) stopStinger(0.8);
|
||||
if (!wanted || muted) { stopCurrent(0.4); return; }
|
||||
if (current && current.name === wanted) return;
|
||||
const name = wanted;
|
||||
|
|
@ -264,10 +265,15 @@
|
|||
});
|
||||
}
|
||||
|
||||
let stingEl = null;
|
||||
function stopStinger(fade) {
|
||||
const el = stingEl; stingEl = null;
|
||||
if (el) fadeEl(el, 0, (fade || 0.6) * 1000, () => { try { el.pause(); } catch (e) { /* ignore */ } });
|
||||
}
|
||||
function stinger(name) {
|
||||
if (muted || !unlocked) return;
|
||||
fileFor(name, (el) => {
|
||||
if (el) { try { el.currentTime = 0; el.volume = Math.min(1, 0.9 * Math.max(0.3, musicVol)); el.play().catch(() => {}); } catch (e) { /* ignore */ } return; }
|
||||
if (el) { try { stopStinger(0.2); stingEl = el; el.currentTime = 0; el.volume = Math.min(1, 0.9 * Math.max(0.3, musicVol)); el.play().catch(() => {}); } catch (e) { /* ignore */ } return; }
|
||||
if (name === 'win') { [0, 4, 7, 12, 16, 19, 24].forEach((n, i) => tone(NOTE(69 + n), 0.3, 'triangle', 0.22, 0, i * 0.11)); }
|
||||
else { [0, -3, -7, -12, -17].forEach((n, i) => tone(NOTE(60 + n), 0.5, 'sawtooth', 0.2, NOTE(58 + n), i * 0.22)); }
|
||||
});
|
||||
|
|
@ -300,6 +306,7 @@
|
|||
unlock,
|
||||
stinger,
|
||||
get muted() { return muted; },
|
||||
get now() { return current ? { name: current.name, kind: current.kind } : null; }, // for tests / debugging
|
||||
setMuted(m) {
|
||||
muted = !!m; save();
|
||||
if (master) master.gain.value = muted ? 0 : 0.9;
|
||||
|
|
|
|||
|
|
@ -379,7 +379,7 @@
|
|||
if (L.attn !== attn) { L.attn = attn; $('btnWave').classList.toggle('attn', attn); }
|
||||
if (L.auto !== view.auto) { L.auto = view.auto; $('btnAuto').setAttribute('aria-pressed', view.auto ? 'true' : 'false'); }
|
||||
if (L.speed !== view.speed) { L.speed = view.speed; $('speedText').textContent = view.speed + '×'; }
|
||||
if (L.paused !== view.paused) { L.paused = view.paused; $('btnPause').innerHTML = '<svg class="ic"><use href="#i-' + (view.paused ? 'play' : 'pause') + '"/></svg>'; $('btnPause').setAttribute('aria-label', view.paused ? 'Resume' : 'Pause'); }
|
||||
if (L.paused !== view.paused) { L.paused = view.paused; $('pausedTag').hidden = !view.paused; $('btnPause').innerHTML = '<svg class="ic"><use href="#i-' + (view.paused ? 'play' : 'pause') + '"/></svg>'; $('btnPause').setAttribute('aria-label', view.paused ? 'Resume' : 'Pause'); }
|
||||
if (L.muted !== Audio.muted) { L.muted = Audio.muted; $('btnSound').innerHTML = '<svg class="ic"><use href="#i-' + (Audio.muted ? 'mute' : 'sound') + '"/></svg>'; }
|
||||
// palette affordability
|
||||
const gold = view.gold;
|
||||
|
|
|
|||