diff --git a/package-lock.json b/package-lock.json
index 01f1a064..d3bfb0a6 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -24,6 +24,7 @@
"@tiptap/suggestion": "^2.6.4",
"@types/throttle-debounce": "^5.0.2",
"@welshman/app": "^0.0.7",
+ "@welshman/content": "^0.0.9",
"@welshman/lib": "^0.0.17",
"@welshman/net": "^0.0.22",
"@welshman/signer": "^0.0.5",
@@ -85,6 +86,11 @@
"node": ">=6.0.0"
}
},
+ "node_modules/@braintree/sanitize-url": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/@braintree/sanitize-url/-/sanitize-url-7.1.0.tgz",
+ "integrity": "sha512-o+UlMLt49RvtCASlOMW0AkHnabN9wR9rwCCherxO0yG4Npy34GkvrAqdXQvrhNs+jh+gkK8gB8Lf05qL/O7KWg=="
+ },
"node_modules/@esbuild/aix-ppc64": {
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz",
@@ -1679,6 +1685,15 @@
"nostr-tools": "^2.7.2"
}
},
+ "node_modules/@welshman/content": {
+ "version": "0.0.9",
+ "resolved": "https://registry.npmjs.org/@welshman/content/-/content-0.0.9.tgz",
+ "integrity": "sha512-tmzSRvVmOdet+X9W1vmjqHf4tkyhxotZ0qG7+iVPd7SjRSvuDmq09odT19rQtWn5Pl8mmEREyQgqzTRubDbsxg==",
+ "dependencies": {
+ "@braintree/sanitize-url": "^7.0.2",
+ "nostr-tools": "^2.7.2"
+ }
+ },
"node_modules/@welshman/lib": {
"version": "0.0.17",
"resolved": "https://registry.npmjs.org/@welshman/lib/-/lib-0.0.17.tgz",
diff --git a/package.json b/package.json
index f9bc2b95..423beffb 100644
--- a/package.json
+++ b/package.json
@@ -49,6 +49,7 @@
"@tiptap/suggestion": "^2.6.4",
"@types/throttle-debounce": "^5.0.2",
"@welshman/app": "^0.0.7",
+ "@welshman/content": "^0.0.9",
"@welshman/lib": "^0.0.17",
"@welshman/net": "^0.0.22",
"@welshman/signer": "^0.0.5",
diff --git a/src/app/components/Content.svelte b/src/app/components/Content.svelte
new file mode 100644
index 00000000..a8dbb143
--- /dev/null
+++ b/src/app/components/Content.svelte
@@ -0,0 +1,125 @@
+
+
+
+ {#each shortContent as parsed, i}
+ {#if isNewline(parsed)}
+
+ {:else if isTopic(parsed)}
+
+ {:else if isCode(parsed)}
+
+ {:else if isCashu(parsed) || isInvoice(parsed)}
+
+ {:else if isLink(parsed)}
+ {#if isStartOrEnd(i)}
+
+ {:else}
+
+ {/if}
+ {:else if isProfile(parsed)}
+
+ {:else if isEvent(parsed) || isAddress(parsed)}
+ {#if isStartOrEnd(i) && depth < 2}
+
+
+
+
+
+ {:else}
+
+ {fromNostrURI(parsed.raw).slice(0, 16) + "…"}
+
+ {/if}
+ {:else}
+ {@html renderParsed(parsed)}
+ {/if}
+ {/each}
+
+
+{#if ellipsize}
+ 0}>
+
+
+{/if}
diff --git a/src/app/components/ContentCode.svelte b/src/app/components/ContentCode.svelte
new file mode 100644
index 00000000..89d43ee5
--- /dev/null
+++ b/src/app/components/ContentCode.svelte
@@ -0,0 +1,9 @@
+
+
+
+
+ {value}
+
+
diff --git a/src/app/components/ContentLinkBlock.svelte b/src/app/components/ContentLinkBlock.svelte
new file mode 100644
index 00000000..e8c72d60
--- /dev/null
+++ b/src/app/components/ContentLinkBlock.svelte
@@ -0,0 +1,54 @@
+
+
+
+ {#if url.match(/\.(mov|webm|mp4)$/)}
+
+ {:else if url.match(/\.(jpe?g|png|gif|webp)$/)}
+
+ {:else}
+ {#await loadPreview()}
+
+ {:then preview}
+ {#if preview.image}
+
+ {/if}
+
+ {#if preview.title}
+
+ {preview.title}
+ {ellipsize(preview.description, 140)}
+
+ {/if}
+ {/await}
+ {/if}
+
diff --git a/src/app/components/ContentLinkInline.svelte b/src/app/components/ContentLinkInline.svelte
new file mode 100644
index 00000000..9e53ba06
--- /dev/null
+++ b/src/app/components/ContentLinkInline.svelte
@@ -0,0 +1,14 @@
+
+
+
+
+ {displayUrl(url)}
+
diff --git a/src/app/components/ContentMention.svelte b/src/app/components/ContentMention.svelte
new file mode 100644
index 00000000..290694d3
--- /dev/null
+++ b/src/app/components/ContentMention.svelte
@@ -0,0 +1,16 @@
+
+
+
+ @{displayProfile($profile)}
+
diff --git a/src/app/components/ContentNewline.svelte b/src/app/components/ContentNewline.svelte
new file mode 100644
index 00000000..04078a7d
--- /dev/null
+++ b/src/app/components/ContentNewline.svelte
@@ -0,0 +1,7 @@
+
+
+{#each value as _}
+
+{/each}
diff --git a/src/app/components/ContentQuote.svelte b/src/app/components/ContentQuote.svelte
new file mode 100644
index 00000000..febd9392
--- /dev/null
+++ b/src/app/components/ContentQuote.svelte
@@ -0,0 +1,21 @@
+
+
+
diff --git a/src/app/components/ContentToken.svelte b/src/app/components/ContentToken.svelte
new file mode 100644
index 00000000..c431f7b4
--- /dev/null
+++ b/src/app/components/ContentToken.svelte
@@ -0,0 +1,17 @@
+
+
+
diff --git a/src/app/components/ContentTopic.svelte b/src/app/components/ContentTopic.svelte
new file mode 100644
index 00000000..01ec4947
--- /dev/null
+++ b/src/app/components/ContentTopic.svelte
@@ -0,0 +1,7 @@
+
+
+
+ #{value}
+
diff --git a/src/app/components/NoteCard.svelte b/src/app/components/NoteCard.svelte
new file mode 100644
index 00000000..e21e173b
--- /dev/null
+++ b/src/app/components/NoteCard.svelte
@@ -0,0 +1,16 @@
+
+
+
+
+
+
{formatTimestamp(event.created_at)}
+
+
+
diff --git a/src/app/components/Profile.svelte b/src/app/components/Profile.svelte
new file mode 100644
index 00000000..622d30b2
--- /dev/null
+++ b/src/app/components/Profile.svelte
@@ -0,0 +1,20 @@
+
+
+
+
+
+
{$profileDisplay}
+
{displayPubkey(pubkey)}
+
+
diff --git a/src/app/components/ThreadItem.svelte b/src/app/components/ThreadItem.svelte
index 9b8b4d79..a39e1de1 100644
--- a/src/app/components/ThreadItem.svelte
+++ b/src/app/components/ThreadItem.svelte
@@ -1,31 +1,17 @@
-
-
-
-
-
-
{$profileDisplay}
-
{displayPubkey(root.pubkey)}
-
-
-
{formatTimestamp(root.created_at)}
+
+
+
-
-
+
{#if replies.length > 0}
Show {replies.length} {replies.length === 1 ? "reply" : "replies"}
{/if}
diff --git a/src/app/state.ts b/src/app/state.ts
index d2d630c3..5a02430b 100644
--- a/src/app/state.ts
+++ b/src/app/state.ts
@@ -47,8 +47,28 @@ export const INDEXER_RELAYS = ["wss://purplepag.es/", "wss://relay.damus.io/", "
export const DUFFLEPUD_URL = "https://dufflepud.onrender.com"
+export const IMGPROXY_URL = "https://imgproxy.coracle.social"
+
export const REACTION_KINDS = [REACTION, ZAP_RESPONSE]
+export const dufflepud = (path: string) => DUFFLEPUD_URL + '/' + path
+
+export const imgproxy = (url: string, {w = 640, h = 1024} = {}) => {
+ if (!url || url.match("gif$")) {
+ return url
+ }
+
+ url = url.split("?")[0]
+
+ try {
+ return url ? `${IMGPROXY_URL}/x/s:${w}:${h}/${btoa(url)}` : url
+ } catch (e) {
+ return url
+ }
+}
+
+export const nostr = (entity: string) => `https://coracle.social/${entity}`
+
setContext({
net: getDefaultNetContext(),
app: getDefaultAppContext({
diff --git a/src/lib/editor/EditEvent.svelte b/src/lib/editor/EditEvent.svelte
index 6b21c760..9eb0137e 100644
--- a/src/lib/editor/EditEvent.svelte
+++ b/src/lib/editor/EditEvent.svelte
@@ -4,7 +4,7 @@
import {ellipsize} from "@welshman/lib"
import {type TrustedEvent, fromNostrURI, Address} from "@welshman/util"
import Link from "@lib/components/Link.svelte"
- import {deriveEvent} from "@app/state"
+ import {deriveEvent, nostr} from "@app/state"
export let node: NodeViewProps["node"]
@@ -18,7 +18,7 @@
-
+
{displayEvent($event)}
diff --git a/src/lib/editor/EditMention.svelte b/src/lib/editor/EditMention.svelte
index 68477ef0..79e92b4a 100644
--- a/src/lib/editor/EditMention.svelte
+++ b/src/lib/editor/EditMention.svelte
@@ -5,6 +5,7 @@
import {displayProfile} from "@welshman/util"
import {deriveProfile} from "@welshman/app"
import Link from "@lib/components/Link.svelte"
+ import {nostr} from '@app/state'
export let node: NodeViewProps["node"]
export let selected: NodeViewProps["selected"]
@@ -15,7 +16,7 @@
@{displayProfile($profile)}
diff --git a/src/routes/settings/about/+page.svelte b/src/routes/settings/about/+page.svelte
index ee8453ba..9cc42533 100644
--- a/src/routes/settings/about/+page.svelte
+++ b/src/routes/settings/about/+page.svelte
@@ -2,6 +2,7 @@
import Link from "@lib/components/Link.svelte"
import Icon from "@lib/components/Icon.svelte"
import Button from "@lib/components/Button.svelte"
+ import {nostr} from '@app/state'
const nprofile =
"nprofile1qqsf03c2gsmx5ef4c9zmxvlew04gdh7u94afnknp33qvv3c94kvwxgspz4mhxue69uhhyetvv9ujuerpd46hxtnfduhsz9rhwden5te0wfjkcctev93xcefwdaexwtcpzdmhxue69uhhqatjwpkx2urpvuhx2ue0vamm57"
@@ -33,7 +34,7 @@
Built with 💜 by
- @hodlbod
+ @hodlbod
diff --git a/src/routes/spaces/[nrelay]/threads/+page.svelte b/src/routes/spaces/[nrelay]/threads/+page.svelte
index aa033654..4641e92b 100644
--- a/src/routes/spaces/[nrelay]/threads/+page.svelte
+++ b/src/routes/spaces/[nrelay]/threads/+page.svelte
@@ -51,7 +51,7 @@
data-tip="Create an Event"
on:click={createThread}>
-
+