Skip to content

Commit bb2c528

Browse files
karin0wwqgtxx
authored andcommitted
only apply ExternalController in Override settings (#330)
1 parent a04c188 commit bb2c528

File tree

4 files changed

+26
-3
lines changed

4 files changed

+26
-3
lines changed

core/src/main/golang/native/config/process.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
)
1818

1919
var processors = []processor{
20+
patchExternalController, // must before patchOverride, so we only apply ExternalController in Override settings
2021
patchOverride,
2122
patchGeneral,
2223
patchProfile,
@@ -39,9 +40,19 @@ func patchOverride(cfg *config.RawConfig, _ string) error {
3940
return nil
4041
}
4142

42-
func patchGeneral(cfg *config.RawConfig, _ string) error {
43+
func patchExternalController(cfg *config.RawConfig, _ string) error {
44+
cfg.ExternalController = ""
45+
cfg.ExternalControllerTLS = ""
46+
47+
return nil
48+
}
49+
50+
func patchGeneral(cfg *config.RawConfig, profileDir string) error {
4351
cfg.Interface = ""
44-
cfg.ExternalUI = ""
52+
cfg.RoutingMark = 0
53+
if cfg.ExternalController != "" || cfg.ExternalControllerTLS != "" {
54+
cfg.ExternalUI = profileDir + "/ui"
55+
}
4556

4657
return nil
4758
}

core/src/main/java/com/github/kr328/clash/core/model/ConfigurationOverride.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ data class ConfigurationOverride(
4242
var ipv6: Boolean? = null,
4343

4444
@SerialName("external-controller")
45-
var externalController: String? = "127.0.0.1:0",
45+
var externalController: String? = null,
46+
47+
@SerialName("external-controller-tls")
48+
var externalControllerTLS: String? = null,
4649

4750
@SerialName("secret")
4851
var secret: String? = null,

design/src/main/java/com/github/kr328/clash/design/OverrideSettingsDesign.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,14 @@ class OverrideSettingsDesign(
149149
empty = R.string.default_
150150
)
151151

152+
editableText(
153+
value = configuration::externalControllerTLS,
154+
adapter = NullableTextAdapter.String,
155+
title = R.string.external_controller_tls,
156+
placeholder = R.string.dont_modify,
157+
empty = R.string.default_
158+
)
159+
152160
editableText(
153161
value = configuration::secret,
154162
adapter = NullableTextAdapter.String,

design/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@
147147
<string name="log_level">Log Level</string>
148148
<string name="ipv6">IPv6</string>
149149
<string name="external_controller">External Controller</string>
150+
<string name="external_controller_tls">External Controller TLS</string>
150151
<string name="secret">Secret</string>
151152
<string name="hosts">Hosts</string>
152153
<string name="_new">New</string>

0 commit comments

Comments
 (0)