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>
This commit is contained in:
parent
66d132dbbc
commit
9bd76fd2dd
1 changed files with 7 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue