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:
1 parent
3a49e3f6dd
commit
179a6b7c54
3 files changed
+66
-172
No files matched your search
@@ -50,13 +50,8 @@ pub async fn lastfm_get_auth_url(state: State<'_, AppState>) -> Result<(String,
|
||||
log::info!("Command: lastfm_get_auth_url");
|
||||
let client = state.lastfm.lock().await;
|
||||
|
||||
if !client.has_credentials() {
|
||||
return Err("Last.fm API credentials not configured. Please set API key and secret in settings.".to_string());
|
||||
}
|
||||
|
||||
let token = client.get_token().await?;
|
||||
let url = client.get_auth_url(&token);
|
||||
Ok((token, url))
|
||||
// Proxy handles credentials, always available
|
||||
client.get_token().await
|
||||
}
|
||||
|
||||
/// Complete Last.fm authentication with token
|
||||
|
||||
Reference in new issue
Block a user