diff --git a/CHANGELOG.md b/CHANGELOG.md index e0cdf6d..9b4975e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versio ## [Unreleased] +## [2.1.2] - 2026-11-16 + +### Fixed + +- Egress, false `dns_bypass` right after a hub restart: the files a probe sends (`resolv.conf`, `containers.map`) lived only in the hub's memory, so after a restart the egress lines the probe replayed on reconnect were judged before the probe sent them again (Hostinger `coolify-sentinel` → its upstream resolver 153.92.2.6, hostinger/INC-8). The hub now keeps the last copy of each file in the node's data directory (`probe-resolv.conf`, `probe-containers.map`) and loads it at start. Regression test `TestProbeFilesSurviveRestart`. +- Phone layout: the global filter sheet (period and host) opens above the bottom tab bar instead of covering it, tapping the tab bar closes it, and the sticky filter bar no longer sits on top of the "More" menu. + ## [2.1.1] - 2026-11-16 ### Fixed diff --git a/CHANGELOG.pt-BR.md b/CHANGELOG.pt-BR.md index d514c46..b815dae 100644 --- a/CHANGELOG.pt-BR.md +++ b/CHANGELOG.pt-BR.md @@ -6,6 +6,13 @@ Formato baseado no [Keep a Changelog](https://keepachangelog.com/pt-BR/1.1.0/); ## [Não lançado] +## [2.1.2] - 2026-11-16 + +### Corrigido + +- Saída, `dns_bypass` falso logo após reiniciar o hub: os arquivos que a sonda envia (`resolv.conf`, `containers.map`) ficavam só na memória do hub, então depois de um reinício as linhas de saída que a sonda reenviava ao reconectar eram julgadas antes de ela mandar os arquivos de novo (`coolify-sentinel` da Hostinger → o resolvedor upstream 153.92.2.6, hostinger/INC-8). O hub agora guarda a última cópia de cada arquivo no diretório do nó (`probe-resolv.conf`, `probe-containers.map`) e a carrega na inicialização. Teste de regressão `TestProbeFilesSurviveRestart`. +- Celular: a folha de filtros globais (período e host) abre acima da barra de navegação inferior em vez de cobri-la, tocar na barra a fecha, e a barra de filtros fixa não fica mais por cima do menu "Mais". + ## [2.1.1] - 2026-11-16 ### Corrigido diff --git a/internal/app/node.go b/internal/app/node.go index 8e9a100..d49fa67 100644 --- a/internal/app/node.go +++ b/internal/app/node.go @@ -124,6 +124,7 @@ func (sh *shared) newNode(name string, primary bool, rec hub.Probe) (*Node, erro sh.wg.Add(1) go func() { defer sh.wg.Done(); n.Enf.Run(sh.ctx) }() } + n.loadProbeFiles() if !egressOff(c) { if err := n.buildEgress(rec.Egress); err != nil { return nil, err @@ -189,6 +190,41 @@ func (n *Node) Close() { } } +// probeFilePath is where the last copy of a file sent by the probe is kept, +// so that after a hub restart the egress lines replayed by the probe are +// judged with its resolvers and container names before it sends them again. +func (n *Node) probeFilePath(name string) string { + return filepath.Join(n.Dir, "probe-"+name) +} + +func (n *Node) loadProbeFiles() { + for _, f := range []struct { + name string + dst *atomic.Pointer[[]byte] + }{{wire.FileContainers, &n.containers}, {wire.FileResolv, &n.resolv}} { + b, err := os.ReadFile(n.probeFilePath(f.name)) + if err != nil || len(b) > wire.MaxFileBytes { + continue + } + f.dst.Store(&b) + } +} + +func (n *Node) saveProbeFile(name string, data []byte) { + p := n.probeFilePath(name) + if old, err := os.ReadFile(p); err == nil && string(old) == string(data) { + return + } + tmp := p + ".tmp" + if err := os.WriteFile(tmp, data, 0o600); err != nil { + n.sh.log.Warn("probe file not saved", "node", n.name, "file", name, "err", err) + return + } + if err := os.Rename(tmp, p); err != nil { + n.sh.log.Warn("probe file not saved", "node", n.name, "file", name, "err", err) + } +} + func (n *Node) buildEgress(eg hub.Egress) error { eng, err := newEgressEngine(n.sh.c, n.St, eg, n.Primary) if err != nil { @@ -263,6 +299,7 @@ func (n *Node) Apply(b wire.Batch) (int, int) { default: continue } + n.saveProbeFile(f.Name, data) if e := n.egr.Load(); e != nil { if f.Name == wire.FileContainers { e.SetContainers(data) diff --git a/internal/app/probefiles_test.go b/internal/app/probefiles_test.go new file mode 100644 index 0000000..96b44ee --- /dev/null +++ b/internal/app/probefiles_test.go @@ -0,0 +1,29 @@ +package app + +import ( + "io" + "log/slog" + "testing" + + "git.lucasrguerra.dev.br/ciberfauna/urutau/internal/wire" +) + +// The files sent by a probe survive a hub restart: without them the egress +// lines the probe replays right after reconnecting were judged with the hub's +// own resolvers (a dns_bypass false positive on the probe's upstream resolver). +func TestProbeFilesSurviveRestart(t *testing.T) { + dir := t.TempDir() + sh := &shared{log: slog.New(slog.NewTextHandler(io.Discard, nil))} + n := &Node{name: "hostinger", Dir: dir, sh: sh} + n.saveProbeFile(wire.FileResolv, []byte("nameserver 153.92.2.6\n")) + n.saveProbeFile(wire.FileContainers, []byte("172.17.0.2 coolify-sentinel\n")) + + n2 := &Node{name: "hostinger", Dir: dir, sh: sh} + n2.loadProbeFiles() + if b := n2.resolv.Load(); b == nil || string(*b) != "nameserver 153.92.2.6\n" { + t.Fatalf("resolv.conf not restored: %v", b) + } + if b := n2.containers.Load(); b == nil || string(*b) != "172.17.0.2 coolify-sentinel\n" { + t.Fatalf("containers.map not restored: %v", b) + } +} diff --git a/internal/app/version.go b/internal/app/version.go index 6e28967..1e0f7be 100644 --- a/internal/app/version.go +++ b/internal/app/version.go @@ -2,4 +2,4 @@ package app // Version is the release version (SemVer). Release builds may override it with // -ldflags "-X .../internal/app.Version=...". -var Version = "2.1.1" +var Version = "2.1.2" diff --git a/internal/server/web/app.js b/internal/server/web/app.js index 91fb455..ade1b22 100644 --- a/internal/server/web/app.js +++ b/internal/server/web/app.js @@ -1929,6 +1929,8 @@ } // closes whichever filter popover is open (kept under this name: Esc and other pages call it) function closeRangePicker(refocus) { closePop(rp, refocus); closePop(hp, refocus); } + // the phone sheet sits above the bottom tab bar: using the tab bar closes it + document.addEventListener('click', function (e) { if (e.target.closest && e.target.closest('.tabbar')) closeRangePicker(false); }, true); function openRangePicker() { if (!rp.pop) return; rp.open = false; renderRangePicker(); diff --git a/internal/server/web/style.css b/internal/server/web/style.css index c017081..e31e4b9 100644 --- a/internal/server/web/style.css +++ b/internal/server/web/style.css @@ -411,14 +411,14 @@ aside#detail li { overflow-wrap: anywhere; margin-bottom: 2px; } .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); } .stat { padding: var(--s-3); } .stat .v { font-size: 1.5rem; } .tabbar { - display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; + display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 34; /* above the sticky filter bar (.slice, 32) */ background: var(--rail); border-top: 1px solid var(--rail-line); padding: 4px 4px max(4px, env(safe-area-inset-bottom)); } .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; border: 0; background: none; color: var(--rail-ink); text-decoration: none; font-size: .75rem; border-radius: var(--radius-sm); cursor: pointer; padding: 4px 2px; } .tab .nav-ico svg { width: 22px; height: 22px; } .tab span:not(.nav-ico):not(.nav-badge) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .tab[aria-current="page"], .tab[aria-expanded="true"] { background: var(--rail-active); color: #fff; } - .more-sheet { position: fixed; left: 0; right: 0; bottom: 68px; z-index: 31; background: var(--surface-overlay); border-top: 1px solid var(--line-strong); border-radius: 14px 14px 0 0; padding: var(--s-3); box-shadow: var(--shadow); max-height: calc(100dvh - 68px - env(safe-area-inset-top, 0px) - 12px); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; } + .more-sheet { position: fixed; left: 0; right: 0; bottom: 68px; z-index: 35; background: var(--surface-overlay); border-top: 1px solid var(--line-strong); border-radius: 14px 14px 0 0; padding: var(--s-3); box-shadow: var(--shadow); max-height: calc(100dvh - 68px - env(safe-area-inset-top, 0px) - 12px); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; } .more-sheet:not([hidden]) { display: block; } .more-sheet a { display: flex; align-items: center; gap: var(--s-3); min-height: 48px; padding: 8px var(--s-3); color: var(--ink); text-decoration: none; border-radius: var(--radius-sm); } .more-sheet a[aria-current="page"] { background: var(--accent-soft); } @@ -788,9 +788,10 @@ html, body { overflow-x: clip; } .slice-ctl:has(#domain:not([hidden])) { flex-wrap: wrap; } .fb-link { min-height: 44px; } .fb-copy span { display: none; } - .fb-pop { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; z-index: 61; border-radius: 16px 16px 0 0; border-bottom: 0; max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain; - padding: var(--s-3) var(--s-4) max(var(--s-4), env(safe-area-inset-bottom)); } - .fb-pop-host { width: auto; padding: var(--s-3) var(--s-4) max(var(--s-4), env(safe-area-inset-bottom)); gap: var(--s-2); } + /* the sheet opens just above the bottom tab bar (65 px + safe area), never over it */ + .fb-pop { position: fixed; left: 0; right: 0; bottom: calc(65px + env(safe-area-inset-bottom, 0px)); top: auto; width: auto; z-index: 61; border-radius: 16px 16px 0 0; border-bottom: 0; max-height: calc(100dvh - 65px - env(safe-area-inset-bottom, 0px) - var(--topbar-h) - 8px); overflow-y: auto; overscroll-behavior: contain; + padding: var(--s-3) var(--s-4) var(--s-4); } + .fb-pop-host { width: auto; padding: var(--s-3) var(--s-4) var(--s-4); gap: var(--s-2); } .fb-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); } .fb-head h2 { margin: 0; font: 700 1rem var(--font-display); color: var(--heading); } .fb-x { width: 44px; min-height: 44px; }