From de18e0d46786c7a4bbecd133903aea4d0f05ee56 Mon Sep 17 00:00:00 2001 From: Robert Rapp Date: Thu, 17 Jul 2025 20:15:04 +0200 Subject: [PATCH] fix cors problem for fart --- nginx/html/index.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nginx/html/index.html b/nginx/html/index.html index 3e94eed..5b9cb28 100644 --- a/nginx/html/index.html +++ b/nginx/html/index.html @@ -98,7 +98,13 @@ // Pre-fetch & decode once (lazy: only on first click) async function initAudio() { ctx = new (window.AudioContext || window.webkitAudioContext)() - const res = await fetch(AUDIO_FILE) + const res = await fetch(AUDIO_FILE, { + method: "GET", + mode: "cors", // nur nötig, wenn Domain ≠ Seite + headers: { + "X-API-Key": API_KEY, + }, + }) const array = await res.arrayBuffer() buffer = await ctx.decodeAudioData(array) }