feat: multi-EPG sources, Personal EPG, auto-migration old config
This commit is contained in:
@@ -34,6 +34,8 @@ This demo runs with a sample XMLTV feed and fake channels to showcase the interf
|
||||
- ▶️ **Built-in HLS player** — click any channel or live program to watch in a PiP overlay
|
||||
- 🔀 **HTTP→HTTPS proxy** — streams Tunarr over HTTP transparently from an HTTPS page
|
||||
- 🎨 **Theme system** — drop a CSS file in `themes/` and it appears in the menu automatically
|
||||
- 📡 **Multi-EPG sources** — configure multiple EPG/M3U sources, switch from the topbar
|
||||
- 👤 **Personal EPG** — optionally let visitors use your instance with their own EPG/M3U
|
||||
- ⚙️ **Guided setup** on first launch — no config files to edit manually
|
||||
- 🔄 **Auto-reload** EPG every 30 minutes
|
||||
- 0️⃣ **Zero JS dependencies** — vanilla PHP, hls.js loaded from CDN
|
||||
@@ -141,9 +143,9 @@ GridTV detects the missing config and automatically redirects you to the setup p
|
||||
|
||||
| Field | Description |
|
||||
|---|---|
|
||||
| **Group name** | Displayed top-left in the topbar (e.g. *MyTV*, *FamilyTV*...) |
|
||||
| **EPG URL (XMLTV)** | Your electronic program guide URL |
|
||||
| **M3U URL** *(optional)* | Your IPTV playlist — used by the built-in player to match channels to streams |
|
||||
| **Group name** | Displayed top-left in the topbar |
|
||||
| **EPG sources** | Add one or more XMLTV sources, each with an optional M3U URL |
|
||||
| **Personal EPG** | Toggle to allow visitors to use your instance with their own EPG/M3U |
|
||||
|
||||
Once submitted, `config.json` is created on the server. **The setup page becomes inaccessible.**
|
||||
|
||||
@@ -158,11 +160,24 @@ nano /var/www/gridtv/config.json
|
||||
```json
|
||||
{
|
||||
"group_name": "MyGroup TV",
|
||||
"epg_sources": [
|
||||
{
|
||||
"name": "Main",
|
||||
"epg_url": "http://192.168.0.3:8000/api/xmltv.xml",
|
||||
"m3u_url": "http://192.168.0.3:8000/api/channels.m3u"
|
||||
},
|
||||
{
|
||||
"name": "Sports",
|
||||
"epg_url": "http://192.168.0.3:8001/api/xmltv.xml",
|
||||
"m3u_url": ""
|
||||
}
|
||||
],
|
||||
"allow_personal_epg": true
|
||||
}
|
||||
```
|
||||
|
||||
> Instances running the old single-source format (`epg_url` at root) are **migrated automatically** on first load — no manual action needed.
|
||||
|
||||
---
|
||||
|
||||
## 📁 Project structure
|
||||
@@ -207,12 +222,20 @@ Drop it in `themes/` — it appears in the theme selector automatically, no code
|
||||
|
||||
---
|
||||
|
||||
## 📡 Multiple EPG Sources
|
||||
|
||||
Configure as many EPG/M3U sources as you want in `config.json`. A dropdown appears in the topbar when more than one source is defined.
|
||||
|
||||
If `allow_personal_epg` is `true`, a **"✏ Personal EPG"** option appears in the dropdown, letting any visitor enter their own XMLTV/M3U URLs. Their choice is saved in `localStorage` — zero server impact.
|
||||
|
||||
---
|
||||
|
||||
## ▶️ Built-in Player
|
||||
|
||||
Click on any **channel name** or **currently airing program** to open a PiP (picture-in-picture) player in the bottom-right corner.
|
||||
|
||||
The player requires:
|
||||
- An **M3U URL** configured in setup (used to match channel names to stream URLs)
|
||||
- An **M3U URL** configured in the active source (used to match channel names to stream URLs)
|
||||
- The **php-curl** extension installed on the server
|
||||
|
||||
If your stream source (e.g. Tunarr) serves streams over HTTP while GridTV runs on HTTPS, `proxy.php` handles the relay transparently — no browser mixed-content errors.
|
||||
|
||||
@@ -1,14 +1,35 @@
|
||||
<?php
|
||||
// GridTV — index.php
|
||||
// Redirige vers setup.php si config.json absent
|
||||
if (!file_exists(__DIR__ . "/config.json")) {
|
||||
$config_path = __DIR__ . "/config.json";
|
||||
|
||||
if (!file_exists($config_path)) {
|
||||
header("Location: setup.php");
|
||||
exit;
|
||||
}
|
||||
$config = json_decode(file_get_contents(__DIR__ . "/config.json"), true);
|
||||
$group_name = htmlspecialchars($config["group_name"] ?? "GridTV");
|
||||
$epg_url = htmlspecialchars($config["epg_url"] ?? "");
|
||||
$m3u_url = htmlspecialchars($config["m3u_url"] ?? "");
|
||||
|
||||
$config = json_decode(file_get_contents($config_path), true);
|
||||
|
||||
// ── Migration automatique ancien format → nouveau ─────────────────────────────
|
||||
if (isset($config['epg_url']) && !isset($config['epg_sources'])) {
|
||||
$config['epg_sources'] = [[
|
||||
'name' => 'Main',
|
||||
'epg_url' => $config['epg_url'],
|
||||
'm3u_url' => $config['m3u_url'] ?? '',
|
||||
]];
|
||||
$config['allow_personal_epg'] = false;
|
||||
unset($config['epg_url'], $config['m3u_url']);
|
||||
file_put_contents($config_path, json_encode($config, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
||||
}
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
$group_name = htmlspecialchars($config['group_name'] ?? 'GridTV');
|
||||
$epg_sources = $config['epg_sources'] ?? [];
|
||||
$allow_personal_epg = !empty($config['allow_personal_epg']);
|
||||
|
||||
// Première source par défaut (pour compatibilité avec le reste du code)
|
||||
$first_source = $epg_sources[0] ?? [];
|
||||
$epg_url = htmlspecialchars($first_source['epg_url'] ?? '');
|
||||
$m3u_url = htmlspecialchars($first_source['m3u_url'] ?? '');
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
@@ -631,6 +652,67 @@ $m3u_url = htmlspecialchars($config["m3u_url"] ?? "");
|
||||
#navBtns { display: none !important; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ── MODAL PERSONAL EPG ─────────────────────────────────────────────────── */
|
||||
.modal-overlay {
|
||||
position: fixed; inset: 0; background: rgba(0,0,0,0.7);
|
||||
z-index: 3000; display: none; align-items: center; justify-content: center;
|
||||
}
|
||||
.modal-overlay.visible { display: flex; }
|
||||
.modal-card {
|
||||
background: var(--surface); border: 1px solid var(--border-bright);
|
||||
padding: 28px; width: 100%; max-width: 420px; margin: 16px;
|
||||
}
|
||||
.modal-title {
|
||||
font-family: var(--font-mono); font-size: 13px; color: var(--accent);
|
||||
letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 6px;
|
||||
}
|
||||
.modal-subtitle { font-size: 12px; color: var(--text-dim); margin-bottom: 20px; line-height: 1.5; }
|
||||
.modal-field { margin-bottom: 14px; }
|
||||
.modal-field label {
|
||||
display: block; font-family: var(--font-mono); font-size: 10px;
|
||||
letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 6px;
|
||||
}
|
||||
.modal-field input {
|
||||
width: 100%; background: var(--surface2); border: 1px solid var(--border-bright);
|
||||
color: var(--text-bright); font-family: var(--font-mono); font-size: 12px;
|
||||
padding: 9px 10px; outline: none; transition: border-color 0.15s;
|
||||
}
|
||||
.modal-field input:focus { border-color: var(--accent); }
|
||||
.modal-field input::placeholder { color: var(--text-dim); opacity: 0.4; }
|
||||
.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }
|
||||
.modal-btn-cancel {
|
||||
background: none; border: 1px solid var(--border-bright); color: var(--text-dim);
|
||||
font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em;
|
||||
text-transform: uppercase; padding: 8px 16px; cursor: pointer; transition: border-color 0.15s;
|
||||
}
|
||||
.modal-btn-cancel:hover { border-color: var(--text-dim); color: var(--text); }
|
||||
.modal-btn-apply {
|
||||
background: var(--accent); border: none; color: #000;
|
||||
font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em;
|
||||
text-transform: uppercase; padding: 8px 20px; cursor: pointer; transition: opacity 0.15s;
|
||||
}
|
||||
.modal-btn-apply:hover { opacity: 0.85; }
|
||||
|
||||
/* ── SOURCE SELECTOR ─────────────────────────────────────────────────────── */
|
||||
.source-select {
|
||||
background: var(--surface2);
|
||||
border: 1px solid var(--border-bright);
|
||||
color: var(--text);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 11px;
|
||||
padding: 5px 8px;
|
||||
cursor: pointer;
|
||||
letter-spacing: 0.06em;
|
||||
height: 28px;
|
||||
outline: none;
|
||||
transition: border-color 0.15s, color 0.15s;
|
||||
max-width: 130px;
|
||||
}
|
||||
.source-select:hover { border-color: var(--accent2); color: var(--accent2); }
|
||||
.source-select option { background: #111; color: #eee; font-family: sans-serif; }
|
||||
|
||||
/* ═══════════════════════════════════════════
|
||||
PLAYER PiP
|
||||
═══════════════════════════════════════════ */
|
||||
@@ -751,6 +833,16 @@ $m3u_url = htmlspecialchars($config["m3u_url"] ?? "");
|
||||
<button class="copy-btn" onclick="copyUrl('m3u')" title="Copier l'URL M3U">M3U</button>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if (count($epg_sources) > 1 || $allow_personal_epg): ?>
|
||||
<select class="source-select" id="sourceSelect" onchange="switchSource(this.value)" title="Source EPG">
|
||||
<?php foreach ($epg_sources as $i => $src): ?>
|
||||
<option value="<?= $i ?>"><?= htmlspecialchars($src['name']) ?></option>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($allow_personal_epg): ?>
|
||||
<option value="personal">✏ Personal EPG</option>
|
||||
<?php endif; ?>
|
||||
</select>
|
||||
<?php endif; ?>
|
||||
<select class="theme-select" id="themeSelect" onchange="setTheme(this.value)" title="Thème">
|
||||
<?php
|
||||
$theme_dir = __DIR__ . '/themes';
|
||||
@@ -809,8 +901,14 @@ foreach ($theme_files as $file) {
|
||||
<div class="mobile-view" id="mobileView"></div>
|
||||
|
||||
<script>
|
||||
const DEFAULT_EPG_URL = '<?= $epg_url ?>';
|
||||
const DEFAULT_M3U_URL = '<?= $m3u_url ?>';
|
||||
const EPG_SOURCES = <?= json_encode(array_values($epg_sources)) ?>;
|
||||
const ALLOW_PERSONAL_EPG = <?= $allow_personal_epg ? 'true' : 'false' ?>;
|
||||
|
||||
// Source active (index)
|
||||
let activeSourceIndex = 0;
|
||||
|
||||
const DEFAULT_EPG_URL = EPG_SOURCES[0]?.epg_url ?? '';
|
||||
const DEFAULT_M3U_URL = EPG_SOURCES[0]?.m3u_url ?? '';
|
||||
const PX_PER_MIN = 5;
|
||||
const GRID_HOURS = 72;
|
||||
const CORS_PROXY = 'https://corsproxy.io/?';
|
||||
@@ -832,7 +930,7 @@ let scrollListenerAdded = false; // sync scroll vertical chaînes
|
||||
function pad(n) { return String(n).padStart(2,'0'); }
|
||||
|
||||
function copyUrl(type) {
|
||||
const url = type === 'epg' ? DEFAULT_EPG_URL : DEFAULT_M3U_URL;
|
||||
const url = type === 'epg' ? currentEpgUrl : currentM3uUrl;
|
||||
if (!url) return;
|
||||
navigator.clipboard.writeText(url).then(() => {
|
||||
const btns = document.querySelectorAll('.copy-btn');
|
||||
@@ -1165,6 +1263,66 @@ function hideTooltip() { document.getElementById('tooltip').classList.remove('vi
|
||||
|
||||
|
||||
|
||||
|
||||
// ── SOURCE SWITCHER ───────────────────────────────────────────────────────────
|
||||
let currentEpgUrl = EPG_SOURCES[0]?.epg_url ?? '';
|
||||
let currentM3uUrl = EPG_SOURCES[0]?.m3u_url ?? '';
|
||||
|
||||
function switchSource(value) {
|
||||
if (value === 'personal') {
|
||||
openPersonalEpgModal();
|
||||
return;
|
||||
}
|
||||
const idx = parseInt(value);
|
||||
const src = EPG_SOURCES[idx];
|
||||
if (!src) return;
|
||||
activeSourceIndex = idx;
|
||||
currentEpgUrl = src.epg_url;
|
||||
currentM3uUrl = src.m3u_url ?? '';
|
||||
localStorage.setItem('gridtv-active-source', idx);
|
||||
loadEPG(currentEpgUrl);
|
||||
if (currentM3uUrl) loadM3U(currentM3uUrl);
|
||||
updateCopyButtons();
|
||||
}
|
||||
|
||||
function updateCopyButtons() {
|
||||
// Rien à faire visuellement, copyUrl() lit currentEpgUrl/currentM3uUrl
|
||||
}
|
||||
|
||||
function openPersonalEpgModal() {
|
||||
const saved_epg = localStorage.getItem('gridtv-personal-epg') ?? '';
|
||||
const saved_m3u = localStorage.getItem('gridtv-personal-m3u') ?? '';
|
||||
const modal = document.getElementById('personalEpgModal');
|
||||
document.getElementById('personalEpgInput').value = saved_epg;
|
||||
document.getElementById('personalM3uInput').value = saved_m3u;
|
||||
modal.classList.add('visible');
|
||||
}
|
||||
|
||||
function closePersonalEpgModal(applied) {
|
||||
document.getElementById('personalEpgModal').classList.remove('visible');
|
||||
// Si annulé (pas applied), remettre le select sur la source précédente
|
||||
if (!applied) {
|
||||
const sel = document.getElementById('sourceSelect');
|
||||
if (sel) sel.value = localStorage.getItem('gridtv-active-source') === 'personal' ? 'personal' : activeSourceIndex;
|
||||
}
|
||||
}
|
||||
|
||||
function applyPersonalEpg() {
|
||||
const epg = document.getElementById('personalEpgInput').value.trim();
|
||||
const m3u = document.getElementById('personalM3uInput').value.trim();
|
||||
if (!epg) { alert('URL EPG obligatoire'); return; }
|
||||
localStorage.setItem('gridtv-personal-epg', epg);
|
||||
localStorage.setItem('gridtv-personal-m3u', m3u);
|
||||
localStorage.setItem('gridtv-active-source', 'personal');
|
||||
currentEpgUrl = epg;
|
||||
currentM3uUrl = m3u;
|
||||
const sel = document.getElementById('sourceSelect');
|
||||
if (sel) sel.value = 'personal';
|
||||
closePersonalEpgModal(true);
|
||||
loadEPG(epg);
|
||||
if (m3u) loadM3U(m3u);
|
||||
}
|
||||
|
||||
// ── M3U PARSER ────────────────────────────────────────────────────────────────
|
||||
function slugify(str) {
|
||||
return str.toLowerCase()
|
||||
@@ -1307,7 +1465,55 @@ window.addEventListener('resize', () => {
|
||||
if (m !== lastMobile) { lastMobile=m; scrollListenerAdded=false; if (channels.length) renderAll(); }
|
||||
});
|
||||
|
||||
window.addEventListener('load', () => { loadEPG(DEFAULT_EPG_URL); loadM3U(DEFAULT_M3U_URL); });
|
||||
window.addEventListener('load', () => {
|
||||
const savedSource = localStorage.getItem('gridtv-active-source');
|
||||
if (savedSource === 'personal') {
|
||||
const epg = localStorage.getItem('gridtv-personal-epg');
|
||||
const m3u = localStorage.getItem('gridtv-personal-m3u') ?? '';
|
||||
if (epg) {
|
||||
currentEpgUrl = epg;
|
||||
currentM3uUrl = m3u;
|
||||
const sel = document.getElementById('sourceSelect');
|
||||
if (sel) sel.value = 'personal';
|
||||
loadEPG(epg);
|
||||
if (m3u) loadM3U(m3u);
|
||||
return;
|
||||
}
|
||||
} else if (savedSource !== null) {
|
||||
const idx = parseInt(savedSource);
|
||||
const src = EPG_SOURCES[idx];
|
||||
if (src) {
|
||||
activeSourceIndex = idx;
|
||||
currentEpgUrl = src.epg_url;
|
||||
currentM3uUrl = src.m3u_url ?? '';
|
||||
const sel = document.getElementById('sourceSelect');
|
||||
if (sel) sel.value = idx;
|
||||
}
|
||||
}
|
||||
loadEPG(currentEpgUrl);
|
||||
loadM3U(currentM3uUrl);
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- MODAL PERSONAL EPG -->
|
||||
<div class="modal-overlay" id="personalEpgModal">
|
||||
<div class="modal-card">
|
||||
<div class="modal-title">✏ Personal EPG</div>
|
||||
<div class="modal-subtitle">Utilisez votre propre source EPG/M3U sur cette instance.</div>
|
||||
<div class="modal-field">
|
||||
<label>URL EPG (XMLTV) *</label>
|
||||
<input type="url" id="personalEpgInput" placeholder="http://mon-serveur/xmltv.xml">
|
||||
</div>
|
||||
<div class="modal-field">
|
||||
<label>URL M3U <span style="opacity:.5;font-size:10px">(optionnel)</span></label>
|
||||
<input type="url" id="personalM3uInput" placeholder="http://mon-serveur/channels.m3u">
|
||||
</div>
|
||||
<div class="modal-actions">
|
||||
<button class="modal-btn-cancel" onclick="closePersonalEpgModal()">Annuler</button>
|
||||
<button class="modal-btn-apply" onclick="applyPersonalEpg()">Appliquer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
<?php
|
||||
// Si config.json existe déjà → on refuse l'accès
|
||||
if (file_exists(__DIR__ . '/config.json')) {
|
||||
// ── Migration automatique ancien format → nouveau ─────────────────────────────
|
||||
$config_path = __DIR__ . '/config.json';
|
||||
|
||||
if (file_exists($config_path)) {
|
||||
$existing = json_decode(file_get_contents($config_path), true);
|
||||
// Vieille instance : epg_url à la racine, pas de epg_sources
|
||||
if (isset($existing['epg_url']) && !isset($existing['epg_sources'])) {
|
||||
$existing['epg_sources'] = [[
|
||||
'name' => 'Main',
|
||||
'epg_url' => $existing['epg_url'],
|
||||
'm3u_url' => $existing['m3u_url'] ?? '',
|
||||
]];
|
||||
$existing['allow_personal_epg'] = false;
|
||||
unset($existing['epg_url'], $existing['m3u_url']);
|
||||
file_put_contents($config_path, json_encode($existing, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
||||
}
|
||||
http_response_code(403);
|
||||
die('Configuration déjà effectuée. Modifiez config.json via SSH pour changer les paramètres.');
|
||||
}
|
||||
@@ -10,31 +24,53 @@ $success = false;
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$group_name = trim($_POST['group_name'] ?? '');
|
||||
$epg_url = trim($_POST['epg_url'] ?? '');
|
||||
$m3u_url = trim($_POST['m3u_url'] ?? '');
|
||||
$allow_personal_epg = isset($_POST['allow_personal_epg']);
|
||||
|
||||
if (empty($group_name) || empty($epg_url)) {
|
||||
$error = 'Le nom du groupe et l\'URL EPG sont obligatoires.';
|
||||
} elseif (!filter_var($epg_url, FILTER_VALIDATE_URL)) {
|
||||
$error = 'L\'URL EPG ne semble pas valide.';
|
||||
} elseif (!empty($m3u_url) && !filter_var($m3u_url, FILTER_VALIDATE_URL)) {
|
||||
$error = 'L\'URL M3U ne semble pas valide.';
|
||||
} else {
|
||||
$config = [
|
||||
'group_name' => $group_name,
|
||||
// Récupérer les sources EPG dynamiques
|
||||
$names = $_POST['source_name'] ?? [];
|
||||
$epg_urls = $_POST['source_epg_url'] ?? [];
|
||||
$m3u_urls = $_POST['source_m3u_url'] ?? [];
|
||||
|
||||
$epg_sources = [];
|
||||
foreach ($names as $i => $name) {
|
||||
$epg_url = trim($epg_urls[$i] ?? '');
|
||||
$m3u_url = trim($m3u_urls[$i] ?? '');
|
||||
if (empty($epg_url)) continue;
|
||||
if (!filter_var($epg_url, FILTER_VALIDATE_URL)) {
|
||||
$error = "URL EPG invalide pour la source « $name »."; break;
|
||||
}
|
||||
if (!empty($m3u_url) && !filter_var($m3u_url, FILTER_VALIDATE_URL)) {
|
||||
$error = "URL M3U invalide pour la source « $name »."; break;
|
||||
}
|
||||
$epg_sources[] = [
|
||||
'name' => trim($name) ?: "Source " . ($i + 1),
|
||||
'epg_url' => $epg_url,
|
||||
'm3u_url' => $m3u_url,
|
||||
];
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
if (empty($group_name)) {
|
||||
$error = 'Le nom du groupe est obligatoire.';
|
||||
} elseif (empty($epg_sources)) {
|
||||
$error = 'Au moins une source EPG est obligatoire.';
|
||||
} else {
|
||||
$config = [
|
||||
'group_name' => $group_name,
|
||||
'epg_sources' => $epg_sources,
|
||||
'allow_personal_epg' => $allow_personal_epg,
|
||||
];
|
||||
$written = file_put_contents(
|
||||
__DIR__ . '/config.json',
|
||||
$config_path,
|
||||
json_encode($config, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)
|
||||
);
|
||||
if ($written === false) {
|
||||
$error = 'Impossible d\'écrire config.json. Vérifiez les permissions du dossier (chmod 775 .).';
|
||||
$error = 'Impossible d\'écrire config.json. Vérifiez les permissions (chmod 775 .).';
|
||||
} else {
|
||||
$success = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
@@ -46,153 +82,133 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
<link href="https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Barlow+Condensed:wght@300;400;600;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
:root {
|
||||
--bg: #0a0b0d;
|
||||
--surface: #111318;
|
||||
--surface2: #181b22;
|
||||
--border: #232733;
|
||||
--border-bright: #2e3444;
|
||||
--accent: #e8c842;
|
||||
--accent2: #4a9eff;
|
||||
--text: #c8cdd8;
|
||||
--text-dim: #5a6070;
|
||||
--text-bright: #eef0f5;
|
||||
--error: #ff4444;
|
||||
--success: #44cc77;
|
||||
--bg: #0a0b0d; --surface: #111318; --surface2: #181b22;
|
||||
--border: #232733; --border-bright: #2e3444;
|
||||
--accent: #e8c842; --accent2: #4a9eff;
|
||||
--text: #c8cdd8; --text-dim: #5a6070; --text-bright: #eef0f5;
|
||||
--error: #ff4444; --success: #44cc77;
|
||||
}
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
html, body {
|
||||
min-height: 100%;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
min-height: 100%; background: var(--bg); color: var(--text);
|
||||
font-family: 'Barlow Condensed', sans-serif;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
display: flex; align-items: flex-start; justify-content: center;
|
||||
}
|
||||
.setup-card {
|
||||
width: 100%;
|
||||
max-width: 520px;
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border-bright);
|
||||
padding: 40px 40px 36px;
|
||||
margin: 40px 16px;
|
||||
width: 100%; max-width: 580px;
|
||||
background: var(--surface); border: 1px solid var(--border-bright);
|
||||
padding: 40px 40px 36px; margin: 40px 16px;
|
||||
}
|
||||
.setup-logo {
|
||||
font-family: 'Share Tech Mono', monospace;
|
||||
font-size: 22px;
|
||||
color: var(--accent);
|
||||
letter-spacing: 0.1em;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 6px;
|
||||
font-family: 'Share Tech Mono', monospace; font-size: 22px;
|
||||
color: var(--accent); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 6px;
|
||||
}
|
||||
.setup-logo span { color: var(--text-dim); margin: 0 6px; }
|
||||
.setup-subtitle {
|
||||
font-size: 13px;
|
||||
color: var(--text-dim);
|
||||
letter-spacing: 0.05em;
|
||||
margin-bottom: 32px;
|
||||
line-height: 1.5;
|
||||
font-size: 13px; color: var(--text-dim); letter-spacing: 0.05em;
|
||||
margin-bottom: 32px; line-height: 1.5;
|
||||
}
|
||||
.form-group {
|
||||
margin-bottom: 22px;
|
||||
.form-group { margin-bottom: 22px; }
|
||||
.section-title {
|
||||
font-family: 'Share Tech Mono', monospace; font-size: 11px;
|
||||
letter-spacing: 0.12em; text-transform: uppercase;
|
||||
color: var(--accent); margin: 32px 0 16px;
|
||||
padding-bottom: 8px; border-bottom: 1px solid var(--border);
|
||||
}
|
||||
label {
|
||||
display: block;
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
color: var(--text-dim);
|
||||
margin-bottom: 7px;
|
||||
font-family: 'Share Tech Mono', monospace;
|
||||
display: block; font-size: 11px; letter-spacing: 0.12em;
|
||||
text-transform: uppercase; color: var(--text-dim);
|
||||
margin-bottom: 7px; font-family: 'Share Tech Mono', monospace;
|
||||
}
|
||||
label .required { color: var(--accent); margin-left: 3px; }
|
||||
label .optional {
|
||||
color: var(--text-dim);
|
||||
font-size: 10px;
|
||||
text-transform: none;
|
||||
letter-spacing: 0;
|
||||
margin-left: 4px;
|
||||
opacity: 0.6;
|
||||
}
|
||||
label .optional { color: var(--text-dim); font-size: 10px; text-transform: none; letter-spacing: 0; margin-left: 4px; opacity: 0.6; }
|
||||
input[type="text"], input[type="url"] {
|
||||
width: 100%;
|
||||
background: var(--surface2);
|
||||
border: 1px solid var(--border-bright);
|
||||
color: var(--text-bright);
|
||||
font-family: 'Share Tech Mono', monospace;
|
||||
font-size: 13px;
|
||||
padding: 10px 12px;
|
||||
outline: none;
|
||||
transition: border-color 0.15s;
|
||||
}
|
||||
input[type="text"]:focus, input[type="url"]:focus {
|
||||
border-color: var(--accent);
|
||||
width: 100%; background: var(--surface2); border: 1px solid var(--border-bright);
|
||||
color: var(--text-bright); font-family: 'Share Tech Mono', monospace;
|
||||
font-size: 13px; padding: 10px 12px; outline: none; transition: border-color 0.15s;
|
||||
}
|
||||
input[type="text"]:focus, input[type="url"]:focus { border-color: var(--accent); }
|
||||
input::placeholder { color: var(--text-dim); opacity: 0.5; }
|
||||
.hint {
|
||||
font-size: 11px;
|
||||
color: var(--text-dim);
|
||||
margin-top: 5px;
|
||||
line-height: 1.4;
|
||||
.hint { font-size: 11px; color: var(--text-dim); margin-top: 5px; line-height: 1.4; }
|
||||
|
||||
/* Sources EPG */
|
||||
.sources-list { display: flex; flex-direction: column; gap: 16px; }
|
||||
.source-block {
|
||||
background: var(--surface2); border: 1px solid var(--border);
|
||||
padding: 16px; position: relative;
|
||||
}
|
||||
.source-block .source-num {
|
||||
font-family: 'Share Tech Mono', monospace; font-size: 10px;
|
||||
color: var(--accent); letter-spacing: 0.1em; margin-bottom: 12px;
|
||||
}
|
||||
.source-fields { display: grid; gap: 10px; }
|
||||
.source-remove {
|
||||
position: absolute; top: 10px; right: 10px;
|
||||
background: none; border: none; color: var(--text-dim);
|
||||
font-size: 16px; cursor: pointer; line-height: 1; padding: 2px 5px;
|
||||
}
|
||||
.source-remove:hover { color: var(--error); }
|
||||
.btn-add-source {
|
||||
width: 100%; background: none; border: 1px dashed var(--border-bright);
|
||||
color: var(--accent2); font-family: 'Barlow Condensed', sans-serif;
|
||||
font-size: 13px; font-weight: 600; letter-spacing: 0.1em;
|
||||
text-transform: uppercase; padding: 10px; cursor: pointer;
|
||||
margin-top: 8px; transition: border-color 0.15s, color 0.15s;
|
||||
}
|
||||
.btn-add-source:hover { border-color: var(--accent2); color: var(--text-bright); }
|
||||
|
||||
/* Toggle personal EPG */
|
||||
.toggle-row {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
background: var(--surface2); border: 1px solid var(--border);
|
||||
padding: 14px 16px; margin-bottom: 22px;
|
||||
}
|
||||
.toggle-label { font-size: 13px; color: var(--text); line-height: 1.4; }
|
||||
.toggle-label small { display: block; font-size: 11px; color: var(--text-dim); margin-top: 2px; }
|
||||
.toggle {
|
||||
position: relative; width: 40px; height: 22px; flex-shrink: 0; margin-left: 16px;
|
||||
}
|
||||
.toggle input { opacity: 0; width: 0; height: 0; }
|
||||
.toggle-slider {
|
||||
position: absolute; inset: 0; background: var(--border-bright);
|
||||
cursor: pointer; transition: background 0.2s; border-radius: 22px;
|
||||
}
|
||||
.toggle-slider:before {
|
||||
content: ''; position: absolute; width: 16px; height: 16px;
|
||||
left: 3px; top: 3px; background: var(--text-dim);
|
||||
transition: transform 0.2s, background 0.2s; border-radius: 50%;
|
||||
}
|
||||
.toggle input:checked + .toggle-slider { background: var(--accent); }
|
||||
.toggle input:checked + .toggle-slider:before { transform: translateX(18px); background: #000; }
|
||||
|
||||
.btn-submit {
|
||||
width: 100%;
|
||||
background: var(--accent);
|
||||
color: #000;
|
||||
border: none;
|
||||
font-family: 'Barlow Condensed', sans-serif;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
padding: 13px;
|
||||
cursor: pointer;
|
||||
margin-top: 8px;
|
||||
transition: opacity 0.15s;
|
||||
width: 100%; background: var(--accent); color: #000; border: none;
|
||||
font-family: 'Barlow Condensed', sans-serif; font-size: 15px; font-weight: 700;
|
||||
letter-spacing: 0.12em; text-transform: uppercase; padding: 13px;
|
||||
cursor: pointer; margin-top: 8px; transition: opacity 0.15s;
|
||||
}
|
||||
.btn-submit:hover { opacity: 0.85; }
|
||||
.alert {
|
||||
padding: 12px 14px;
|
||||
font-size: 13px;
|
||||
margin-bottom: 24px;
|
||||
line-height: 1.5;
|
||||
border-left: 3px solid;
|
||||
padding: 12px 14px; font-size: 13px; margin-bottom: 24px;
|
||||
line-height: 1.5; border-left: 3px solid;
|
||||
}
|
||||
.alert-error { background: rgba(255,68,68,0.08); border-color: var(--error); color: var(--error); }
|
||||
.alert-success { background: rgba(68,204,119,0.08); border-color: var(--success); color: var(--success); }
|
||||
.success-actions {
|
||||
text-align: center;
|
||||
margin-top: 28px;
|
||||
}
|
||||
.alert-success{ background: rgba(68,204,119,0.08); border-color: var(--success); color: var(--success); }
|
||||
.success-actions { text-align: center; margin-top: 28px; }
|
||||
.btn-go {
|
||||
display: inline-block;
|
||||
background: var(--accent);
|
||||
color: #000;
|
||||
font-family: 'Barlow Condensed', sans-serif;
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
padding: 13px 40px;
|
||||
text-decoration: none;
|
||||
transition: opacity 0.15s;
|
||||
display: inline-block; background: var(--accent); color: #000;
|
||||
font-family: 'Barlow Condensed', sans-serif; font-size: 16px; font-weight: 700;
|
||||
letter-spacing: 0.12em; text-transform: uppercase; padding: 13px 40px;
|
||||
text-decoration: none; transition: opacity 0.15s;
|
||||
}
|
||||
.btn-go:hover { opacity: 0.85; }
|
||||
.setup-note {
|
||||
margin-top: 28px;
|
||||
padding-top: 20px;
|
||||
border-top: 1px solid var(--border);
|
||||
font-size: 11px;
|
||||
color: var(--text-dim);
|
||||
line-height: 1.6;
|
||||
margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border);
|
||||
font-size: 11px; color: var(--text-dim); line-height: 1.6;
|
||||
}
|
||||
.setup-note code {
|
||||
font-family: 'Share Tech Mono', monospace;
|
||||
background: var(--surface2);
|
||||
padding: 1px 5px;
|
||||
border: 1px solid var(--border);
|
||||
color: var(--accent2);
|
||||
font-size: 11px;
|
||||
font-family: 'Share Tech Mono', monospace; background: var(--surface2);
|
||||
padding: 1px 5px; border: 1px solid var(--border); color: var(--accent2); font-size: 11px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
@@ -230,21 +246,43 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
<div class="hint">S'affiche en haut à gauche dans la topbar.</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>URL du guide EPG (XMLTV) <span class="required">*</span></label>
|
||||
<input type="url" name="epg_url"
|
||||
value="<?= htmlspecialchars($_POST['epg_url'] ?? '') ?>"
|
||||
placeholder="http://votre-serveur/api/xmltv.xml"
|
||||
required>
|
||||
<div class="hint">URL du fichier XMLTV généré par Tunarr ou autre source.</div>
|
||||
<div class="section-title">Sources EPG</div>
|
||||
|
||||
<div class="sources-list" id="sourcesList">
|
||||
<div class="source-block" data-index="0">
|
||||
<div class="source-num">SOURCE 1</div>
|
||||
<button type="button" class="source-remove" onclick="removeSource(this)" style="display:none">✕</button>
|
||||
<div class="source-fields">
|
||||
<div>
|
||||
<label>Nom de la source</label>
|
||||
<input type="text" name="source_name[]" value="Main" placeholder="Ex: Main, Sports, Films...">
|
||||
</div>
|
||||
<div>
|
||||
<label>URL EPG (XMLTV) <span class="required">*</span></label>
|
||||
<input type="url" name="source_epg_url[]" placeholder="http://votre-serveur/api/xmltv.xml" required>
|
||||
</div>
|
||||
<div>
|
||||
<label>URL M3U <span class="optional">(optionnel)</span></label>
|
||||
<input type="url" name="source_m3u_url[]" placeholder="http://votre-serveur/api/channels.m3u">
|
||||
<div class="hint">Utilisé par le lecteur intégré pour matcher les chaînes.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>URL de la playlist M3U <span class="optional">(optionnel)</span></label>
|
||||
<input type="url" name="m3u_url"
|
||||
value="<?= htmlspecialchars($_POST['m3u_url'] ?? '') ?>"
|
||||
placeholder="http://votre-serveur/api/channels.m3u">
|
||||
<div class="hint">Permet de copier l'URL M3U depuis la topbar du guide.</div>
|
||||
<button type="button" class="btn-add-source" onclick="addSource()">+ Ajouter une source EPG</button>
|
||||
|
||||
<div class="section-title">Options</div>
|
||||
|
||||
<div class="toggle-row">
|
||||
<div class="toggle-label">
|
||||
Autoriser les EPG personnels
|
||||
<small>Les visiteurs peuvent utiliser votre instance avec leur propre EPG/M3U.</small>
|
||||
</div>
|
||||
<label class="toggle">
|
||||
<input type="checkbox" name="allow_personal_epg" id="allowPersonalEpg">
|
||||
<span class="toggle-slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn-submit">Enregistrer la configuration</button>
|
||||
@@ -260,5 +298,56 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let sourceCount = 1;
|
||||
|
||||
function addSource() {
|
||||
sourceCount++;
|
||||
const list = document.getElementById('sourcesList');
|
||||
const div = document.createElement('div');
|
||||
div.className = 'source-block';
|
||||
div.dataset.index = sourceCount - 1;
|
||||
div.innerHTML = `
|
||||
<div class="source-num">SOURCE ${sourceCount}</div>
|
||||
<button type="button" class="source-remove" onclick="removeSource(this)">✕</button>
|
||||
<div class="source-fields">
|
||||
<div>
|
||||
<label>Nom de la source</label>
|
||||
<input type="text" name="source_name[]" placeholder="Ex: Sports, Films...">
|
||||
</div>
|
||||
<div>
|
||||
<label>URL EPG (XMLTV) <span class="required">*</span></label>
|
||||
<input type="url" name="source_epg_url[]" placeholder="http://votre-serveur/api/xmltv.xml">
|
||||
</div>
|
||||
<div>
|
||||
<label>URL M3U <span class="optional">(optionnel)</span></label>
|
||||
<input type="url" name="source_m3u_url[]" placeholder="http://votre-serveur/api/channels.m3u">
|
||||
<div class="hint">Utilisé par le lecteur intégré pour matcher les chaînes.</div>
|
||||
</div>
|
||||
</div>`;
|
||||
list.appendChild(div);
|
||||
updateRemoveButtons();
|
||||
}
|
||||
|
||||
function removeSource(btn) {
|
||||
btn.closest('.source-block').remove();
|
||||
renumberSources();
|
||||
updateRemoveButtons();
|
||||
}
|
||||
|
||||
function renumberSources() {
|
||||
document.querySelectorAll('.source-block').forEach((block, i) => {
|
||||
block.querySelector('.source-num').textContent = `SOURCE ${i + 1}`;
|
||||
});
|
||||
}
|
||||
|
||||
function updateRemoveButtons() {
|
||||
const blocks = document.querySelectorAll('.source-block');
|
||||
blocks.forEach(block => {
|
||||
block.querySelector('.source-remove').style.display = blocks.length > 1 ? '' : 'none';
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user