Implemented excludeFromBookmarklet to our external settings

This commit is contained in:
WardPearce
2026-02-16 03:39:38 +13:00
parent 08304fd588
commit 77581259ef
2 changed files with 15 additions and 8 deletions
@@ -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);
}
}
@@ -61,6 +61,7 @@ type PersistedStore<T> = {
store: Writable<T>;
schema: z.ZodType<T>;
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',