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

+6 -9
View File
@@ -23,12 +23,9 @@ import { createSpotifyRouter } from "./api/spotify.js";
import type { SpotifyOAuth } from "../music/spotify/spotify-oauth.js";
import { resolveSpotifyBackendKind } from "../music/spotify/backend-select.js";
import {
isGoLibrespotSupported,
findGoLibrespot,
isRustLibrespotSupported,
findLibrespot,
isGoLibrespotPresent,
isLibrespotPresent,
} from "../music/spotify/binary.js";
import { existsSync } from "node:fs";
import { setupWebSocket } from "./websocket.js";
import { createUserStore } from "../data/users.js";
import { createSessionStore } from "../data/sessions.js";
@@ -156,10 +153,10 @@ export function createWebServer(options: WebServerOptions): WebServer {
oauth: options.spotifyOAuth,
logger,
getBackendInfo: () => {
const goPresent =
isGoLibrespotSupported() && existsSync(findGoLibrespot());
const rustPresent =
isRustLibrespotSupported() && existsSync(findLibrespot());
// PATH-aware presence (Bug m1): a PATH-installed binary (bare name)
// is resolved against $PATH, not existsSync()'d against cwd.
const goPresent = isGoLibrespotPresent();
const rustPresent = isLibrespotPresent();
const resolved = resolveSpotifyBackendKind(
options.config.spotify.backend,
goPresent,