mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
Add Random/Preferred/None modes, preferred provider selection, and provider-order fallback. Catbox/Imgur/PostImages on Android via WebView; Electron CDP automation for Imgur/PostImages. Hide upload controls on web runtime.
13 lines
528 B
TypeScript
13 lines
528 B
TypeScript
/** File extensions that denote direct media URLs (images + videos) */
|
|
const DIRECT_MEDIA_EXTENSIONS = ['.jpg', '.jpeg', '.png', '.gif', '.webp', '.webm', '.mp4', '.mov', '.avi', '.mkv', '.gifv'] as const;
|
|
|
|
/** Returns true if the URL appears to point to a direct media file (image or video) */
|
|
export function isDirectMediaUrl(url: string): boolean {
|
|
try {
|
|
const normalized = url.split('?')[0].toLowerCase();
|
|
return DIRECT_MEDIA_EXTENSIONS.some((ext) => normalized.endsWith(ext));
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|