aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/org/pacien
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/org/pacien')
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt1
-rw-r--r--app/src/main/java/org/pacien/tincapp/commands/TincApp.kt6
2 files changed, 7 insertions, 0 deletions
diff --git a/app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt b/app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt
index e571cf5..64ed61d 100644
--- a/app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt
+++ b/app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt
@@ -100,6 +100,7 @@ class ConfigureActivity : BaseActivity() {
100 R.string.message_generating_configuration, 100 R.string.message_generating_configuration,
101 Tinc.init(netName, nodeName) 101 Tinc.init(netName, nodeName)
102 .thenCompose { TincApp.removeScripts(netName) } 102 .thenCompose { TincApp.removeScripts(netName) }
103 .thenCompose { TincApp.generateIfaceCfgTemplate(netName) }
103 .thenCompose { TincApp.setPassphrase(netName, newPassphrase = passphrase) }) 104 .thenCompose { TincApp.setPassphrase(netName, newPassphrase = passphrase) })
104 105
105 private fun joinNetwork(netName: String, url: String, passphrase: String? = null) = execAction( 106 private fun joinNetwork(netName: String, url: String, passphrase: String? = null) = execAction(
diff --git a/app/src/main/java/org/pacien/tincapp/commands/TincApp.kt b/app/src/main/java/org/pacien/tincapp/commands/TincApp.kt
index 3c2e27a..53e91db 100644
--- a/app/src/main/java/org/pacien/tincapp/commands/TincApp.kt
+++ b/app/src/main/java/org/pacien/tincapp/commands/TincApp.kt
@@ -39,6 +39,12 @@ object TincApp {
39 .write(AppPaths.netConfFile(netName)) 39 .write(AppPaths.netConfFile(netName))
40 } 40 }
41 41
42 fun generateIfaceCfgTemplate(netName: String) = runAsyncTask {
43 App.getResources().openRawResource(R.raw.network).use { inputStream ->
44 AppPaths.netConfFile(netName).outputStream().use { inputStream.copyTo(it) }
45 }
46 }
47
42 fun setPassphrase(netName: String, currentPassphrase: String? = null, newPassphrase: String?) = runAsyncTask { 48 fun setPassphrase(netName: String, currentPassphrase: String? = null, newPassphrase: String?) = runAsyncTask {
43 listPrivateKeys(netName) 49 listPrivateKeys(netName)
44 .filter { it.exists() } 50 .filter { it.exists() }