mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-08 16:28:49 +00:00
nip27: support more image, audio and video extensions.
This commit is contained in:
6
nip27.ts
6
nip27.ts
@@ -131,19 +131,19 @@ export function* parse(content: string | NostrEvent): Iterable<Block> {
|
|||||||
yield { type: 'text', text: content.slice(prevIndex, u - prefixLen) }
|
yield { type: 'text', text: content.slice(prevIndex, u - prefixLen) }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/\.(png|jpe?g|gif|webp)$/i.test(url.pathname)) {
|
if (/\.(png|jpe?g|gif|webp|heic|svg)$/i.test(url.pathname)) {
|
||||||
yield { type: 'image', url: url.toString() }
|
yield { type: 'image', url: url.toString() }
|
||||||
index = end
|
index = end
|
||||||
prevIndex = index
|
prevIndex = index
|
||||||
continue mainloop
|
continue mainloop
|
||||||
}
|
}
|
||||||
if (/\.(mp4|avi|webm|mkv)$/i.test(url.pathname)) {
|
if (/\.(mp4|avi|webm|mkv|mov)$/i.test(url.pathname)) {
|
||||||
yield { type: 'video', url: url.toString() }
|
yield { type: 'video', url: url.toString() }
|
||||||
index = end
|
index = end
|
||||||
prevIndex = index
|
prevIndex = index
|
||||||
continue mainloop
|
continue mainloop
|
||||||
}
|
}
|
||||||
if (/\.(mp3|aac|ogg|opus)$/i.test(url.pathname)) {
|
if (/\.(mp3|aac|ogg|opus|wav|flac)$/i.test(url.pathname)) {
|
||||||
yield { type: 'audio', url: url.toString() }
|
yield { type: 'audio', url: url.toString() }
|
||||||
index = end
|
index = end
|
||||||
prevIndex = index
|
prevIndex = index
|
||||||
|
|||||||
Reference in New Issue
Block a user