feat: files uploader

This commit is contained in:
codytseng 2024-11-10 01:13:11 +08:00
parent 87dbc33231
commit af04aed6e8
4 changed files with 122 additions and 20 deletions

View file

@ -104,7 +104,7 @@ function preprocess(content: string) {
function isImage(url: string) {
try {
const imageExtensions = ['.jpg', '.jpeg', '.png', '.gif', 'webp', 'heic', 'svg']
const imageExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.webp', '.heic', '.svg']
return imageExtensions.some((ext) => new URL(url).pathname.toLowerCase().endsWith(ext))
} catch {
return false
@ -113,7 +113,7 @@ function isImage(url: string) {
function isVideo(url: string) {
try {
const videoExtensions = ['.mp4', '.webm', '.ogg']
const videoExtensions = ['.mp4', '.webm', '.ogg', '.mov']
return videoExtensions.some((ext) => new URL(url).pathname.toLowerCase().endsWith(ext))
} catch {
return false