... |
... |
@@ -89,13 +89,13 @@ class TorControllerGV( |
89
|
89
|
}
|
90
|
90
|
|
91
|
91
|
|
92
|
|
- // Bridges Enabled is a cache variable. The TorController interface we are locked into at the
|
93
|
|
- // moment to support the TAS backend calls setting `bridgesEnabled = true` and setting
|
94
|
|
- // the bridge type seperately so to support that,
|
95
|
|
- // while at the same time it being invalid states to not submit them together to the TorSettings
|
96
|
|
- // backend where TorSettings.sys.mjs's #cleanupSettings will remove a lone bridgeEnabled
|
97
|
|
- // we thus have to hold it here to support the UI but not submit to the backend until
|
98
|
|
- // bridgeTransport is also set (below)
|
|
92
|
+ // On a fresh install bridgeEnagled can be set to true without a valid bridgeSource
|
|
93
|
+ // having been selected. After first use this will not happen because last selected bridge
|
|
94
|
+ // will be remembered and reused.
|
|
95
|
+ // However, on first use, submitting this to TorSettings is an invalid state.
|
|
96
|
+ // TorSettings.sys.mjs's #cleanupSettings will remove a lone bridgeEnabled with no source
|
|
97
|
+ // selected. Therefore we check and don't call setSettings if bridgeSource isn't selected
|
|
98
|
+ // (when trying to enable). Disabeling is always valid.
|
99
|
99
|
private var _bridgesEnabled: Boolean? = null
|
100
|
100
|
override var bridgesEnabled: Boolean
|
101
|
101
|
get() {
|
... |
... |
@@ -103,6 +103,12 @@ class TorControllerGV( |
103
|
103
|
}
|
104
|
104
|
set(value) {
|
105
|
105
|
_bridgesEnabled = value
|
|
106
|
+ getTorSettings()?.let {
|
|
107
|
+ if (!value || it.bridgesSource != BridgeSource.Invalid) {
|
|
108
|
+ it.bridgesEnabled = value
|
|
109
|
+ getTorIntegration().setSettings(it, true, true)
|
|
110
|
+ }
|
|
111
|
+ }
|
106
|
112
|
}
|
107
|
113
|
|
108
|
114
|
|
... |
... |
@@ -146,8 +152,9 @@ class TorControllerGV( |
146
|
152
|
|
147
|
153
|
|
148
|
154
|
// Currently the UI takes a user provided string and sets this in one step so there is where we
|
149
|
|
- // actually set it.bridgesSource = BridgeSource.UserProvided, not above, as TorSettings.sys.mjs #cleanupSettings
|
150
|
|
- // could reject BridgeSource.UserProvided with no bridge strings
|
|
155
|
+ // actually set it.bridgesSource = BridgeSource.UserProvided, not above,
|
|
156
|
+ // as TorSettings.sys.mjs #cleanupSettings could reject BridgeSource.UserProvided
|
|
157
|
+ // with no bridge strings
|
151
|
158
|
override var userProvidedBridges: String?
|
152
|
159
|
get() {
|
153
|
160
|
return getTorSettings()?.bridgeBridgeStrings?.joinToString("\r\n")
|