feat(links): detect invite links in previews

This commit is contained in:
2026-04-08 17:49:36 +05:30
parent 1c8457a4bf
commit 8d4f78ecaf
+12 -1
View File
@@ -6,7 +6,13 @@
import ContentLinkDetail from "@app/components/ContentLinkDetail.svelte"
import ContentLinkBlockImage from "@app/components/ContentLinkBlockImage.svelte"
import {pushModal} from "@app/util/modal"
import {dufflepud, PLATFORM_URL, IMAGE_CONTENT_TYPES, VIDEO_CONTENT_TYPES} from "@app/core/state"
import {
dufflepud,
PLATFORM_URL,
IMAGE_CONTENT_TYPES,
VIDEO_CONTENT_TYPES,
parseInviteLink,
} from "@app/core/state"
import {makeSpacePath} from "@app/util/routes"
const {value, event} = $props()
@@ -14,6 +20,7 @@
let hideImage = $state(false)
const url = value.url.toString()
const inviteData = parseInviteLink(url)
const fileType = getTagValue("file-type", event.tags) || ""
const [href, external] = call(() => {
if (isRelayUrl(url)) return [makeSpacePath(url), false]
@@ -49,6 +56,10 @@
<button type="button" onclick={stopPropagation(preventDefault(expand))}>
<ContentLinkBlockImage {value} {event} class="m-auto max-h-96 rounded-box" />
</button>
{:else if inviteData}
<div class="bg-alt p-4 leading-normal">
<strong>{displayUrl(inviteData.url)}</strong>
</div>
{:else}
{#await loadPreview()}
<div class="center my-12 w-full">