diff options
author | pacien | 2018-02-24 14:23:31 +0100 |
---|---|---|
committer | pacien | 2018-02-24 14:23:31 +0100 |
commit | eb31e3770f8c79ee0debb866e0fd56f9c37eb1be (patch) | |
tree | cfe4b5282a4dcfca884b38d83d8985f58ea77c50 /app/src/main/java | |
parent | 4f41dc1d2f33223f7051b12d7525d5f0a0e62997 (diff) | |
download | tincapp-eb31e3770f8c79ee0debb866e0fd56f9c37eb1be.tar.gz |
Add template network.conf at conf. gen.
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt | 1 | ||||
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/commands/TincApp.kt | 6 |
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() } |