From a60668c9c429643fe4d8c0958d068cb829ed4a75 Mon Sep 17 00:00:00 2001 From: samosvalishe Date: Fri, 3 Apr 2026 02:06:21 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3=20=D1=81=D1=82=D1=80=D0=BE=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2=D1=8B=D1=85=20=D1=80=D0=B5=D1=81=D1=83=D1=80=D1=81?= =?UTF-8?q?=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/screens/ClientSetupScreen.kt | 52 ++++---- .../com/freeturn/app/ui/screens/HomeScreen.kt | 65 +++++----- .../com/freeturn/app/ui/screens/LogsScreen.kt | 9 +- .../app/ui/screens/OnboardingScreen.kt | 11 +- .../app/ui/screens/ServerManagementScreen.kt | 39 +++--- .../freeturn/app/ui/screens/SshSetupScreen.kt | 37 +++--- app/src/main/res/values/strings.xml | 115 +++++++++++++++++- 7 files changed, 224 insertions(+), 104 deletions(-) diff --git a/app/src/main/java/com/freeturn/app/ui/screens/ClientSetupScreen.kt b/app/src/main/java/com/freeturn/app/ui/screens/ClientSetupScreen.kt index 7b261f4..49c371d 100644 --- a/app/src/main/java/com/freeturn/app/ui/screens/ClientSetupScreen.kt +++ b/app/src/main/java/com/freeturn/app/ui/screens/ClientSetupScreen.kt @@ -42,7 +42,9 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp +import com.freeturn.app.R import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.freeturn.app.data.ClientConfig import com.freeturn.app.ui.HapticUtil @@ -105,7 +107,7 @@ fun ClientSetupScreen( Scaffold( topBar = { - TopAppBar(title = { Text("Клиент") }) + TopAppBar(title = { Text(stringResource(R.string.client_title)) }) }, contentWindowInsets = WindowInsets(0, 0, 0, 0) ) { padding -> @@ -121,45 +123,45 @@ fun ClientSetupScreen( Spacer(Modifier.height(4.dp)) // ── Подключение ─────────────────────────────────────────────── - Text("Подключение", style = MaterialTheme.typography.titleMedium) + Text(stringResource(R.string.connection_title), style = MaterialTheme.typography.titleMedium) OutlinedTextField( value = serverAddress, onValueChange = { serverAddress = it }, - label = { Text("Адрес vk-turn-proxy сервера") }, - placeholder = { Text("1.2.3.4:56000") }, + label = { Text(stringResource(R.string.server_address_label)) }, + placeholder = { Text(stringResource(R.string.server_address_placeholder)) }, modifier = Modifier.fillMaxWidth(), singleLine = true, - supportingText = { Text("IP и порт vk-turn-proxy на вашем VPS") } + supportingText = { Text(stringResource(R.string.server_address_support)) } ) OutlinedTextField( value = vkLink, onValueChange = { vkLink = it }, - label = { Text("Ссылка VK-звонок / Yandex Telemost") }, - placeholder = { Text("https://vk.com/call/...") }, + label = { Text(stringResource(R.string.vk_link_label)) }, + placeholder = { Text(stringResource(R.string.vk_link_placeholder)) }, modifier = Modifier.fillMaxWidth(), minLines = 2, maxLines = 4, - supportingText = { Text("VK: Звонки → Создать → Скопировать ссылку (не нажимайте «Завершить»)") } + supportingText = { Text(stringResource(R.string.vk_link_support)) } ) OutlinedTextField( value = localPort, onValueChange = { localPort = it }, - label = { Text("Локальный адрес прослушивания") }, - placeholder = { Text("127.0.0.1:9000") }, + label = { Text(stringResource(R.string.local_listen_address)) }, + placeholder = { Text(stringResource(R.string.local_listen_placeholder)) }, modifier = Modifier.fillMaxWidth(), singleLine = true, supportingText = { - Text("Адрес, на котором клиент принимает трафик от WireGuard/Hysteria") + Text(stringResource(R.string.local_listen_support)) } ) HorizontalDivider(Modifier, DividerDefaults.Thickness, DividerDefaults.color) // ── Параметры ───────────────────────────────────────────────── - Text("Параметры", style = MaterialTheme.typography.titleMedium) + Text(stringResource(R.string.parameters_title), style = MaterialTheme.typography.titleMedium) Column { Row( @@ -167,9 +169,9 @@ fun ClientSetupScreen( modifier = Modifier.fillMaxWidth() ) { Column(modifier = Modifier.weight(1f)) { - Text("Потоки: ${threads.toInt()}", style = MaterialTheme.typography.bodyMedium) + Text(stringResource(R.string.threads_format, threads.toInt()), style = MaterialTheme.typography.bodyMedium) Text( - "Рекомендуется 4–8", + stringResource(R.string.threads_recommendation), style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.5f) ) @@ -192,8 +194,8 @@ fun ClientSetupScreen( } SwitchRow( - label = "UDP-режим", - description = "Снижает задержки и повышает стабильность", + label = stringResource(R.string.udp_mode), + description = stringResource(R.string.udp_mode_desc), checked = useUdp, onCheckedChange = { HapticUtil.perform(context, if (it) HapticUtil.Pattern.TOGGLE_ON else HapticUtil.Pattern.TOGGLE_OFF) @@ -202,8 +204,8 @@ fun ClientSetupScreen( ) SwitchRow( - label = "Без DTLS-шифрования", - description = "Может ускорить соединение, повышает риск блокировки", + label = stringResource(R.string.no_dtls), + description = stringResource(R.string.no_dtls_desc), checked = noDtls, onCheckedChange = { HapticUtil.perform(context, if (it) HapticUtil.Pattern.TOGGLE_ON else HapticUtil.Pattern.TOGGLE_OFF) @@ -214,7 +216,7 @@ fun ClientSetupScreen( HorizontalDivider(Modifier, DividerDefaults.Thickness, DividerDefaults.color) // ── Ядро ────────────────────────────────────────────────────── - Text("Ядро", style = MaterialTheme.typography.titleMedium) + Text(stringResource(R.string.core_title), style = MaterialTheme.typography.titleMedium) Card( modifier = Modifier.fillMaxWidth(), @@ -234,12 +236,12 @@ fun ClientSetupScreen( ) { Column(modifier = Modifier.weight(1f)) { Text( - if (customKernelExists) "Кастомное ядро" else "Встроенное ядро", + if (customKernelExists) stringResource(R.string.custom_core) else stringResource(R.string.builtin_core), style = MaterialTheme.typography.bodyMedium ) Text( - if (customKernelExists) "Загружено из памяти устройства" - else "Из APK (libvkturn.so)", + if (customKernelExists) stringResource(R.string.loaded_from_memory) + else stringResource(R.string.from_apk), style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.55f) ) @@ -254,13 +256,13 @@ fun ClientSetupScreen( colors = ButtonDefaults.outlinedButtonColors( contentColor = MaterialTheme.colorScheme.error ) - ) { Text("Сбросить") } + ) { Text(stringResource(R.string.reset)) } } Button(onClick = { HapticUtil.perform(context, HapticUtil.Pattern.CLICK) kernelPickerLauncher.launch(arrayOf("*/*")) }) { - Text("Загрузить") + Text(stringResource(R.string.btn_load)) } } } @@ -277,7 +279,7 @@ fun ClientSetupScreen( enabled = serverAddress.isNotBlank() && vkLink.isNotBlank(), shape = MaterialTheme.shapes.large ) { - Text("Завершить настройку", style = MaterialTheme.typography.labelLarge) + Text(stringResource(R.string.finish_setup), style = MaterialTheme.typography.labelLarge) } } diff --git a/app/src/main/java/com/freeturn/app/ui/screens/HomeScreen.kt b/app/src/main/java/com/freeturn/app/ui/screens/HomeScreen.kt index 9bb7335..4ad83e9 100644 --- a/app/src/main/java/com/freeturn/app/ui/screens/HomeScreen.kt +++ b/app/src/main/java/com/freeturn/app/ui/screens/HomeScreen.kt @@ -29,6 +29,7 @@ import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.verticalScroll import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource import com.freeturn.app.R import androidx.compose.material3.AlertDialog import androidx.compose.material3.ButtonDefaults @@ -148,13 +149,13 @@ fun HomeScreen( Scaffold( topBar = { TopAppBar( - title = { Text("Turn Proxy") }, + title = { Text(stringResource(R.string.turn_proxy_title)) }, actions = { IconButton(onClick = { HapticUtil.perform(context, HapticUtil.Pattern.CLICK) showBottomSheet.value = true }) { - Icon(painterResource(R.drawable.info_24px), contentDescription = "Информация") + Icon(painterResource(R.drawable.info_24px), contentDescription = stringResource(R.string.info_desc)) } } ) @@ -191,10 +192,10 @@ fun HomeScreen( Text( text = when (proxyState) { - is ProxyState.Running -> "Прокси активен" - is ProxyState.Starting -> "Подключение..." + is ProxyState.Running -> stringResource(R.string.proxy_active) + is ProxyState.Starting -> stringResource(R.string.proxy_connecting) is ProxyState.Error -> (proxyState as ProxyState.Error).message - else -> "Нажмите для запуска" + else -> stringResource(R.string.proxy_press_to_start) }, style = MaterialTheme.typography.titleMedium, color = when (proxyState) { @@ -215,12 +216,12 @@ fun HomeScreen( elevation = CardDefaults.cardElevation(2.dp) ) { Column(modifier = Modifier.padding(20.dp)) { - Text("Текущие настройки", style = MaterialTheme.typography.titleSmall) + Text(stringResource(R.string.current_settings), style = MaterialTheme.typography.titleSmall) Spacer(Modifier.height(12.dp)) - ConfigRow("Сервер", clientConfig.serverAddress) - ConfigRow("Потоки", "${clientConfig.threads}") - ConfigRow("UDP", if (clientConfig.useUdp) "Вкл" else "Выкл") - ConfigRow("Локальный порт", clientConfig.localPort) + ConfigRow(stringResource(R.string.server), clientConfig.serverAddress) + ConfigRow(stringResource(R.string.threads), "${clientConfig.threads}") + ConfigRow(stringResource(R.string.udp), if (clientConfig.useUdp) stringResource(R.string.on) else stringResource(R.string.off)) + ConfigRow(stringResource(R.string.local_port), clientConfig.localPort) } } @@ -245,9 +246,9 @@ fun HomeScreen( Text( when (sshState) { is SshConnectionState.Connected -> "SSH: ${(sshState as SshConnectionState.Connected).ip}" - is SshConnectionState.Connecting -> "SSH: подключение..." - is SshConnectionState.Error -> "SSH: ошибка" - else -> "SSH: не подключено" + is SshConnectionState.Connecting -> stringResource(R.string.ssh_connecting) + is SshConnectionState.Error -> stringResource(R.string.ssh_error) + else -> stringResource(R.string.ssh_disconnected) }, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.6f) @@ -261,7 +262,7 @@ fun HomeScreen( }, modifier = Modifier.height(28.dp) ) { - Text("Переподключить", style = MaterialTheme.typography.labelSmall) + Text(stringResource(R.string.reconnect), style = MaterialTheme.typography.labelSmall) } } } @@ -336,15 +337,15 @@ private fun ProxyToggleButton(state: ProxyState, onClick: () -> Unit) { when (state) { is ProxyState.Starting -> CircularWavyProgressIndicator(color = contentColor) is ProxyState.Running -> Icon( - painterResource(R.drawable.check_circle_24px), "Прокси активен — нажмите для остановки", + painterResource(R.drawable.check_circle_24px), stringResource(R.string.proxy_active_stop), Modifier.size(52.dp), tint = contentColor ) is ProxyState.Error -> Icon( - painterResource(R.drawable.error_24px), "Ошибка — нажмите для повторного запуска", + painterResource(R.drawable.error_24px), stringResource(R.string.proxy_error_restart), Modifier.size(52.dp), tint = contentColor ) else -> Icon( - painterResource(R.drawable.play_arrow_24px), "Запустить прокси", + painterResource(R.drawable.play_arrow_24px), stringResource(R.string.start_proxy), Modifier.size(52.dp), tint = contentColor ) } @@ -379,7 +380,7 @@ private fun InfoBottomSheet( // ── Соединение ──────────────────────────────────────────────────── item { ListItem( - headlineContent = { Text("Соединение", style = MaterialTheme.typography.titleSmall) }, + headlineContent = { Text(stringResource(R.string.connection), style = MaterialTheme.typography.titleSmall) }, colors = listColors, supportingContent = { Text( @@ -390,7 +391,7 @@ private fun InfoBottomSheet( (sshState as SshConnectionState.Connecting).step is SshConnectionState.Error -> "Ошибка: ${(sshState as SshConnectionState.Error).message}" - else -> "Не подключено" + else -> stringResource(R.string.not_connected) } ) }, @@ -399,12 +400,12 @@ private fun InfoBottomSheet( TextButton(onClick = { HapticUtil.perform(context, HapticUtil.Pattern.CLICK) onNavigateToSshSetup() - }) { Text("Изменить") } + }) { Text(stringResource(R.string.change)) } } else { TextButton(onClick = { HapticUtil.perform(context, HapticUtil.Pattern.CLICK) onNavigateToSshSetup() - }) { Text("Настроить") } + }) { Text(stringResource(R.string.configure)) } } } ) @@ -415,9 +416,9 @@ private fun InfoBottomSheet( // ── Ссылки ──────────────────────────────────────────────────────── item { RepoLinkItem( - title = "Android-клиент", - subtitle = "antongospod/turn-proxy", - url = "https://github.com/antongospod/turn-proxy", + title = stringResource(R.string.android_client), + subtitle = "antongospod/turn-proxy-android", + url = "https://github.com/antongospod/turn-proxy-android", containerColor = containerColor, onHaptic = { HapticUtil.perform(context, HapticUtil.Pattern.SELECTION) }, onOpen = { uriHandler.openUri(it) } @@ -426,7 +427,7 @@ private fun InfoBottomSheet( item { RepoLinkItem( - title = "Прокси-ядро", + title = stringResource(R.string.proxy_core), subtitle = "cacggghp/vk-turn-proxy", url = "https://github.com/cacggghp/vk-turn-proxy", containerColor = containerColor, @@ -442,7 +443,7 @@ private fun InfoBottomSheet( ListItem( headlineContent = { Text( - "Сбросить настройки", + stringResource(R.string.reset_settings), style = MaterialTheme.typography.titleSmall, color = MaterialTheme.colorScheme.error ) @@ -451,7 +452,7 @@ private fun InfoBottomSheet( trailingContent = { Icon( painterResource(R.drawable.delete_24px), - contentDescription = "Сбросить", + contentDescription = stringResource(R.string.reset), modifier = Modifier.size(20.dp), tint = MaterialTheme.colorScheme.error ) @@ -480,8 +481,8 @@ private fun InfoBottomSheet( if (showResetDialog) { AlertDialog( onDismissRequest = { showResetDialog = false }, - title = { Text("Сбросить все настройки?") }, - text = { Text("Все настройки будут удалены, прокси остановлен. Приложение перезапустится.") }, + title = { Text(stringResource(R.string.reset_all_settings_title)) }, + text = { Text(stringResource(R.string.reset_all_settings_desc)) }, confirmButton = { TextButton( onClick = { @@ -491,10 +492,10 @@ private fun InfoBottomSheet( colors = ButtonDefaults.textButtonColors( contentColor = MaterialTheme.colorScheme.error ) - ) { Text("Сбросить") } + ) { Text(stringResource(R.string.reset)) } }, dismissButton = { - TextButton(onClick = { showResetDialog = false }) { Text("Отмена") } + TextButton(onClick = { showResetDialog = false }) { Text(stringResource(R.string.cancel)) } } ) } @@ -522,7 +523,7 @@ private fun RepoLinkItem( trailingContent = { Icon( painterResource(R.drawable.open_in_new_24px), - contentDescription = "Открыть", + contentDescription = stringResource(R.string.btn_open), modifier = Modifier.size(18.dp), tint = MaterialTheme.colorScheme.primary ) diff --git a/app/src/main/java/com/freeturn/app/ui/screens/LogsScreen.kt b/app/src/main/java/com/freeturn/app/ui/screens/LogsScreen.kt index 393e793..aa4b8d0 100644 --- a/app/src/main/java/com/freeturn/app/ui/screens/LogsScreen.kt +++ b/app/src/main/java/com/freeturn/app/ui/screens/LogsScreen.kt @@ -30,6 +30,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign @@ -54,7 +55,7 @@ fun LogsScreen(viewModel: MainViewModel) { Scaffold( topBar = { TopAppBar( - title = { Text("Логи") }, + title = { Text(stringResource(R.string.logs_title)) }, actions = { IconButton( onClick = { @@ -66,7 +67,7 @@ fun LogsScreen(viewModel: MainViewModel) { ) { Icon( painterResource(R.drawable.content_copy_24px), - contentDescription = "Копировать" + contentDescription = stringResource(R.string.copy) ) } IconButton( @@ -78,7 +79,7 @@ fun LogsScreen(viewModel: MainViewModel) { ) { Icon( painterResource(R.drawable.delete_24px), - contentDescription = "Очистить" + contentDescription = stringResource(R.string.clear) ) } } @@ -93,7 +94,7 @@ fun LogsScreen(viewModel: MainViewModel) { contentAlignment = Alignment.Center ) { Text( - "Нет логов", + stringResource(R.string.no_logs), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.4f) ) diff --git a/app/src/main/java/com/freeturn/app/ui/screens/OnboardingScreen.kt b/app/src/main/java/com/freeturn/app/ui/screens/OnboardingScreen.kt index f925f5f..723bb8b 100644 --- a/app/src/main/java/com/freeturn/app/ui/screens/OnboardingScreen.kt +++ b/app/src/main/java/com/freeturn/app/ui/screens/OnboardingScreen.kt @@ -36,6 +36,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.scale import androidx.compose.ui.graphics.Brush import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import com.freeturn.app.ui.HapticUtil @@ -98,7 +99,7 @@ fun OnboardingScreen( Spacer(Modifier.height(40.dp)) Text( - text = "Turn Proxy", + text = stringResource(R.string.onboarding_title), style = MaterialTheme.typography.displaySmall, color = MaterialTheme.colorScheme.onBackground, textAlign = TextAlign.Center @@ -107,7 +108,7 @@ fun OnboardingScreen( Spacer(Modifier.height(12.dp)) Text( - text = "Проксируйте WireGuard и Hysteria‑трафик\nчерез TURN‑серверы VK Calls", + text = stringResource(R.string.onboarding_subtitle), style = MaterialTheme.typography.bodyLarge, color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.65f), textAlign = TextAlign.Center @@ -134,7 +135,7 @@ fun OnboardingScreen( ) Spacer(Modifier.width(10.dp)) Text( - "Мы не собираем никаких данных. Все настройки (SSH-доступ, параметры прокси) хранятся исключительно на вашем устройстве.", + stringResource(R.string.privacy_notice), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant ) @@ -160,7 +161,7 @@ fun OnboardingScreen( ) { Icon(painterResource(R.drawable.wifi_24px), contentDescription = null) Spacer(Modifier.width(10.dp)) - Text("Настроить сервер", style = MaterialTheme.typography.labelLarge) + Text(stringResource(R.string.setup_server), style = MaterialTheme.typography.labelLarge) } Spacer(Modifier.height(12.dp)) @@ -169,7 +170,7 @@ fun OnboardingScreen( HapticUtil.perform(context, HapticUtil.Pattern.SELECTION) onSkip() }) { - Text("Пропустить настройки") + Text(stringResource(R.string.skip_setup)) } Spacer(Modifier.height(24.dp)) diff --git a/app/src/main/java/com/freeturn/app/ui/screens/ServerManagementScreen.kt b/app/src/main/java/com/freeturn/app/ui/screens/ServerManagementScreen.kt index 4eba0e1..f77b656 100644 --- a/app/src/main/java/com/freeturn/app/ui/screens/ServerManagementScreen.kt +++ b/app/src/main/java/com/freeturn/app/ui/screens/ServerManagementScreen.kt @@ -24,6 +24,7 @@ import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.verticalScroll import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource import com.freeturn.app.R import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults @@ -86,7 +87,7 @@ fun ServerManagementScreen( Scaffold( topBar = { TopAppBar( - title = { Text("Сервер") }, + title = { Text(stringResource(R.string.server)) }, actions = { SshStatusBadge(sshState = sshState, ip = sshConfig.ip) } @@ -109,11 +110,11 @@ fun ServerManagementScreen( // Status card Card(modifier = Modifier.fillMaxWidth()) { Column(modifier = Modifier.padding(20.dp)) { - Text("Статус сервера", style = MaterialTheme.typography.titleMedium) + Text(stringResource(R.string.server_status), style = MaterialTheme.typography.titleMedium) Spacer(Modifier.height(16.dp)) - StatusRow("SSH‑соединение", isConnected) + StatusRow(stringResource(R.string.ssh_connection), isConnected) Spacer(Modifier.height(10.dp)) - StatusRow("vk‑turn‑proxy", serverKnown?.running == true) + StatusRow(stringResource(R.string.vk_turn_proxy), serverKnown?.running == true) when (serverState) { is ServerState.Checking -> { @@ -133,7 +134,7 @@ fun ServerManagementScreen( is ServerState.Error -> { Spacer(Modifier.height(12.dp)) Text( - "Ошибка: ${(serverState as ServerState.Error).message}", + stringResource(R.string.error_format, (serverState as ServerState.Error).message), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.error ) @@ -144,26 +145,26 @@ fun ServerManagementScreen( } // Server config - Text("Конфигурация сервера", style = MaterialTheme.typography.titleMedium) + Text(stringResource(R.string.server_config), style = MaterialTheme.typography.titleMedium) OutlinedTextField( value = proxyListen, onValueChange = { proxyListen = it }, - label = { Text("Порт прослушивания") }, - placeholder = { Text("0.0.0.0:56000") }, + label = { Text(stringResource(R.string.listen_port)) }, + placeholder = { Text(stringResource(R.string.listen_port_placeholder)) }, modifier = Modifier.fillMaxWidth(), singleLine = true, - supportingText = { Text("Порт, на котором сервер принимает подключения от клиентов") } + supportingText = { Text(stringResource(R.string.listen_port_desc)) } ) OutlinedTextField( value = proxyConnect, onValueChange = { proxyConnect = it }, - label = { Text("Адрес TURN‑клиента") }, - placeholder = { Text("127.0.0.1:40537") }, + label = { Text(stringResource(R.string.turn_client_address)) }, + placeholder = { Text(stringResource(R.string.turn_client_placeholder)) }, modifier = Modifier.fillMaxWidth(), singleLine = true, - supportingText = { Text("Локальный WireGuard/Hysteria-клиент на стороне сервера") } + supportingText = { Text(stringResource(R.string.turn_client_desc)) } ) // Action buttons @@ -181,7 +182,7 @@ fun ServerManagementScreen( ) { Icon(painterResource(R.drawable.cloud_download_24px), null) Spacer(Modifier.width(8.dp)) - Text(if (serverKnown?.installed == true) "Обновить" else "Установить") + Text(if (serverKnown?.installed == true) stringResource(R.string.update) else stringResource(R.string.install)) } Button( @@ -199,7 +200,7 @@ fun ServerManagementScreen( ) { Icon(painterResource(R.drawable.play_arrow_24px), null) Spacer(Modifier.width(8.dp)) - Text("Запустить сервер") + Text(stringResource(R.string.start_server)) } OutlinedButton( @@ -218,7 +219,7 @@ fun ServerManagementScreen( ) { Icon(painterResource(R.drawable.stop_24px), null) Spacer(Modifier.width(8.dp)) - Text("Остановить сервер") + Text(stringResource(R.string.stop_server)) } if (serverKnown?.running == true) { @@ -233,7 +234,7 @@ fun ServerManagementScreen( .height(56.dp), shape = MaterialTheme.shapes.large ) { - Text("Продолжить настройку клиента") + Text(stringResource(R.string.continue_client_setup)) Spacer(Modifier.width(8.dp)) Icon(painterResource(R.drawable.arrow_forward_24px), null) } @@ -243,7 +244,7 @@ fun ServerManagementScreen( if (sshLog.isNotEmpty()) { Card(modifier = Modifier.fillMaxWidth()) { Column(modifier = Modifier.padding(20.dp)) { - Text("SSH-лог", style = MaterialTheme.typography.titleMedium) + Text(stringResource(R.string.ssh_log_title), style = MaterialTheme.typography.titleMedium) Spacer(Modifier.height(12.dp)) val listState = rememberLazyListState() LaunchedEffect(sshLog.size) { @@ -303,7 +304,7 @@ private fun SshStatusBadge(sshState: SshConnectionState, ip: String) { ) Spacer(Modifier.width(6.dp)) Text( - if (connected) ip else "Не подключено", + if (connected) ip else stringResource(R.string.not_connected), style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.7f) ) @@ -329,7 +330,7 @@ private fun StatusRow(label: String, isActive: Boolean) { ) Spacer(Modifier.width(6.dp)) Text( - if (isActive) "Активно" else "Неактивно", + if (isActive) stringResource(R.string.active) else stringResource(R.string.inactive), style = MaterialTheme.typography.labelSmall, color = if (isActive) StatusGreen else MaterialTheme.colorScheme.outline ) diff --git a/app/src/main/java/com/freeturn/app/ui/screens/SshSetupScreen.kt b/app/src/main/java/com/freeturn/app/ui/screens/SshSetupScreen.kt index c00a5d5..3bd186d 100644 --- a/app/src/main/java/com/freeturn/app/ui/screens/SshSetupScreen.kt +++ b/app/src/main/java/com/freeturn/app/ui/screens/SshSetupScreen.kt @@ -34,6 +34,7 @@ import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource import com.freeturn.app.R import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect @@ -90,13 +91,13 @@ fun SshSetupScreen( Scaffold( topBar = { TopAppBar( - title = { Text("Подключение к серверу") }, + title = { Text(stringResource(R.string.connect_to_server)) }, navigationIcon = { IconButton(onClick = { HapticUtil.perform(context, HapticUtil.Pattern.SELECTION) onBack() }) { - Icon(painterResource(R.drawable.arrow_back_24px), contentDescription = "Назад") + Icon(painterResource(R.drawable.arrow_back_24px), contentDescription = stringResource(R.string.back)) } } ) @@ -164,13 +165,13 @@ private fun FormSection( onConnect: () -> Unit ) { val context = LocalContext.current - Text("Данные сервера", style = MaterialTheme.typography.titleMedium) + Text(stringResource(R.string.server_data), style = MaterialTheme.typography.titleMedium) OutlinedTextField( value = ip, onValueChange = onIpChange, - label = { Text("IP-адрес сервера") }, - placeholder = { Text("1.2.3.4") }, + label = { Text(stringResource(R.string.server_ip_label)) }, + placeholder = { Text(stringResource(R.string.server_ip_placeholder)) }, modifier = Modifier.fillMaxWidth(), singleLine = true, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri) @@ -179,7 +180,7 @@ private fun FormSection( OutlinedTextField( value = port, onValueChange = onPortChange, - label = { Text("SSH порт") }, + label = { Text(stringResource(R.string.ssh_port)) }, modifier = Modifier.fillMaxWidth(), singleLine = true, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number) @@ -188,7 +189,7 @@ private fun FormSection( OutlinedTextField( value = username, onValueChange = onUsernameChange, - label = { Text("Имя пользователя") }, + label = { Text(stringResource(R.string.username)) }, modifier = Modifier.fillMaxWidth(), singleLine = true ) @@ -199,10 +200,10 @@ private fun FormSection( modifier = Modifier.fillMaxWidth() ) { OutlinedTextField( - value = if (authType == "PASSWORD") "Пароль" else "Приватный ключ", + value = if (authType == "PASSWORD") stringResource(R.string.password) else stringResource(R.string.private_key), onValueChange = {}, readOnly = true, - label = { Text("Аутентификация") }, + label = { Text(stringResource(R.string.authentication)) }, trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = authDropdownExpanded) }, modifier = Modifier .fillMaxWidth() @@ -212,13 +213,13 @@ private fun FormSection( expanded = authDropdownExpanded, onDismissRequest = { onAuthDropdownChange(false) } ) { - DropdownMenuItem(text = { Text("Пароль") }, + DropdownMenuItem(text = { Text(stringResource(R.string.password)) }, onClick = { HapticUtil.perform(context, HapticUtil.Pattern.SELECTION) onAuthTypeChange("PASSWORD") onAuthDropdownChange(false) }) - DropdownMenuItem(text = { Text("Приватный ключ") }, + DropdownMenuItem(text = { Text(stringResource(R.string.private_key)) }, onClick = { HapticUtil.perform(context, HapticUtil.Pattern.SELECTION) onAuthTypeChange("SSH_KEY") @@ -231,7 +232,7 @@ private fun FormSection( OutlinedTextField( value = password, onValueChange = onPasswordChange, - label = { Text("Пароль") }, + label = { Text(stringResource(R.string.password)) }, modifier = Modifier.fillMaxWidth(), singleLine = true, visualTransformation = if (showPassword) VisualTransformation.None else PasswordVisualTransformation(), @@ -252,8 +253,8 @@ private fun FormSection( OutlinedTextField( value = sshKey, onValueChange = onSshKeyChange, - label = { Text("Приватный ключ (PEM)") }, - placeholder = { Text("-----BEGIN RSA PRIVATE KEY-----\n...") }, + label = { Text(stringResource(R.string.private_key_pem)) }, + placeholder = { Text(stringResource(R.string.private_key_placeholder)) }, modifier = Modifier .fillMaxWidth() .height(160.dp), @@ -291,16 +292,16 @@ private fun FormSection( }, shape = MaterialTheme.shapes.large ) { - Text("Подключиться", style = MaterialTheme.typography.labelLarge) + Text(stringResource(R.string.connect_btn), style = MaterialTheme.typography.labelLarge) } } @Composable private fun ConnectionProgressCard(step: String) { val steps = listOf( - "Подключение к серверу...", - "Аутентификация...", - "Проверка SSH..." + stringResource(R.string.step_connecting), + stringResource(R.string.step_auth), + stringResource(R.string.step_ssh_check) ) val currentIndex = steps.indexOf(step).coerceAtLeast(0) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fac407e..2beb114 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,3 +1,116 @@ + - FreeTurn + Turn Proxy + + + Turn Proxy + Информация + Прокси активен + Подключение… + Нажмите для запуска + Текущие настройки + Сервер + Потоки + UDP + Вкл + Выкл + Локальный порт + SSH: подключение… + SSH: ошибка + SSH: не подключено + Переподключить + Прокси активен — нажмите для остановки + Ошибка — нажмите для повторного запуска + Запустить прокси + Соединение + Не подключено + Изменить + Настроить + Android-клиент + Прокси-ядро + Открыть + Сбросить настройки + Сбросить + Сбросить все настройки? + Все настройки будут удалены, прокси остановлен. Приложение перезапустится. + Отмена + + + Клиент + Подключение + Адрес vk-turn-proxy сервера + 1.2.3.4:56000 + IP и порт vk-turn-proxy на вашем VPS + Ссылка VK-звонок / Yandex Telemost + https://vk.com/call/… + VK: Звонки → Создать → Скопировать ссылку (не нажимайте «Завершить») + Локальный адрес прослушивания + 127.0.0.1:9000 + Адрес, на котором клиент принимает трафик от WireGuard/Hysteria + Параметры + Потоки: %1$d + Рекомендуется 4–8 + UDP-режим + Снижает задержки + Без DTLS-шифрования + Может ускорить соединение, повышает риск блокировки + Ядро + Кастомное ядро + Встроенное ядро + Загружено из памяти устройства + Из APK (libvkturn.so) + Загрузить + Завершить настройку + + + Логи + Копировать + Очистить + Нет логов + + + Статус сервера + SSH‑соединение + vk‑turn‑proxy + Ошибка: %1$s + Конфигурация сервера + Порт прослушивания + 0.0.0.0:56000 + Порт, на котором сервер принимает подключения от клиентов + Адрес TURN‑клиента + 127.0.0.1:40537 + Локальный WireGuard/Hysteria-клиент на стороне сервера + Обновить + Установить + Запустить сервер + Остановить сервер + Продолжить настройку клиента + SSH-лог + Активно + Неактивно + + + Подключение к серверу + Назад + Данные сервера + IP-адрес сервера + 1.2.3.4 + SSH порт + Имя пользователя + Пароль + Приватный ключ + Аутентификация + Приватный ключ (PEM) + -----BEGIN RSA PRIVATE KEY-----\n… + Подключиться + Подключение к серверу… + Аутентификация… + Проверка SSH… + + + Turn Proxy + Проксируйте WireGuard и Hysteria‑трафик\nчерез TURN‑серверы VK Calls + Мы не собираем никаких данных. Все настройки (SSH-доступ, параметры прокси) хранятся исключительно на вашем устройстве. + Настроить сервер + Пропустить настройки \ No newline at end of file