fix: 首页本地服务只显示 localOnly 转发, 集群转发不再误报为本地服务

- handleStatus 的 localStatuses 遍历所有 locals 时跳过非 localOnly,
  集群转发只出现在活跃转发卡区 (per-remote 时代的残留逻辑)
- gofmt 格式化 topoKey 定义
- 同步 dist (含 ⚙/⊕ emoji 变体选择器修复)
This commit is contained in:
JianFeeeee
2026-08-24 16:13:59 +08:00
parent e3a978888a
commit 88b862b515
8 changed files with 78 additions and 28 deletions

View File

@ -138,7 +138,6 @@ func NewServeMux(h *Handler) (http.Handler, error) {
return mux, nil
}
// handleStatic serves the embedded web build. Paths map to dist files; / and
// unknown paths serve index.html for SPA routing. The SPA uses hash-based
// routing, so returning index.html for "/" is enough — a redirect here would
@ -235,7 +234,10 @@ func (h *Handler) handleStatus(w http.ResponseWriter, r *http.Request) {
for _, l := range locals {
localByName[l.Name] = l
}
type topoKey struct{ local, remote string; port int }
type topoKey struct {
local, remote string
port int
}
ownerOf := map[topoKey]string{}
topoEntries := []*cluster.TopoEntry{} // full topology for canvas/status merge
selfID := h.SelfAddr
@ -281,9 +283,12 @@ func (h *Handler) handleStatus(w http.ResponseWriter, r *http.Request) {
profiles = append(profiles, p)
}
// Local status: each local plus its forwarding targets and whether each
// target's worker is healthy (running). The per-forward owner/active detail
// lives in the forwards array below; this is the local-services overview.
// Local status: localOnly forwards that stay on THIS node — each one plus
// its forwarding target and whether the per-forward worker is healthy.
// Cluster (non-localOnly) forwards are NOT listed here: their lifecycle is
// managed by the ring and shown in the forwards card grid above. Listing
// cluster forwards here as "本地服务" was a leftover from the per-remote
// model and misled users into seeing cluster forwards as local ones.
type localTargetStatus struct {
Remote string `json:"remote"`
RemotePort int `json:"remotePort"`
@ -296,6 +301,9 @@ func (h *Handler) handleStatus(w http.ResponseWriter, r *http.Request) {
localStatuses := make([]localStatus, 0, len(locals))
for _, l := range locals {
if !l.LocalOnly {
continue
}
targets, err := h.Store.LinksForLocal(l.Name)
if err != nil {
targets = nil