rename some files and add nip 94 widget

This commit is contained in:
Ren Amamiya
2023-08-23 15:18:59 +07:00
parent c97c685149
commit 3455eb701f
34 changed files with 145 additions and 35 deletions

View File

@@ -1,3 +0,0 @@
export function isImage(url: string) {
return /\.(jpg|jpeg|gif|png|webp|avif)$/.test(url);
}

11
src/utils/nip94.ts Normal file
View File

@@ -0,0 +1,11 @@
export function fileType(url: string) {
if (url.match(/\.(jpg|jpeg|gif|png|webp|avif)$/)) {
return 'image';
}
if (url.match(/\.(mp4|mov|webm|wmv|flv|mts|avi|ogv|mkv|mp3|m3u8)$/)) {
return 'video';
}
return 'link';
}