refactor: вынос ProxyOrchestrator и UI-полировка MD3

- вынос дублирующейся логики restart/start прокси и сервера из
  ServerViewModel и SettingsViewModel в общий ProxyOrchestrator
- переход на Koin viewModelOf для ViewModel
- новые сеттеры клиентского конфига в SettingsViewModel
  (provider, dnsMode, useUdp, manualCaptcha, useCarrierDns, debugMode, magicSwitch)
- MD3: pinnedScrollBehavior у TopAppBar на всех экранах,
  ограничение ширины контента 840dp, скроллируемый онбординг
- локализация строк уведомления и QS-тайла через ресурсы
- правки текстов strings.xml (WireGuard/XRay, переименование obf_key_regen)
- троттлинг опроса трафика 1с -> 3с
- переименование нативной библиотеки в libfreeturn.so
This commit is contained in:
samosvalishe committed 2026-06-01 17:18:52 +03:00
1 parent 7f683bb3f4
commit c242647588
15 files changed
+251 -176

No files matched your search

@@ -276,7 +276,7 @@ class ProxyService : Service() {
ConnectionStats(udpActive, udpTotal) ConnectionStats(udpActive, udpTotal)
} }
ProxyServiceState.setConnectionStats(stats) ProxyServiceState.setConnectionStats(stats)
if (currentBaseStatus == "Прокси активен") { if (currentBaseStatus == getString(R.string.proxy_active)) {
buildAndShowNotification() buildAndShowNotification()
} }
} }
@@ -415,7 +415,7 @@ class ProxyService : Service() {
hasConnection -> { hasConnection -> {
ProxyServiceState.setStartupResult(StartupResult.Success) ProxyServiceState.setStartupResult(StartupResult.Success)
ProxyServiceState.markConnectedIfAbsent(SystemClock.elapsedRealtime()) ProxyServiceState.markConnectedIfAbsent(SystemClock.elapsedRealtime())
updateNotification("Прокси активен") updateNotification(getString(R.string.proxy_active))
startupEmitted = true startupEmitted = true
} }
} }
@@ -611,7 +611,7 @@ class ProxyService : Service() {
var lastRx = android.net.TrafficStats.getUidRxBytes(uid) var lastRx = android.net.TrafficStats.getUidRxBytes(uid)
var lastTx = android.net.TrafficStats.getUidTxBytes(uid) var lastTx = android.net.TrafficStats.getUidTxBytes(uid)
while (!userStopped.get()) { while (!userStopped.get()) {
kotlinx.coroutines.delay(1000) kotlinx.coroutines.delay(3000)
val currentRx = android.net.TrafficStats.getUidRxBytes(uid) val currentRx = android.net.TrafficStats.getUidRxBytes(uid)
val currentTx = android.net.TrafficStats.getUidTxBytes(uid) val currentTx = android.net.TrafficStats.getUidTxBytes(uid)
@@ -621,7 +621,7 @@ class ProxyService : Service() {
currentSpeedText = "↓ ${formatSpeed(rxSpeed)} ↑ ${formatSpeed(txSpeed)}" currentSpeedText = "↓ ${formatSpeed(rxSpeed)} ↑ ${formatSpeed(txSpeed)}"
lastRx = currentRx lastRx = currentRx
lastTx = currentTx lastTx = currentTx
if (currentBaseStatus == "Прокси активен") { if (currentBaseStatus == getString(R.string.proxy_active)) {
buildAndShowNotification() buildAndShowNotification()
} }
} }
@@ -633,7 +633,7 @@ class ProxyService : Service() {
var text = currentBaseStatus var text = currentBaseStatus
val stats = ProxyServiceState.connectionStats.value val stats = ProxyServiceState.connectionStats.value
if (currentBaseStatus == "Прокси активен" || currentBaseStatus == getString(R.string.proxy_active)) { if (currentBaseStatus == getString(R.string.proxy_active)) {
if (stats.total > 0) { if (stats.total > 0) {
text = String.format( text = String.format(
java.util.Locale.US, java.util.Locale.US,
@@ -50,11 +50,9 @@ class ProxyTileService : TileService() {
private fun updateTileState() { private fun updateTileState() {
val tile = qsTile ?: return val tile = qsTile ?: return
if (isProxyRunning) { tile.state = if (isProxyRunning) Tile.STATE_ACTIVE else Tile.STATE_INACTIVE
tile.state = Tile.STATE_ACTIVE tile.label = getString(R.string.tile_service_label)
} else { tile.contentDescription = getString(R.string.tile_service_label)
tile.state = Tile.STATE_INACTIVE
}
tile.icon = android.graphics.drawable.Icon.createWithResource(this, R.drawable.ic_qs_tile_nearby) tile.icon = android.graphics.drawable.Icon.createWithResource(this, R.drawable.ic_qs_tile_nearby)
tile.updateTile() tile.updateTile()
} }
@@ -3,12 +3,13 @@ package com.freeturn.app.di
import com.freeturn.app.data.AppPreferences import com.freeturn.app.data.AppPreferences
import com.freeturn.app.domain.AppUpdater import com.freeturn.app.domain.AppUpdater
import com.freeturn.app.domain.LocalProxyManager import com.freeturn.app.domain.LocalProxyManager
import com.freeturn.app.domain.ProxyOrchestrator
import com.freeturn.app.domain.SshRepository import com.freeturn.app.domain.SshRepository
import com.freeturn.app.viewmodel.ProxyViewModel import com.freeturn.app.viewmodel.ProxyViewModel
import com.freeturn.app.viewmodel.ServerViewModel import com.freeturn.app.viewmodel.ServerViewModel
import com.freeturn.app.viewmodel.SettingsViewModel import com.freeturn.app.viewmodel.SettingsViewModel
import org.koin.android.ext.koin.androidContext import org.koin.android.ext.koin.androidContext
import org.koin.androidx.viewmodel.dsl.viewModel import org.koin.androidx.viewmodel.dsl.viewModelOf
import org.koin.dsl.module import org.koin.dsl.module
val appModule = module { val appModule = module {
@@ -16,8 +17,9 @@ val appModule = module {
single { LocalProxyManager(androidContext()) } single { LocalProxyManager(androidContext()) }
single { SshRepository(androidContext()) } single { SshRepository(androidContext()) }
single { AppUpdater(androidContext()) } single { AppUpdater(androidContext()) }
single { ProxyOrchestrator(get(), get(), get()) }
viewModel { ProxyViewModel(get(), get()) } viewModelOf(::ProxyViewModel)
viewModel { ServerViewModel(get(), get(), get(), androidContext()) } viewModelOf(::ServerViewModel)
viewModel { SettingsViewModel(get(), get(), get(), get(), androidContext()) } viewModelOf(::SettingsViewModel)
} }
@@ -22,6 +22,11 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
/**
* Управляет жизненным циклом прокси-сервиса: старт, стоп, отслеживание состояния.
* Создаётся как Koin `single` и живёт в Application scope — `destroy()` не вызывается
* намеренно, так как scope привязан к процессу приложения.
*/
class LocalProxyManager(private val context: Context) { class LocalProxyManager(private val context: Context) {
private val _proxyState = MutableStateFlow<ProxyState>(ProxyState.Idle) private val _proxyState = MutableStateFlow<ProxyState>(ProxyState.Idle)
@@ -0,0 +1,53 @@
package com.freeturn.app.domain
import com.freeturn.app.ProxyServiceState
import com.freeturn.app.data.AppPreferences
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.withTimeoutOrNull
import com.freeturn.app.viewmodel.ServerState
class ProxyOrchestrator(
private val prefs: AppPreferences,
private val proxyManager: LocalProxyManager,
private val sshRepository: SshRepository
) {
suspend fun restartServerIfRunning() {
val running = (sshRepository.serverState.value as? ServerState.Known)?.running == true
if (!running) return
val l = prefs.proxyListenFlow.first()
val c = prefs.proxyConnectFlow.first()
if (!l.matches(Regex("""^[\w.\-]+:\d{1,5}$""")) ||
!c.matches(Regex("""^[\w.\-]+:\d{1,5}$"""))) return
val opts = prefs.serverOptsFlow.first()
val tcpMode = prefs.clientConfigFlow.first().tcpForward
sshRepository.stopServer()
sshRepository.startServer(
listen = l, connect = c,
tcpMode = tcpMode,
obfProfile = if (opts.obfEnabled) opts.obfProfile else "none",
obfKey = if (opts.obfEnabled) opts.obfKey else ""
)
}
suspend fun restartProxyIfRunning() {
if (!ProxyServiceState.isRunning.value) return
proxyManager.stopProxy()
withTimeoutOrNull(2_000) {
ProxyServiceState.isRunning.first { !it }
}
proxyManager.startProxy(prefs.clientConfigFlow.first())
}
suspend fun startServerFromPrefs() {
val l = prefs.proxyListenFlow.first()
val c = prefs.proxyConnectFlow.first()
val tcpMode = prefs.clientConfigFlow.first().tcpForward
val opts = prefs.serverOptsFlow.first()
sshRepository.startServer(
listen = l, connect = c,
tcpMode = tcpMode,
obfProfile = if (opts.obfEnabled) opts.obfProfile else "none",
obfKey = if (opts.obfEnabled) opts.obfKey else ""
)
}
}
@@ -36,6 +36,7 @@ import androidx.compose.material3.Slider
import androidx.compose.material3.Switch import androidx.compose.material3.Switch
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
@@ -47,6 +48,7 @@ import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
@@ -90,24 +92,16 @@ fun ClientSetupScreen(
// (если запущен), иначе сохранённое. В !sync режиме — всегда сохранённое: // (если запущен), иначе сохранённое. В !sync режиме — всегда сохранённое:
// серверная и клиентская стороны могут различаться, и UI отражает клиента. // серверная и клиентская стороны могут различаться, и UI отражает клиента.
val syncOn = saved.syncServerSwitches val syncOn = saved.syncServerSwitches
val effectiveTcpForward = if (syncOn) serverKnown?.tcpMode ?: saved.tcpForward else saved.tcpForward val effectiveTcpForward = if (syncOn && serverKnown?.running == true) serverKnown.tcpMode ?: saved.tcpForward else saved.tcpForward
val effectiveObfProfile = if (syncOn) serverKnown?.obfProfile ?: serverOpts.obfProfile else serverOpts.obfProfile val effectiveObfProfile = if (syncOn && serverKnown?.running == true) serverKnown.obfProfile ?: serverOpts.obfProfile else serverOpts.obfProfile
val context = LocalContext.current val context = LocalContext.current
var serverAddress by rememberSaveable(saved.serverAddress) { mutableStateOf(saved.serverAddress) } var serverAddress by rememberSaveable(saved.serverAddress) { mutableStateOf(saved.serverAddress) }
var vkLink by rememberSaveable(saved.vkLink) { mutableStateOf(saved.vkLink) } var vkLink by rememberSaveable(saved.vkLink) { mutableStateOf(saved.vkLink) }
var provider by rememberSaveable(saved.provider) { mutableStateOf(saved.provider) }
var threads by rememberSaveable(saved.threads) { mutableFloatStateOf(saved.threads.toFloat()) } var threads by rememberSaveable(saved.threads) { mutableFloatStateOf(saved.threads.toFloat()) }
var streamsPerCred by rememberSaveable(saved.streamsPerCred) { mutableFloatStateOf(saved.streamsPerCred.toFloat()) } var streamsPerCred by rememberSaveable(saved.streamsPerCred) { mutableFloatStateOf(saved.streamsPerCred.toFloat()) }
var useUdp by rememberSaveable(saved.useUdp) { mutableStateOf(saved.useUdp) }
var manualCaptcha by rememberSaveable(saved.manualCaptcha) { mutableStateOf(saved.manualCaptcha) }
var useCarrierDns by rememberSaveable(saved.useCarrierDns) { mutableStateOf(saved.useCarrierDns) }
var dnsMode by rememberSaveable(saved.dnsMode) { mutableStateOf(saved.dnsMode) }
var localPort by rememberSaveable(saved.localPort) { mutableStateOf(saved.localPort) } var localPort by rememberSaveable(saved.localPort) { mutableStateOf(saved.localPort) }
var debugMode by rememberSaveable(saved.debugMode) { mutableStateOf(saved.debugMode) }
var magicSwitch by rememberSaveable(saved.magicSwitch) { mutableStateOf(saved.magicSwitch) }
var magicTurn by rememberSaveable(saved.magicTurn) { mutableStateOf(saved.magicTurn) } var magicTurn by rememberSaveable(saved.magicTurn) { mutableStateOf(saved.magicTurn) }
var lastSliderInt by rememberSaveable { mutableIntStateOf(saved.threads) } var lastSliderInt by rememberSaveable { mutableIntStateOf(saved.threads) }
var lastStreamsInt by rememberSaveable { mutableIntStateOf(saved.streamsPerCred) } var lastStreamsInt by rememberSaveable { mutableIntStateOf(saved.streamsPerCred) }
@@ -120,36 +114,31 @@ fun ClientSetupScreen(
} }
} }
// Авто-сохранение с дебаунсом 600 мс на каждое изменение поля. // Авто-сохранение с дебаунсом 600 мс для текстовых полей и ползунков
// tcpForward/bond исключены — сохраняются через setTcpForward/setBond с автоперезапуском. LaunchedEffect(serverAddress, vkLink, threads, streamsPerCred, localPort, magicTurn) {
LaunchedEffect(serverAddress, vkLink, provider, threads, streamsPerCred, useUdp, manualCaptcha, useCarrierDns, localPort, dnsMode, debugMode, magicSwitch, magicTurn) {
delay(600) delay(600)
val current = settingsViewModel.clientConfig.value
settingsViewModel.saveClientConfig( settingsViewModel.saveClientConfig(
ClientConfig( current.copy(
serverAddress = serverAddress.trim(), serverAddress = serverAddress.trim(),
vkLink = vkLink.trim(), vkLink = vkLink.trim(),
provider = provider,
threads = threads.roundToInt(), threads = threads.roundToInt(),
streamsPerCred = streamsPerCred.roundToInt(), streamsPerCred = streamsPerCred.roundToInt(),
useUdp = useUdp,
manualCaptcha = manualCaptcha,
localPort = localPort.trim(), localPort = localPort.trim(),
tcpForward = saved.tcpForward,
bond = saved.bond,
debugMode = debugMode,
useCarrierDns = useCarrierDns,
dnsMode = dnsMode,
syncServerSwitches = saved.syncServerSwitches,
magicSwitch = magicSwitch,
magicTurn = magicTurn.trim() magicTurn = magicTurn.trim()
) )
) )
} }
val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior()
Scaffold( Scaffold(
modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
topBar = { topBar = {
TopAppBar(title = { Text(stringResource(R.string.client_title)) }) TopAppBar(
title = { Text(stringResource(R.string.client_title)) },
scrollBehavior = scrollBehavior
)
}, },
contentWindowInsets = WindowInsets(0, 0, 0, 0) contentWindowInsets = WindowInsets(0, 0, 0, 0)
) { padding -> ) { padding ->
@@ -190,10 +179,10 @@ fun ClientSetupScreen(
SingleChoiceSegmentedButtonRow(modifier = Modifier.fillMaxWidth()) { SingleChoiceSegmentedButtonRow(modifier = Modifier.fillMaxWidth()) {
Provider.ALL.forEachIndexed { idx, value -> Provider.ALL.forEachIndexed { idx, value ->
SegmentedButton( SegmentedButton(
selected = provider == value, selected = saved.provider == value,
onClick = { onClick = {
HapticUtil.perform(context, HapticUtil.Pattern.TOGGLE_ON) HapticUtil.perform(context, HapticUtil.Pattern.TOGGLE_ON)
provider = value settingsViewModel.setProvider(value)
}, },
shape = SegmentedButtonDefaults.itemShape(index = idx, count = Provider.ALL.size) shape = SegmentedButtonDefaults.itemShape(index = idx, count = Provider.ALL.size)
) { Text(providerLabel(value)) } ) { Text(providerLabel(value)) }
@@ -201,7 +190,7 @@ fun ClientSetupScreen(
} }
} }
if (provider == Provider.VK) { if (saved.provider == Provider.VK) {
OutlinedTextField( OutlinedTextField(
value = vkLink.redact(privacyMode), value = vkLink.redact(privacyMode),
onValueChange = { if (!privacyMode) vkLink = it }, onValueChange = { if (!privacyMode) vkLink = it },
@@ -303,10 +292,10 @@ fun ClientSetupScreen(
SingleChoiceSegmentedButtonRow(modifier = Modifier.fillMaxWidth()) { SingleChoiceSegmentedButtonRow(modifier = Modifier.fillMaxWidth()) {
dnsOptions.forEachIndexed { idx, (value, label) -> dnsOptions.forEachIndexed { idx, (value, label) ->
SegmentedButton( SegmentedButton(
selected = dnsMode == value, selected = saved.dnsMode == value,
onClick = { onClick = {
HapticUtil.perform(context, HapticUtil.Pattern.TOGGLE_ON) HapticUtil.perform(context, HapticUtil.Pattern.TOGGLE_ON)
dnsMode = value settingsViewModel.setDnsMode(value)
}, },
shape = SegmentedButtonDefaults.itemShape(index = idx, count = dnsOptions.size) shape = SegmentedButtonDefaults.itemShape(index = idx, count = dnsOptions.size)
) { Text(label) } ) { Text(label) }
@@ -326,18 +315,18 @@ fun ClientSetupScreen(
} }
SingleChoiceSegmentedButtonRow(modifier = Modifier.fillMaxWidth()) { SingleChoiceSegmentedButtonRow(modifier = Modifier.fillMaxWidth()) {
SegmentedButton( SegmentedButton(
selected = !useUdp, selected = !saved.useUdp,
onClick = { onClick = {
HapticUtil.perform(context, HapticUtil.Pattern.TOGGLE_ON) HapticUtil.perform(context, HapticUtil.Pattern.TOGGLE_ON)
useUdp = false settingsViewModel.setUseUdp(false)
}, },
shape = SegmentedButtonDefaults.itemShape(index = 0, count = 2) shape = SegmentedButtonDefaults.itemShape(index = 0, count = 2)
) { Text(stringResource(R.string.tcp)) } ) { Text(stringResource(R.string.tcp)) }
SegmentedButton( SegmentedButton(
selected = useUdp, selected = saved.useUdp,
onClick = { onClick = {
HapticUtil.perform(context, HapticUtil.Pattern.TOGGLE_ON) HapticUtil.perform(context, HapticUtil.Pattern.TOGGLE_ON)
useUdp = true settingsViewModel.setUseUdp(true)
}, },
shape = SegmentedButtonDefaults.itemShape(index = 1, count = 2) shape = SegmentedButtonDefaults.itemShape(index = 1, count = 2)
) { Text(stringResource(R.string.udp)) } ) { Text(stringResource(R.string.udp)) }
@@ -349,44 +338,44 @@ fun ClientSetupScreen(
SwitchRow( SwitchRow(
label = stringResource(R.string.manual_captcha), label = stringResource(R.string.manual_captcha),
description = stringResource(R.string.manual_captcha_desc), description = stringResource(R.string.manual_captcha_desc),
checked = manualCaptcha, checked = saved.manualCaptcha,
onCheckedChange = { onCheckedChange = {
HapticUtil.perform(context, if (it) HapticUtil.Pattern.TOGGLE_ON else HapticUtil.Pattern.TOGGLE_OFF) HapticUtil.perform(context, if (it) HapticUtil.Pattern.TOGGLE_ON else HapticUtil.Pattern.TOGGLE_OFF)
manualCaptcha = it settingsViewModel.setManualCaptcha(it)
} }
) )
SwitchRow( SwitchRow(
label = stringResource(R.string.use_carrier_dns), label = stringResource(R.string.use_carrier_dns),
description = stringResource(R.string.use_carrier_dns_desc), description = stringResource(R.string.use_carrier_dns_desc),
checked = useCarrierDns, checked = saved.useCarrierDns,
onCheckedChange = { onCheckedChange = {
HapticUtil.perform(context, if (it) HapticUtil.Pattern.TOGGLE_ON else HapticUtil.Pattern.TOGGLE_OFF) HapticUtil.perform(context, if (it) HapticUtil.Pattern.TOGGLE_ON else HapticUtil.Pattern.TOGGLE_OFF)
useCarrierDns = it settingsViewModel.setUseCarrierDns(it)
} }
) )
SwitchRow( SwitchRow(
label = stringResource(R.string.debug_mode), label = stringResource(R.string.debug_mode),
description = stringResource(R.string.debug_mode_desc), description = stringResource(R.string.debug_mode_desc),
checked = debugMode, checked = saved.debugMode,
onCheckedChange = { onCheckedChange = {
HapticUtil.perform(context, if (it) HapticUtil.Pattern.TOGGLE_ON else HapticUtil.Pattern.TOGGLE_OFF) HapticUtil.perform(context, if (it) HapticUtil.Pattern.TOGGLE_ON else HapticUtil.Pattern.TOGGLE_OFF)
debugMode = it settingsViewModel.setDebugMode(it)
} }
) )
SwitchRow( SwitchRow(
label = stringResource(R.string.magic_switch), label = stringResource(R.string.magic_switch),
description = stringResource(R.string.magic_switch_desc), description = stringResource(R.string.magic_switch_desc),
checked = magicSwitch, checked = saved.magicSwitch,
onCheckedChange = { onCheckedChange = {
HapticUtil.perform(context, if (it) HapticUtil.Pattern.TOGGLE_ON else HapticUtil.Pattern.TOGGLE_OFF) HapticUtil.perform(context, if (it) HapticUtil.Pattern.TOGGLE_ON else HapticUtil.Pattern.TOGGLE_OFF)
magicSwitch = it settingsViewModel.setMagicSwitch(it)
} }
) )
if (magicSwitch) { if (saved.magicSwitch) {
OutlinedTextField( OutlinedTextField(
value = magicTurn.redact(privacyMode), value = magicTurn.redact(privacyMode),
onValueChange = { if (!privacyMode) magicTurn = it }, onValueChange = { if (!privacyMode) magicTurn = it },
@@ -511,11 +500,11 @@ fun ClientSetupScreen(
supportingText = { supportingText = {
when { when {
obfKeyDraft.isBlank() -> Text( obfKeyDraft.isBlank() -> Text(
stringResource(R.string.wrap_key_empty_hint), stringResource(R.string.obf_key_empty_hint),
color = MaterialTheme.colorScheme.error color = MaterialTheme.colorScheme.error
) )
!draftValid -> Text( !draftValid -> Text(
stringResource(R.string.wrap_key_invalid_hint), stringResource(R.string.obf_key_invalid_hint),
color = MaterialTheme.colorScheme.error color = MaterialTheme.colorScheme.error
) )
} }
@@ -530,7 +519,7 @@ fun ClientSetupScreen(
enabled = draftValid, enabled = draftValid,
modifier = Modifier.fillMaxWidth() modifier = Modifier.fillMaxWidth()
) { ) {
Text(stringResource(R.string.wrap_key_apply)) Text(stringResource(R.string.obf_key_apply))
} }
} }
if (isSshConnected) { if (isSshConnected) {
@@ -548,9 +537,9 @@ fun ClientSetupScreen(
modifier = Modifier.size(20.dp) modifier = Modifier.size(20.dp)
) )
Spacer(Modifier.size(8.dp)) Spacer(Modifier.size(8.dp))
Text(stringResource(R.string.server_wrap_regen_in_progress)) Text(stringResource(R.string.obf_key_regen_in_progress))
} else { } else {
Text(stringResource(R.string.server_wrap_regen)) Text(stringResource(R.string.obf_key_regen))
} }
} }
} }
@@ -53,6 +53,7 @@ import androidx.compose.material3.Surface
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.TextButton import androidx.compose.material3.TextButton
import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.material3.rememberModalBottomSheetState
import android.Manifest import android.Manifest
import android.annotation.SuppressLint import android.annotation.SuppressLint
@@ -75,6 +76,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.scale import androidx.compose.ui.draw.scale
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.semantics.contentDescription import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
@@ -615,8 +617,8 @@ private fun InfoBottomSheet(
item { item {
RepoLinkItem( RepoLinkItem(
title = stringResource(R.string.proxy_core), title = stringResource(R.string.proxy_core),
subtitle = "moroka8/vk-turn-proxy", subtitle = "samosvalishe/free-turn-proxy",
url = "https://github.com/moroka8/vk-turn-proxy", url = "https://github.com/samosvalishe/free-turn-proxy",
containerColor = containerColor, containerColor = containerColor,
onHaptic = { HapticUtil.perform(context, HapticUtil.Pattern.SELECTION) }, onHaptic = { HapticUtil.perform(context, HapticUtil.Pattern.SELECTION) },
onOpen = { uriHandler.openUri(it) } onOpen = { uriHandler.openUri(it) }
@@ -24,11 +24,13 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
@@ -51,10 +53,14 @@ fun LogsScreen(proxyViewModel: ProxyViewModel) {
if (logs.isNotEmpty()) listState.animateScrollToItem(logs.lastIndex) if (logs.isNotEmpty()) listState.animateScrollToItem(logs.lastIndex)
} }
val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior()
Scaffold( Scaffold(
modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
topBar = { topBar = {
TopAppBar( TopAppBar(
title = { Text(stringResource(R.string.logs_title)) }, title = { Text(stringResource(R.string.logs_title)) },
scrollBehavior = scrollBehavior,
actions = { actions = {
IconButton( IconButton(
onClick = { onClick = {
@@ -17,8 +17,12 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import com.freeturn.app.R import com.freeturn.app.R
import androidx.compose.material3.Button import androidx.compose.material3.Button
@@ -57,7 +61,7 @@ fun OnboardingScreen(
label = "pulse" label = "pulse"
) )
Box( BoxWithConstraints(
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxSize()
.background( .background(
@@ -69,16 +73,22 @@ fun OnboardingScreen(
) )
) )
) { ) {
val minHeight = maxHeight
Column( Column(
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxWidth()
.verticalScroll(rememberScrollState())
.padding(32.dp), .padding(32.dp),
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.SpaceBetween
) { ) {
Spacer(Modifier.height(56.dp)) Column(
modifier = Modifier.heightIn(min = minHeight - 64.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.SpaceBetween
) {
Spacer(Modifier.height(16.dp))
Column(horizontalAlignment = Alignment.CenterHorizontally) { Column(horizontalAlignment = Alignment.CenterHorizontally) {
Box( Box(
modifier = Modifier modifier = Modifier
.size(148.dp) .size(148.dp)
@@ -168,6 +178,7 @@ fun OnboardingScreen(
Spacer(Modifier.height(24.dp)) Spacer(Modifier.height(24.dp))
} }
}
} }
} }
} }
@@ -48,6 +48,7 @@ import androidx.compose.material3.SnackbarHost
import androidx.compose.material3.SnackbarHostState import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
@@ -58,6 +59,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontFamily
import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.foundation.text.KeyboardOptions
@@ -109,11 +111,14 @@ fun ServerManagementScreen(
val isConnected = sshState is SshConnectionState.Connected val isConnected = sshState is SshConnectionState.Connected
val isWorking = serverState is ServerState.Working || serverState is ServerState.Checking val isWorking = serverState is ServerState.Working || serverState is ServerState.Checking
val serverKnown = serverState as? ServerState.Known val serverKnown = serverState as? ServerState.Known
val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior()
Scaffold( Scaffold(
modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
topBar = { topBar = {
TopAppBar( TopAppBar(
title = { Text(stringResource(R.string.server)) }, title = { Text(stringResource(R.string.server)) },
scrollBehavior = scrollBehavior,
actions = { actions = {
SshStatusBadge(sshState = sshState, ip = sshConfig.ip.redact(privacyMode)) SshStatusBadge(sshState = sshState, ip = sshConfig.ip.redact(privacyMode))
} }
@@ -14,6 +14,7 @@ import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.verticalScroll import androidx.compose.foundation.verticalScroll
@@ -33,6 +34,7 @@ import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Scaffold import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import com.freeturn.app.R import com.freeturn.app.R
@@ -45,6 +47,7 @@ import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.PasswordVisualTransformation import androidx.compose.ui.text.input.PasswordVisualTransformation
@@ -56,12 +59,13 @@ import com.freeturn.app.data.SshConfig
import com.freeturn.app.ui.HapticUtil import com.freeturn.app.ui.HapticUtil
import com.freeturn.app.viewmodel.ServerViewModel import com.freeturn.app.viewmodel.ServerViewModel
import com.freeturn.app.viewmodel.SshConnectionState import com.freeturn.app.viewmodel.SshConnectionState
import com.freeturn.app.viewmodel.SettingsViewModel
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
fun SshSetupScreen( fun SshSetupScreen(
serverViewModel: ServerViewModel, serverViewModel: ServerViewModel,
settingsViewModel: com.freeturn.app.viewmodel.SettingsViewModel, settingsViewModel: SettingsViewModel,
onConnected: () -> Unit, onConnected: () -> Unit,
onBack: () -> Unit onBack: () -> Unit
) { ) {
@@ -88,11 +92,14 @@ fun SshSetupScreen(
val isConnecting = sshState is SshConnectionState.Connecting val isConnecting = sshState is SshConnectionState.Connecting
val context = LocalContext.current val context = LocalContext.current
val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior()
Scaffold( Scaffold(
modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
topBar = { topBar = {
TopAppBar( TopAppBar(
title = { Text(stringResource(R.string.connect_to_server)) }, title = { Text(stringResource(R.string.connect_to_server)) },
scrollBehavior = scrollBehavior,
navigationIcon = { navigationIcon = {
IconButton(onClick = { IconButton(onClick = {
HapticUtil.perform(context, HapticUtil.Pattern.SELECTION) HapticUtil.perform(context, HapticUtil.Pattern.SELECTION)
@@ -110,10 +117,16 @@ fun SshSetupScreen(
.fillMaxSize() .fillMaxSize()
.padding(padding) .padding(padding)
.imePadding() .imePadding()
.padding(horizontal = 24.dp)
.verticalScroll(rememberScrollState()), .verticalScroll(rememberScrollState()),
verticalArrangement = Arrangement.spacedBy(16.dp) horizontalAlignment = Alignment.CenterHorizontally
) { ) {
Column(
modifier = Modifier
.widthIn(max = 840.dp)
.fillMaxWidth()
.padding(horizontal = 24.dp),
verticalArrangement = Arrangement.spacedBy(16.dp)
) {
Spacer(Modifier.height(4.dp)) Spacer(Modifier.height(4.dp))
if (!isConnecting) { if (!isConnecting) {
@@ -147,6 +160,7 @@ fun SshSetupScreen(
} }
Spacer(Modifier.height(24.dp)) Spacer(Modifier.height(24.dp))
}
} }
} }
} }
@@ -6,7 +6,7 @@ import androidx.lifecycle.viewModelScope
import com.freeturn.app.ProxyServiceState import com.freeturn.app.ProxyServiceState
import com.freeturn.app.data.AppPreferences import com.freeturn.app.data.AppPreferences
import com.freeturn.app.data.SshConfig import com.freeturn.app.data.SshConfig
import com.freeturn.app.domain.LocalProxyManager import com.freeturn.app.domain.ProxyOrchestrator
import com.freeturn.app.domain.SshRepository import com.freeturn.app.domain.SshRepository
import com.freeturn.app.ui.HapticUtil import com.freeturn.app.ui.HapticUtil
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
@@ -20,8 +20,8 @@ import kotlinx.coroutines.withTimeoutOrNull
class ServerViewModel( class ServerViewModel(
private val sshRepository: SshRepository, private val sshRepository: SshRepository,
private val proxyManager: LocalProxyManager,
private val prefs: AppPreferences, private val prefs: AppPreferences,
private val orchestrator: ProxyOrchestrator,
private val context: Context private val context: Context
) : ViewModel() { ) : ViewModel() {
@@ -83,7 +83,7 @@ class ServerViewModel(
} }
if (outcome.needsRestart) { if (outcome.needsRestart) {
startServer() startServer()
restartProxyIfRunning() orchestrator.restartProxyIfRunning()
} }
} }
} }
@@ -133,39 +133,11 @@ class ServerViewModel(
prefs.saveServerOpts(next) prefs.saveServerOpts(next)
val clientConfig = prefs.clientConfigFlow.first() val clientConfig = prefs.clientConfigFlow.first()
if (clientConfig.syncServerSwitches) restartServerIfRunning() if (clientConfig.syncServerSwitches) orchestrator.restartServerIfRunning()
restartProxyIfRunning() orchestrator.restartProxyIfRunning()
} finally { } finally {
_isRegeneratingObfKey.value = false _isRegeneratingObfKey.value = false
} }
} }
} }
private suspend fun restartServerIfRunning() {
val running = (serverState.value as? ServerState.Known)?.running == true
if (!running) return
val l = prefs.proxyListenFlow.first()
val c = prefs.proxyConnectFlow.first()
if (!l.matches(Regex("""^[\w.\-]+:\d{1,5}$""")) ||
!c.matches(Regex("""^[\w.\-]+:\d{1,5}$"""))) return
val opts = prefs.serverOptsFlow.first()
val tcpMode = prefs.clientConfigFlow.first().tcpForward
sshRepository.stopServer()
sshRepository.startServer(
listen = l, connect = c,
tcpMode = tcpMode,
obfProfile = if (opts.obfEnabled) opts.obfProfile else "none",
obfKey = if (opts.obfEnabled) opts.obfKey else ""
)
}
private suspend fun restartProxyIfRunning() {
if (!ProxyServiceState.isRunning.value) return
proxyManager.stopProxy()
withTimeoutOrNull(2_000) {
ProxyServiceState.isRunning.first { !it }
}
val clientConfig = prefs.clientConfigFlow.first()
proxyManager.startProxy(clientConfig)
}
} }
@@ -14,6 +14,7 @@ import com.freeturn.app.data.ProfilesSnapshot
import com.freeturn.app.data.SshConfig import com.freeturn.app.data.SshConfig
import com.freeturn.app.domain.AppUpdater import com.freeturn.app.domain.AppUpdater
import com.freeturn.app.domain.LocalProxyManager import com.freeturn.app.domain.LocalProxyManager
import com.freeturn.app.domain.ProxyOrchestrator
import com.freeturn.app.domain.SshRepository import com.freeturn.app.domain.SshRepository
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.SharingStarted
@@ -32,6 +33,7 @@ class SettingsViewModel(
private val proxyManager: LocalProxyManager, private val proxyManager: LocalProxyManager,
private val sshRepository: SshRepository, private val sshRepository: SshRepository,
private val appUpdater: AppUpdater, private val appUpdater: AppUpdater,
private val orchestrator: ProxyOrchestrator,
private val context: Context private val context: Context
) : ViewModel() { ) : ViewModel() {
@@ -105,6 +107,62 @@ class SettingsViewModel(
} }
} }
fun setProvider(value: String) {
viewModelScope.launch {
val current = prefs.clientConfigFlow.first()
if (current.provider == value) return@launch
profileMutex.withLock { prefs.saveClientConfig(current.copy(provider = value)) }
}
}
fun setDnsMode(value: String) {
viewModelScope.launch {
val current = prefs.clientConfigFlow.first()
if (current.dnsMode == value) return@launch
profileMutex.withLock { prefs.saveClientConfig(current.copy(dnsMode = value)) }
}
}
fun setUseUdp(enabled: Boolean) {
viewModelScope.launch {
val current = prefs.clientConfigFlow.first()
if (current.useUdp == enabled) return@launch
profileMutex.withLock { prefs.saveClientConfig(current.copy(useUdp = enabled)) }
}
}
fun setManualCaptcha(enabled: Boolean) {
viewModelScope.launch {
val current = prefs.clientConfigFlow.first()
if (current.manualCaptcha == enabled) return@launch
profileMutex.withLock { prefs.saveClientConfig(current.copy(manualCaptcha = enabled)) }
}
}
fun setUseCarrierDns(enabled: Boolean) {
viewModelScope.launch {
val current = prefs.clientConfigFlow.first()
if (current.useCarrierDns == enabled) return@launch
profileMutex.withLock { prefs.saveClientConfig(current.copy(useCarrierDns = enabled)) }
}
}
fun setDebugMode(enabled: Boolean) {
viewModelScope.launch {
val current = prefs.clientConfigFlow.first()
if (current.debugMode == enabled) return@launch
profileMutex.withLock { prefs.saveClientConfig(current.copy(debugMode = enabled)) }
}
}
fun setMagicSwitch(enabled: Boolean) {
viewModelScope.launch {
val current = prefs.clientConfigFlow.first()
if (current.magicSwitch == enabled) return@launch
profileMutex.withLock { prefs.saveClientConfig(current.copy(magicSwitch = enabled)) }
}
}
fun saveProxyServerConfig(listen: String, connect: String) { fun saveProxyServerConfig(listen: String, connect: String) {
viewModelScope.launch { viewModelScope.launch {
profileMutex.withLock { prefs.saveProxyConfig(listen, connect) } profileMutex.withLock { prefs.saveProxyConfig(listen, connect) }
@@ -194,7 +252,7 @@ class SettingsViewModel(
} ?: return@launch } ?: return@launch
val serverRunning = (sshRepository.serverState.value as? ServerState.Known)?.running == true val serverRunning = (sshRepository.serverState.value as? ServerState.Known)?.running == true
if (serverRunning) restartServerIfRunning() if (serverRunning) orchestrator.restartServerIfRunning()
if (ProxyServiceState.isRunning.value) { if (ProxyServiceState.isRunning.value) {
proxyManager.stopProxy() proxyManager.stopProxy()
@@ -249,7 +307,7 @@ class SettingsViewModel(
if (current.bond == enabled) return@launch if (current.bond == enabled) return@launch
val next = current.copy(bond = enabled) val next = current.copy(bond = enabled)
profileMutex.withLock { prefs.saveClientConfig(next) } profileMutex.withLock { prefs.saveClientConfig(next) }
restartProxyIfRunning() orchestrator.restartProxyIfRunning()
} }
} }
@@ -269,8 +327,8 @@ class SettingsViewModel(
if (!storedMatches || next.obfKey != current.obfKey) { if (!storedMatches || next.obfKey != current.obfKey) {
profileMutex.withLock { prefs.saveServerOpts(next) } profileMutex.withLock { prefs.saveServerOpts(next) }
} }
if (sync) restartServerIfRunning() if (sync) orchestrator.restartServerIfRunning()
restartProxyIfRunning() orchestrator.restartProxyIfRunning()
} }
} }
@@ -281,8 +339,8 @@ class SettingsViewModel(
val next = current.copy(syncServerSwitches = enabled) val next = current.copy(syncServerSwitches = enabled)
profileMutex.withLock { prefs.saveClientConfig(next) } profileMutex.withLock { prefs.saveClientConfig(next) }
if (enabled) { if (enabled) {
restartServerIfRunning() orchestrator.restartServerIfRunning()
restartProxyIfRunning() orchestrator.restartProxyIfRunning()
} }
} }
} }
@@ -294,8 +352,8 @@ class SettingsViewModel(
if (current.obfKey == trimmed) return@launch if (current.obfKey == trimmed) return@launch
val next = current.copy(obfKey = trimmed) val next = current.copy(obfKey = trimmed)
profileMutex.withLock { prefs.saveServerOpts(next) } profileMutex.withLock { prefs.saveServerOpts(next) }
if (prefs.clientConfigFlow.first().syncServerSwitches) restartServerIfRunning() if (prefs.clientConfigFlow.first().syncServerSwitches) orchestrator.restartServerIfRunning()
restartProxyIfRunning() orchestrator.restartProxyIfRunning()
} }
} }
@@ -314,53 +372,13 @@ class SettingsViewModel(
val serverRunning = (sshRepository.serverState.value as? ServerState.Known)?.running == true val serverRunning = (sshRepository.serverState.value as? ServerState.Known)?.running == true
if (serverRunning) { if (serverRunning) {
sshRepository.stopServer() sshRepository.stopServer()
startServerFromPrefs() orchestrator.startServerFromPrefs()
} }
} }
restartProxyIfRunning() orchestrator.restartProxyIfRunning()
} }
} }
private suspend fun startServerFromPrefs() {
val l = prefs.proxyListenFlow.first()
val c = prefs.proxyConnectFlow.first()
val tcpMode = prefs.clientConfigFlow.first().tcpForward
val opts = prefs.serverOptsFlow.first()
sshRepository.startServer(
listen = l, connect = c,
tcpMode = tcpMode,
obfProfile = if (opts.obfEnabled) opts.obfProfile else "none",
obfKey = if (opts.obfEnabled) opts.obfKey else ""
)
}
private suspend fun restartServerIfRunning() {
val running = (sshRepository.serverState.value as? ServerState.Known)?.running == true
if (!running) return
val l = prefs.proxyListenFlow.first()
val c = prefs.proxyConnectFlow.first()
if (!l.matches(Regex("""^[\w.\-]+:\d{1,5}$""")) ||
!c.matches(Regex("""^[\w.\-]+:\d{1,5}$"""))) return
val opts = prefs.serverOptsFlow.first()
val tcpMode = prefs.clientConfigFlow.first().tcpForward
sshRepository.stopServer()
sshRepository.startServer(
listen = l, connect = c,
tcpMode = tcpMode,
obfProfile = if (opts.obfEnabled) opts.obfProfile else "none",
obfKey = if (opts.obfEnabled) opts.obfKey else ""
)
}
private suspend fun restartProxyIfRunning() {
if (!ProxyServiceState.isRunning.value) return
proxyManager.stopProxy()
withTimeoutOrNull(2_000) {
ProxyServiceState.isRunning.first { !it }
}
proxyManager.startProxy(prefs.clientConfigFlow.first())
}
// --- Updates --- // --- Updates ---
fun checkForUpdate() { fun checkForUpdate() {
viewModelScope.launch { appUpdater.checkForUpdate(silent = false) } viewModelScope.launch { appUpdater.checkForUpdate(silent = false) }
+20 -20
View File
@@ -20,8 +20,8 @@
<string name="ssh_error">SSH: ошибка</string> <string name="ssh_error">SSH: ошибка</string>
<string name="ssh_disconnected">SSH: не сопряжено</string> <string name="ssh_disconnected">SSH: не сопряжено</string>
<string name="reconnect">Повторить сопряжение</string> <string name="reconnect">Повторить сопряжение</string>
<string name="proxy_active_stop">Прокси активен — нажмите для остановки</string> <string name="proxy_active_stop">Прокси активен - нажмите для остановки</string>
<string name="proxy_error_restart">Ошибка — нажмите для повторного запуска</string> <string name="proxy_error_restart">Ошибка - нажмите для повторного запуска</string>
<string name="start_proxy">Запустить прокси</string> <string name="start_proxy">Запустить прокси</string>
<string name="connection">Соединение</string> <string name="connection">Соединение</string>
<string name="not_connected">Не сопряжено</string> <string name="not_connected">Не сопряжено</string>
@@ -49,32 +49,32 @@
<string name="call_link_support">Звонки → Создать → Скопировать ссылку (не нажимайте «Завершить»)</string> <string name="call_link_support">Звонки → Создать → Скопировать ссылку (не нажимайте «Завершить»)</string>
<string name="local_listen_address">Локальный адрес прослушивания</string> <string name="local_listen_address">Локальный адрес прослушивания</string>
<string name="local_listen_placeholder">127.0.0.1:9000</string> <string name="local_listen_placeholder">127.0.0.1:9000</string>
<string name="local_listen_support">Адрес, на котором клиент принимает трафик от WireGuard/Hysteria</string> <string name="local_listen_support">Адрес, на котором клиент принимает трафик от WireGuard/XRay</string>
<string name="parameters_title">Параметры</string> <string name="parameters_title">Параметры</string>
<string name="threads_format">Потоки: %1$d</string> <string name="threads_format">Потоки: %1$d</string>
<string name="threads_recommendation">Рекомендуется 4–8</string> <string name="threads_recommendation">Рекомендуется 8–12</string>
<string name="streams_per_cred_recommendation">Сколько TURN-потоков обслуживает один VK-аккаунт. По умолчанию 10.</string> <string name="streams_per_cred_recommendation">Сколько TURN-потоков обслуживает один VK-аккаунт</string>
<string name="streams_per_cred_format">Потоков на аккаунт: %1$d</string> <string name="streams_per_cred_format">Потоков на аккаунт: %1$d</string>
<string name="tcp_forward_mode">TCP-форвард (Xray/sing-box)</string> <string name="tcp_forward_mode">Режим</string>
<string name="tcp_forward_mode_desc">Режим -mode tcp для проброса Xray/VLESS/Trojan. Выкл = UDP-релей для WireGuard. Должен совпадать с сервером.</string> <string name="tcp_forward_mode_desc">Режим tcp для проброса Xray/VLESS/Trojan</string>
<string name="client_bond">Bond (стрипинг TCP)</string> <string name="client_bond">Bond (стрипинг TCP)</string>
<string name="client_bond_desc">Распределяет TCP по smux-сессиям. Только в TCP-режиме. Клиентский флаг — сервер настраивать не нужно.</string> <string name="client_bond_desc">Распределяет TCP по smux-сессиям. Только в TCP-режиме.</string>
<string name="obf_profile_title">Обфускация</string> <string name="obf_profile_title">Обфускация</string>
<string name="obf_profile_desc">Профиль маскировки payload (обход шейпинга VK). Должен совпадать с сервером. Ключ берётся с сервера.</string> <string name="obf_profile_desc">Профиль маскировки</string>
<string name="obf_none">Выкл</string> <string name="obf_none">Выкл</string>
<string name="obf_rtpopus">rtpopus</string> <string name="obf_rtpopus">rtpopus</string>
<string name="provider_title">Провайдер</string> <string name="provider_title">Провайдер</string>
<string name="provider_vk">VK Calls</string> <string name="provider_vk">VK Calls</string>
<string name="locked_disconnect_hint">Подключитесь к серверу, чтобы изменить</string> <string name="locked_disconnect_hint">Подключитесь к серверу, чтобы изменить</string>
<string name="wrap_key_empty_hint">Ключ не сгенерирован — нажмите кнопку ниже</string> <string name="obf_key_empty_hint">Ключ не сгенерирован - нажмите кнопку ниже</string>
<string name="wrap_key_invalid_hint">Неверный формат — нужны 64 hex-символа</string> <string name="obf_key_invalid_hint">Неверный формат - нужны 64 hex-символа</string>
<string name="wrap_key_apply">Применить</string> <string name="obf_key_apply">Применить</string>
<string name="server_wrap_regen_in_progress">Генерация ключа…</string> <string name="obf_key_regen_in_progress">Генерация ключа…</string>
<string name="server_sync_section">Синхронные настройки сервера</string> <string name="server_sync_section">Синхронные настройки сервера</string>
<string name="sync_server_switches">Синхронизировать с сервером</string> <string name="sync_server_switches">Синхронизировать с сервером</string>
<string name="sync_server_switches_desc">При выкл. флаги TCP-режим/обфускация меняются только у клиента, серверный процесс не перезапускается</string> <string name="sync_server_switches_desc">При выкл. флаги меняются только у клиента, серверный процесс не перезапускается</string>
<string name="sync_off_banner">Sync с сервером выключен. Клиентские флаги TCP-режим/обфускация сервер не получает — следите за совпадением вручную.</string> <string name="sync_off_banner">Sync с сервером выключен. Cледите за совпадением вручную.</string>
<string name="server_journal_title">Журнал</string> <string name="server_journal_title">Журнал</string>
<string name="server_journal_fetch">Показать журнал</string> <string name="server_journal_fetch">Показать журнал</string>
<string name="server_journal_refresh">Обновить</string> <string name="server_journal_refresh">Обновить</string>
@@ -82,13 +82,13 @@
<string name="server_journal_empty">Журнал пуст</string> <string name="server_journal_empty">Журнал пуст</string>
<string name="server_journal_clear">Очистить</string> <string name="server_journal_clear">Очистить</string>
<string name="transport_protocol">Транспорт</string> <string name="transport_protocol">Транспорт</string>
<string name="transport_protocol_desc">UDP снижает задержки, TCP — стабильнее</string> <string name="transport_protocol_desc">UDP снижает задержки, TCP - стабильнее</string>
<string name="manual_captcha">Ручной ввод капчи</string> <string name="manual_captcha">Ручной ввод капчи</string>
<string name="manual_captcha_desc">Решать капчу вручную вместо автоматического распознавания</string> <string name="manual_captcha_desc">Решать капчу вручную вместо автоматического распознавания</string>
<string name="use_carrier_dns">DNS оператора связи</string> <string name="use_carrier_dns">DNS оператора связи</string>
<string name="use_carrier_dns_desc">Использовать DNS текущей сети вместо системного резолвера</string> <string name="use_carrier_dns_desc">Использовать DNS текущей сети вместо системного резолвера</string>
<string name="dns_mode_title">DNS-резолвер</string> <string name="dns_mode_title">DNS-резолвер</string>
<string name="dns_mode_desc">Авто — пробует системный DNS, переключается на DNS-over-HTTPS при блокировке</string> <string name="dns_mode_desc">Авто - пробует системный DNS, переключается на DNS-over-HTTPS при блокировке</string>
<string name="dns_mode_auto">Авто</string> <string name="dns_mode_auto">Авто</string>
<string name="dns_mode_udp">UDP/53</string> <string name="dns_mode_udp">UDP/53</string>
<string name="dns_mode_doh">DoH</string> <string name="dns_mode_doh">DoH</string>
@@ -111,7 +111,7 @@
<string name="listen_port_desc">Порт, на котором сервер принимает подключения от клиентов</string> <string name="listen_port_desc">Порт, на котором сервер принимает подключения от клиентов</string>
<string name="listen_ip">IP прослушивания</string> <string name="listen_ip">IP прослушивания</string>
<string name="listen_ip_placeholder">0.0.0.0</string> <string name="listen_ip_placeholder">0.0.0.0</string>
<string name="listen_ip_desc">IP-адрес, к которому биндится сервер. 0.0.0.0 — все интерфейсы. Укажите конкретный WAN IP, если на хосте несколько адресов.</string> <string name="listen_ip_desc">IP-адрес, к которому биндится сервер. 0.0.0.0 - все интерфейсы. Укажите конкретный WAN IP, если на хосте несколько адресов.</string>
<string name="turn_client_address">Адрес TURN‑клиента</string> <string name="turn_client_address">Адрес TURN‑клиента</string>
<string name="turn_client_placeholder">127.0.0.1:40537</string> <string name="turn_client_placeholder">127.0.0.1:40537</string>
<string name="turn_client_desc">Локальный WireGuard/Hysteria-клиент на стороне сервера</string> <string name="turn_client_desc">Локальный WireGuard/Hysteria-клиент на стороне сервера</string>
@@ -120,7 +120,7 @@
<string name="server_install_downloaded">Обновлено</string> <string name="server_install_downloaded">Обновлено</string>
<string name="server_version_label">Версия: %1$s</string> <string name="server_version_label">Версия: %1$s</string>
<string name="server_obf_key_label">Obf-ключ (64 hex)</string> <string name="server_obf_key_label">Obf-ключ (64 hex)</string>
<string name="server_wrap_regen">Сгенерировать новый ключ на сервере</string> <string name="obf_key_regen">Сгенерировать новый ключ на сервере</string>
<string name="start_server">Запустить сервер</string> <string name="start_server">Запустить сервер</string>
<string name="stop_server">Остановить сервер</string> <string name="stop_server">Остановить сервер</string>
<string name="continue_client_setup">Продолжить настройку клиента</string> <string name="continue_client_setup">Продолжить настройку клиента</string>
@@ -152,7 +152,7 @@
<!-- OnboardingScreen --> <!-- OnboardingScreen -->
<string name="onboarding_title">Free Turn</string> <string name="onboarding_title">Free Turn</string>
<string name="onboarding_subtitle">Проксируйте WireGuard и Hysteria‑трафик\nчерез TURN‑серверы VK Calls</string> <string name="onboarding_subtitle">Проксируйте WireGuard/Xray трафик\nчерез TURN‑сервера</string>
<string name="privacy_notice">Мы не собираем никаких данных. Все настройки (SSH-доступ, параметры прокси) хранятся исключительно на вашем устройстве.</string> <string name="privacy_notice">Мы не собираем никаких данных. Все настройки (SSH-доступ, параметры прокси) хранятся исключительно на вашем устройстве.</string>
<string name="setup_server">Настроить сервер</string> <string name="setup_server">Настроить сервер</string>
<string name="skip_setup">Пропустить настройки</string> <string name="skip_setup">Пропустить настройки</string>