Refactor Last.fm integration to use Cloudflare Workers proxy

- Update LASTFM_API_URL to point to proxy endpoint
- Remove MD5 signature generation (proxy handles it)
- Remove api_key and api_secret from LastFmClient (proxy manages credentials)
- Simplify client to only handle session_key
- Update get_token() to return (token, authUrl) tuple from proxy
- Update all methods (get_session, scrobble, update_now_playing) to use proxy
- Add User-Agent header 'QBZ/1.0.0' for proxy validation
- Update bootstrap.ts to skip credential restoration (proxy handles it)
- Maintain backward compatibility with set_credentials as no-op
This commit is contained in:
vicrodh committed 2026-01-16 21:09:18 -06:00
1 parent 3a49e3f6dd
commit 179a6b7c54
3 files changed
+66 -172

No files matched your search

+1 -11
View File
@@ -47,19 +47,9 @@ export async function applySavedZoom(): Promise<void> {
*/
export async function restoreLastfmSession(): Promise<void> {
try {
const savedApiKey = localStorage.getItem('qbz-lastfm-api-key');
const savedApiSecret = localStorage.getItem('qbz-lastfm-api-secret');
const savedSessionKey = localStorage.getItem('qbz-lastfm-session-key');
// Restore credentials if user-provided
if (savedApiKey && savedApiSecret) {
await invoke('lastfm_set_credentials', {
apiKey: savedApiKey,
apiSecret: savedApiSecret
});
}
// Restore session if available
// Restore session if available (proxy handles credentials)
if (savedSessionKey) {
await invoke('lastfm_set_session', { sessionKey: savedSessionKey });
console.log('Last.fm session restored on startup');