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

@ -758,6 +758,15 @@ func (e *Engine) CreateCluster() error {
return nil
}
// ResetTopology clears all established topology entries (pending tasks are
// kept). Used by the leader's startup reconcile: the recovered topology
// records forwards whose worker processes died with the restart, and HasTask
// would short-circuit re-submission — so the leader wipes topology first,
// then re-submits every forward to ride the token fresh.
func (e *Engine) ResetTopology() {
e.state.Topology = map[string]*TopoEntry{}
}
// SubmitTask adds a new forward request to pending; it rides the next token
// round and is claimed by the lowest-load member.
// RemoveNode publishes a node-removal command via the token; the target

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5,8 +5,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
<title>webui4frpc</title>
<script type="module" crossorigin src="/assets/index-D0MfyrKF.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-D67FPIKJ.css">
<script type="module" crossorigin src="/assets/index-BUbn_fgs.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DQV0nqgE.css">
</head>
<body>
<div id="app"></div>

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