Stripped from the internal repo: per-box deploy trees, Go services (nodelist/astmeta/proxy/svxdr), deploy/sync scripts and all secrets. Config templates for nginx, PHP-FPM, Redis and tmpfiles live in install/ with CHANGEME placeholders. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
32 lines
1.1 KiB
PHP
32 lines
1.1 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;
|
|
$tgs[] = [
|
|
'tg' => (int)($o['tg'] ?? 0),
|
|
'name' => (string)($o['name'] ?? ''),
|
|
'system' => (string)($o['system'] ?? ''),
|
|
'allstar' => (string)($o['allstar'] ?? ''),
|
|
'mode' => (string)($o['mode'] ?? ''),
|
|
];
|
|
}
|
|
}
|
|
}
|
|
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);
|