Unlock everything, add a donation link, credit Last.fm, nudge re-linking
- Every feature is free for everyone (the plan system stays for later); remaining limits are abuse guards - Optional website donation link (NEXT_PUBLIC_DONATION_URL). Not shown in the mobile apps, where tips to the developer generally need in-app purchase - Last.fm/ListenBrainz-sourced plays link to the user's profile, as Last.fm's API terms require - Connections track when they last saw activity; a scrobbler silent for over a week prompts re-linking Spotify (its link expires every 6 months) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MzFywujuH9TiuXbr9vjoX8
This commit is contained in:
@@ -62,3 +62,35 @@ export function openUrl(
|
||||
if (direct) return { url: direct, exact: true };
|
||||
return { url: searchUrl(service, track.title, track.artist), exact: false };
|
||||
}
|
||||
|
||||
/** Public profile page for scrobbling services (attribution links). */
|
||||
export function sourceProfileUrl(provider: string, username: string): string | null {
|
||||
const u = encodeURIComponent(username);
|
||||
if (provider === 'lastfm') return `https://www.last.fm/user/${u}`;
|
||||
if (provider === 'listenbrainz') return `https://listenbrainz.org/user/${u}/`;
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Where users re-link Spotify on each scrobbling service. */
|
||||
export const SPOTIFY_LINK_PAGES = {
|
||||
lastfm: 'https://www.last.fm/settings/applications',
|
||||
listenbrainz: 'https://listenbrainz.org/settings/music-services/details/',
|
||||
} as const;
|
||||
|
||||
const QUIET_AFTER_MS = 7 * 86_400_000;
|
||||
|
||||
/**
|
||||
* A scrobbler that used to report plays but has gone silent for a week. Usually
|
||||
* Spotify's link to it expired (Spotify makes users re-approve every 6 months).
|
||||
*/
|
||||
export function isQuietScrobbler(
|
||||
c: { provider: string; status: string; lastActivityAt: string | null },
|
||||
now = Date.now(),
|
||||
): c is { provider: 'lastfm' | 'listenbrainz'; status: string; lastActivityAt: string } {
|
||||
return (
|
||||
(c.provider === 'lastfm' || c.provider === 'listenbrainz') &&
|
||||
c.status === 'active' &&
|
||||
c.lastActivityAt !== null &&
|
||||
now - new Date(c.lastActivityAt).getTime() > QUIET_AFTER_MS
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user