diff --git a/materialious/src/lib/components/settings/Interface.svelte b/materialious/src/lib/components/settings/Interface.svelte index baabb8bf..29505abc 100644 --- a/materialious/src/lib/components/settings/Interface.svelte +++ b/materialious/src/lib/components/settings/Interface.svelte @@ -32,11 +32,13 @@ interfaceRegionStore, interfaceSearchHistoryEnabled, interfaceSearchSuggestionsStore, + rawSubscriptionKeyStore, searchHistoryStore, themeColorStore } from '../../store'; import { addToast } from '../Toast.svelte'; import { tick } from 'svelte'; + import { isOwnBackend } from '$lib/shared'; let invidiousInstance = $state(get(instanceStore)); let region = $state(get(interfaceRegionStore)); @@ -89,6 +91,11 @@ } async function setBackend(event: Event) { + if (isOwnBackend()?.internalAuth) { + rawSubscriptionKeyStore.set(undefined); + fetch('/api/user/logout', { method: 'DELETE' }); + } + const select = event.target as HTMLSelectElement; backendInUseStore.set(select.value as 'ivg' | 'yt'); reloadState(); diff --git a/materialious/src/routes/(app)/+layout.svelte b/materialious/src/routes/(app)/+layout.svelte index 33767789..7714b5a9 100644 --- a/materialious/src/routes/(app)/+layout.svelte +++ b/materialious/src/routes/(app)/+layout.svelte @@ -116,7 +116,7 @@ }); async function login() { - if (isOwnBackend()?.internalAuth) { + if (isOwnBackend()?.internalAuth && isYTBackend()) { goto(resolve('/internal/login', {})); return; } @@ -188,7 +188,7 @@ } function logout() { - if (isOwnBackend()?.internalAuth) { + if (isOwnBackend()?.internalAuth && isYTBackend()) { rawSubscriptionKeyStore.set(undefined); fetch('/api/user/logout', { method: 'DELETE' }); }