Adjusting comments into files.

This commit is contained in:
Johnnybegood90
2026-03-14 04:23:44 +01:00
parent 062954a780
commit 8dabd2d190
19 changed files with 69 additions and 73 deletions
+5 -6
View File
@@ -1,8 +1,8 @@
// ── M3U PARSER ────────────────────────────────────────────────────────────────
function slugify(str) {
return str.toLowerCase()
.replace(/^\d+\s*/, '') // virer le numéro de chaîne en début
.replace(/[^a-z0-9]/g, ''); // garder que alphanum
.replace(/^\d+\s*/, '') // Strip any leading channel number.
.replace(/[^a-z0-9]/g, ''); // Keep only alphanumeric characters.
}
async function loadM3U(url) {
@@ -25,7 +25,7 @@ function parseM3U(text) {
for (let i = 0; i < lines.length; i++) {
const line = lines[i].trim();
if (line.startsWith('#EXTINF')) {
// Extraire le nom : dernière partie après la virgule
// Extract the display name from the last comma-separated segment.
const comma = line.lastIndexOf(',');
currentName = comma !== -1 ? line.slice(comma + 1).trim() : null;
} else if (line && !line.startsWith('#') && currentName) {
@@ -42,16 +42,15 @@ function getStreamUrl(channelName) {
if (m3uStreams[slug]) {
url = m3uStreams[slug];
} else {
// Fallback : chercher une clé qui contient le slug ou l'inverse
// Fallback: try a partial match in either direction.
for (const [key, u] of Object.entries(m3uStreams)) {
if (key.includes(slug) || slug.includes(key)) { url = u; break; }
}
}
if (!url) return null;
// Passer par proxy.php pour éviter le mixed content HTTP/HTTPS
// Route plain HTTP streams through proxy.php to avoid mixed-content issues.
if (url.startsWith('http://')) {
return 'proxy.php?url=' + encodeURIComponent(url);
}
return url;
}