Web: Sign in with Last.fm and explain the Spotify beta limit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzFywujuH9TiuXbr9vjoX8
This commit is contained in:
2026-10-04 07:12:19 -04:00
co-authored by Claude Opus 5.5
parent 1d4aeee0dd
commit 507cffbe57
+27 -4
View File
@@ -95,7 +95,9 @@ function ProfileForm({ me }: { me: MeDTO }) {
function Connections() { function Connections() {
const params = useSearchParams(); const params = useSearchParams();
const { data: connections = [], mutate } = useSWR<ConnectionDTO[]>('/connections', fetcher); const { data: connections = [], mutate } = useSWR<ConnectionDTO[]>('/connections', fetcher);
const [error, setError] = useState<string | null>(params.get('error')); const errorParam = params.get('error');
const spotifyLimited = errorParam === 'spotify_limited';
const [error, setError] = useState<string | null>(spotifyLimited ? null : errorParam);
const byProvider = new Map(connections.map((c) => [c.provider, c])); const byProvider = new Map(connections.map((c) => [c.provider, c]));
const run = async (fn: () => Promise<unknown>) => { const run = async (fn: () => Promise<unknown>) => {
@@ -108,7 +110,7 @@ function Connections() {
} }
}; };
const connectOAuth = (provider: 'spotify' | 'plex') => const connectOAuth = (provider: 'spotify' | 'plex' | 'lastfm') =>
run(async () => { run(async () => {
const { url } = await api<{ url: string }>(`/connections/${provider}/authorize`, { body: { client: 'web' } }); const { url } = await api<{ url: string }>(`/connections/${provider}/authorize`, { body: { client: 'web' } });
window.location.href = url; window.location.href = url;
@@ -187,6 +189,16 @@ function Connections() {
)} )}
</div> </div>
{spotifyLimited && (
<div className="notice">
<strong>Spotify sign-in is limited during beta.</strong> Spotify only lets a few accounts sign in to new apps
directly. You can still share Spotify through Last.fm: sign in to Last.fm below, then{' '}
<a href="https://www.last.fm/settings/applications" target="_blank" rel="noreferrer">
connect “Spotify Scrobbling” on Last.fm
</a>
.
</div>
)}
{(['lastfm', 'listenbrainz'] as const).map((p) => ( {(['lastfm', 'listenbrainz'] as const).map((p) => (
<div className="connection" key={p}> <div className="connection" key={p}>
<div> <div>
@@ -202,9 +214,20 @@ function Connections() {
</div> </div>
</div> </div>
{byProvider.has(p) ? ( {byProvider.has(p) ? (
<div className="row">
{p === 'lastfm' && (
<a className="btn" href="https://www.last.fm/settings/applications" target="_blank" rel="noreferrer">
Link Spotify
</a>
)}
<button className="btn" onClick={() => disconnect(p)}> <button className="btn" onClick={() => disconnect(p)}>
Disconnect Disconnect
</button> </button>
</div>
) : p === 'lastfm' ? (
<button className="btn btn-primary" onClick={() => connectOAuth('lastfm')}>
Sign in with Last.fm
</button>
) : ( ) : (
<form className="row" onSubmit={connectUsername(p)}> <form className="row" onSubmit={connectUsername(p)}>
<input name="username" placeholder="Username" required /> <input name="username" placeholder="Username" required />
@@ -214,10 +237,10 @@ function Connections() {
</div> </div>
))} ))}
<div className="connection disabled"> <div className={`connection ${byProvider.has('apple_music') ? '' : 'disabled'}`}>
<div> <div>
<strong>Apple Music</strong> <strong>Apple Music</strong>
<div className="muted">Coming with the iOS app</div> <div className="muted">{byProvider.has('apple_music') ? status('apple_music') : 'Connect from the musicshare iPhone app (one tap)'}</div>
</div> </div>
</div> </div>
</div> </div>