@@ -201,13 +201,20 @@ ErrorCode InstallController::updateServerConfig(const QString &serverId, DockerC
201201 SshSession sshSession;
202202
203203 bool reinstallRequired = isReinstallContainerRequired (container, oldConfig, newConfig);
204- if (container == DockerContainer::Xray || container == DockerContainer::SSXray) {
205- reinstallRequired = true ;
206- }
207204 qDebug () << " InstallController::updateServerConfig for container" << container << " reinstall required is" << reinstallRequired;
208205
209206 ErrorCode errorCode = ErrorCode::NoError;
210- if (reinstallRequired) {
207+ if ((container == DockerContainer::Xray || container == DockerContainer::SSXray) && !reinstallRequired) {
208+ // Settings changed but don't require a full reinstall (e.g. flow/security tweak): merge them
209+ // into the existing server.json in place instead of regenerating keys and every client entry.
210+ const auto *oldXrayConfig = oldConfig.getXrayProtocolConfig ();
211+ const auto *newXrayConfig = newConfig.getXrayProtocolConfig ();
212+ if (oldXrayConfig && newXrayConfig && !oldXrayConfig->serverConfig .hasEqualServerSettings (newXrayConfig->serverConfig )) {
213+ DnsSettings dnsSettings = { m_appSettingsRepository->primaryDns (), m_appSettingsRepository->secondaryDns () };
214+ XrayConfigurator xrayConfigurator (&sshSession);
215+ errorCode = xrayConfigurator.applyServerSettingsToRemote (credentials, container, newConfig, dnsSettings, false );
216+ }
217+ } else if (reinstallRequired) {
211218 errorCode = setupContainer (credentials, container, newConfig, true );
212219
213220 // Reinstall pulls the latest container image, so the server runs the latest protocol version
0 commit comments