@onnie81/murdoku-spor 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client/src/audio.js
CHANGED
|
@@ -40,18 +40,46 @@ function ensureCtx() {
|
|
|
40
40
|
return ctx;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
// iOS: playing a (nearly) silent media element inside the gesture switches the
|
|
44
|
+
// audio session to "playback", so WebAudio stays audible even with the ring
|
|
45
|
+
// switch on silent. One-time, invisible.
|
|
46
|
+
const SILENT_WAV = 'data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEAQB8AAIA+AAACABAAZGF0YQAAAAA=';
|
|
47
|
+
let mediaUnlocked = false;
|
|
48
|
+
function unlockMediaSession() {
|
|
49
|
+
if (mediaUnlocked) return;
|
|
50
|
+
mediaUnlocked = true;
|
|
51
|
+
try {
|
|
52
|
+
const a = document.createElement('audio');
|
|
53
|
+
a.setAttribute('playsinline', '');
|
|
54
|
+
a.src = SILENT_WAV;
|
|
55
|
+
a.volume = 0.01;
|
|
56
|
+
const p = a.play();
|
|
57
|
+
if (p && p.catch) p.catch(() => { mediaUnlocked = false; });
|
|
58
|
+
} catch { mediaUnlocked = false; }
|
|
59
|
+
}
|
|
60
|
+
|
|
43
61
|
export function initAudioOnGesture() {
|
|
62
|
+
const EVENTS = ['pointerdown', 'touchend', 'mousedown', 'keydown'];
|
|
44
63
|
const kick = () => {
|
|
45
64
|
const c = ensureCtx();
|
|
46
65
|
if (!c) return;
|
|
47
|
-
|
|
66
|
+
unlockMediaSession();
|
|
67
|
+
const go = () => {
|
|
68
|
+
if (c.state !== 'running') return; // keep listeners until truly unlocked
|
|
69
|
+
EVENTS.forEach(ev => window.removeEventListener(ev, kick));
|
|
70
|
+
if (enabled.music) startMusic();
|
|
71
|
+
};
|
|
48
72
|
if (c.state === 'suspended') c.resume().then(go).catch(() => {});
|
|
49
73
|
else go();
|
|
50
|
-
window.removeEventListener('pointerdown', kick);
|
|
51
|
-
window.removeEventListener('keydown', kick);
|
|
52
74
|
};
|
|
53
|
-
window.addEventListener(
|
|
54
|
-
|
|
75
|
+
EVENTS.forEach(ev => window.addEventListener(ev, kick));
|
|
76
|
+
|
|
77
|
+
// phones suspend the context when the tab goes to background — resume on return
|
|
78
|
+
document.addEventListener('visibilitychange', () => {
|
|
79
|
+
if (!document.hidden && ctx && ctx.state === 'suspended') {
|
|
80
|
+
ctx.resume().then(() => { if (enabled.music) startMusic(); }).catch(() => {});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
55
83
|
}
|
|
56
84
|
|
|
57
85
|
export function setAudioPrefs({ sfx, music }) {
|
package/murdoku.bundle
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -32,6 +32,12 @@ mkdir -p "$APP"
|
|
|
32
32
|
find "$APP" -mindepth 1 -maxdepth 1 ! -name .git ! -name .version -exec rm -rf {} +
|
|
33
33
|
cp -a "$src"/. "$APP"/
|
|
34
34
|
|
|
35
|
+
# the deploy runner updates itself from the package (effective next run)
|
|
36
|
+
if [ -f "$APP/scripts/npm-server-deploy.sh" ] && ! cmp -s "$APP/scripts/npm-server-deploy.sh" /usr/local/bin/murdoku-deploy; then
|
|
37
|
+
install -m 755 "$APP/scripts/npm-server-deploy.sh" /usr/local/bin/murdoku-deploy || true
|
|
38
|
+
echo "$(date -Is) deploy runner self-updated"
|
|
39
|
+
fi
|
|
40
|
+
|
|
35
41
|
# refresh real git history from the bundle carried in the package (optional)
|
|
36
42
|
if command -v git >/dev/null 2>&1 && [ -f "$src/murdoku.bundle" ]; then
|
|
37
43
|
if [ ! -d "$APP/.git" ]; then git -C "$APP" init -q; fi
|
|
@@ -43,7 +49,11 @@ cd "$APP"
|
|
|
43
49
|
GIT_SHA=$(git rev-parse --short main 2>/dev/null || echo "$ver")
|
|
44
50
|
export GIT_SHA
|
|
45
51
|
if docker compose version >/dev/null 2>&1; then DC="docker compose"; else DC="docker-compose"; fi
|
|
46
|
-
$DC up -d --build
|
|
52
|
+
if ! $DC up -d --build --remove-orphans; then
|
|
53
|
+
echo "$(date -Is) compose up failed — clearing stray containers and retrying"
|
|
54
|
+
docker rm -f murdoku murdoku-caddy >/dev/null 2>&1 || true
|
|
55
|
+
$DC up -d --build --remove-orphans
|
|
56
|
+
fi
|
|
47
57
|
|
|
48
58
|
ok=0
|
|
49
59
|
for _ in $(seq 1 45); do
|