Skip to content

Commit 6d3e4ab

Browse files
michaelblaessclaude
andcommitted
fix: BASE_URL fuer Musik und Highscore (404 auf GitHub Pages)
Absolute Pfade (/music/..., /HIGHSCORE.md) funktionierten nicht unter dem /halma/ Subpath. Jetzt wird import.meta.env.BASE_URL verwendet. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2b39218 commit 6d3e4ab

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/audio/music.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
// Background music player — shuffled playlist, loops forever
22

33
// Hashed filenames — Mapping siehe scripts/decrypt-music.sh
4+
const BASE = import.meta.env.BASE_URL;
45
const TRACKS = [
5-
'/music/1e6b41f0261e.mp3',
6-
'/music/9685818f508c.mp3',
7-
'/music/a07b560519d9.mp3',
6+
`${BASE}music/1e6b41f0261e.mp3`,
7+
`${BASE}music/9685818f508c.mp3`,
8+
`${BASE}music/a07b560519d9.mp3`,
89
];
910

1011
let audio: HTMLAudioElement | null = null;

src/components/GameInfo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const HighscoreOverlay: React.FC<{ onClose: () => void }> = ({ onClose }) => {
5757
const panelRef = useFocusTrap(onClose);
5858

5959
React.useEffect(() => {
60-
fetch('/HIGHSCORE.md')
60+
fetch(`${import.meta.env.BASE_URL}HIGHSCORE.md`)
6161
.then((res) => {
6262
if (!res.ok) throw new Error('Not found');
6363
return res.text();

0 commit comments

Comments
 (0)