Implemented PUBLIC_PLAYER_ID

This commit is contained in:
WardPearce
2026-03-05 13:25:20 +13:00
parent 97b1bf4103
commit a9a0c1ef8e
3 changed files with 11 additions and 2 deletions
+5
View File
@@ -47,6 +47,11 @@ services:
# guide here for URL structure https://docs.preset.io/docs/uri-connection-strings
DATABASE_CONNECTION_URI: "sqlite:///materialious-data/materialious.db"
# YouTube player id to use, can be left blank but setting to a older player id may fix
# video playback with local video processing.
# https://youtube-player-ids.nadeko.net
PUBLIC_PLAYER_ID: ""
# Use Materialious account system.
PUBLIC_INTERNAL_AUTH: "true"
+3 -1
View File
@@ -1,3 +1,4 @@
import { getPublicEnv } from '$lib/misc';
import { interfaceRegionStore } from '$lib/store';
import { USER_AGENT } from 'bgutils-js';
import { get } from 'svelte/store';
@@ -12,7 +13,8 @@ export async function getInnertube(): Promise<Innertube> {
fetch: fetch,
cache: new UniversalCache(true),
location: get(interfaceRegionStore),
user_agent: USER_AGENT
user_agent: USER_AGENT,
player_id: getPublicEnv('PLAYER_ID') ?? '9f4cc5e4'
});
return innertube;
+3 -1
View File
@@ -10,7 +10,9 @@ import { addToast } from './components/Toast.svelte';
import { _ } from './i18n';
export function getPublicEnv(envName: string): string | undefined {
return env[`PUBLIC_${envName}`] ?? import.meta.env[`VITE_${envName}`];
const envValue = env[`PUBLIC_${envName}`] ?? import.meta.env[`VITE_${envName}`];
if (envValue === '') return;
return envValue;
}
export function isMobile(): boolean {