Reload on instance / backend set
This commit is contained in:
@@ -15,7 +15,8 @@
|
||||
isUnrestrictedPlatform,
|
||||
setInvidiousInstance,
|
||||
goToInvidiousLogin,
|
||||
invidiousLogout
|
||||
invidiousLogout,
|
||||
clearCaches
|
||||
} from '../../misc';
|
||||
import { getPages, type Pages } from '../../navPages';
|
||||
import ColorPicker from 'svelte-awesome-color-picker';
|
||||
@@ -43,6 +44,8 @@
|
||||
import { addToast } from '../Toast.svelte';
|
||||
import { tick } from 'svelte';
|
||||
import { isOwnBackend } from '$lib/shared';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { page } from '$app/state';
|
||||
|
||||
let invidiousInstance = $state(get(invidiousInstanceStore));
|
||||
let region = $state(get(interfaceRegionStore));
|
||||
@@ -84,12 +87,13 @@
|
||||
async function setInstance(event: Event) {
|
||||
event.preventDefault();
|
||||
invalidInstance = !(await setInvidiousInstance(invidiousInstance));
|
||||
goto(resolve('/', {}), { replaceState: true });
|
||||
location.reload();
|
||||
}
|
||||
|
||||
async function setBackend(event: Event) {
|
||||
const select = event.target as HTMLSelectElement;
|
||||
backendInUseStore.set(select.value as 'ivg' | 'yt');
|
||||
location.reload();
|
||||
}
|
||||
|
||||
function allowInsecureRequests() {
|
||||
@@ -136,7 +140,7 @@
|
||||
<form onsubmit={setInstance}>
|
||||
<nav>
|
||||
<div
|
||||
class="field prefix label surface-container-highest max"
|
||||
class="field prefix suffix label surface-container-highest max"
|
||||
class:invalid={invalidInstance}
|
||||
>
|
||||
<i>link</i>
|
||||
@@ -150,6 +154,17 @@
|
||||
{#if invalidInstance}
|
||||
<span class="error">{$_('invalidInstance')}</span>
|
||||
{/if}
|
||||
{#if $invidiousInstanceStore}
|
||||
<i
|
||||
role="presentation"
|
||||
class="front"
|
||||
onclick={() => {
|
||||
invidiousInstanceStore.set(undefined);
|
||||
invidiousInstance = undefined;
|
||||
invidiousLogout();
|
||||
}}>close</i
|
||||
>
|
||||
{/if}
|
||||
</div>
|
||||
<button class="square">
|
||||
<i>done</i>
|
||||
|
||||
@@ -29,10 +29,12 @@ export async function load() {
|
||||
errorMsg = popularError as Error;
|
||||
}
|
||||
|
||||
if (errorMsg && errorMsg.toString() === 'Error: Administrator has disabled this endpoint.') {
|
||||
popularDisabled = true;
|
||||
} else {
|
||||
throw error(500, errorMsg);
|
||||
if (errorMsg) {
|
||||
if (errorMsg.toString() === 'Error: Administrator has disabled this endpoint.') {
|
||||
popularDisabled = true;
|
||||
} else {
|
||||
throw error(500, errorMsg);
|
||||
}
|
||||
}
|
||||
|
||||
feedCacheStore.set({ ...get(feedCacheStore), popular });
|
||||
|
||||
Reference in New Issue
Block a user