feat(relay): support configurable frps webui port and fix node detail integration

- Implement configurable FRPS WebUI switch and custom port setting (relay_frps_web_ui_port) in system configs.
- Integrate settings into Relay Node detail manage page instead of global settings.
- Dynamically query server version to select matching Docker image tag for Relay installation.
- Clean up legacy code and fix backend linter/test warnings.
This commit is contained in:
ryan
2026-06-22 12:48:54 +08:00
parent ffe98f6307
commit 346024f346
24 changed files with 204 additions and 69 deletions
+7 -2
View File
@@ -127,7 +127,8 @@ func (m *Manager) UpdateConfig(ctx context.Context, cfg *service.RelayConfig) {
m.activeConfig.BindPort == cfg.BindPort &&
m.activeConfig.VhostHTTPPort == cfg.VhostHTTPPort &&
m.activeConfig.AuthToken == cfg.AuthToken &&
m.activeConfig.WebServerEnabled == cfg.WebServerEnabled {
m.activeConfig.WebServerEnabled == cfg.WebServerEnabled &&
m.activeConfig.WebServerPort == cfg.WebServerPort {
if m.cmd == nil && !m.stopping {
slog.Warn("frps config unchanged but process is not running, restarting")
m.stopping = false
@@ -188,7 +189,11 @@ func (m *Manager) renderConfig(cfg *service.RelayConfig) error {
} else {
buf.WriteString("addr = \"127.0.0.1\"\n")
}
fmt.Fprintf(&buf, "port = %d\n", defaultFrpsWebServerPort)
port := cfg.WebServerPort
if port <= 0 {
port = defaultFrpsWebServerPort
}
fmt.Fprintf(&buf, "port = %d\n", port)
buf.WriteString("user = \"admin\"\n")
password := m.agentToken
+6
View File
@@ -53,6 +53,9 @@ exit "${EXIT_CODE:-0}"
// Helper to poll for status to eliminate timing flakiness in tests
func assertStatusEventually(t *testing.T, m *Manager, expectedStatus string, timeout time.Duration) {
if timeout < 6*time.Second {
timeout = 6 * time.Second
}
deadline := time.Now().Add(timeout)
for time.Now().Before(deadline) {
rt := m.GetRuntimeStatus()
@@ -67,6 +70,9 @@ func assertStatusEventually(t *testing.T, m *Manager, expectedStatus string, tim
func assertCommandExitedEventually(t *testing.T, cmd *exec.Cmd, timeout time.Duration) {
t.Helper()
if timeout < 6*time.Second {
timeout = 6 * time.Second
}
done := make(chan error, 1)
go func() {