only apply ExternalController in Override settings (#330)

This commit is contained in:
karin0 2024-09-11 17:17:59 +08:00 committed by wwqgtxx
parent a04c1883fa
commit bb2c5283f8
4 changed files with 26 additions and 3 deletions

View File

@ -17,6 +17,7 @@ import (
) )
var processors = []processor{ var processors = []processor{
patchExternalController, // must before patchOverride, so we only apply ExternalController in Override settings
patchOverride, patchOverride,
patchGeneral, patchGeneral,
patchProfile, patchProfile,
@ -39,9 +40,19 @@ func patchOverride(cfg *config.RawConfig, _ string) error {
return nil return nil
} }
func patchGeneral(cfg *config.RawConfig, _ string) error { func patchExternalController(cfg *config.RawConfig, _ string) error {
cfg.ExternalController = ""
cfg.ExternalControllerTLS = ""
return nil
}
func patchGeneral(cfg *config.RawConfig, profileDir string) error {
cfg.Interface = "" cfg.Interface = ""
cfg.ExternalUI = "" cfg.RoutingMark = 0
if cfg.ExternalController != "" || cfg.ExternalControllerTLS != "" {
cfg.ExternalUI = profileDir + "/ui"
}
return nil return nil
} }

View File

@ -42,7 +42,10 @@ data class ConfigurationOverride(
var ipv6: Boolean? = null, var ipv6: Boolean? = null,
@SerialName("external-controller") @SerialName("external-controller")
var externalController: String? = "127.0.0.1:0", var externalController: String? = null,
@SerialName("external-controller-tls")
var externalControllerTLS: String? = null,
@SerialName("secret") @SerialName("secret")
var secret: String? = null, var secret: String? = null,

View File

@ -149,6 +149,14 @@ class OverrideSettingsDesign(
empty = R.string.default_ empty = R.string.default_
) )
editableText(
value = configuration::externalControllerTLS,
adapter = NullableTextAdapter.String,
title = R.string.external_controller_tls,
placeholder = R.string.dont_modify,
empty = R.string.default_
)
editableText( editableText(
value = configuration::secret, value = configuration::secret,
adapter = NullableTextAdapter.String, adapter = NullableTextAdapter.String,

View File

@ -147,6 +147,7 @@
<string name="log_level">Log Level</string> <string name="log_level">Log Level</string>
<string name="ipv6">IPv6</string> <string name="ipv6">IPv6</string>
<string name="external_controller">External Controller</string> <string name="external_controller">External Controller</string>
<string name="external_controller_tls">External Controller TLS</string>
<string name="secret">Secret</string> <string name="secret">Secret</string>
<string name="hosts">Hosts</string> <string name="hosts">Hosts</string>
<string name="_new">New</string> <string name="_new">New</string>