From f643956e855943b021f2db527547972ffcd24daf Mon Sep 17 00:00:00 2001 From: James Xylight Date: Wed, 3 Sep 2025 21:13:27 -0700 Subject: [PATCH 1/8] sec: remove auth for other logins --- src/lib/client/README | 1 - src/lib/lemmy.svelte.ts | 8 ++++++-- src/style/app.css | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) delete mode 100644 src/lib/client/README diff --git a/src/lib/client/README b/src/lib/client/README deleted file mode 100644 index fe092b44..00000000 --- a/src/lib/client/README +++ /dev/null @@ -1 +0,0 @@ -A lot of the code in here was either inspired or modified from https://github.com/aeharding/threadiverse, which is licensed under the AGPL 3.0. \ No newline at end of file diff --git a/src/lib/lemmy.svelte.ts b/src/lib/lemmy.svelte.ts index 632ac4f4..a4eef268 100644 --- a/src/lib/lemmy.svelte.ts +++ b/src/lib/lemmy.svelte.ts @@ -63,8 +63,11 @@ export function client({ if (!instanceURL) instanceURL = profile.current.instance || DEFAULT_INSTANCE_URL - const jwt = auth ? auth : profile.current?.jwt + // we use nullish coealsiaihsa something so that + // we can set auth = '' to remove it + const jwt = auth ?? profile.current?.jwt + // but not here, so that if jwt == '', it doesnt put a bearer const headers = jwt ? { authorization: `Bearer ${jwt}` } : {} return new LemmyHttp(instanceToURL(instanceURL), { @@ -74,6 +77,7 @@ export function client({ }) } +// here for parts where i forgor to switch export function getClient( instanceURL?: string, func?: ( @@ -89,7 +93,7 @@ export async function validateInstance(instance: string): Promise { if (instance == '') return false try { - await getClient(instance).getSite() + await client({ instanceURL: instance, auth: '' }).getSite() return true } catch { diff --git a/src/style/app.css b/src/style/app.css index 5b210d37..626ba25e 100644 --- a/src/style/app.css +++ b/src/style/app.css @@ -11,7 +11,7 @@ --font-display: Inter, system-ui, sans-serif; --font-mono: monospace; - --animate-pop-in: pop-in 0.8s cubic-bezier(0.075, 0.82, 0.165, 1); + --animate-pop-in: pop-in 0.8s cubic-bezier(0.075, 0.82, 0.165, 1) forwards; --ease-cubic: cubic-bezier(0.075, 0.82, 0.165, 1); --spacing-22: 88px; From b76679509d296c986ba705400388d323c68aa370 Mon Sep 17 00:00:00 2001 From: James Xylight Date: Wed, 3 Sep 2025 21:15:01 -0700 Subject: [PATCH 2/8] fix: add margin to fixate to prevent weird looking stuff --- src/lib/components/ui/generic/Fixate.svelte | 2 +- src/routes/search/SearchBar.svelte | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lib/components/ui/generic/Fixate.svelte b/src/lib/components/ui/generic/Fixate.svelte index c01e19e7..7892cc0c 100644 --- a/src/lib/components/ui/generic/Fixate.svelte +++ b/src/lib/components/ui/generic/Fixate.svelte @@ -3,7 +3,7 @@ const placements = { top: 'top-6 lg:top-22', - bottom: 'bottom-22 lg:bottom-6', + bottom: 'bottom-22 lg:bottom-6 mt-6', } interface Props { diff --git a/src/routes/search/SearchBar.svelte b/src/routes/search/SearchBar.svelte index a0c8a0be..2c32d6b9 100644 --- a/src/routes/search/SearchBar.svelte +++ b/src/routes/search/SearchBar.svelte @@ -13,9 +13,7 @@ let searchElement = $state() -
+
Date: Fri, 5 Sep 2025 16:32:23 -0700 Subject: [PATCH 3/8] fix: show more context by default --- src/routes/comment/[instance]/[id]/+page.ts | 5 +---- src/routes/post/[instance]/[id=integer]/+page.ts | 3 ++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/routes/comment/[instance]/[id]/+page.ts b/src/routes/comment/[instance]/[id]/+page.ts index 43624d65..79eabbe2 100644 --- a/src/routes/comment/[instance]/[id]/+page.ts +++ b/src/routes/comment/[instance]/[id]/+page.ts @@ -16,10 +16,7 @@ export async function load({ params, fetch }) { const split = comment.comment_view.comment.path.split('.') - const threadPath = - split.length > 4 - ? comment.comment_view.comment.id - : split.slice(-5).join('.') + const threadPath = split.slice(-5).join('.') redirect( 302, diff --git a/src/routes/post/[instance]/[id=integer]/+page.ts b/src/routes/post/[instance]/[id=integer]/+page.ts index 7ca9b91b..bec05fd0 100644 --- a/src/routes/post/[instance]/[id=integer]/+page.ts +++ b/src/routes/post/[instance]/[id=integer]/+page.ts @@ -26,7 +26,7 @@ interface PartialPost { function buildContext(thread?: string) { let parentId: number | undefined let showContext: boolean = false - const max_depth = 3 + let max_depth = 3 if (thread) { const split = thread.split('.') @@ -35,6 +35,7 @@ function buildContext(thread?: string) { else { parentId = Number(thread.split('.')[0]) showContext = true + max_depth = 5 } } From 63eafdd1e1a23a07da6855bb5a9e05283deea864 Mon Sep 17 00:00:00 2001 From: James Xylight Date: Fri, 5 Sep 2025 16:34:55 -0700 Subject: [PATCH 4/8] design: make pageination more consistent with other floats --- .../lemmy/post/form/PostForm.svelte | 5 +- src/lib/components/ui/Pageination.svelte | 104 +++++++++--------- .../components/ui/layout/pages/Tabs.svelte | 10 +- src/routes/communities/+page.svelte | 5 +- .../(local_user)/password/+layout.svelte | 4 +- src/routes/saved/+page.svelte | 1 + 6 files changed, 70 insertions(+), 59 deletions(-) diff --git a/src/lib/components/lemmy/post/form/PostForm.svelte b/src/lib/components/lemmy/post/form/PostForm.svelte index a20cb529..ec10fcda 100644 --- a/src/lib/components/lemmy/post/form/PostForm.svelte +++ b/src/lib/components/lemmy/post/form/PostForm.svelte @@ -314,10 +314,11 @@
{$t('form.post.community')} + {/if} + + {#if page} +
+ {#key page} +
+ {page} +
+ {/key} +
+ {/if} + - {/if} - - {#if page} -
- {#key page} -
- {page} -
- {/key} -
- {/if} - - - + +{/if} diff --git a/src/lib/components/ui/layout/pages/Tabs.svelte b/src/lib/components/ui/layout/pages/Tabs.svelte index b223e9f6..c5987db7 100644 --- a/src/lib/components/ui/layout/pages/Tabs.svelte +++ b/src/lib/components/ui/layout/pages/Tabs.svelte @@ -13,6 +13,7 @@ buildUrl?: (currentRoute: SvelteURL | undefined, href: string) => string children?: import('svelte').Snippet style?: 'header' | 'subpage' + margin?: boolean } let { @@ -21,6 +22,7 @@ buildUrl = (_, href) => href, children, style = 'header', + margin = true, }: Props = $props() let matchType = $derived<('search' | 'pathname')[]>( @@ -53,10 +55,12 @@ - -{#if style == 'subpage'} -
-{/if} diff --git a/src/routes/communities/+page.svelte b/src/routes/communities/+page.svelte index c06ee075..3fc22943 100644 --- a/src/routes/communities/+page.svelte +++ b/src/routes/communities/+page.svelte @@ -17,6 +17,7 @@ import { expoOut } from 'svelte/easing' import { fly } from 'svelte/transition' import SearchBar from '../search/SearchBar.svelte' + import Fixate from '$lib/components/ui/generic/Fixate.svelte' let { data } = $props() @@ -157,10 +158,10 @@ {/if} {#if data.communities.value.length > 0} -
+ `?page=${c}`} /> -
+ {/if} diff --git a/src/routes/profile/(local_user)/password/+layout.svelte b/src/routes/profile/(local_user)/password/+layout.svelte index 09bdc155..c8bbb10c 100644 --- a/src/routes/profile/(local_user)/password/+layout.svelte +++ b/src/routes/profile/(local_user)/password/+layout.svelte @@ -35,9 +35,11 @@
{routes.find(r => page.url.pathname == r.href)?.name ?? $t('routes.profile.credentials')} + {#snippet extended()} + + {/snippet}
-
{:else} From d30a77a6a1784889dd11a5c8573e4e072ae78e5c Mon Sep 17 00:00:00 2001 From: James Xylight Date: Fri, 5 Sep 2025 16:45:36 -0700 Subject: [PATCH 5/8] design: improve top community results --- .../components/lemmy/community/CommunityItem.svelte | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/lib/components/lemmy/community/CommunityItem.svelte b/src/lib/components/lemmy/community/CommunityItem.svelte index 80cafc4d..caf44159 100644 --- a/src/lib/components/lemmy/community/CommunityItem.svelte +++ b/src/lib/components/lemmy/community/CommunityItem.svelte @@ -54,7 +54,7 @@
@@ -63,7 +63,7 @@ community.community.name, community.community.actor_id, )}" - class="flex-1 w-full overflow-hidden" + class="flex-1 w-full overflow-hidden group" data-sveltekit-preload-data="tap" >
@@ -88,7 +88,9 @@
- {community.community.title} +

+ {community.community.title} +

{#if community.community.deleted} {/if}
-
+
{new URL(community.community.actor_id).hostname} From 383e6268f28c8246b8d5c7c4fdd688f2381e63ba Mon Sep 17 00:00:00 2001 From: James Xylight Date: Fri, 5 Sep 2025 20:35:07 -0700 Subject: [PATCH 6/8] design: remove title text-balance because issue #645 was brutally honest and now i feel kinda bad --- src/lib/components/lemmy/post/PostMeta.svelte | 2 +- src/lib/mono/toast/Toast.svelte | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/components/lemmy/post/PostMeta.svelte b/src/lib/components/lemmy/post/PostMeta.svelte index 58c7337b..3a7f0048 100644 --- a/src/lib/components/lemmy/post/PostMeta.svelte +++ b/src/lib/components/lemmy/post/PostMeta.svelte @@ -342,7 +342,7 @@

Date: Fri, 5 Sep 2025 20:59:09 -0700 Subject: [PATCH 7/8] fix: hide create community for instances where that is disabled --- src/lib/components/lemmy/post/Post.svelte | 2 +- src/lib/mono/index.ts | 1 + src/lib/mono/loader/TextLoader.svelte | 42 +++++++++++++++++++++++ src/routes/create/+layout.svelte | 29 +++++++++------- src/routes/create/post/+page.svelte | 9 +---- src/routes/search/+page.svelte | 7 ++-- src/routes/u/[name]/+page.ts | 9 +++-- 7 files changed, 70 insertions(+), 29 deletions(-) create mode 100644 src/lib/mono/loader/TextLoader.svelte diff --git a/src/lib/components/lemmy/post/Post.svelte b/src/lib/components/lemmy/post/Post.svelte index 84f2a05e..62e982aa 100644 --- a/src/lib/components/lemmy/post/Post.svelte +++ b/src/lib/components/lemmy/post/Post.svelte @@ -78,7 +78,7 @@ -->
+ import type { Snippet } from 'svelte' + + interface Props { + children: Snippet + } + + let { children }: Props = $props() + + +
+ {@render children?.()} +
+ + diff --git a/src/routes/create/+layout.svelte b/src/routes/create/+layout.svelte index aff9ef0e..2c1686a1 100644 --- a/src/routes/create/+layout.svelte +++ b/src/routes/create/+layout.svelte @@ -1,4 +1,5 @@