mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-10-02 21:12:49 +08:00
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:
1 parent
b4c3cc0539
commit
399cf0cf41
5 files changed
+211
-28
No files matched your search
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user