- lastheard 24h: client-side paginering (lib/pager.js), dynamisk sidstorlek - lastheard: separat live-feed (lastheard_live_view.js), 24h loggar varje key-up - listen_view.js + auth/admin_listen.*: Listen Live - genomgående UI/auth-uppdateringar synkade från dev Inga hårdkodade secrets/IP/login — endast hostnamn.
35 lines
1.3 KiB
PHP
35 lines
1.3 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
require __DIR__ . '/auth/lib.php';
|
|
|
|
// Public canonical TG list. Reads the SVX JSON file (source of truth; DMR is
|
|
// Redis, not this). No auth — the URL every box/program fetches. The internal
|
|
// 'owner'/'admins' fields are NOT exposed here (edit-authority, not display).
|
|
|
|
$p = cfg()['tglist_file'] ?? '/etc/svxlink/tglist.json';
|
|
$tgs = [];
|
|
if (is_string($p) && is_file($p)) {
|
|
$raw = @file_get_contents($p);
|
|
$j = json_decode((string)$raw, true);
|
|
if (is_array($j) && isset($j['tgs']) && is_array($j['tgs'])) {
|
|
foreach ($j['tgs'] as $o) {
|
|
if (!is_array($o)) continue;
|
|
$lv = strtolower(trim((string)($o['listen'] ?? 'free')));
|
|
if (!in_array($lv, ['free', 'members', 'off'], true)) $lv = 'free';
|
|
$tgs[] = [
|
|
'tg' => (int)($o['tg'] ?? 0),
|
|
'name' => (string)($o['name'] ?? ''),
|
|
'system' => (string)($o['system'] ?? ''),
|
|
'allstar' => (string)($o['allstar'] ?? ''),
|
|
'mode' => (string)($o['mode'] ?? ''),
|
|
'listen' => $lv, // Listen Live access level (free/members/off)
|
|
];
|
|
}
|
|
}
|
|
}
|
|
usort($tgs, fn($a, $b) => $a['tg'] <=> $b['tg']);
|
|
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
header('Cache-Control: public, max-age=60');
|
|
echo json_encode(['ok' => true, 'count' => count($tgs), 'tgs' => $tgs], JSON_UNESCAPED_SLASHES);
|