Documenter release et demo

This commit is contained in:
Johnnybegood90
2026-03-15 04:51:06 +01:00
parent 68f65f84b2
commit ef374b2633
6 changed files with 46 additions and 4 deletions
+25
View File
@@ -69,6 +69,7 @@ if ($mode === 'setup' && $_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['
} else {
$group_name = trim($_POST['group_name'] ?? '');
$allow_personal_epg = isset($_POST['allow_personal_epg']);
$allow_personal_m3u = $allow_personal_epg && isset($_POST['allow_personal_m3u']);
$names = $_POST['source_name'] ?? [];
$epg_urls = $_POST['source_epg_url'] ?? [];
@@ -103,6 +104,7 @@ if ($mode === 'setup' && $_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['
'group_name' => $group_name,
'epg_sources' => $epg_sources,
'allow_personal_epg' => $allow_personal_epg,
'allow_personal_m3u' => $allow_personal_m3u,
'admin_key' => $new_key,
];
$written = file_put_contents($config_path, json_encode($config, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
@@ -119,6 +121,9 @@ if ($mode === 'setup' && $_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['
$prefill_group = $_POST['group_name'] ?? $existing['group_name'] ?? '';
$prefill_sources = $existing['epg_sources'] ?? [];
$prefill_epg = !empty($existing['allow_personal_epg']);
$prefill_personal_m3u = array_key_exists('allow_personal_m3u', $existing)
? !empty($existing['allow_personal_m3u'])
: $prefill_epg;
$submitted_key = trim($_POST['admin_key_input'] ?? $_POST['admin_key_hidden'] ?? '');
?>
<!DOCTYPE html>
@@ -289,6 +294,17 @@ $submitted_key = trim($_POST['admin_key_input'] ?? $_POST['admin_key_hidden']
</label>
</div>
<div class="toggle-row">
<div class="toggle-label">
Allow personal M3U
<small>Lets visitors add their own stream playlist in the Personal EPG modal.</small>
</div>
<label class="toggle">
<input type="checkbox" name="allow_personal_m3u" id="allowPersonalM3u"<?= $prefill_personal_m3u ? ' checked' : '' ?><?= !$prefill_epg ? ' disabled' : '' ?>>
<span class="toggle-slider"></span>
</label>
</div>
<?php if (!$demo_mode): ?>
<button type="submit" class="btn-submit">Save configuration</button>
<?php endif; ?>
@@ -324,6 +340,15 @@ function addSource() {
function removeSource(btn) { btn.closest('.source-block').remove(); renumberSources(); updateRemoveButtons(); }
function renumberSources() { document.querySelectorAll('.source-block').forEach((b,i) => b.querySelector('.source-num').textContent = `SOURCE ${i+1}`); }
function updateRemoveButtons() { const b = document.querySelectorAll('.source-block'); b.forEach(bl => bl.querySelector('.source-remove').style.display = b.length > 1 ? '' : 'none'); }
const allowPersonalEpgToggle = document.getElementById('allowPersonalEpg');
const allowPersonalM3uToggle = document.getElementById('allowPersonalM3u');
function syncPersonalM3uToggle() {
if (!allowPersonalEpgToggle || !allowPersonalM3uToggle) return;
allowPersonalM3uToggle.disabled = !allowPersonalEpgToggle.checked;
if (!allowPersonalEpgToggle.checked) allowPersonalM3uToggle.checked = false;
}
allowPersonalEpgToggle?.addEventListener('change', syncPersonalM3uToggle);
syncPersonalM3uToggle();
</script>
</body>
</html>