fix: parser key rotation, name comment, export name clarity

closes #1243
closes #1217
This commit is contained in:
zaneschepke
2026-06-01 15:37:17 -04:00
parent 9f4e801aad
commit fed9537f5c
4 changed files with 21 additions and 6 deletions
@@ -85,7 +85,10 @@ data class TunnelConfig(
fun tunnelConfFromQuick(amQuick: String, name: String? = null): TunnelConfig { fun tunnelConfFromQuick(amQuick: String, name: String? = null): TunnelConfig {
val config = Config.parseQuickString(amQuick) val config = Config.parseQuickString(amQuick)
return TunnelConfig(name = name ?: config.defaultName(), quickConfig = amQuick) return TunnelConfig(
name = config.name ?: name ?: config.defaultName(),
quickConfig = amQuick,
)
} }
fun generateDefaultGlobalConfig(): TunnelConfig { fun generateDefaultGlobalConfig(): TunnelConfig {
@@ -34,7 +34,6 @@ import io.ktor.client.request.prepareGet
import io.ktor.client.statement.bodyAsText import io.ktor.client.statement.bodyAsText
import java.io.File import java.io.File
import java.io.IOException import java.io.IOException
import java.time.Instant
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll import kotlinx.coroutines.awaitAll
@@ -335,7 +334,9 @@ class SharedAppViewModel(
fun exportSelectedTunnels(uri: Uri?) = intent { fun exportSelectedTunnels(uri: Uri?) = intent {
val selectedTunnels = tunnelsUiState.value.selectedTunnels val selectedTunnels = tunnelsUiState.value.selectedTunnels
val files = createConfFiles(selectedTunnels) val files = createConfFiles(selectedTunnels)
val shareFileName = "wgtunnel-export_${Instant.now().epochSecond}.zip"
val shareFileName = createExportFileName(selectedTunnels.size)
val onFailure = { action: Throwable -> val onFailure = { action: Throwable ->
intent { intent {
postSideEffect( postSideEffect(
@@ -349,6 +350,7 @@ class SharedAppViewModel(
} }
Unit Unit
} }
fileUtils fileUtils
.createNewShareFile(shareFileName) .createNewShareFile(shareFileName)
.onSuccess { .onSuccess {
@@ -366,6 +368,17 @@ class SharedAppViewModel(
.onFailure(onFailure) .onFailure(onFailure)
} }
private fun createExportFileName(tunnelCount: Int): String {
val timestamp =
java.time.LocalDateTime.now()
.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd_HH-mm"))
return when (tunnelCount) {
1 -> "WGTunnel_Export_$timestamp.zip"
else -> "WGTunnel_Export_${timestamp}_${tunnelCount}_Tunnels.zip"
}
}
fun setScreenRecordingSecurity(to: Boolean) = intent { fun setScreenRecordingSecurity(to: Boolean) = intent {
settingsRepository.updateScreenRecordingSecurity(to) settingsRepository.updateScreenRecordingSecurity(to)
} }
+1
View File
@@ -26,6 +26,7 @@ fun allowedLicenseUrls(): List<String> {
"https://github.com/RikkaApps/Shizuku-API/blob/master/LICENSE", "https://github.com/RikkaApps/Shizuku-API/blob/master/LICENSE",
"https://github.com/rafi0101/Android-Room-Database-Backup/blob/master/LICENSE", "https://github.com/rafi0101/Android-Room-Database-Backup/blob/master/LICENSE",
"https://opensource.org/license/mit", "https://opensource.org/license/mit",
"https://www.bouncycastle.org/licence.html",
) )
} }
+1 -3
View File
@@ -1,5 +1,4 @@
[versions] [versions]
app="5.0.0"
accompanist = "0.37.3" accompanist = "0.37.3"
activityCompose = "1.13.0" activityCompose = "1.13.0"
androidx-junit = "1.3.0" androidx-junit = "1.3.0"
@@ -44,7 +43,7 @@ storage = "1.6.0"
ktfmt = "0.26.0" ktfmt = "0.26.0"
licensee = "1.14.1" licensee = "1.14.1"
lifecycleViewmodelNavigation3 = "2.10.0" lifecycleViewmodelNavigation3 = "2.10.0"
parser = "1.0.7" parser = "1.1.0"
relinker = "1.4.5" relinker = "1.4.5"
libsu = "6.0.0" libsu = "6.0.0"
jetbrainsKotlinJvm = "2.3.21" jetbrainsKotlinJvm = "2.3.21"
@@ -200,7 +199,6 @@ libsu = { module = "com.github.topjohnwu.libsu:core", version.ref = "libsu" }
[plugins] [plugins]
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
kotlinxSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } kotlinxSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
androidLibrary = { id = "com.android.library", version.ref = "androidGradlePlugin" } androidLibrary = { id = "com.android.library", version.ref = "androidGradlePlugin" }