diff --git a/src/app/shared/NoteContentKind1.svelte b/src/app/shared/NoteContentKind1.svelte
index 1969813c..28a4a9f2 100644
--- a/src/app/shared/NoteContentKind1.svelte
+++ b/src/app/shared/NoteContentKind1.svelte
@@ -1,5 +1,5 @@
@@ -46,7 +45,7 @@
{:else if type === LINK}
-
+
{:else if type.match(/^nostr:np(rofile|ub)$/)}
{:else if type.startsWith("nostr:") && showMedia && isStartOrEnd(i) && value.id !== anchorId}
diff --git a/src/app/shared/NoteContentKind1063.svelte b/src/app/shared/NoteContentKind1063.svelte
index a414822f..ce0062dd 100644
--- a/src/app/shared/NoteContentKind1063.svelte
+++ b/src/app/shared/NoteContentKind1063.svelte
@@ -1,6 +1,6 @@
{#if url}
-
+
{/if}
diff --git a/src/app/shared/NoteContentKind30023.svelte b/src/app/shared/NoteContentKind30023.svelte
index 0fab55ac..2747f86e 100644
--- a/src/app/shared/NoteContentKind30023.svelte
+++ b/src/app/shared/NoteContentKind30023.svelte
@@ -1,10 +1,10 @@
-
{title}
+
{title}
{#if summary && !showEntire}
{summary}
{/if}
- {#if showMedia && image && canDisplayUrl(image)}
+ {#if showMedia && image && urlIsMedia(image)}
{/if}
{#each tags.topics() as topic}
-
openTopic(topic)}>
+ openTopic(topic)}>
#{topic}
{/each}
diff --git a/src/app/shared/NoteContentKind9802.svelte b/src/app/shared/NoteContentKind9802.svelte
index dd067021..f4f91a78 100644
--- a/src/app/shared/NoteContentKind9802.svelte
+++ b/src/app/shared/NoteContentKind9802.svelte
@@ -1,6 +1,6 @@
-{#if showMedia && value.canDisplay}
+{#if showMedia && value.isMedia}
diff --git a/src/util/notes.ts b/src/util/notes.ts
index 322b1838..7be9a422 100644
--- a/src/util/notes.ts
+++ b/src/util/notes.ts
@@ -14,7 +14,8 @@ export const NOSTR_NPUB = "nostr:npub"
export const NOSTR_NPROFILE = "nostr:nprofile"
export const NOSTR_NADDR = "nostr:naddr"
-export const canDisplayUrl = url => !url.match(/\.(apk|docx|xlsx|csv|dmg)/)
+export const urlIsMedia = url =>
+ !url.match(/\.(apk|docx|xlsx|csv|dmg)/) && last(url.split("://")).includes("/")
export const parseContent = ({content, tags = []}) => {
const result = []
@@ -120,7 +121,7 @@ export const parseContent = ({content, tags = []}) => {
url = "https://" + url
}
- return [LINK, raw, {url, canDisplay: canDisplayUrl(url)}]
+ return [LINK, raw, {url, isMedia: urlIsMedia(url)}]
}
}
@@ -170,8 +171,8 @@ export const truncateContent = (content, {showEntire, maxLength, showMedia = fal
const truncateAt = maxLength * 0.6
content.every((part, i) => {
- const isText = [TOPIC, TEXT].includes(part.type)
- const isMedia = [LINK, INVOICE].includes(part.type) || part.type.startsWith("nostr:")
+ const isText = [TOPIC, TEXT].includes(part.type) || (part.type === LINK && !part.value.isMedia)
+ const isMedia = part.type === INVOICE || part.type.startsWith("nostr:") || part.value.isMedia
if (isText) {
length += part.value.length
@@ -200,5 +201,5 @@ export const truncateContent = (content, {showEntire, maxLength, showMedia = fal
export const getLinks = parts =>
pluck(
"value",
- parts.filter(x => x.type === LINK && x.canDisplay)
+ parts.filter(x => x.type === LINK && x.isMedia)
)