V2.0.1: listen override fix, sing-box core fetch, probe settings page + fast report, spx removal, core mem env
Docs Deploy (GitHub Pages) / build (push) Canceled after 0s
Docs Deploy (GitHub Pages) / deploy (push) Canceled after 0s
CI / go-test (push) Canceled after 0s
CI / postgres-durable-first (push) Canceled after 0s
CI / codegen (push) Canceled after 0s
CI / govulncheck (push) Canceled after 0s
CI / race (push) Canceled after 0s
CI / fuzz-smoke (push) Canceled after 0s
CI / golangci (push) Canceled after 0s
CI / frontend (push) Canceled after 0s
Docs CI / build (push) Canceled after 0s
Release 3X-UI / build (386) (push) Canceled after 0s
Release 3X-UI / build (amd64) (push) Canceled after 0s
Release 3X-UI / build (arm64) (push) Canceled after 0s
Release 3X-UI / build (armv5) (push) Canceled after 0s
Release 3X-UI / build (armv6) (push) Canceled after 0s
Release 3X-UI / build (armv7) (push) Canceled after 0s
Release 3X-UI / build (s390x) (push) Canceled after 0s
Release 3X-UI / Build for Windows (amd64) (push) Canceled after 0s
Release 3X-UI / Publish rolling dev release (push) Canceled after 0s
CodeQL Advanced / Analyze (go) (push) Canceled after 0s
CodeQL Advanced / Analyze (actions) (push) Canceled after 0s
CodeQL Advanced / Analyze (javascript-typescript) (push) Canceled after 0s
Docs Deploy (GitHub Pages) / build (push) Canceled after 0s
Docs Deploy (GitHub Pages) / deploy (push) Canceled after 0s
CI / go-test (push) Canceled after 0s
CI / postgres-durable-first (push) Canceled after 0s
CI / codegen (push) Canceled after 0s
CI / govulncheck (push) Canceled after 0s
CI / race (push) Canceled after 0s
CI / fuzz-smoke (push) Canceled after 0s
CI / golangci (push) Canceled after 0s
CI / frontend (push) Canceled after 0s
Docs CI / build (push) Canceled after 0s
Release 3X-UI / build (386) (push) Canceled after 0s
Release 3X-UI / build (amd64) (push) Canceled after 0s
Release 3X-UI / build (arm64) (push) Canceled after 0s
Release 3X-UI / build (armv5) (push) Canceled after 0s
Release 3X-UI / build (armv6) (push) Canceled after 0s
Release 3X-UI / build (armv7) (push) Canceled after 0s
Release 3X-UI / build (s390x) (push) Canceled after 0s
Release 3X-UI / Build for Windows (amd64) (push) Canceled after 0s
Release 3X-UI / Publish rolling dev release (push) Canceled after 0s
CodeQL Advanced / Analyze (go) (push) Canceled after 0s
CodeQL Advanced / Analyze (actions) (push) Canceled after 0s
CodeQL Advanced / Analyze (javascript-typescript) (push) Canceled after 0s
- 0: sing-box gen overrides fragment listen/port from the inbound row (empty listen -> "::"), Update/Add recompute the stored fragment; non-loopback E2E against the real core binary. - 1: agent fetches the sing-box core from the Gitea release when missing, self-checks it, and only then latches the switch. - 2: node list shows the sing-box core version (heartbeat field, persisted on the node row), xray version as fallback. - 3: public-page fallback returns 404 to anonymous visitors when the page is disabled. - 4: settings restart hint bar removed, dead i18n keys cleaned. - 5: two PUT calls missing JSON headers fixed (audit: only those two), batch probe-task creation endpoint + UI. - 6: cf-probe retirement card and coverage pipeline removed. - 7: generated vless links no longer carry spx (panel export + sub); parser still accepts spx; golden fixtures updated. - probe batch: dedicated probe settings tab (public-page settings, tasks, per-node meta), retention_days editable, per-node traffic calibration + stat-interface pinning, runtime metrics split into a lightweight fast report (default 3s, 1-60s adjustable). - 8: sing-box core processes start with GOMEMLIMIT=32MiB, GOGC=50. - 9: dead /getTwoFactorEnable docs entries removed (frontend call and contract entry already gone at base; verified by grep).
This commit is contained in:
@@ -31,6 +31,7 @@ func NewProbeTasksController(g *gin.RouterGroup) *ProbeTasksController {
|
||||
pc := &ProbeTasksController{}
|
||||
g.GET("/probe-tasks", pc.listTasks)
|
||||
g.PUT("/probe-tasks", pc.saveTask)
|
||||
g.POST("/probe-tasks/batch", pc.saveTaskBatch)
|
||||
g.DELETE("/probe-tasks/:id", pc.deleteTask)
|
||||
g.POST("/probe-tasks/reorder", pc.reorderTasks)
|
||||
g.PUT("/probe-tasks/by-node/:nodeId", pc.setNodeTasks)
|
||||
@@ -269,6 +270,114 @@ func (pc *ProbeTasksController) saveTask(c *gin.Context) {
|
||||
jsonObj(c, gin.H{"id": id}, nil)
|
||||
}
|
||||
|
||||
// probeTaskBatchForm is the batch-create shape (V2.0.1 ⑤): many
|
||||
// targets at once — already split client-side from the pasted
|
||||
// lines/commas — sharing every other field. Name is a shared label:
|
||||
// with several targets each task is auto-named after its target
|
||||
// unless a name is given, in which case it prefixes the target
|
||||
// ("<name> · <target>"); with exactly one target the name is used
|
||||
// verbatim (and may be empty, falling back to the target).
|
||||
type probeTaskBatchForm struct {
|
||||
Targets []string `json:"targets"`
|
||||
Name string `json:"name"`
|
||||
Interval int64 `json:"interval"`
|
||||
AutoJoin bool `json:"autoJoin"`
|
||||
Region string `json:"region"`
|
||||
NodeIDs []int64 `json:"nodeIds"`
|
||||
}
|
||||
|
||||
// saveTaskBatch creates one task per target, all-or-nothing on
|
||||
// validation: every form is validated before the first insert, so a
|
||||
// bad line refuses the whole paste with the hub-style message
|
||||
// instead of leaving a half-entered list behind.
|
||||
func (pc *ProbeTasksController) saveTaskBatch(c *gin.Context) {
|
||||
var form probeTaskBatchForm
|
||||
if err := c.ShouldBindJSON(&form); err != nil {
|
||||
jsonMsg(c, "Invalid request", err)
|
||||
return
|
||||
}
|
||||
if form.NodeIDs == nil {
|
||||
form.NodeIDs = []int64{}
|
||||
}
|
||||
// The batch form's interval is a shared convenience field: an
|
||||
// omitted one means the standard 60 s (the single-task form
|
||||
// keeps requiring an explicit value).
|
||||
if form.Interval == 0 {
|
||||
form.Interval = 60
|
||||
}
|
||||
// Split remnants and duplicates in the paste collapse here;
|
||||
// order is preserved (it becomes the tasks' sort order).
|
||||
seen := map[string]bool{}
|
||||
targets := make([]string, 0, len(form.Targets))
|
||||
for _, raw := range form.Targets {
|
||||
tgt := strings.TrimSpace(raw)
|
||||
if tgt == "" || seen[tgt] {
|
||||
continue
|
||||
}
|
||||
seen[tgt] = true
|
||||
targets = append(targets, tgt)
|
||||
}
|
||||
if len(targets) == 0 {
|
||||
jsonMsg(c, "请填写目标", errRequest)
|
||||
return
|
||||
}
|
||||
sharedName := strings.TrimSpace(form.Name)
|
||||
forms := make([]probeTaskForm, 0, len(targets))
|
||||
for _, tgt := range targets {
|
||||
name := sharedName
|
||||
switch {
|
||||
case len(targets) == 1:
|
||||
if name == "" {
|
||||
name = tgt
|
||||
}
|
||||
case name == "":
|
||||
name = tgt
|
||||
default:
|
||||
name = name + " · " + tgt
|
||||
}
|
||||
f := probeTaskForm{
|
||||
Name: name,
|
||||
Target: tgt,
|
||||
Interval: form.Interval,
|
||||
AutoJoin: form.AutoJoin,
|
||||
Region: form.Region,
|
||||
NodeIDs: form.NodeIDs,
|
||||
}
|
||||
if msg := validateProbeTaskForm(&f); msg != "" {
|
||||
jsonMsg(c, msg, errRequest)
|
||||
return
|
||||
}
|
||||
forms = append(forms, f)
|
||||
}
|
||||
bound, err := agentsByNode()
|
||||
if err != nil {
|
||||
jsonMsg(c, "save probe tasks failed", err)
|
||||
return
|
||||
}
|
||||
agentIDs, refusal := resolveAgentIDs(form.NodeIDs, bound)
|
||||
if refusal != "" {
|
||||
jsonMsg(c, refusal, errRequest)
|
||||
return
|
||||
}
|
||||
ids := make([]int64, 0, len(forms))
|
||||
for _, f := range forms {
|
||||
id, err := probe.SavePingTask(probe.PingTask{
|
||||
Name: f.Name,
|
||||
Target: f.Target,
|
||||
Interval: f.Interval,
|
||||
AutoJoin: f.AutoJoin,
|
||||
Region: f.Region,
|
||||
AgentIDs: agentIDs,
|
||||
}, nil)
|
||||
if err != nil {
|
||||
probeTaskError(c, err)
|
||||
return
|
||||
}
|
||||
ids = append(ids, id)
|
||||
}
|
||||
jsonObj(c, gin.H{"ids": ids}, nil)
|
||||
}
|
||||
|
||||
func (pc *ProbeTasksController) deleteTask(c *gin.Context) {
|
||||
id, err := strconv.ParseInt(c.Param("id"), 10, 64)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user