fix: remove Spotify credential requirement — no API keys needed
spotdl (SpotAPI) works without developer credentials. Remove the health-check warning, credential error UI, and Client Credentials fallback that were blocking the importer. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
9b197e119a
commit
eacd68aea7
2 files changed
+3
-64
No files matched your search
@@ -224,29 +224,7 @@ async function fetchSpotifyToken() {
|
||||
_spSecretCache = null; // force secret re-extraction next time
|
||||
}
|
||||
|
||||
// Approach 2: Client Credentials fallback (requires SPOTIFY_CLIENT_ID/SECRET in env)
|
||||
if (!CONFIG.spotifyClientId || !CONFIG.spotifyClientSecret) {
|
||||
throw new Error(
|
||||
'Spotify-Token nicht abrufbar (TOTP gescheitert). ' +
|
||||
'SPOTIFY_CLIENT_ID und SPOTIFY_CLIENT_SECRET setzen als Fallback.'
|
||||
);
|
||||
}
|
||||
const basic = Buffer.from(`${CONFIG.spotifyClientId}:${CONFIG.spotifyClientSecret}`).toString('base64');
|
||||
const r = await _fetchTimeout('https://accounts.spotify.com/api/token', {
|
||||
method: 'POST',
|
||||
headers: { 'Authorization': `Basic ${basic}`, 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
body: 'grant_type=client_credentials',
|
||||
});
|
||||
if (!r.ok) {
|
||||
const errBody = await r.text().catch(() => '');
|
||||
throw new Error(`Spotify-Token-Fehler (${r.status}): ${errBody.slice(0, 200)}`);
|
||||
}
|
||||
const d = await r.json();
|
||||
if (!d.access_token) throw new Error('Kein access_token von Spotify erhalten');
|
||||
_spTokenCache = d.access_token;
|
||||
_spTokenExpiry = Date.now() + (d.expires_in * 1000) - 30000;
|
||||
console.log('[spotify] token ok (Client Credentials)');
|
||||
return _spTokenCache;
|
||||
throw new Error('Spotify-Token nicht abrufbar (TOTP gescheitert)');
|
||||
}
|
||||
|
||||
async function _spApi(path, token) {
|
||||
@@ -370,9 +348,7 @@ app.get('/api/health', (req, res) => {
|
||||
squidQuality: CONFIG.squidQuality,
|
||||
activeJobs: activeDownloads,
|
||||
queueLength: downloadQueue.length,
|
||||
spotify: {
|
||||
configured: !!(CONFIG.spotifyClientId && CONFIG.spotifyClientSecret),
|
||||
},
|
||||
spotify: { configured: true },
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user