@onnie81/murdoku-spor 1.2.1 → 1.2.3
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,18 +32,40 @@ 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
|
-
#
|
|
35
|
+
# the deploy runner updates itself from the package and re-executes so the
|
|
36
|
+
# rest of THIS deploy runs with the fresh logic (cmp guard prevents looping)
|
|
37
|
+
if [ -f "$APP/scripts/npm-server-deploy.sh" ] && ! cmp -s "$APP/scripts/npm-server-deploy.sh" /usr/local/bin/murdoku-deploy; then
|
|
38
|
+
install -m 755 "$APP/scripts/npm-server-deploy.sh" /usr/local/bin/murdoku-deploy || true
|
|
39
|
+
echo "$(date -Is) deploy runner self-updated — re-executing"
|
|
40
|
+
rm -rf "$tmp"
|
|
41
|
+
exec env FORCE=1 /usr/local/bin/murdoku-deploy "$APP" "$BRANCH"
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
# refresh real git history from the bundle carried in the package.
|
|
45
|
+
# NOTE: fetch into a side ref — git refuses to fetch into the checked-out
|
|
46
|
+
# branch, which is what froze the reported sha at the first deploy.
|
|
36
47
|
if command -v git >/dev/null 2>&1 && [ -f "$src/murdoku.bundle" ]; then
|
|
37
48
|
if [ ! -d "$APP/.git" ]; then git -C "$APP" init -q; fi
|
|
38
|
-
git -C "$APP" fetch -f "$src/murdoku.bundle" 'refs/heads/main:refs/heads/
|
|
39
|
-
|
|
49
|
+
if git -C "$APP" fetch -f "$src/murdoku.bundle" 'refs/heads/main:refs/heads/incoming' 2>/dev/null; then
|
|
50
|
+
NEWREF=$(git -C "$APP" rev-parse --verify incoming 2>/dev/null || true)
|
|
51
|
+
if [ -n "$NEWREF" ]; then
|
|
52
|
+
git -C "$APP" update-ref refs/heads/main "$NEWREF"
|
|
53
|
+
git -C "$APP" symbolic-ref HEAD refs/heads/main 2>/dev/null || true
|
|
54
|
+
git -C "$APP" reset --hard main >/dev/null 2>&1 || true
|
|
55
|
+
git -C "$APP" update-ref -d refs/heads/incoming 2>/dev/null || true
|
|
56
|
+
fi
|
|
57
|
+
fi
|
|
40
58
|
fi
|
|
41
59
|
|
|
42
60
|
cd "$APP"
|
|
43
61
|
GIT_SHA=$(git rev-parse --short main 2>/dev/null || echo "$ver")
|
|
44
62
|
export GIT_SHA
|
|
45
63
|
if docker compose version >/dev/null 2>&1; then DC="docker compose"; else DC="docker-compose"; fi
|
|
46
|
-
$DC up -d --build
|
|
64
|
+
if ! $DC up -d --build --remove-orphans; then
|
|
65
|
+
echo "$(date -Is) compose up failed — clearing stray containers and retrying"
|
|
66
|
+
docker rm -f murdoku murdoku-caddy >/dev/null 2>&1 || true
|
|
67
|
+
$DC up -d --build --remove-orphans
|
|
68
|
+
fi
|
|
47
69
|
|
|
48
70
|
ok=0
|
|
49
71
|
for _ in $(seq 1 45); do
|