mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-03-17 21:31:43 +01:00
Support embedding media from IPFS
This commit is contained in:
parent
fef6880fe5
commit
3da4c3f6cd
5
.changeset/flat-buses-glow.md
Normal file
5
.changeset/flat-buses-glow.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"nostrudel": patch
|
||||
---
|
||||
|
||||
Support embedding media from IPFS
|
@ -9,15 +9,21 @@ export function isMediaURL(url: string | URL) {
|
||||
}
|
||||
export function isImageURL(url: string | URL) {
|
||||
const u = new URL(url);
|
||||
return IMAGE_EXT.some((ext) => u.pathname.endsWith(ext));
|
||||
const ipfsFilename = u.searchParams.get("filename");
|
||||
|
||||
return IMAGE_EXT.some((ext) => u.pathname.endsWith(ext) || ipfsFilename?.endsWith(ext));
|
||||
}
|
||||
export function isVideoURL(url: string | URL) {
|
||||
const u = new URL(url);
|
||||
return VIDEO_EXT.some((ext) => u.pathname.endsWith(ext));
|
||||
const ipfsFilename = u.searchParams.get("filename");
|
||||
|
||||
return VIDEO_EXT.some((ext) => u.pathname.endsWith(ext) || ipfsFilename?.endsWith(ext));
|
||||
}
|
||||
export function isAudioURL(url: string | URL) {
|
||||
const u = new URL(url);
|
||||
return AUDIO_EXT.some((ext) => u.pathname.endsWith(ext));
|
||||
const ipfsFilename = u.searchParams.get("filename");
|
||||
|
||||
return AUDIO_EXT.some((ext) => u.pathname.endsWith(ext) || ipfsFilename?.endsWith(ext));
|
||||
}
|
||||
|
||||
export function replaceDomain(url: string | URL, replacementUrl: string | URL) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user