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:
@@ -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,8 +214,19 @@ function Connections() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{byProvider.has(p) ? (
|
{byProvider.has(p) ? (
|
||||||
<button className="btn" onClick={() => disconnect(p)}>
|
<div className="row">
|
||||||
Disconnect
|
{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)}>
|
||||||
|
Disconnect
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
) : p === 'lastfm' ? (
|
||||||
|
<button className="btn btn-primary" onClick={() => connectOAuth('lastfm')}>
|
||||||
|
Sign in with Last.fm
|
||||||
</button>
|
</button>
|
||||||
) : (
|
) : (
|
||||||
<form className="row" onSubmit={connectUsername(p)}>
|
<form className="row" onSubmit={connectUsername(p)}>
|
||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user