From 468006173a168c25def199d008a73fe41d2c3004 Mon Sep 17 00:00:00 2001 From: dawn <90008@gaze.systems> Date: Tue, 20 Jan 2026 19:54:15 +0300 Subject: [PATCH] add settings fields for pocket and cdn endpoints --- src/components/SettingsAdvancedTab.svelte | 2 ++ src/lib/at/index.ts | 2 ++ src/lib/at/pocket.ts | 3 ++- src/lib/cdn.ts | 3 ++- src/lib/settings.ts | 12 ++++++++++-- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/components/SettingsAdvancedTab.svelte b/src/components/SettingsAdvancedTab.svelte index 63fe14c..ea0b982 100644 --- a/src/components/SettingsAdvancedTab.svelte +++ b/src/components/SettingsAdvancedTab.svelte @@ -38,6 +38,8 @@ {@render _input('spacedust', 'spacedust url (for notifications)')} {@render _input('constellation', 'constellation url (for backlinks)')} {@render _input('jetstream', 'jetstream url (for real-time updates)')} + {@render _input('pocket', 'pocket url (for preferences)')} + {@render _input('cdn', 'cdn url (for media)')} diff --git a/src/lib/at/index.ts b/src/lib/at/index.ts index 7863fcb..fa73615 100644 --- a/src/lib/at/index.ts +++ b/src/lib/at/index.ts @@ -5,5 +5,7 @@ import { get } from 'svelte/store'; export const slingshotUrl: URL = new URL(get(settings).endpoints.slingshot); export const spacedustUrl: URL = new URL(get(settings).endpoints.spacedust); export const constellationUrl: URL = new URL(get(settings).endpoints.constellation); +export const pocketUrl: URL = new URL(get(settings).endpoints.pocket); +export const cdnUrl: URL = new URL(get(settings).endpoints.cdn); export const httpToDidWeb = (url: string): Did => `did:web:${new URL(url).hostname}`; diff --git a/src/lib/at/pocket.ts b/src/lib/at/pocket.ts index 5d13278..a85d16b 100644 --- a/src/lib/at/pocket.ts +++ b/src/lib/at/pocket.ts @@ -1,8 +1,9 @@ +import { httpToDidWeb, pocketUrl } from './index'; import type { Did } from '@atcute/lexicons/syntax'; import type { AtpClient } from './client.svelte'; import { err, ok, type Result } from '$lib/result'; -const POCKET_PROXY = 'did:web:pocket.at-app.net#pocket_prefs'; +const POCKET_PROXY = `${httpToDidWeb(pocketUrl.toString())}#pocket_prefs`; export type Preferences = { mutes?: Did[]; diff --git a/src/lib/cdn.ts b/src/lib/cdn.ts index c4b781c..0616d5a 100644 --- a/src/lib/cdn.ts +++ b/src/lib/cdn.ts @@ -1,6 +1,7 @@ import type { Did } from '@atcute/lexicons'; +import { cdnUrl } from '$lib/at'; -export const cdn = `https://cdn.bsky.app`; +export const cdn = cdnUrl.origin; export type ImageKind = 'avatar_thumbnail' | 'avatar' | 'feed_thumbnail' | 'feed_fullsize'; export type ImageFormat = 'webp' | 'png' | 'jpg'; diff --git a/src/lib/settings.ts b/src/lib/settings.ts index 090e3b8..6cccbfc 100644 --- a/src/lib/settings.ts +++ b/src/lib/settings.ts @@ -7,7 +7,10 @@ export type ApiEndpoints = Record & { spacedust: string; constellation: string; jetstream: string; + pocket: string; + cdn: string; }; + export type SavedFeed = { feed: FeedGenerator, pinned: boolean, @@ -25,7 +28,9 @@ export const defaultSettings: Settings = { slingshot: 'https://slingshot.microcosm.blue', spacedust: 'https://spacedust.microcosm.blue', constellation: 'https://constellation.microcosm.blue', - jetstream: 'wss://jetstream2.fr.hose.cam' + jetstream: 'wss://jetstream2.fr.hose.cam', + pocket: 'https://pocket.at-app.net', + cdn: 'https://cdn.bsky.app' }, theme: defaultTheme, socialAppUrl: 'https://bsky.app', @@ -91,6 +96,9 @@ export const needsReload = (current: Settings, other: Settings): boolean => { current.endpoints.slingshot !== other.endpoints.slingshot || current.endpoints.spacedust !== other.endpoints.spacedust || current.endpoints.constellation !== other.endpoints.constellation || - current.endpoints.jetstream !== other.endpoints.jetstream + current.endpoints.jetstream !== other.endpoints.jetstream || + current.endpoints.pocket !== other.endpoints.pocket || + current.endpoints.cdn !== other.endpoints.cdn ); }; + -- 2.51.2