feat: Introduce the Shaarli Professional theme with new templates, styles, scripts, and updated documentation.
This commit is contained in:
@@ -1140,30 +1140,19 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
'.mp3', '.mp4', '.ogg', '.webm', '.m3u8', '.flac', '.wav', '.aac',
|
||||
'.m4a', '.opus', '.wma', '.oga', '.m3u', '.pls'
|
||||
];
|
||||
const STREAM_PATTERNS = [
|
||||
'icecast', 'shoutcast', 'stream', 'radio', 'listen', 'audio',
|
||||
'/live', '.stream'
|
||||
];
|
||||
|
||||
function isMediaUrl(url) {
|
||||
if (!url) return false;
|
||||
const lower = url.toLowerCase();
|
||||
// Check file extensions
|
||||
// Strip query params and fragment for cleaner extension matching
|
||||
const pathname = lower.split('?')[0].split('#')[0];
|
||||
// Check file extensions at end of path
|
||||
for (const ext of MEDIA_EXTENSIONS) {
|
||||
if (lower.includes(ext)) return true;
|
||||
if (pathname.endsWith(ext)) return true;
|
||||
}
|
||||
// Check streaming patterns
|
||||
for (const pattern of STREAM_PATTERNS) {
|
||||
if (lower.includes(pattern) && (lower.includes('http') || lower.includes('//'))) {
|
||||
// Must also look like an audio/stream URL (not just any page about audio)
|
||||
if (lower.endsWith('.mp3') || lower.endsWith('.ogg') || lower.endsWith('.m3u8') ||
|
||||
lower.endsWith('.aac') || lower.endsWith('.flac') || lower.endsWith('.m4a') ||
|
||||
lower.endsWith('.wav') || lower.endsWith('.opus') || lower.endsWith('.pls') ||
|
||||
lower.endsWith('.m3u') || lower.includes('.mp3') || lower.includes('.ogg') ||
|
||||
lower.includes('stream') || lower.includes('icecast') || lower.includes('listen')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Check streaming URL patterns (path-segment matching)
|
||||
if (/\/(stream|listen|live|icecast|shoutcast)(\/|$|\?)/i.test(url)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user