parent
321730536d
commit
5a1430706b
|
@ -14,8 +14,8 @@ android {
|
||||||
applicationId = "com.zaneschepke.wireguardautotunnel"
|
applicationId = "com.zaneschepke.wireguardautotunnel"
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 31100
|
versionCode = 31200
|
||||||
versionName = "3.1.1"
|
versionName = "3.1.2"
|
||||||
|
|
||||||
multiDexEnabled = true
|
multiDexEnabled = true
|
||||||
|
|
||||||
|
|
|
@ -12,14 +12,15 @@ data class InterfaceProxy(
|
||||||
var mtu : String = "",
|
var mtu : String = "",
|
||||||
){
|
){
|
||||||
companion object {
|
companion object {
|
||||||
|
private fun String.removeWhiteSpaces() = replace("\\s".toRegex(), "")
|
||||||
fun from(i : Interface) : InterfaceProxy {
|
fun from(i : Interface) : InterfaceProxy {
|
||||||
return InterfaceProxy(
|
return InterfaceProxy(
|
||||||
publicKey = i.keyPair.publicKey.toBase64(),
|
publicKey = i.keyPair.publicKey.toBase64().removeWhiteSpaces(),
|
||||||
privateKey = i.keyPair.privateKey.toBase64(),
|
privateKey = i.keyPair.privateKey.toBase64().removeWhiteSpaces(),
|
||||||
addresses = i.addresses.joinToString(","),
|
addresses = i.addresses.joinToString(",").removeWhiteSpaces(),
|
||||||
dnsServers = i.dnsServers.joinToString(",").replace("/", ""),
|
dnsServers = i.dnsServers.joinToString(",").replace("/", "").removeWhiteSpaces(),
|
||||||
listenPort = if(i.listenPort.isPresent) i.listenPort.get().toString() else "",
|
listenPort = if(i.listenPort.isPresent) i.listenPort.get().toString().removeWhiteSpaces() else "",
|
||||||
mtu = if(i.mtu.isPresent) i.mtu.get().toString() else ""
|
mtu = if(i.mtu.isPresent) i.mtu.get().toString().removeWhiteSpaces() else ""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,9 @@ fun ConfigScreen(
|
||||||
val proxyInterface by viewModel.interfaceProxy.collectAsStateWithLifecycle()
|
val proxyInterface by viewModel.interfaceProxy.collectAsStateWithLifecycle()
|
||||||
var showApplicationsDialog by remember { mutableStateOf(false) }
|
var showApplicationsDialog by remember { mutableStateOf(false) }
|
||||||
val baseTextBoxModifier = Modifier.onFocusChanged {
|
val baseTextBoxModifier = Modifier.onFocusChanged {
|
||||||
keyboardController?.hide()
|
if(WireGuardAutoTunnel.isRunningOnAndroidTv(context)) {
|
||||||
|
keyboardController?.hide()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val keyboardActions = KeyboardActions(
|
val keyboardActions = KeyboardActions(
|
||||||
|
|
|
@ -271,22 +271,22 @@ class ConfigViewModel @Inject constructor(private val application : Application,
|
||||||
fun buildPeerListFromProxyPeers() : List<Peer> {
|
fun buildPeerListFromProxyPeers() : List<Peer> {
|
||||||
return _proxyPeers.value.map {
|
return _proxyPeers.value.map {
|
||||||
val builder = Peer.Builder()
|
val builder = Peer.Builder()
|
||||||
if (it.allowedIps.isNotEmpty()) builder.parseAllowedIPs(it.allowedIps)
|
if (it.allowedIps.isNotEmpty()) builder.parseAllowedIPs(it.allowedIps.removeWhiteSpaces())
|
||||||
if (it.publicKey.isNotEmpty()) builder.parsePublicKey(it.publicKey)
|
if (it.publicKey.isNotEmpty()) builder.parsePublicKey(it.publicKey.removeWhiteSpaces())
|
||||||
if (it.preSharedKey.isNotEmpty()) builder.parsePreSharedKey(it.preSharedKey)
|
if (it.preSharedKey.isNotEmpty()) builder.parsePreSharedKey(it.preSharedKey.removeWhiteSpaces())
|
||||||
if (it.endpoint.isNotEmpty()) builder.parseEndpoint(it.endpoint)
|
if (it.endpoint.isNotEmpty()) builder.parseEndpoint(it.endpoint.removeWhiteSpaces())
|
||||||
if (it.persistentKeepalive.isNotEmpty()) builder.parsePersistentKeepalive(it.persistentKeepalive)
|
if (it.persistentKeepalive.isNotEmpty()) builder.parsePersistentKeepalive(it.persistentKeepalive.removeWhiteSpaces())
|
||||||
builder.build()
|
builder.build()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun buildInterfaceListFromProxyInterface() : Interface {
|
fun buildInterfaceListFromProxyInterface() : Interface {
|
||||||
val builder = Interface.Builder()
|
val builder = Interface.Builder()
|
||||||
builder.parsePrivateKey(_interface.value.privateKey)
|
builder.parsePrivateKey(_interface.value.privateKey.removeWhiteSpaces())
|
||||||
builder.parseAddresses(_interface.value.addresses)
|
builder.parseAddresses(_interface.value.addresses.removeWhiteSpaces())
|
||||||
builder.parseDnsServers(_interface.value.dnsServers)
|
builder.parseDnsServers(_interface.value.dnsServers.removeWhiteSpaces())
|
||||||
if(_interface.value.mtu.isNotEmpty()) builder.parseMtu(_interface.value.mtu)
|
if(_interface.value.mtu.isNotEmpty()) builder.parseMtu(_interface.value.mtu.removeWhiteSpaces())
|
||||||
if(_interface.value.listenPort.isNotEmpty()) builder.parseListenPort(_interface.value.listenPort)
|
if(_interface.value.listenPort.isNotEmpty()) builder.parseListenPort(_interface.value.listenPort.removeWhiteSpaces())
|
||||||
if(isAllApplicationsEnabled()) _checkedPackages.value.clear()
|
if(isAllApplicationsEnabled()) _checkedPackages.value.clear()
|
||||||
if(_include.value) builder.includeApplications(_checkedPackages.value)
|
if(_include.value) builder.includeApplications(_checkedPackages.value)
|
||||||
if(!_include.value) builder.excludeApplications(_checkedPackages.value)
|
if(!_include.value) builder.excludeApplications(_checkedPackages.value)
|
||||||
|
@ -397,4 +397,6 @@ class ConfigViewModel @Inject constructor(private val application : Application,
|
||||||
onInterfacePublicKeyChange("")
|
onInterfacePublicKeyChange("")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun String.removeWhiteSpaces() = replace("\\s".toRegex(), "")
|
||||||
}
|
}
|
|
@ -269,7 +269,9 @@ fun SettingsScreen(
|
||||||
onValueChange = { currentText = it },
|
onValueChange = { currentText = it },
|
||||||
label = { Text(stringResource(R.string.add_trusted_ssid)) },
|
label = { Text(stringResource(R.string.add_trusted_ssid)) },
|
||||||
modifier = Modifier.padding(start = screenPadding, top = 5.dp).focusRequester(focusRequester).onFocusChanged {
|
modifier = Modifier.padding(start = screenPadding, top = 5.dp).focusRequester(focusRequester).onFocusChanged {
|
||||||
keyboardController?.hide()
|
if(WireGuardAutoTunnel.isRunningOnAndroidTv(context)) {
|
||||||
|
keyboardController?.hide()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
keyboardOptions = KeyboardOptions(
|
keyboardOptions = KeyboardOptions(
|
||||||
|
|
Loading…
Reference in New Issue