rename instanceStore to invidiousInstanceStore
This commit is contained in:
@@ -4,7 +4,7 @@ import {
|
||||
invidiousAuthStore,
|
||||
deArrowInstanceStore,
|
||||
deArrowThumbnailInstanceStore,
|
||||
instanceStore,
|
||||
invidiousInstanceStore,
|
||||
interfaceRegionStore,
|
||||
playerYouTubeJsAlways,
|
||||
playerYouTubeJsFallback,
|
||||
@@ -55,7 +55,7 @@ import {
|
||||
} from './backend';
|
||||
|
||||
export function buildPath(path: string): URL {
|
||||
return new URL(`${get(instanceStore)}/api/v1/${path}`);
|
||||
return new URL(`${get(invidiousInstanceStore)}/api/v1/${path}`);
|
||||
}
|
||||
|
||||
export function setRegion(url: URL): URL {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
import type { VideoPlay } from '../api/model';
|
||||
import {
|
||||
invidiousAuthStore,
|
||||
instanceStore,
|
||||
invidiousInstanceStore,
|
||||
isAndroidTvStore,
|
||||
playerAlwaysLoopStore,
|
||||
playerAndroidLockOrientation,
|
||||
@@ -547,7 +547,9 @@
|
||||
playerMaxKnownTime
|
||||
);
|
||||
} else if (!data.video.fallbackPatch) {
|
||||
const thumbnailVTTResp = await fetch(`${$instanceStore}${selectedStoryboard.url}`);
|
||||
const thumbnailVTTResp = await fetch(
|
||||
`${$invidiousInstanceStore}${selectedStoryboard.url}`
|
||||
);
|
||||
if (thumbnailVTTResp.ok) thumbnailVTT = await thumbnailVTTResp.text();
|
||||
}
|
||||
|
||||
@@ -576,10 +578,10 @@
|
||||
if (data.video.captions) {
|
||||
for (const caption of data.video.captions) {
|
||||
let captionUrl: string;
|
||||
if (!import.meta.env.VITE_DEFAULT_COMPANION_INSTANCE && $instanceStore) {
|
||||
if (!import.meta.env.VITE_DEFAULT_COMPANION_INSTANCE && $invidiousInstanceStore) {
|
||||
captionUrl = caption.url.startsWith('http')
|
||||
? caption.url
|
||||
: `${new URL($instanceStore).origin}${caption.url}`;
|
||||
: `${new URL($invidiousInstanceStore).origin}${caption.url}`;
|
||||
} else {
|
||||
captionUrl = `${import.meta.env.VITE_DEFAULT_COMPANION_INSTANCE}${caption.url}`;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { resolve } from '$app/paths';
|
||||
import { instanceStore } from '$lib/store';
|
||||
import { invidiousInstanceStore } from '$lib/store';
|
||||
import { _ } from '$lib/i18n';
|
||||
import { get } from 'svelte/store';
|
||||
import type { Notification, PlaylistPageVideo, Video, VideoBase } from '../api/model';
|
||||
@@ -45,7 +45,7 @@
|
||||
role="presentation"
|
||||
onclick={async () => {
|
||||
if (isUnrestrictedPlatform()) {
|
||||
shareVideo(`${get(instanceStore)}/watch/${video.videoId}`);
|
||||
shareVideo(`${get(invidiousInstanceStore)}/watch/${video.videoId}`);
|
||||
} else {
|
||||
shareVideo(
|
||||
`${location.origin}${resolve('/watch/[videoId]', { videoId: video.videoId })}`,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { _ } from '$lib/i18n';
|
||||
import type { VideoPlay } from '../api/model';
|
||||
import { decodeHtmlCharCodes } from '../misc';
|
||||
import { instanceStore } from '../store';
|
||||
import { invidiousInstanceStore } from '../store';
|
||||
|
||||
interface Props {
|
||||
video: VideoPlay;
|
||||
@@ -49,8 +49,8 @@
|
||||
|
||||
if (video.fallbackPatch === 'youtubejs') {
|
||||
urlConstructed = url;
|
||||
} else if ($instanceStore) {
|
||||
urlConstructed = new URL($instanceStore).origin + url;
|
||||
} else if ($invidiousInstanceStore) {
|
||||
urlConstructed = new URL($invidiousInstanceStore).origin + url;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
engineCullYTStore,
|
||||
engineFallbacksStore,
|
||||
engineMaxConcurrentChannelsStore,
|
||||
instanceStore
|
||||
invidiousInstanceStore
|
||||
} from '$lib/store';
|
||||
import { useEngineFallback, type EngineFallback } from '$lib/api/misc';
|
||||
import { get } from 'svelte/store';
|
||||
@@ -134,7 +134,7 @@
|
||||
<label for="concurrent">{$_('layout.backendEngine.concurrent')}</label>
|
||||
</div>
|
||||
|
||||
{#if $invidiousAuthStore && $instanceStore}
|
||||
{#if $invidiousAuthStore && $invidiousInstanceStore}
|
||||
<h6>{$_('layout.backendEngine.importExport')}</h6>
|
||||
<div class="space"></div>
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
invidiousAuthStore,
|
||||
backendInUseStore,
|
||||
darkModeStore,
|
||||
instanceStore,
|
||||
invidiousInstanceStore,
|
||||
interfaceAllowInsecureRequests,
|
||||
interfaceAmoledTheme,
|
||||
interfaceAndroidUseNativeShare,
|
||||
@@ -46,7 +46,7 @@
|
||||
import { tick } from 'svelte';
|
||||
import { isOwnBackend } from '$lib/shared';
|
||||
|
||||
let invidiousInstance = $state(get(instanceStore));
|
||||
let invidiousInstance = $state(get(invidiousInstanceStore));
|
||||
let region = $state(get(interfaceRegionStore));
|
||||
let forceCase = $state(get(interfaceForceCase));
|
||||
let defaultPage = $state(get(interfaceDefaultPage));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { get } from 'svelte/store';
|
||||
import type { Image } from './api/model';
|
||||
import { instanceStore } from './store';
|
||||
import { invidiousInstanceStore } from './store';
|
||||
import { isYTBackend } from './misc';
|
||||
|
||||
export class ImageCache {
|
||||
@@ -66,5 +66,5 @@ export function proxyGoogleImage(source: string): string {
|
||||
|
||||
if (typeof path === 'undefined') return '';
|
||||
|
||||
return `${get(instanceStore)}/ggpht${path}`;
|
||||
return `${get(invidiousInstanceStore)}/ggpht${path}`;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
backendInUseStore,
|
||||
channelCacheStore,
|
||||
feedCacheStore,
|
||||
instanceStore,
|
||||
invidiousInstanceStore,
|
||||
interfaceAllowInsecureRequests,
|
||||
interfaceAndroidUseNativeShare,
|
||||
isAndroidTvStore,
|
||||
@@ -287,15 +287,15 @@ export async function setInvidiousInstance(
|
||||
return false;
|
||||
}
|
||||
|
||||
instanceStore.set(instance);
|
||||
invidiousInstanceStore.set(instance);
|
||||
invidiousAuthStore.set(null);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
export async function goToInvidiousLogin() {
|
||||
if (!get(instanceStore)) return;
|
||||
const path = new URL(`${get(instanceStore)}/authorize_token`);
|
||||
if (!get(invidiousInstanceStore)) return;
|
||||
const path = new URL(`${get(invidiousInstanceStore)}/authorize_token`);
|
||||
const searchParams = new URLSearchParams({
|
||||
scopes: ':feed,:subscriptions*,:playlists*,:history*,:notifications*'
|
||||
});
|
||||
|
||||
@@ -86,7 +86,7 @@ function ifNotWebDefault(givenValue: any, defaultValue: any): any {
|
||||
}
|
||||
}
|
||||
|
||||
export const instanceStore: Writable<string | undefined> = persist(
|
||||
export const invidiousInstanceStore: Writable<string | undefined> = persist(
|
||||
writable(
|
||||
!import.meta.env.VITE_DEFAULT_INVIDIOUS_INSTANCE
|
||||
? undefined
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
import {
|
||||
invidiousAuthStore,
|
||||
darkModeStore,
|
||||
instanceStore,
|
||||
invidiousInstanceStore,
|
||||
interfaceAmoledTheme,
|
||||
interfaceDefaultPage,
|
||||
isAndroidTvStore,
|
||||
@@ -149,7 +149,7 @@
|
||||
body.append('password', rawPassword);
|
||||
body.append('action', 'signin');
|
||||
|
||||
const response = await fetch(`${$instanceStore}/login?type=invidious`, {
|
||||
const response = await fetch(`${$invidiousInstanceStore}/login?type=invidious`, {
|
||||
method: 'POST',
|
||||
body: body,
|
||||
headers: {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { goto } from '$app/navigation';
|
||||
import { resolve } from '$app/paths';
|
||||
import { isYTBackend } from '$lib/misc';
|
||||
import { instanceStore } from '$lib/store';
|
||||
import { invidiousInstanceStore } from '$lib/store';
|
||||
import { get } from 'svelte/store';
|
||||
|
||||
export async function load() {
|
||||
if (isYTBackend() || get(instanceStore)) {
|
||||
if (isYTBackend() || get(invidiousInstanceStore)) {
|
||||
goto(resolve('/', {}), { replaceState: true });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import { getPages } from '$lib/navPages';
|
||||
import {
|
||||
invidiousAuthStore,
|
||||
backendInUseStore,
|
||||
instanceStore,
|
||||
invidiousInstanceStore,
|
||||
interfaceDefaultPage,
|
||||
isAndroidTvStore,
|
||||
rawMasterKeyStore
|
||||
@@ -35,7 +35,7 @@ export async function load({ url }) {
|
||||
// Due to race condition with how we set & save persistent store values
|
||||
// we manually set stores like auth & instance before load.
|
||||
const preferenceKey: Record<string, Writable<any>> = {
|
||||
invidiousInstance: instanceStore,
|
||||
invidiousInstance: invidiousInstanceStore,
|
||||
authToken: invidiousAuthStore,
|
||||
backendInUse: backendInUseStore,
|
||||
rawMasterKey: rawMasterKeyStore
|
||||
@@ -84,7 +84,7 @@ export async function load({ url }) {
|
||||
|
||||
if (isOwnBackend()?.requireAuth && !get(rawMasterKeyStore)) {
|
||||
goto(resolve('/internal/login', {}), { replaceState: true });
|
||||
} else if (!get(instanceStore) && !isYTBackend() && !isSetupPage) {
|
||||
} else if (!get(invidiousInstanceStore) && !isYTBackend() && !isSetupPage) {
|
||||
goto(resolve('/setup', {}), { replaceState: true });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user