sync från dev (svx-web): utloggningsfixar, lastheard utan trunk-eko, svxdr på egen Redis
- auth/footer.php: libs saknades på auth/*.php-sidorna, så utloggning gick inte (dev 338b139) - auth/lib.php, index.html: cache-bust auth_ui-paret + skydda start_session (dev 052a319) - svxdr/nodelist: lastheard loggar bara riktiga avsändaren, inte utgående trunk-eko (dev e05fa7c) - install/svxdr.json.example: socket = /run/redis-svxportal/redis.sock, samma dedikerade Redis som auth/config.php enligt INSTALL.md (motsvarar dev 5d99683) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
42f2fb0742
commit
d1ed13c04d
5 files changed
+48
-4
No files matched your search
@@ -4,6 +4,10 @@
|
||||
© 2026 SA7AUX. All rights reserved.
|
||||
</footer>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<!-- auth_ui.js needs apiFetch (lib/api.js) + window.authLogout (lib/auth_ui.js);
|
||||
load them FIRST so doLogout/checkSession on auth/*.php pages work. -->
|
||||
<script src="/lib/api.js?v=<?= @filemtime(dirname(__DIR__) . '/lib/api.js') ?>"></script>
|
||||
<script src="/lib/auth_ui.js?v=<?= @filemtime(dirname(__DIR__) . '/lib/auth_ui.js') ?>"></script>
|
||||
<script src="/auth_ui.js?v=<?= @filemtime(dirname(__DIR__) . '/auth_ui.js') ?>"></script>
|
||||
<?= $extra_scripts ?? '' ?>
|
||||
</body>
|
||||
|
||||
+6
-1
@@ -71,6 +71,11 @@ function token_hash(string $secret): string {
|
||||
}
|
||||
|
||||
function start_session(): void {
|
||||
// Already started → nothing to configure (session_name /
|
||||
// session_set_cookie_params fatal-warn when the session is active, which
|
||||
// on display_errors=on leaks output before setcookie()/header() and breaks
|
||||
// logout's cookie-clear + redirect). Guard the whole config block.
|
||||
if (session_status() === PHP_SESSION_ACTIVE) return;
|
||||
$s = cfg()['session'];
|
||||
$params = session_get_cookie_params();
|
||||
session_name($s['name'] ?? 'svxportal_sess');
|
||||
@@ -82,7 +87,7 @@ function start_session(): void {
|
||||
'httponly' => true,
|
||||
'samesite' => $s['cookie_samesite'] ?? 'Lax',
|
||||
]);
|
||||
if (session_status() !== PHP_SESSION_ACTIVE) session_start();
|
||||
session_start();
|
||||
}
|
||||
|
||||
function set_session_user(string $uuid): void {
|
||||
|
||||
+2
-2
@@ -514,7 +514,7 @@
|
||||
<script src="lib/ui_msg.js?v=20260922a" defer></script>
|
||||
<script src="lib/pager.js?v=20260922a" defer></script>
|
||||
<script src="lib/changelog.js?v=20260922a" defer></script>
|
||||
<script src="lib/auth_ui.js?v=20260922a" defer></script>
|
||||
<script src="lib/auth_ui.js?v=20261024a" defer></script>
|
||||
<script src="lib/fmt.js?v=20260922a" defer></script>
|
||||
<script src="lib/ui_list.js?v=20260922a" defer></script>
|
||||
<script src="lib/ui_field.js?v=20260922a" defer></script>
|
||||
@@ -529,7 +529,7 @@
|
||||
<script src="talker_view.js?v=20260720a" defer></script>
|
||||
<script src="ctcss_view.js?v=20260704e" defer></script>
|
||||
<script src="tgmon_view.js?v=20260826a" defer></script>
|
||||
<script src="auth_ui.js?v=20260717a" defer></script>
|
||||
<script src="auth_ui.js?v=20261024a" defer></script>
|
||||
<script src="app.js?v=20260728a" defer></script>
|
||||
|
||||
<!-- Color edit — pick each part of the "Color" theme with a colour swatch.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"xlink": false
|
||||
},
|
||||
"redis": {
|
||||
"socket": "/run/redis/redis.sock",
|
||||
"socket": "/run/redis-svxportal/redis.sock",
|
||||
"password": "CHANGEME",
|
||||
"db": 0,
|
||||
"status_key": "/registry/svxlink/status/json",
|
||||
|
||||
@@ -3964,6 +3964,14 @@ func logTailer(rdb *redis.Client, path string) {
|
||||
}()
|
||||
|
||||
active := map[string]liveTalker{} // key: callsign|tg
|
||||
// A TG carries one talker at a time, so a trunk talker-start that overlaps a
|
||||
// local (client) talker on the same TG is our OWN outbound transmission being
|
||||
// forwarded to the trunk — not an inbound talker. Log only the real sender
|
||||
// (the local client) and drop the trunk echo; its matching stop is swallowed
|
||||
// too. A trunk talker with no concurrent local talker is a genuine inbound
|
||||
// (the remote/AllStar side is the sender) and is logged as before.
|
||||
localByTG := map[int]int{} // active non-trunk (client) talkers per TG
|
||||
dropped := map[string]bool{} // trunk starts suppressed as outbound echo
|
||||
keyOf := func(cs string, tg int) string { return fmt.Sprintf("%s|%d", cs, tg) }
|
||||
|
||||
mkLive := func(ev talkerLogEvent) liveTalker {
|
||||
@@ -4064,8 +4072,20 @@ func logTailer(rdb *redis.Client, path string) {
|
||||
}
|
||||
k := keyOf(ev.Callsign, ev.TG)
|
||||
if !ev.IsStop {
|
||||
if ev.IsTrunk && localByTG[ev.TG] > 0 {
|
||||
dropped[k] = true // outbound echo of a local talker → not logged
|
||||
continue
|
||||
}
|
||||
active[k] = mkLive(ev)
|
||||
if !ev.IsTrunk {
|
||||
localByTG[ev.TG]++
|
||||
}
|
||||
} else if dropped[k] {
|
||||
delete(dropped, k)
|
||||
} else if st, was := active[k]; was {
|
||||
if !st.IsTrunk && localByTG[ev.TG] > 0 {
|
||||
localByTG[ev.TG]--
|
||||
}
|
||||
if !existing[st.StartTs] { // already persisted by a previous run → don't duplicate
|
||||
emit(st, ev.TG, ev.Ts)
|
||||
}
|
||||
@@ -4101,15 +4121,30 @@ func logTailer(rdb *redis.Client, path string) {
|
||||
if ev, ok := parseTalkerLogLine(line); ok {
|
||||
k := keyOf(ev.Callsign, ev.TG)
|
||||
if !ev.IsStop {
|
||||
if ev.IsTrunk && localByTG[ev.TG] > 0 {
|
||||
dropped[k] = true // outbound echo of a local talker → not logged
|
||||
continue
|
||||
}
|
||||
lt := mkLive(ev)
|
||||
active[k] = lt
|
||||
if !ev.IsTrunk {
|
||||
localByTG[ev.TG]++
|
||||
}
|
||||
// Live only (not backfill): announce the SVX talker to the mesh.
|
||||
xlinkPublishTalker(lt.Callsign, lt.System, lt.Trunk, lt.Node, ev.TG, lt.Network, "start", ev.Ts)
|
||||
} else if dropped[k] {
|
||||
delete(dropped, k)
|
||||
} else if st, was := active[k]; was {
|
||||
if !st.IsTrunk && localByTG[ev.TG] > 0 {
|
||||
localByTG[ev.TG]--
|
||||
}
|
||||
xlinkPublishTalker(st.Callsign, st.System, st.Trunk, st.Node, ev.TG, st.Network, "stop", ev.Ts)
|
||||
emit(st, ev.TG, ev.Ts)
|
||||
delete(active, k)
|
||||
} else {
|
||||
if ev.IsTrunk && localByTG[ev.TG] > 0 {
|
||||
continue // outbound trunk echo with no tracked start → no row
|
||||
}
|
||||
lt := mkLive(ev)
|
||||
cs3, loc3 := bridgeIdentity(lt, ev.TG)
|
||||
writeLastheardEvent(rdb, lastheardEvent{
|
||||
|
||||
Reference in new issue
Block a user