From 9bd76fd2dd87d54ff4c5cc4542640e2d99c8e566 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 16 Apr 2026 19:22:30 +0000 Subject: [PATCH] Avoid ?q fallback on external hifi-api search Agent-Logs-Url: https://github.com/monochrome-music/monochrome/sessions/b34dfb4a-cfae-459a-ac01-4c675551575b Co-authored-by: binimum <61615730+binimum@users.noreply.github.com> --- js/api.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/api.js b/js/api.js index 6956f4f..0d6849f 100644 --- a/js/api.js +++ b/js/api.js @@ -79,6 +79,9 @@ export class LosslessAPI { return await HiFiClient.instance.query(relativePath); } catch (err) { + if (options.directOnly) { + throw err; + } console.warn( `Direct fetch failed for ${relativePath}. Falling back to configured API instances...`, err @@ -446,7 +449,10 @@ export class LosslessAPI { try { // Keep direct TIDAL combined search behavior for normal mode. // If direct query fails, fall back to hifi-api-compatible scoped searches (?s, ?a, ?al, ?v, ?p). - const response = await HiFiClient.instance.query(`/search/?q=${encodeURIComponent(query)}`, options.signal); + const response = await this.fetchWithRetry(`/search/?q=${encodeURIComponent(query)}`, { + ...options, + directOnly: true, + }); const data = await response.json(); // Check if backend returned an error or if this looks like individual fallback