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
+23 -28
View File
@@ -68,19 +68,8 @@ func (s *Service) syncMatchingChecksum(ctx context.Context, mode string, startup
}
func (s *Service) finishUpToDateSync(ctx context.Context, mode string, snapshot *state.Snapshot, target *protocol.ActiveConfigMeta) error {
if pagesReconcileNeeded(snapshot) {
if pagesDiscoveryNeeded(snapshot) {
config, err := s.client.GetActiveConfig(ctx)
if err != nil {
slog.Error("fetch active config failed", "mode", mode, "error", err)
return err
}
if err := s.syncPagesDeployments(ctx, snapshot, config); err != nil {
return err
}
} else if err := s.syncPagesDeployments(ctx, snapshot, nil); err != nil {
return err
}
if err := s.reconcilePages(ctx, mode, snapshot); err != nil {
return err
}
slog.Debug("local openresty config already up to date", "mode", mode, "version", target.Version)
if shouldReportNoopApply(snapshot, target.Version, target.Checksum) {
@@ -96,6 +85,21 @@ func (s *Service) finishUpToDateSync(ctx context.Context, mode string, snapshot
return s.stateStore.Save(snapshot)
}
func (s *Service) reconcilePages(ctx context.Context, mode string, snapshot *state.Snapshot) error {
if !pagesReconcileNeeded(snapshot) {
return nil
}
if pagesDiscoveryNeeded(snapshot) {
config, err := s.client.GetActiveConfig(ctx)
if err != nil {
slog.Error("fetch active config failed", "mode", mode, "error", err)
return err
}
return s.syncPagesDeployments(ctx, snapshot, config)
}
return s.syncPagesDeployments(ctx, snapshot, nil)
}
func (s *Service) syncMismatchedChecksum(ctx context.Context, mode string, startup bool, snapshot *state.Snapshot, currentChecksum string, target *protocol.ActiveConfigMeta) error {
if isBlockedTarget(snapshot, target.Version, target.Checksum) {
slog.Warn("skipping blocked config version after previous failed apply", "mode", mode, "version", target.Version, "checksum", target.Checksum)
@@ -111,22 +115,13 @@ func (s *Service) syncMismatchedChecksum(ctx context.Context, mode string, start
clearBlockedTarget(snapshot)
}
if snapshot.CurrentVersion == target.Version && snapshot.CurrentChecksum == target.Checksum && !startup {
if pagesReconcileNeeded(snapshot) {
if pagesDiscoveryNeeded(snapshot) {
config, fetchErr := s.client.GetActiveConfig(ctx)
if fetchErr != nil {
slog.Error("fetch active config failed", "mode", mode, "error", fetchErr)
return fetchErr
}
if err := s.syncPagesDeployments(ctx, snapshot, config); err != nil {
return err
}
} else if err := s.syncPagesDeployments(ctx, snapshot, nil); err != nil {
return err
}
return s.stateStore.Save(snapshot)
reconciled := pagesReconcileNeeded(snapshot)
if err := s.reconcilePages(ctx, mode, snapshot); err != nil {
return err
}
if !reconciled {
slog.Debug("skipping config fetch because state already records target version/checksum", "version", target.Version, "checksum", target.Checksum)
}
slog.Debug("skipping config fetch because state already records target version/checksum", "version", target.Version, "checksum", target.Checksum)
return s.stateStore.Save(snapshot)
}