From 6fca1244d371f2d584895f55f416fce9af001d6a Mon Sep 17 00:00:00 2001 From: Florian <45694132+flo-bit@users.noreply.github.com> Date: Wed, 28 Jan 2026 12:28:07 +0100 Subject: [PATCH] improve login, small fixes --- docs/Beta.md | 2 - src/lib/atproto/UI/LoginModal.svelte | 4 +- src/lib/atproto/auth.svelte.ts | 24 +++- src/lib/atproto/metadata.ts | 8 +- src/lib/atproto/settings.ts | 9 +- .../FluidTextCard/EditingFluidTextCard.svelte | 12 +- src/lib/website/Controls.svelte | 123 ++++++++++++++++++ src/lib/website/EditableProfile.svelte | 96 +------------- src/lib/website/EditableWebsite.svelte | 41 +----- 9 files changed, 170 insertions(+), 149 deletions(-) create mode 100644 src/lib/website/Controls.svelte diff --git a/docs/Beta.md b/docs/Beta.md index f067970..6bfd8b7 100644 --- a/docs/Beta.md +++ b/docs/Beta.md @@ -24,5 +24,3 @@ - when adding images try to add them in a size that best fits aspect ratio - onboarding - -- fix invalid handle thing diff --git a/src/lib/atproto/UI/LoginModal.svelte b/src/lib/atproto/UI/LoginModal.svelte index 2ad5939..8206320 100644 --- a/src/lib/atproto/UI/LoginModal.svelte +++ b/src/lib/atproto/UI/LoginModal.svelte @@ -126,7 +126,9 @@ {#if showRecentLogins}
Recent logins
- {#each Object.values(recentLogins).slice(0, 4) as recentLogin (recentLogin.did)} + {#each Object.values(recentLogins) + .filter((l) => l.handle && l.handle !== 'handle.invalid') + .slice(0, 4) as recentLogin (recentLogin.did)}
'repo:' + collection).join(' '); @@ -14,9 +14,9 @@ function constructScope() { } let blobScope: string | undefined = undefined; - if (Array.isArray(permissions.blobs)) { + if (Array.isArray(permissions.blobs) && permissions.blobs.length > 0) { blobScope = 'blob?' + permissions.blobs.map((b) => 'accept=' + b).join('&'); - } else if (permissions.blobs) { + } else if (permissions.blobs && permissions.blobs.length > 0) { blobScope = 'blob:' + permissions.blobs; } @@ -26,7 +26,7 @@ function constructScope() { export const metadata = { client_id: SITE + resolve('/oauth-client-metadata.json'), - redirect_uris: [SITE + resolve('/oauth/callback')], + redirect_uris: [SITE + resolve(REDIRECT_PATH)], scope: constructScope(), grant_types: ['authorization_code', 'refresh_token'], response_types: ['code'], diff --git a/src/lib/atproto/settings.ts b/src/lib/atproto/settings.ts index 1f67ca4..64795fe 100644 --- a/src/lib/atproto/settings.ts +++ b/src/lib/atproto/settings.ts @@ -46,4 +46,11 @@ export type AllowedCollection = ExtractCollectionBase<(typeof permissions.collec // which PDS to use for signup // ATTENTION: pds.rip is only for development, all accounts get deleted automatically after a week -export const signUpPDS = dev ? 'https://pds.rip/' : 'https://selfhosted.social'; +const devPDS = 'https://pds.rip/'; +const prodPDS = 'https://selfhosted.social/'; +export const signUpPDS = dev ? devPDS : prodPDS; + +// where to redirect after oauth login/signup, e.g. /oauth/callback +export const REDIRECT_PATH = '/oauth/callback'; + +export const DOH_RESOLVER = 'https://mozilla.cloudflare-dns.com/dns-query'; diff --git a/src/lib/cards/FluidTextCard/EditingFluidTextCard.svelte b/src/lib/cards/FluidTextCard/EditingFluidTextCard.svelte index a51f595..12b0d86 100644 --- a/src/lib/cards/FluidTextCard/EditingFluidTextCard.svelte +++ b/src/lib/cards/FluidTextCard/EditingFluidTextCard.svelte @@ -1,5 +1,6 @@ @@ -36,7 +46,7 @@ : ''}" onclick={handleClick} > - {#key item.color} + {#key item.color + '-' + rerender.toString()} {/key} diff --git a/src/lib/website/Controls.svelte b/src/lib/website/Controls.svelte new file mode 100644 index 0000000..131f5fb --- /dev/null +++ b/src/lib/website/Controls.svelte @@ -0,0 +1,123 @@ + + +
+ + + + {#if !isMobile() && !getHideProfileSection(data)} + + {/if} + + + updateTheme(newAccent, newBase)} + /> +
diff --git a/src/lib/website/EditableProfile.svelte b/src/lib/website/EditableProfile.svelte index 94bf558..7465016 100644 --- a/src/lib/website/EditableProfile.svelte +++ b/src/lib/website/EditableProfile.svelte @@ -11,24 +11,6 @@ let { data = $bindable(), hideBlento = false }: { data: WebsiteData; hideBlento?: boolean } = $props(); - let accentColor = $derived(data.publication?.preferences?.accentColor ?? 'pink'); - let baseColor = $derived(data.publication?.preferences?.baseColor ?? 'stone'); - - function updateTheme(newAccent: string, newBase: string) { - data.publication.preferences ??= {}; - data.publication.preferences.accentColor = newAccent; - data.publication.preferences.baseColor = newBase; - data = { ...data }; - } - - let profilePosition = $derived(getProfilePosition(data)); - - function toggleProfilePosition() { - data.publication.preferences ??= {}; - data.publication.preferences.profilePosition = profilePosition === 'side' ? 'top' : 'side'; - data = { ...data }; - } - let fileInput: HTMLInputElement; let isHoveringAvatar = $state(false); @@ -62,7 +44,7 @@ fileInput.click(); } - let isMobile = getIsMobile(); + let profilePosition = $derived(getProfilePosition(data));
-
- - - - {#if !isMobile()} - - {/if} - - - updateTheme(newAccent, newBase)} - /> -
-
{/if} + + {#if showingMobileView}
- {#if getHideProfileSection(data)} -
- - updateTheme(newAccent, newBase)} - /> -
- {/if}