Dan Ballard pushed to branch firefox-android-115.2.1-13.5-1 at The Tor Project / Applications / firefox-android

Commits:

1 changed file:

Changes:

  • fenix/app/src/main/java/org/mozilla/fenix/tor/TorControllerGV.kt
    ... ... @@ -157,12 +157,20 @@ class TorControllerGV(
    157 157
         // with no bridge strings
    
    158 158
         override var userProvidedBridges: String?
    
    159 159
             get() {
    
    160
    -            return getTorSettings()?.bridgeBridgeStrings?.joinToString("\r\n")
    
    160
    +            return getTorSettings()?.let {
    
    161
    +                if (it.bridgesSource == BridgeSource.UserProvided) {
    
    162
    +                    return getTorSettings()?.bridgeBridgeStrings?.joinToString("\n")
    
    163
    +                }
    
    164
    +                return ""
    
    165
    +            }
    
    161 166
             }
    
    162 167
             set(value) {
    
    163 168
                 getTorSettings()?.let {
    
    169
    +                Log.i(TAG, "setUserProvidedBridges: '$value'");
    
    170
    +                // Hack: we don't have validation so lets do something quick and dirty (each line has a length)
    
    171
    +                val  userProvidedLines: Array<String> = value?.split("\n")?.filter { it.length > 4 }?.toTypedArray() ?: arrayOf<String>()
    
    164 172
                     it.bridgesSource = BridgeSource.UserProvided
    
    165
    -                it.bridgeBridgeStrings = value?.split("\r\n")?.toTypedArray() ?: arrayOf<String>()
    
    173
    +                it.bridgeBridgeStrings = userProvidedLines
    
    166 174
                     getTorIntegration().setSettings(it, true, true)
    
    167 175
                 }
    
    168 176
             }