fix: crosspost problems/cleanup for instance hosts

This commit is contained in:
Xylight committed 2025-11-20 18:28:33 -08:00
1 parent b872db9eaf
commit 7c322310e9
4 files changed
+46 -44

No files matched your search

+1 -1
View File
@@ -38,7 +38,7 @@
<EntityHeader
name={site.site.name}
avatar={site.site.icon}
banner={site.site.banner}
banner={site.site.banner ?? null}
compact="always"
avatarCircle={false}
/>
@@ -17,7 +17,7 @@
Trash,
XMark,
} from 'svelte-hero-icons/dist'
import type { PostFormInit } from '../form/postform.svelte'
import { type PostFormInit } from '../form/postform.svelte'
import { hidePost } from '../helpers'
interface Props {
@@ -27,6 +27,21 @@
}
let { post = $bindable(), onhide, editing = $bindable() }: Props = $props()
function crosspostB64() {
return JSON.stringify({
body: `${
settings.crosspostOriginalLink
? `cross-posted from: ${post.post.ap_id}`
: ``
}\n${
post.post.body ? '>' + post.post.body.split('\n').join('\n> ') : ''
}`,
name: post.post.name,
url: post.post.url,
nsfw: post.post.nsfw,
} as PostFormInit)
}
</script>
{#if profile.current?.user && profile.current?.jwt && profile.current.user.local_user_view.person.id == post.creator.id}
@@ -49,20 +64,7 @@
{/if}
{#if profile.current?.jwt}
<MenuButton
href="/create/post?crosspost={btoa(
JSON.stringify({
body: `${
settings.crosspostOriginalLink
? `cross-posted from: ${post.post.ap_id}`
: ``
}\n${
post.post.body ? '>' + post.post.body.split('\n').join('\n> ') : ''
}`,
name: post.post.name,
url: post.post.url,
nsfw: post.post.nsfw,
} as PostFormInit),
)}"
href="/create/post?crosspost={crosspostB64()}"
icon={ArrowTopRightOnSquare}
>
{$t('post.actions.more.crosspost')}
+27 -25
View File
@@ -8,11 +8,11 @@
import Blobs from './Blobs.svelte'
interface Props {
avatar?: string | undefined
avatar?: string
name: string
bio?: string | undefined
banner?: string | undefined
url?: string | undefined
bio?: string
banner?: string | null
url?: string
stats?: {
name: string
value: string | number
@@ -27,11 +27,11 @@
}
let {
avatar = undefined,
avatar,
name,
bio = undefined,
banner = undefined,
url = undefined,
bio,
banner,
url,
stats = [],
class: clazz = '',
nameDetail,
@@ -45,22 +45,24 @@
<div {...rest} class={['z-10 text-sm w-full space-y-4 @container', clazz]}>
<Material padding="xl" rounding="3xl" class="flex flex-col gap-2 @lg:gap-4">
<div
class="relative overflow-hidden rounded-t-[inherit] -m-6 mask-b-from-0 h-32 @lg:h-48"
>
{#if banner}
<img
src={banner}
class="w-full object-cover h-full bg-white dark:bg-zinc-900"
height="192"
alt="User banner"
/>
{:else}
<div class="scale-150 h-full">
<Blobs seed={name} />
</div>
{/if}
</div>
{#if banner !== null}
<div
class="relative overflow-hidden rounded-t-[inherit] -m-6 mask-b-from-0 h-32 @lg:h-48"
>
{#if banner}
<img
src={banner}
class="w-full object-cover h-full bg-white dark:bg-zinc-900"
height="192"
alt="User banner"
/>
{:else}
<div class="scale-150 h-full">
<Blobs seed={name} />
</div>
{/if}
</div>
{/if}
{#snippet icon(width: number)}
<Avatar
@@ -70,7 +72,7 @@
circle={avatarCircle}
class={[
'relative',
'-mt-4 @md:-mt-8',
banner !== null && '-mt-4 @md:-mt-8',
!avatarCircle && 'rounded-xl @md:rounded-3xl!',
]}
/>