From 77581259ef5b1d1ddded270498fd94fcb2d7cdf8 Mon Sep 17 00:00:00 2001 From: WardPearce Date: Mon, 16 Feb 2026 03:39:38 +1300 Subject: [PATCH] Implemented excludeFromBookmarklet to our external settings --- .../src/lib/externalSettings/index.ts | 4 ++-- .../src/lib/externalSettings/settings.ts | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/materialious/src/lib/externalSettings/index.ts b/materialious/src/lib/externalSettings/index.ts index 5abd88e5..a69b19c5 100644 --- a/materialious/src/lib/externalSettings/index.ts +++ b/materialious/src/lib/externalSettings/index.ts @@ -107,11 +107,11 @@ export function loadSettingsFromEnv() { export function bookmarkletSaveToUrl(): string { const url = new URL(location.origin); - for (const { name, store, serialize } of persistedStores) { + for (const { name, store, serialize, excludeFromBookmarklet } of persistedStores) { const value = get(store); const encoded = serialize ? serialize(value) : value?.toString(); - if (encoded !== undefined) { + if (encoded !== undefined && !excludeFromBookmarklet) { url.searchParams.set(name, encoded); } } diff --git a/materialious/src/lib/externalSettings/settings.ts b/materialious/src/lib/externalSettings/settings.ts index 4bc5ff5d..27d2729d 100644 --- a/materialious/src/lib/externalSettings/settings.ts +++ b/materialious/src/lib/externalSettings/settings.ts @@ -61,6 +61,7 @@ type PersistedStore = { store: Writable; schema: z.ZodType; serialize?: (value: T) => string; + excludeFromBookmarklet?: boolean; // Won't be include in bookmarklet }; const zBoolean = z.coerce.boolean(); @@ -269,7 +270,8 @@ if (isOwnBackend()) { name: 'authToken', store: invidiousAuthStore, schema: zAuth, - serialize: JSON.stringify + serialize: JSON.stringify, + excludeFromBookmarklet: true }); persistedStores.push({ name: 'backendInUse', @@ -304,27 +306,32 @@ if (isOwnBackend()) { persistedStores.push({ name: 'allowInsecureRequests', store: interfaceAllowInsecureRequests, - schema: zString + schema: zString, + excludeFromBookmarklet: true }); persistedStores.push({ name: 'disableAutoUpdate', store: interfaceDisableAutoUpdate, - schema: zString + schema: zString, + excludeFromBookmarklet: true }); persistedStores.push({ name: 'androidUseNativeShare', store: interfaceAndroidUseNativeShare, - schema: zString + schema: zString, + excludeFromBookmarklet: true }); persistedStores.push({ name: 'pauseOnNetworkChange', store: playerAndroidPauseOnNetworkChange, - schema: zBoolean + schema: zBoolean, + excludeFromBookmarklet: true }); persistedStores.push({ name: 'androidLockOrientation', store: playerAndroidLockOrientation, - schema: zBoolean + schema: zBoolean, + excludeFromBookmarklet: true }); persistedStores.push({ name: 'youTubeJsFallback',