fix(spotify): PATH-aware binary presence detection (bin/ or PATH) [whole-branch I3,m1]

rustPresent/goPresent and getBackendInfo used existsSync(findX()), which for a
bare PATH command name resolves against cwd, not $PATH — so a scoop/choco/cargo/
apt install was invisible and Spotify was gated off. Add a sync PATH-aware
resolveExecutable() + isLibrespotPresent()/isGoLibrespotPresent() in binary.ts
and route controller.ts and web/server.ts through them.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
saopig1andClaude Opus 4.8 committed 2026-07-03 01:45:48 +08:00
1 parent b4c3cc0539
commit 399cf0cf41
5 files changed
+211 -28

No files matched your search

+5 -8
View File
@@ -15,12 +15,7 @@ import type {
SpotifyTrackEndedEvent,
SpotifyNowPlaying,
} from "./backend.js";
import {
isGoLibrespotSupported,
findGoLibrespot,
isRustLibrespotSupported,
findLibrespot,
} from "./binary.js";
import { isGoLibrespotPresent, isLibrespotPresent } from "./binary.js";
import { GoLibrespotBackend } from "./go-librespot.js";
import { RustLibrespotBackend } from "./rust-librespot.js";
import {
@@ -151,11 +146,13 @@ export class SpotifyController extends EventEmitter {
}
private goPresent(): boolean {
return isGoLibrespotSupported() && existsSync(findGoLibrespot());
// PATH-aware, sync presence gate (Bug I3): a bare PATH-installed binary is
// resolved against $PATH, not existsSync()'d against process.cwd().
return isGoLibrespotPresent();
}
private rustPresent(): boolean {
return isRustLibrespotSupported() && existsSync(findLibrespot());
return isLibrespotPresent();
}
/**