Fix: Error 500 on export. Fix: Show health page immediately then load the diag data.
This commit is contained in:
@@ -55,7 +55,7 @@ This demo runs with sample XMLTV feeds to showcase the interface.
|
||||
|
||||
### Requirements
|
||||
|
||||
- A web server running **PHP 8.0+** with **php-curl** extension
|
||||
- A web server running **PHP 8.0+** with **php-curl** and **php-xml** extensions
|
||||
- **Apache** or **Nginx** — or just use **Docker**
|
||||
- An **EPG source in XMLTV format** (e.g. Tunarr, Jellyfin, xTeVe...)
|
||||
- *(Optional)* An **M3U playlist** — required for the built-in player
|
||||
@@ -100,13 +100,13 @@ chmod 775 /var/www/gridtv
|
||||
chown -R www-data:www-data /var/www/gridtv
|
||||
```
|
||||
|
||||
#### 3. Install php-curl
|
||||
#### 3. Install php-curl + php-xml
|
||||
|
||||
The built-in player uses `proxy.php` to relay HTTP streams over HTTPS. This requires the **php-curl** extension:
|
||||
The built-in player uses `proxy.php` to relay HTTP streams over HTTPS, and the admin tools parse XMLTV directly. This requires **php-curl** and **php-xml**:
|
||||
|
||||
```bash
|
||||
# Debian/Ubuntu — adjust version to match your PHP
|
||||
apt install php8.4-curl
|
||||
apt install php8.4-curl php8.4-xml
|
||||
systemctl reload apache2 # or: systemctl reload nginx
|
||||
```
|
||||
|
||||
|
||||
+6
-3
@@ -123,10 +123,13 @@ $sources = array_values($config['epg_sources'] ?? []);
|
||||
$source_index = max(0, min((int) ($_GET['source'] ?? 0), max(count($sources) - 1, 0)));
|
||||
$source = $sources[$source_index] ?? null;
|
||||
$target_day = preg_match('/^\d{4}-\d{2}-\d{2}$/', (string) ($_GET['day'] ?? '')) ? (string) $_GET['day'] : (new DateTimeImmutable('today'))->format('Y-m-d');
|
||||
$layout = in_array((string) ($_GET['layout'] ?? 'cards'), ['cards', 'timeline'], true) ? (string) $_GET['layout'] : 'cards';
|
||||
$limit = in_array((string) ($_GET['limit'] ?? '8'), ['4', '8', 'all'], true) ? (string) $_GET['limit'] : '8';
|
||||
$layout_input = isset($_GET['layout']) ? (string) $_GET['layout'] : 'cards';
|
||||
$limit_input = isset($_GET['limit']) ? (string) $_GET['limit'] : '8';
|
||||
$window_input = isset($_GET['window']) ? (string) $_GET['window'] : 'full';
|
||||
$layout = in_array($layout_input, ['cards', 'timeline'], true) ? $layout_input : 'cards';
|
||||
$limit = in_array($limit_input, ['4', '8', 'all'], true) ? $limit_input : '8';
|
||||
$windows = export_window_definitions($target_day);
|
||||
$window_key = array_key_exists((string) ($_GET['window'] ?? 'full'), $windows) ? (string) $_GET['window'] : 'full';
|
||||
$window_key = array_key_exists($window_input, $windows) ? $window_input : 'full';
|
||||
$window = $windows[$window_key];
|
||||
$slots = export_hour_slots($window['start'], $window['end']->modify('+1 second'));
|
||||
|
||||
|
||||
+153
-93
@@ -9,10 +9,6 @@ function health_status_class(bool $ok): string {
|
||||
return $ok ? 'ok' : 'ko';
|
||||
}
|
||||
|
||||
function health_status_label(bool $ok): string {
|
||||
return $ok ? 'OK' : 'Issue';
|
||||
}
|
||||
|
||||
function health_parse_xmltv(string $xml): array {
|
||||
if (!class_exists('DOMDocument')) {
|
||||
return ['ok' => false, 'error' => 'PHP DOM/XML extension is not installed.'];
|
||||
@@ -84,12 +80,13 @@ function health_format_xmltv_stamp(?string $stamp): string {
|
||||
return $dt->format('d/m/Y H:i');
|
||||
}
|
||||
|
||||
$config_path = gridtv_config_path();
|
||||
$config_exists = file_exists($config_path);
|
||||
$config_writable = $config_exists ? is_writable($config_path) : is_writable(dirname($config_path));
|
||||
$sources = array_values($config['epg_sources'] ?? []);
|
||||
function health_build_payload(array $config, string $locale): array {
|
||||
$config_path = gridtv_config_path();
|
||||
$config_exists = file_exists($config_path);
|
||||
$config_writable = $config_exists ? is_writable($config_path) : is_writable(dirname($config_path));
|
||||
$sources = array_values($config['epg_sources'] ?? []);
|
||||
|
||||
$checks = [
|
||||
$checks = [
|
||||
[
|
||||
'label' => 'Config file',
|
||||
'ok' => $config_exists,
|
||||
@@ -110,15 +107,20 @@ $checks = [
|
||||
'ok' => extension_loaded('curl'),
|
||||
'detail' => extension_loaded('curl') ? 'Extension loaded' : 'Missing php-curl',
|
||||
],
|
||||
[
|
||||
'label' => 'php-xml / DOM',
|
||||
'ok' => class_exists('DOMDocument'),
|
||||
'detail' => class_exists('DOMDocument') ? 'Extension loaded' : 'Missing php-xml / DOM',
|
||||
],
|
||||
[
|
||||
'label' => 'Configured sources',
|
||||
'ok' => count($sources) > 0,
|
||||
'detail' => count($sources) . ' source(s) in config',
|
||||
],
|
||||
];
|
||||
];
|
||||
|
||||
$source_reports = [];
|
||||
foreach ($sources as $index => $source) {
|
||||
$source_reports = [];
|
||||
foreach ($sources as $index => $source) {
|
||||
$epg_url = trim((string) ($source['epg_url'] ?? ''));
|
||||
$m3u_url = trim((string) ($source['m3u_url'] ?? ''));
|
||||
|
||||
@@ -136,11 +138,36 @@ foreach ($sources as $index => $source) {
|
||||
'name' => $source['name'] ?: 'Source ' . ($index + 1),
|
||||
'epg_url' => $epg_url,
|
||||
'm3u_url' => $m3u_url,
|
||||
'epg_host' => gridtv_extract_host($epg_url),
|
||||
'm3u_host' => gridtv_extract_host($m3u_url),
|
||||
'epg_fetch' => $epg_fetch,
|
||||
'epg_stats' => $epg_stats,
|
||||
'm3u_fetch' => $m3u_fetch,
|
||||
'm3u_stats' => $m3u_stats,
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'summary' => [
|
||||
'group_name' => $config['group_name'] ?? 'GridTV',
|
||||
'source_count' => count($sources),
|
||||
'locale' => strtoupper($locale),
|
||||
'config_size' => $config_exists ? gridtv_format_bytes((int) filesize($config_path)) : '0 B',
|
||||
'config_path' => $config_path,
|
||||
],
|
||||
'checks' => $checks,
|
||||
'sources' => $source_reports,
|
||||
'helpers' => [
|
||||
'status_ok' => 'OK',
|
||||
'status_bad' => 'Issue',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
if (isset($_GET['format']) && $_GET['format'] === 'json') {
|
||||
header('Content-Type: application/json; charset=UTF-8');
|
||||
echo json_encode(health_build_payload($config, $locale), JSON_UNESCAPED_SLASHES);
|
||||
exit;
|
||||
}
|
||||
?><!DOCTYPE html>
|
||||
<html lang="<?= htmlspecialchars($locale) ?>">
|
||||
@@ -156,33 +183,17 @@ foreach ($sources as $index => $source) {
|
||||
.hero{display:flex;justify-content:space-between;gap:18px;align-items:flex-end;margin-bottom:24px}
|
||||
.logo{font-family:'Share Tech Mono',monospace;font-size:26px;letter-spacing:.12em;color:var(--accent);text-transform:uppercase}
|
||||
.subtitle{color:var(--muted);font-size:14px;max-width:700px;line-height:1.5}
|
||||
.actions{display:flex;gap:10px;flex-wrap:wrap}
|
||||
.btn{display:inline-flex;align-items:center;gap:8px;padding:11px 14px;border:1px solid var(--border);background:var(--surface);color:var(--text);text-decoration:none;font-size:13px;letter-spacing:.08em;text-transform:uppercase}
|
||||
.btn-primary{background:var(--accent);color:#000;border-color:var(--accent)}
|
||||
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:14px;margin-bottom:22px}
|
||||
.card,.source{background:rgba(19,22,27,.95);border:1px solid var(--border)}
|
||||
.card{padding:16px}
|
||||
.eyebrow{font-family:'Share Tech Mono',monospace;font-size:11px;color:var(--accent2);letter-spacing:.12em;text-transform:uppercase;margin-bottom:10px}
|
||||
.value{font-size:28px;font-weight:700}
|
||||
.small{font-size:13px;color:var(--muted)}
|
||||
.checks{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px;margin-bottom:24px}
|
||||
.check{padding:14px;background:var(--surface);border:1px solid var(--border)}
|
||||
.status{display:inline-flex;align-items:center;gap:8px;font-family:'Share Tech Mono',monospace;font-size:11px;letter-spacing:.1em;text-transform:uppercase}
|
||||
.status::before{content:'';width:10px;height:10px;border-radius:50%}
|
||||
.status.ok{color:var(--ok)}.status.ok::before{background:var(--ok)}
|
||||
.status.ko{color:var(--warn)}.status.ko::before{background:var(--warn)}
|
||||
.source-list{display:grid;gap:18px}
|
||||
.source{padding:20px}
|
||||
.source-head{display:flex;justify-content:space-between;gap:14px;align-items:flex-start;margin-bottom:16px}
|
||||
.source-title{font-size:24px;font-weight:700}
|
||||
.pill{display:inline-block;padding:6px 10px;font-family:'Share Tech Mono',monospace;font-size:11px;letter-spacing:.1em;text-transform:uppercase;background:var(--surface2);border:1px solid var(--border);color:var(--accent2)}
|
||||
.split{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:14px}
|
||||
.panel{padding:16px;background:var(--surface2);border:1px solid var(--border)}
|
||||
.panel h3{margin:0 0 10px;font-size:16px;letter-spacing:.06em;text-transform:uppercase}
|
||||
.kv{display:grid;grid-template-columns:160px 1fr;gap:8px;font-size:14px;line-height:1.45}
|
||||
.kv div:nth-child(odd){color:var(--muted)}
|
||||
.mono{font-family:'Share Tech Mono',monospace;font-size:12px;word-break:break-all}
|
||||
@media (max-width:700px){.hero{flex-direction:column;align-items:flex-start}.kv{grid-template-columns:1fr}}
|
||||
.actions{display:flex;gap:10px;flex-wrap:wrap}.btn{display:inline-flex;align-items:center;gap:8px;padding:11px 14px;border:1px solid var(--border);background:var(--surface);color:var(--text);text-decoration:none;font-size:13px;letter-spacing:.08em;text-transform:uppercase}.btn-primary{background:var(--accent);color:#000;border-color:var(--accent)}
|
||||
.grid,.checks,.source-list{display:grid;gap:14px}.grid{grid-template-columns:repeat(auto-fit,minmax(220px,1fr));margin-bottom:22px}.checks{grid-template-columns:repeat(auto-fit,minmax(220px,1fr));margin-bottom:24px}.source-list{gap:18px}
|
||||
.card,.source,.check{background:rgba(19,22,27,.95);border:1px solid var(--border)}.card,.check,.source{padding:16px}.source{padding:20px}
|
||||
.eyebrow{font-family:'Share Tech Mono',monospace;font-size:11px;color:var(--accent2);letter-spacing:.12em;text-transform:uppercase;margin-bottom:10px}.value{font-size:28px;font-weight:700}.small{font-size:13px;color:var(--muted)}
|
||||
.status{display:inline-flex;align-items:center;gap:8px;font-family:'Share Tech Mono',monospace;font-size:11px;letter-spacing:.1em;text-transform:uppercase}.status::before{content:'';width:10px;height:10px;border-radius:50%}.status.ok{color:var(--ok)}.status.ok::before{background:var(--ok)}.status.ko{color:var(--warn)}.status.ko::before{background:var(--warn)}
|
||||
.source-head{display:flex;justify-content:space-between;gap:14px;align-items:flex-start;margin-bottom:16px}.source-title{font-size:24px;font-weight:700}.pill{display:inline-block;padding:6px 10px;font-family:'Share Tech Mono',monospace;font-size:11px;letter-spacing:.1em;text-transform:uppercase;background:var(--surface2);border:1px solid var(--border);color:var(--accent2)}
|
||||
.split{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:14px}.panel{padding:16px;background:var(--surface2);border:1px solid var(--border)}.panel h3{margin:0 0 10px;font-size:16px;letter-spacing:.06em;text-transform:uppercase}
|
||||
.kv{display:grid;grid-template-columns:160px 1fr;gap:8px;font-size:14px;line-height:1.45}.kv div:nth-child(odd){color:var(--muted)}.mono{font-family:'Share Tech Mono',monospace;font-size:12px;word-break:break-all}
|
||||
.skeleton{position:relative;overflow:hidden}.skeleton::after{content:'';position:absolute;inset:0;background:linear-gradient(90deg,transparent,rgba(255,255,255,.08),transparent);transform:translateX(-100%);animation:shine 1.5s infinite}.skeleton-line{height:16px;background:#1c2430;margin-top:8px}.skeleton-line.short{width:42%}.splash{display:flex;align-items:center;gap:14px;padding:18px 20px;margin-bottom:20px;background:rgba(19,22,27,.95);border:1px solid var(--border)}.spinner{width:22px;height:22px;border:3px solid rgba(94,192,255,.18);border-top-color:var(--accent2);border-radius:50%;animation:spin 1s linear infinite}
|
||||
.hidden{display:none!important}
|
||||
@keyframes spin{to{transform:rotate(360deg)}}@keyframes shine{100%{transform:translateX(100%)}}@media (max-width:700px){.hero{flex-direction:column;align-items:flex-start}.kv{grid-template-columns:1fr}}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -190,7 +201,7 @@ foreach ($sources as $index => $source) {
|
||||
<div class="hero">
|
||||
<div>
|
||||
<div class="logo">GridTV / Health</div>
|
||||
<div class="subtitle">Page de diagnostic admin. Elle vérifie l’état de l’instance, les flux XMLTV/M3U configurés et les signaux qui aident à comprendre vite ce qui coince.</div>
|
||||
<div class="subtitle">Page de diagnostic admin. L’écran apparaît tout de suite, puis les checks XMLTV/M3U se remplissent en arrière-plan.</div>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<a class="btn btn-primary" href="/export.php">Export 24h</a>
|
||||
@@ -199,79 +210,128 @@ foreach ($sources as $index => $source) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid">
|
||||
<div class="card"><div class="eyebrow">Group</div><div class="value"><?= htmlspecialchars($config['group_name'] ?? 'GridTV') ?></div><div class="small">Configured TV group name</div></div>
|
||||
<div class="card"><div class="eyebrow">Sources</div><div class="value"><?= count($sources) ?></div><div class="small">Configured XMLTV sources</div></div>
|
||||
<div class="card"><div class="eyebrow">Locale</div><div class="value"><?= strtoupper(htmlspecialchars($locale)) ?></div><div class="small">Detected UI locale</div></div>
|
||||
<div class="card"><div class="eyebrow">Config Size</div><div class="value"><?= $config_exists ? htmlspecialchars(gridtv_format_bytes(filesize($config_path))) : '0 B' ?></div><div class="small"><?= htmlspecialchars($config_path) ?></div></div>
|
||||
<div class="splash" id="splash">
|
||||
<div class="spinner"></div>
|
||||
<div>
|
||||
<div style="font-size:18px;font-weight:700">Loading diagnostics…</div>
|
||||
<div class="small">Configuration, XMLTV et M3U sont testés en arrière-plan.</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="checks">
|
||||
<?php foreach ($checks as $check): ?>
|
||||
<div class="grid" id="summaryGrid">
|
||||
<div class="card skeleton"><div class="eyebrow">Group</div><div class="skeleton-line"></div><div class="skeleton-line short"></div></div>
|
||||
<div class="card skeleton"><div class="eyebrow">Sources</div><div class="skeleton-line"></div><div class="skeleton-line short"></div></div>
|
||||
<div class="card skeleton"><div class="eyebrow">Locale</div><div class="skeleton-line"></div><div class="skeleton-line short"></div></div>
|
||||
<div class="card skeleton"><div class="eyebrow">Config Size</div><div class="skeleton-line"></div><div class="skeleton-line short"></div></div>
|
||||
</div>
|
||||
|
||||
<div class="checks" id="checksGrid">
|
||||
<div class="check skeleton"><div class="skeleton-line"></div><div class="skeleton-line short"></div></div>
|
||||
<div class="check skeleton"><div class="skeleton-line"></div><div class="skeleton-line short"></div></div>
|
||||
<div class="check skeleton"><div class="skeleton-line"></div><div class="skeleton-line short"></div></div>
|
||||
</div>
|
||||
|
||||
<div class="source-list" id="sourceList">
|
||||
<div class="source skeleton"><div class="skeleton-line"></div><div class="skeleton-line"></div><div class="skeleton-line short"></div></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const healthUrl = '<?= htmlspecialchars(strtok($_SERVER['REQUEST_URI'] ?? '/health.php', '?')) ?>?format=json';
|
||||
|
||||
function statusHtml(ok, labels) {
|
||||
const cls = ok ? 'ok' : 'ko';
|
||||
return `<span class="status ${cls}">${ok ? labels.status_ok : labels.status_bad}</span>`;
|
||||
}
|
||||
|
||||
function renderSummary(summary) {
|
||||
document.getElementById('summaryGrid').innerHTML = `
|
||||
<div class="card"><div class="eyebrow">Group</div><div class="value">${summary.group_name}</div><div class="small">Configured TV group name</div></div>
|
||||
<div class="card"><div class="eyebrow">Sources</div><div class="value">${summary.source_count}</div><div class="small">Configured XMLTV sources</div></div>
|
||||
<div class="card"><div class="eyebrow">Locale</div><div class="value">${summary.locale}</div><div class="small">Detected UI locale</div></div>
|
||||
<div class="card"><div class="eyebrow">Config Size</div><div class="value">${summary.config_size}</div><div class="small">${summary.config_path}</div></div>
|
||||
`;
|
||||
}
|
||||
|
||||
function renderChecks(checks, labels) {
|
||||
document.getElementById('checksGrid').innerHTML = checks.map(check => `
|
||||
<div class="check">
|
||||
<div class="status <?= health_status_class($check['ok']) ?>"><?= health_status_label($check['ok']) ?></div>
|
||||
<div style="font-size:18px;font-weight:700;margin:8px 0 6px"><?= htmlspecialchars($check['label']) ?></div>
|
||||
<div class="small"><?= htmlspecialchars($check['detail']) ?></div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
${statusHtml(check.ok, labels)}
|
||||
<div style="font-size:18px;font-weight:700;margin:8px 0 6px">${check.label}</div>
|
||||
<div class="small">${check.detail}</div>
|
||||
</div>
|
||||
`).join('');
|
||||
}
|
||||
|
||||
<div class="source-list">
|
||||
<?php foreach ($source_reports as $report): ?>
|
||||
function renderSources(sources, labels) {
|
||||
document.getElementById('sourceList').innerHTML = sources.map(report => {
|
||||
const epgHealthy = report.epg_fetch.ok && report.epg_stats.ok;
|
||||
const m3uHealthy = report.m3u_fetch ? report.m3u_fetch.ok : true;
|
||||
const epgRows = epgHealthy ? `
|
||||
<div>Channels</div><div>${report.epg_stats.channels}</div>
|
||||
<div>Programmes</div><div>${report.epg_stats.programmes}</div>
|
||||
<div>Sub-titles</div><div>${report.epg_stats.subtitles}</div>
|
||||
<div>Ratings</div><div>${report.epg_stats.ratings}</div>
|
||||
<div>Categories</div><div>${report.epg_stats.categories}</div>
|
||||
<div>Date tags</div><div>${report.epg_stats.dates}</div>
|
||||
<div>Window</div><div>${report.epg_stats.first_start || '—'} → ${report.epg_stats.last_stop || '—'}</div>
|
||||
<div>Content-Type</div><div>${report.epg_fetch.content_type || '—'}</div>
|
||||
` : `<div>Parse</div><div>${report.epg_stats.error || 'Unable to read XMLTV'}</div>`;
|
||||
|
||||
const m3uRows = !report.m3u_url ? `<div class="small">No M3U URL configured for this source.</div>` : `
|
||||
<div class="kv">
|
||||
<div>Status</div><div>${statusHtml(m3uHealthy, labels)}</div>
|
||||
<div>URL</div><div class="mono">${report.m3u_url}</div>
|
||||
<div>HTTP</div><div>${report.m3u_fetch.status || 0}${report.m3u_fetch.error ? ' · ' + report.m3u_fetch.error : ''}</div>
|
||||
<div>Response time</div><div>${Number(report.m3u_fetch.time_total || 0).toFixed(2)} s</div>
|
||||
${report.m3u_fetch.ok && report.m3u_stats ? `
|
||||
<div>Streams</div><div>${report.m3u_stats.streams}</div>
|
||||
<div>#EXTINF</div><div>${report.m3u_stats.extinf}</div>
|
||||
<div>Content-Type</div><div>${report.m3u_fetch.content_type || '—'}</div>
|
||||
` : `<div>Parse</div><div>Unable to load playlist.</div>`}
|
||||
</div>`;
|
||||
|
||||
return `
|
||||
<section class="source">
|
||||
<div class="source-head">
|
||||
<div>
|
||||
<div class="source-title"><?= htmlspecialchars($report['name']) ?></div>
|
||||
<div class="small">EPG host: <?= htmlspecialchars(gridtv_extract_host($report['epg_url'])) ?: '—' ?><?= $report['m3u_url'] ? ' · M3U host: ' . htmlspecialchars(gridtv_extract_host($report['m3u_url'])) : '' ?></div>
|
||||
<div class="source-title">${report.name}</div>
|
||||
<div class="small">EPG host: ${report.epg_host || '—'}${report.m3u_host ? ' · M3U host: ' + report.m3u_host : ''}</div>
|
||||
</div>
|
||||
<span class="pill"><?= htmlspecialchars($report['epg_fetch']['ok'] && $report['epg_stats']['ok'] ? 'Healthy XMLTV' : 'Check source') ?></span>
|
||||
<span class="pill">${epgHealthy ? 'Healthy XMLTV' : 'Check source'}</span>
|
||||
</div>
|
||||
<div class="split">
|
||||
<div class="panel">
|
||||
<h3>XMLTV</h3>
|
||||
<div class="kv">
|
||||
<div>Status</div><div><span class="status <?= health_status_class($report['epg_fetch']['ok'] && $report['epg_stats']['ok']) ?>"><?= health_status_label($report['epg_fetch']['ok'] && $report['epg_stats']['ok']) ?></span></div>
|
||||
<div>URL</div><div class="mono"><?= htmlspecialchars($report['epg_url']) ?></div>
|
||||
<div>HTTP</div><div><?= htmlspecialchars((string) $report['epg_fetch']['status']) ?><?= $report['epg_fetch']['error'] ? ' · ' . htmlspecialchars($report['epg_fetch']['error']) : '' ?></div>
|
||||
<div>Response time</div><div><?= htmlspecialchars(number_format($report['epg_fetch']['time_total'], 2)) ?> s</div>
|
||||
<?php if ($report['epg_fetch']['ok'] && $report['epg_stats']['ok']): ?>
|
||||
<div>Channels</div><div><?= htmlspecialchars((string) $report['epg_stats']['channels']) ?></div>
|
||||
<div>Programmes</div><div><?= htmlspecialchars((string) $report['epg_stats']['programmes']) ?></div>
|
||||
<div>Sub-titles</div><div><?= htmlspecialchars((string) $report['epg_stats']['subtitles']) ?></div>
|
||||
<div>Ratings</div><div><?= htmlspecialchars((string) $report['epg_stats']['ratings']) ?></div>
|
||||
<div>Categories</div><div><?= htmlspecialchars((string) $report['epg_stats']['categories']) ?></div>
|
||||
<div>Date tags</div><div><?= htmlspecialchars((string) $report['epg_stats']['dates']) ?></div>
|
||||
<div>Window</div><div><?= htmlspecialchars(health_format_xmltv_stamp($report['epg_stats']['first_start'])) ?> → <?= htmlspecialchars(health_format_xmltv_stamp($report['epg_stats']['last_stop'])) ?></div>
|
||||
<div>Content-Type</div><div><?= htmlspecialchars($report['epg_fetch']['content_type'] ?: '—') ?></div>
|
||||
<?php else: ?>
|
||||
<div>Parse</div><div><?= htmlspecialchars($report['epg_stats']['error'] ?? 'Unable to read XMLTV') ?></div>
|
||||
<?php endif; ?>
|
||||
<div>Status</div><div>${statusHtml(epgHealthy, labels)}</div>
|
||||
<div>URL</div><div class="mono">${report.epg_url}</div>
|
||||
<div>HTTP</div><div>${report.epg_fetch.status}${report.epg_fetch.error ? ' · ' + report.epg_fetch.error : ''}</div>
|
||||
<div>Response time</div><div>${Number(report.epg_fetch.time_total).toFixed(2)} s</div>
|
||||
${epgRows}
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel">
|
||||
<h3>M3U</h3>
|
||||
<?php if (!$report['m3u_url']): ?>
|
||||
<div class="small">No M3U URL configured for this source.</div>
|
||||
<?php else: ?>
|
||||
<div class="kv">
|
||||
<div>Status</div><div><span class="status <?= health_status_class((bool) ($report['m3u_fetch']['ok'] ?? false)) ?>"><?= health_status_label((bool) ($report['m3u_fetch']['ok'] ?? false)) ?></span></div>
|
||||
<div>URL</div><div class="mono"><?= htmlspecialchars($report['m3u_url']) ?></div>
|
||||
<div>HTTP</div><div><?= htmlspecialchars((string) ($report['m3u_fetch']['status'] ?? 0)) ?><?= !empty($report['m3u_fetch']['error']) ? ' · ' . htmlspecialchars($report['m3u_fetch']['error']) : '' ?></div>
|
||||
<div>Response time</div><div><?= htmlspecialchars(number_format((float) ($report['m3u_fetch']['time_total'] ?? 0), 2)) ?> s</div>
|
||||
<?php if (!empty($report['m3u_fetch']['ok']) && $report['m3u_stats']): ?>
|
||||
<div>Streams</div><div><?= htmlspecialchars((string) $report['m3u_stats']['streams']) ?></div>
|
||||
<div>#EXTINF</div><div><?= htmlspecialchars((string) $report['m3u_stats']['extinf']) ?></div>
|
||||
<div>Content-Type</div><div><?= htmlspecialchars($report['m3u_fetch']['content_type'] ?: '—') ?></div>
|
||||
<?php else: ?>
|
||||
<div>Parse</div><div>Unable to load playlist.</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
${m3uRows}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}).join('');
|
||||
}
|
||||
|
||||
fetch(healthUrl, {credentials: 'same-origin'})
|
||||
.then(r => r.json())
|
||||
.then(data => {
|
||||
renderSummary(data.summary);
|
||||
renderChecks(data.checks, data.helpers);
|
||||
renderSources(data.sources, data.helpers);
|
||||
document.getElementById('splash').classList.add('hidden');
|
||||
})
|
||||
.catch(err => {
|
||||
document.getElementById('splash').innerHTML = `<div><div style="font-size:18px;font-weight:700;color:#ff6767">Unable to load diagnostics</div><div class="small">${err.message}</div></div>`;
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"version": "1.5.0"
|
||||
"version": "1.6.0"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user