Выпуск WDTT Plus v5
This commit is contained in:
1 parent
87e9892cab
commit
ce393e151a
8 files changed
+1785
-89
No files matched your search
@@ -5,7 +5,7 @@ plugins {
|
||||
id("org.jetbrains.kotlin.plugin.compose")
|
||||
}
|
||||
|
||||
val appVersionName = "4"
|
||||
val appVersionName = "5"
|
||||
val releaseApkBaseName = "WDTT-Plus"
|
||||
|
||||
val localProperties = Properties()
|
||||
@@ -22,7 +22,7 @@ android {
|
||||
applicationId = "com.wdtt.plus"
|
||||
minSdk = 28
|
||||
targetSdk = 35
|
||||
versionCode = 4
|
||||
versionCode = 5
|
||||
versionName = appVersionName
|
||||
buildConfigField("String", "MOD_RELEASE_DATE", "\"05.07.2026\"")
|
||||
|
||||
|
||||
@@ -653,6 +653,7 @@ fun MainScreen(
|
||||
val permissionOnboardingComplete by settingsStore.permissionOnboardingComplete.collectAsStateWithLifecycle(initialValue = false)
|
||||
val migrationNoticeV2Shown by settingsStore.migrationNoticeV2Shown.collectAsStateWithLifecycle(initialValue = true)
|
||||
val migrationNoticeV3Shown by settingsStore.migrationNoticeV3Shown.collectAsStateWithLifecycle(initialValue = true)
|
||||
val migrationNoticeV5Shown by settingsStore.migrationNoticeV5Shown.collectAsStateWithLifecycle(initialValue = true)
|
||||
val isAdminInterface = interfaceRole == "admin"
|
||||
val isUpdatedInstall = remember(context) {
|
||||
runCatching {
|
||||
@@ -1041,6 +1042,38 @@ fun MainScreen(
|
||||
)
|
||||
}
|
||||
|
||||
if (
|
||||
BuildConfig.VERSION_CODE == 5 &&
|
||||
isAdminInterface &&
|
||||
isUpdatedInstall &&
|
||||
!migrationNoticeV5Shown
|
||||
) {
|
||||
AlertDialog(
|
||||
onDismissRequest = {},
|
||||
properties = DialogProperties(
|
||||
dismissOnBackPress = false,
|
||||
dismissOnClickOutside = false
|
||||
),
|
||||
title = { Text("Обновите серверную часть") },
|
||||
text = {
|
||||
Text(
|
||||
"Чтобы управление выходным IP, бесплатным WARP и новыми проверками корректно работало в приложении и Telegram-боте, выполните установку сервера во вкладке «Деплой».\n\n" +
|
||||
"Выберите установку с сохранением данных. Клиенты, доступы и настройки сохранятся.\n\n" +
|
||||
"Установку с нуля выполнять не нужно."
|
||||
)
|
||||
},
|
||||
confirmButton = {
|
||||
Box(modifier = Modifier.fillMaxWidth(), contentAlignment = Alignment.Center) {
|
||||
Button(
|
||||
onClick = { scope.launch { settingsStore.saveMigrationNoticeV5Shown() } }
|
||||
) {
|
||||
Text("Хорошо")
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
if (showTransferCenter) {
|
||||
TransferCenterDialog(
|
||||
settingsStore = settingsStore,
|
||||
|
||||
@@ -313,6 +313,7 @@ class SettingsStore(context: Context) {
|
||||
private val UPDATE_DIALOG_LAST_ACTION_AT = longPreferencesKey("update_dialog_last_action_at")
|
||||
private val MIGRATION_NOTICE_V2_SHOWN = booleanPreferencesKey("migration_notice_v2_shown")
|
||||
private val MIGRATION_NOTICE_V3_SHOWN = booleanPreferencesKey("migration_notice_v3_shown")
|
||||
private val MIGRATION_NOTICE_V5_SHOWN = booleanPreferencesKey("migration_notice_v5_shown")
|
||||
private val DEPLOY_CLIENTS_SECTION_EXPANDED = booleanPreferencesKey("deploy_clients_section_expanded")
|
||||
private val DEPLOY_OUTBOUND_SECTION_EXPANDED = booleanPreferencesKey("deploy_outbound_section_expanded")
|
||||
private val DEPLOY_MIGRATION_SECTION_EXPANDED = booleanPreferencesKey("deploy_migration_section_expanded")
|
||||
@@ -537,6 +538,7 @@ class SettingsStore(context: Context) {
|
||||
val updateDialogLastActionAt: Flow<Long> = dataStore.data.map { it[UPDATE_DIALOG_LAST_ACTION_AT] ?: 0L }
|
||||
val migrationNoticeV2Shown: Flow<Boolean> = dataStore.data.map { it[MIGRATION_NOTICE_V2_SHOWN] ?: false }
|
||||
val migrationNoticeV3Shown: Flow<Boolean> = dataStore.data.map { it[MIGRATION_NOTICE_V3_SHOWN] ?: false }
|
||||
val migrationNoticeV5Shown: Flow<Boolean> = dataStore.data.map { it[MIGRATION_NOTICE_V5_SHOWN] ?: false }
|
||||
val deployClientsSectionExpanded: Flow<Boolean> = dataStore.data.map { it[DEPLOY_CLIENTS_SECTION_EXPANDED] ?: true }
|
||||
val deployOutboundSectionExpanded: Flow<Boolean> = dataStore.data.map { it[DEPLOY_OUTBOUND_SECTION_EXPANDED] ?: false }
|
||||
val deployMigrationSectionExpanded: Flow<Boolean> = dataStore.data.map { it[DEPLOY_MIGRATION_SECTION_EXPANDED] ?: false }
|
||||
@@ -649,6 +651,12 @@ class SettingsStore(context: Context) {
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun saveMigrationNoticeV5Shown() {
|
||||
dataStore.edit { prefs ->
|
||||
prefs[MIGRATION_NOTICE_V5_SHOWN] = true
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun saveDeployClientsSectionExpanded(expanded: Boolean) {
|
||||
dataStore.edit { prefs ->
|
||||
prefs[DEPLOY_CLIENTS_SECTION_EXPANDED] = expanded
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,82 @@
|
||||
package com.wdtt.plus.ui
|
||||
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
import java.io.File
|
||||
|
||||
class OutboundWireGuardTest {
|
||||
private val safeConfig = """
|
||||
[Interface]
|
||||
PrivateKey = AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
|
||||
Address = 172.16.0.2/32
|
||||
DNS = 1.1.1.1
|
||||
MTU = 1280
|
||||
Table = auto
|
||||
|
||||
[Peer]
|
||||
PublicKey = BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB=
|
||||
AllowedIPs = 0.0.0.0/0, ::/0
|
||||
Endpoint = engage.cloudflareclient.com:2408
|
||||
PersistentKeepalive = 25
|
||||
""".trimIndent()
|
||||
|
||||
@Test
|
||||
fun importedWireGuardConfig_isSanitizedForPolicyRouting() {
|
||||
val sanitized = sanitizeWireGuardConfigForWdttExit(safeConfig)
|
||||
|
||||
assertTrue("Table = off" in sanitized)
|
||||
assertTrue("MTU = 1280" in sanitized)
|
||||
assertFalse(Regex("(?im)^\\s*DNS\\s*=").containsMatchIn(sanitized))
|
||||
assertFalse("Table = auto" in sanitized)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun importedWireGuardConfig_rejectsCommandsAndUnknownParameters() {
|
||||
val commandConfig = safeConfig.replace("MTU = 1280", "PostUp = touch /tmp/unsafe")
|
||||
val unknownConfig = safeConfig.replace("MTU = 1280", "UnsafeOption = true")
|
||||
|
||||
assertTrue(validateWireGuardConfigText(commandConfig).isFailure)
|
||||
assertTrue(validateWireGuardConfigText(unknownConfig).isFailure)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun importedWireGuardConfig_requiresDefaultIpv4Route() {
|
||||
val config = safeConfig.replace("0.0.0.0/0, ::/0", "10.0.0.0/8")
|
||||
|
||||
assertTrue(validateWireGuardConfigText(config).isFailure)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun freeWarpScript_hasSafeUpdateChecksAndValidShellSyntax() {
|
||||
val script = buildFreeWarpInstallScript(1392)
|
||||
|
||||
assertTrue("WARP_MTU=1392" in script)
|
||||
assertTrue("checksums.txt" in script)
|
||||
assertTrue("sha256sum" in script)
|
||||
assertTrue("--accept-tos" in script)
|
||||
assertTrue("wdtt-warp-watchdog.timer" in script)
|
||||
assertTrue("for attempt in 1 2 3" in script)
|
||||
assertShellSyntax(script)
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException::class)
|
||||
fun freeWarpScript_rejectsUnsafeMtu() {
|
||||
buildFreeWarpInstallScript(1600)
|
||||
}
|
||||
|
||||
private fun assertShellSyntax(script: String) {
|
||||
val file = File.createTempFile("wdtt-warp-", ".sh")
|
||||
try {
|
||||
file.writeText(script)
|
||||
val process = ProcessBuilder("bash", "-n", file.absolutePath)
|
||||
.redirectErrorStream(true)
|
||||
.start()
|
||||
val output = process.inputStream.bufferedReader().readText()
|
||||
val code = process.waitFor()
|
||||
assertTrue("bash -n завершился с кодом $code: $output", code == 0)
|
||||
} finally {
|
||||
file.delete()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user