mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
Compare commits
4 commits
24ab3a2be0
...
fd1134d8fa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd1134d8fa | ||
|
|
370deac1af | ||
|
|
c79cd80859 | ||
|
|
4594f2dbeb |
5 changed files with 96 additions and 16 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
image: denoland/deno:2.2.2
|
image: denoland/deno:2.3.1
|
||||||
|
|
||||||
default:
|
default:
|
||||||
interruptible: true
|
interruptible: true
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
deno 2.2.2
|
deno 2.3.1
|
||||||
|
|
|
||||||
51
deno.lock
generated
51
deno.lock
generated
|
|
@ -30,6 +30,8 @@
|
||||||
"jsr:@gleasonator/policy@0.9.4": "0.9.4",
|
"jsr:@gleasonator/policy@0.9.4": "0.9.4",
|
||||||
"jsr:@gleasonator/policy@0.9.5": "0.9.5",
|
"jsr:@gleasonator/policy@0.9.5": "0.9.5",
|
||||||
"jsr:@gleasonator/policy@0.9.6": "0.9.6",
|
"jsr:@gleasonator/policy@0.9.6": "0.9.6",
|
||||||
|
"jsr:@gleasonator/policy@0.9.7": "0.9.7",
|
||||||
|
"jsr:@gleasonator/policy@0.9.8": "0.9.8",
|
||||||
"jsr:@hono/hono@^4.4.6": "4.6.15",
|
"jsr:@hono/hono@^4.4.6": "4.6.15",
|
||||||
"jsr:@negrel/http-ece@0.6.0": "0.6.0",
|
"jsr:@negrel/http-ece@0.6.0": "0.6.0",
|
||||||
"jsr:@negrel/webpush@0.3": "0.3.0",
|
"jsr:@negrel/webpush@0.3": "0.3.0",
|
||||||
|
|
@ -42,12 +44,14 @@
|
||||||
"jsr:@nostrify/nostrify@~0.22.4": "0.22.4",
|
"jsr:@nostrify/nostrify@~0.22.4": "0.22.4",
|
||||||
"jsr:@nostrify/nostrify@~0.22.5": "0.22.5",
|
"jsr:@nostrify/nostrify@~0.22.5": "0.22.5",
|
||||||
"jsr:@nostrify/nostrify@~0.39.1": "0.39.1",
|
"jsr:@nostrify/nostrify@~0.39.1": "0.39.1",
|
||||||
|
"jsr:@nostrify/nostrify@~0.46.3": "0.46.3",
|
||||||
"jsr:@nostrify/policies@0.33": "0.33.0",
|
"jsr:@nostrify/policies@0.33": "0.33.0",
|
||||||
"jsr:@nostrify/policies@0.33.1": "0.33.1",
|
"jsr:@nostrify/policies@0.33.1": "0.33.1",
|
||||||
"jsr:@nostrify/policies@0.34": "0.34.0",
|
"jsr:@nostrify/policies@0.34": "0.34.0",
|
||||||
"jsr:@nostrify/policies@0.36": "0.36.0",
|
"jsr:@nostrify/policies@0.36": "0.36.0",
|
||||||
"jsr:@nostrify/policies@~0.33.1": "0.33.1",
|
"jsr:@nostrify/policies@~0.33.1": "0.33.1",
|
||||||
"jsr:@nostrify/policies@~0.36.1": "0.36.1",
|
"jsr:@nostrify/policies@~0.36.1": "0.36.1",
|
||||||
|
"jsr:@nostrify/policies@~0.36.2": "0.36.2",
|
||||||
"jsr:@nostrify/types@0.30": "0.30.1",
|
"jsr:@nostrify/types@0.30": "0.30.1",
|
||||||
"jsr:@nostrify/types@0.35": "0.35.0",
|
"jsr:@nostrify/types@0.35": "0.35.0",
|
||||||
"jsr:@nostrify/types@0.36": "0.36.0",
|
"jsr:@nostrify/types@0.36": "0.36.0",
|
||||||
|
|
@ -128,6 +132,7 @@
|
||||||
"npm:lru-cache@^10.2.2": "10.2.2",
|
"npm:lru-cache@^10.2.2": "10.2.2",
|
||||||
"npm:nostr-tools@2.5.1": "2.5.1",
|
"npm:nostr-tools@2.5.1": "2.5.1",
|
||||||
"npm:nostr-tools@^2.10.4": "2.10.4",
|
"npm:nostr-tools@^2.10.4": "2.10.4",
|
||||||
|
"npm:nostr-tools@^2.13.0": "2.14.2",
|
||||||
"npm:nostr-tools@^2.5.0": "2.5.1",
|
"npm:nostr-tools@^2.5.0": "2.5.1",
|
||||||
"npm:nostr-tools@^2.7.0": "2.7.0",
|
"npm:nostr-tools@^2.7.0": "2.7.0",
|
||||||
"npm:nostr-wasm@0.1": "0.1.0",
|
"npm:nostr-wasm@0.1": "0.1.0",
|
||||||
|
|
@ -334,6 +339,20 @@
|
||||||
"jsr:@nostrify/policies@~0.36.1"
|
"jsr:@nostrify/policies@~0.36.1"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"@gleasonator/policy@0.9.7": {
|
||||||
|
"integrity": "e4f45032683e7433f9b8fb8a38e1ca767bbfb75513dd0600230f85d06d2956d6",
|
||||||
|
"dependencies": [
|
||||||
|
"jsr:@nostrify/nostrify@0.36",
|
||||||
|
"jsr:@nostrify/policies@~0.36.1"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"@gleasonator/policy@0.9.8": {
|
||||||
|
"integrity": "a972b1bc797f5a38f2e71458194c37af075c85e941c04048d208b858100efc52",
|
||||||
|
"dependencies": [
|
||||||
|
"jsr:@nostrify/nostrify@~0.46.3",
|
||||||
|
"jsr:@nostrify/policies@~0.36.2"
|
||||||
|
]
|
||||||
|
},
|
||||||
"@hono/hono@4.4.6": {
|
"@hono/hono@4.4.6": {
|
||||||
"integrity": "aa557ca9930787ee86b9ca1730691f1ce1c379174c2cb244d5934db2b6314453"
|
"integrity": "aa557ca9930787ee86b9ca1730691f1ce1c379174c2cb244d5934db2b6314453"
|
||||||
},
|
},
|
||||||
|
|
@ -535,6 +554,18 @@
|
||||||
"npm:zod"
|
"npm:zod"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"@nostrify/nostrify@0.46.3": {
|
||||||
|
"integrity": "a809b83219c483dff4c87420f54bef7e0f98a438450283be26a167698114fec5",
|
||||||
|
"dependencies": [
|
||||||
|
"jsr:@nostrify/nostrify@~0.46.3",
|
||||||
|
"jsr:@nostrify/types@0.36",
|
||||||
|
"jsr:@std/encoding@~0.224.1",
|
||||||
|
"npm:lru-cache@^10.2.0",
|
||||||
|
"npm:nostr-tools@^2.13.0",
|
||||||
|
"npm:websocket-ts@^2.2.1",
|
||||||
|
"npm:zod"
|
||||||
|
]
|
||||||
|
},
|
||||||
"@nostrify/policies@0.33.0": {
|
"@nostrify/policies@0.33.0": {
|
||||||
"integrity": "c946b06d0527298b4d7c9819d142a10f522ba09eee76c37525aa4acfc5d87aee",
|
"integrity": "c946b06d0527298b4d7c9819d142a10f522ba09eee76c37525aa4acfc5d87aee",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
|
@ -573,6 +604,14 @@
|
||||||
"npm:nostr-tools@^2.7.0"
|
"npm:nostr-tools@^2.7.0"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"@nostrify/policies@0.36.2": {
|
||||||
|
"integrity": "b62c99fadf2d451e68d24ac1643844b953785c45cc170d3aee62b57c60ab9829",
|
||||||
|
"dependencies": [
|
||||||
|
"jsr:@nostrify/nostrify@~0.46.3",
|
||||||
|
"jsr:@nostrify/types@0.36",
|
||||||
|
"npm:nostr-tools@^2.13.0"
|
||||||
|
]
|
||||||
|
},
|
||||||
"@nostrify/types@0.30.0": {
|
"@nostrify/types@0.30.0": {
|
||||||
"integrity": "1f38fa849cff930bd709edbf94ef9ac02f46afb8b851f86c8736517b354616da"
|
"integrity": "1f38fa849cff930bd709edbf94ef9ac02f46afb8b851f86c8736517b354616da"
|
||||||
},
|
},
|
||||||
|
|
@ -1529,6 +1568,18 @@
|
||||||
"nostr-wasm"
|
"nostr-wasm"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"nostr-tools@2.14.2": {
|
||||||
|
"integrity": "sha512-YOIOn5EdJ2Kq5sQW5Zh4wOcqzR6kUyrCDHG4+mVD2szzthsyOTpiWX0yrwaRZGlHJG6q83vkhg95qc2W201XTQ==",
|
||||||
|
"dependencies": [
|
||||||
|
"@noble/ciphers",
|
||||||
|
"@noble/curves@1.2.0",
|
||||||
|
"@noble/hashes@1.3.1",
|
||||||
|
"@scure/base@1.1.1",
|
||||||
|
"@scure/bip32@1.3.1",
|
||||||
|
"@scure/bip39@1.2.1",
|
||||||
|
"nostr-wasm"
|
||||||
|
]
|
||||||
|
},
|
||||||
"nostr-tools@2.5.1": {
|
"nostr-tools@2.5.1": {
|
||||||
"integrity": "sha512-bpkhGGAhdiCN0irfV+xoH3YP5CQeOXyXzUq7SYeM6D56xwTXZCPEmBlUGqFVfQidvRsoVeVxeAiOXW2c2HxoRQ==",
|
"integrity": "sha512-bpkhGGAhdiCN0irfV+xoH3YP5CQeOXyXzUq7SYeM6D56xwTXZCPEmBlUGqFVfQidvRsoVeVxeAiOXW2c2HxoRQ==",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,9 @@ export function contentToHtml(content: string, mentions: MastodonMention[], opts
|
||||||
hashtag: ({ content }) => {
|
hashtag: ({ content }) => {
|
||||||
const tag = content.replace(/^#/, '');
|
const tag = content.replace(/^#/, '');
|
||||||
const href = conf.local(`/tags/${tag}`);
|
const href = conf.local(`/tags/${tag}`);
|
||||||
return html`<a class="mention hashtag" href="${href}" rel="tag"><span>#</span>${tag}</a>`;
|
return html`
|
||||||
|
<a class="mention hashtag" href="${href}" rel="tag"><span>#</span>${tag}</a>
|
||||||
|
`;
|
||||||
},
|
},
|
||||||
url: ({ attributes, content }) => {
|
url: ({ attributes, content }) => {
|
||||||
try {
|
try {
|
||||||
|
|
@ -47,7 +49,10 @@ export function contentToHtml(content: string, mentions: MastodonMention[], opts
|
||||||
const acct = mention?.acct ?? npub;
|
const acct = mention?.acct ?? npub;
|
||||||
const name = mention?.acct ?? npub.substring(0, 8);
|
const name = mention?.acct ?? npub.substring(0, 8);
|
||||||
const href = mention?.url ?? conf.local(`/@${acct}`);
|
const href = mention?.url ?? conf.local(`/@${acct}`);
|
||||||
return html`<span class="h-card"><a class="u-url mention" href="${href}" rel="ugc">@<span>${name}</span></a></span>${extra}`;
|
return html`
|
||||||
|
<span class="h-card"><a class="u-url mention" href="${href}" rel="ugc">@<span
|
||||||
|
>${name}</span></a></span>${extra}
|
||||||
|
`;
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,34 +21,58 @@ export function renderMetadata(url: string, { account, status, instance }: Metad
|
||||||
const height = attachment?.meta?.original?.height;
|
const height = attachment?.meta?.original?.height;
|
||||||
|
|
||||||
if (title) {
|
if (title) {
|
||||||
tags.push(html`<title>${title}</title>`);
|
tags.push(html`
|
||||||
tags.push(html`<meta property="og:title" content="${title}">`);
|
<title>${title}</title>
|
||||||
tags.push(html`<meta name="twitter:title" content="${title}">`);
|
`);
|
||||||
|
tags.push(html`
|
||||||
|
<meta property="og:title" content="${title}">
|
||||||
|
`);
|
||||||
|
tags.push(html`
|
||||||
|
<meta name="twitter:title" content="${title}">
|
||||||
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (description) {
|
if (description) {
|
||||||
tags.push(html`<meta name="description" content="${description}">`);
|
tags.push(html`
|
||||||
tags.push(html`<meta property="og:description" content="${description}">`);
|
<meta name="description" content="${description}">
|
||||||
tags.push(html`<meta name="twitter:description" content="${description}">`);
|
`);
|
||||||
|
tags.push(html`
|
||||||
|
<meta property="og:description" content="${description}">
|
||||||
|
`);
|
||||||
|
tags.push(html`
|
||||||
|
<meta name="twitter:description" content="${description}">
|
||||||
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (image) {
|
if (image) {
|
||||||
tags.push(html`<meta property="og:image" content="${image}">`);
|
tags.push(html`
|
||||||
tags.push(html`<meta name="twitter:image" content="${image}">`);
|
<meta property="og:image" content="${image}">
|
||||||
|
`);
|
||||||
|
tags.push(html`
|
||||||
|
<meta name="twitter:image" content="${image}">
|
||||||
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof width === 'number' && typeof height === 'number') {
|
if (typeof width === 'number' && typeof height === 'number') {
|
||||||
tags.push(html`<meta property="og:image:width" content="${width}">`);
|
tags.push(html`
|
||||||
tags.push(html`<meta property="og:image:height" content="${height}">`);
|
<meta property="og:image:width" content="${width}">
|
||||||
|
`);
|
||||||
|
tags.push(html`
|
||||||
|
<meta property="og:image:height" content="${height}">
|
||||||
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (siteName) {
|
if (siteName) {
|
||||||
tags.push(html`<meta property="og:site_name" content="${siteName}">`);
|
tags.push(html`
|
||||||
|
<meta property="og:site_name" content="${siteName}">
|
||||||
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extra tags (always present if other tags exist).
|
// Extra tags (always present if other tags exist).
|
||||||
if (tags.length > 0) {
|
if (tags.length > 0) {
|
||||||
tags.push(html`<meta property="og:url" content="${url}">`);
|
tags.push(html`
|
||||||
|
<meta property="og:url" content="${url}">
|
||||||
|
`);
|
||||||
tags.push('<meta property="og:type" content="website">');
|
tags.push('<meta property="og:type" content="website">');
|
||||||
tags.push('<meta name="twitter:card" content="summary">');
|
tags.push('<meta name="twitter:card" content="summary">');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue