Skip to content

Plugin LastFM

Derrik Diener edited this page Jul 16, 2026 · 1 revision

Last.fm Plugin

Enabled by Default: Yes (Disable via SUPERNOVA_PLUGIN_LASTFM=false)

Purpose

Handles OAuth authentication with Last.fm and manages background track scrobbling strictly according to Last.fm API guidelines.

Technical Internals

  1. Authentication: Uses a pop-up callback flow (/api/plugins/lastfm/auth-url). It securely exchanges the temporary token for a persistent session key stored in the user's browser localStorage.
  2. State Management: The frontend PlayerContext tracks the exact accumulatedPlayTimeRef for the active track.
  3. Scrobble Rules: A scrobble request is ONLY fired to /api/plugins/lastfm/scrobble if:
    • The user has listened to at least 50% of the track's duration.
    • OR the user has listened for 4 continuous minutes.
  4. Security: The callback URLs and API keys are strictly url.QueryEscape'd to prevent parameter injection attacks.

API Execution

  • GET /api/plugins/lastfm/auth-url
  • POST /api/plugins/lastfm/session
  • POST /api/plugins/lastfm/scrobble

Clone this wiki locally