add Twitch identity disconnect controls
This commit is contained in:
@@ -328,6 +328,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function revokeOAuth(identity: 'streamer' | 'bot') {
|
||||
oauthBusy = true;
|
||||
oauthError = '';
|
||||
try {
|
||||
const response = await fetch(`${serverAddress}/api/v1/twitch/oauth/revoke?identity=${identity}`, {
|
||||
method: 'POST',
|
||||
headers: { authorization: `Bearer ${sessionToken}` },
|
||||
});
|
||||
if (!response.ok) throw new Error('The server could not revoke this Twitch authorization.');
|
||||
await loadStreamInfo();
|
||||
} catch (error) {
|
||||
oauthError = error instanceof Error ? error.message : 'The Twitch authorization could not be revoked.';
|
||||
} finally {
|
||||
oauthBusy = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function copyOAuthLink() {
|
||||
if (!oauthLink) return;
|
||||
await navigator.clipboard.writeText(oauthLink).catch(() => {
|
||||
@@ -378,7 +395,9 @@
|
||||
{#if authenticated}
|
||||
<div class="oauth-actions">
|
||||
<button class="secondary-action" onclick={() => createOAuthLink('streamer')} disabled={oauthBusy}>CONNECT STREAMER</button>
|
||||
<button class="secondary-action" onclick={() => revokeOAuth('streamer')} disabled={oauthBusy}>DISCONNECT STREAMER</button>
|
||||
<button class="secondary-action" onclick={() => createOAuthLink('bot')} disabled={oauthBusy}>CONNECT BOT</button>
|
||||
<button class="secondary-action" onclick={() => revokeOAuth('bot')} disabled={oauthBusy}>DISCONNECT BOT</button>
|
||||
</div>
|
||||
{#if oauthLink}
|
||||
<div class="oauth-link-card">
|
||||
|
||||
Reference in New Issue
Block a user