Add r-tags to statuses
This commit is contained in:
parent
493a5c9fcf
commit
5de7366ff0
|
@ -1,5 +1,6 @@
|
||||||
import { NostrEvent, NSchema as n } from '@nostrify/nostrify';
|
import { NostrEvent, NSchema as n } from '@nostrify/nostrify';
|
||||||
import ISO6391 from 'iso-639-1';
|
import ISO6391 from 'iso-639-1';
|
||||||
|
import linkify from 'linkifyjs';
|
||||||
import { nip19 } from 'nostr-tools';
|
import { nip19 } from 'nostr-tools';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
|
@ -144,6 +145,12 @@ const createStatusController: AppController = async (c) => {
|
||||||
tags.push(['t', match[1]]);
|
tags.push(['t', match[1]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const link of linkify.find(data.status ?? '')) {
|
||||||
|
if (link.type === 'url' && link.href.startsWith('https://')) {
|
||||||
|
tags.push(['r', link.href]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const mediaUrls: string[] = media
|
const mediaUrls: string[] = media
|
||||||
.map(({ data }) => data.find(([name]) => name === 'url')?.[1])
|
.map(({ data }) => data.find(([name]) => name === 'url')?.[1])
|
||||||
.filter((url): url is string => Boolean(url));
|
.filter((url): url is string => Boolean(url));
|
||||||
|
|
Loading…
Reference in New Issue