Compare commits
41 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dac08f7588 | ||
|
|
4112145a64 | ||
|
|
3e098de4dc | ||
|
|
7454f5f90b | ||
|
|
56b44ea0ba | ||
|
|
686a9b0444 | ||
|
|
1eb913b436 | ||
|
|
962aff21f0 | ||
|
|
d9469b5ab3 | ||
|
|
4f4a587242 | ||
|
|
7cfd3f96f1 | ||
|
|
7fce58d729 | ||
|
|
8730c26295 | ||
|
|
e0b4eea076 | ||
|
|
1e9f043112 | ||
|
|
b92e2d94da | ||
|
|
71a46f878b | ||
|
|
80ae4368a8 | ||
|
|
b24153c861 | ||
|
|
69be86e084 | ||
|
|
b4a1b7bf30 | ||
|
|
698624e0cd | ||
|
|
b854898270 | ||
|
|
387b52d1a4 | ||
|
|
6fd1476adb | ||
|
|
e88d142041 | ||
|
|
7ac9fea0a3 | ||
|
|
b5a8192eea | ||
|
|
014e6b9d58 | ||
|
|
e15c212330 | ||
|
|
9d7e790caa | ||
|
|
893808f327 | ||
|
|
f2f8edc48f | ||
|
|
774948ae87 | ||
|
|
297ce0cdea | ||
|
|
80abf2380a | ||
|
|
fd69451adc | ||
|
|
611e8ae39c | ||
|
|
21e80d0463 | ||
|
|
98f2af3853 | ||
|
|
d00677270a |
4
.idea/deploymentTargetSelector.xml
generated
@@ -4,10 +4,10 @@
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2025-10-03T07:21:08.712998131Z">
|
||||
<DropdownSelection timestamp="2026-01-10T16:13:45.882808992Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="LocalEmulator" identifier="path=/home/dimap/.android/avd/Medium_Phone.avd" />
|
||||
<DeviceId pluginId="LocalEmulator" identifier="path=/home/dimap/.android/avd/Medium_Phone_2.avd" />
|
||||
</handle>
|
||||
</Target>
|
||||
</DropdownSelection>
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
На данный момент приложение умеет:
|
||||
* Запускать, останавливать и перезапускать сервис
|
||||
* Работа с листами (добавление, включение и выключение, загрузка из репозитория)
|
||||
* Работа с айписетами (добавление, включение и выключение, загрузка из репозитория)
|
||||
* Работа с стратегиями (добавление, выбор, загрузка из репозитория)
|
||||
* Авто обновление приложения
|
||||
|
||||
@@ -39,4 +40,6 @@
|
||||
<img src="images/5.png" width="180">
|
||||
<img src="images/6.png" width="180"><br>
|
||||
<img src="images/7.png" width="180">
|
||||
<img src="images/8.png" width="180">
|
||||
<img src="images/9.png" width="180">
|
||||
</p>
|
||||
|
||||
@@ -14,10 +14,10 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.cherret.zaprett"
|
||||
minSdk = 29
|
||||
minSdk = 28
|
||||
targetSdk = 35
|
||||
versionCode = 25
|
||||
versionName = "2.13"
|
||||
versionCode = 27
|
||||
versionName = "2.15"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@file:OptIn(ExperimentalMaterial3ExpressiveApi::class)
|
||||
package com.cherret.zaprett
|
||||
|
||||
import android.Manifest
|
||||
@@ -7,7 +8,6 @@ import android.content.pm.PackageManager
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Environment
|
||||
import android.provider.Settings
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
@@ -16,6 +16,7 @@ import androidx.activity.result.ActivityResultLauncher
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.activity.viewModels
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.foundation.layout.consumeWindowInsets
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Home
|
||||
@@ -24,6 +25,7 @@ import androidx.compose.material.icons.filled.MultipleStop
|
||||
import androidx.compose.material.icons.filled.Settings
|
||||
import androidx.compose.material.icons.filled.SettingsInputComposite
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.NavigationBar
|
||||
import androidx.compose.material3.NavigationBarItem
|
||||
@@ -207,7 +209,7 @@ class MainActivity : ComponentActivity() {
|
||||
NavHost(
|
||||
navController,
|
||||
startDestination = Screen.home.route,
|
||||
Modifier.padding(innerPadding)
|
||||
Modifier.padding(innerPadding).consumeWindowInsets(innerPadding)
|
||||
) {
|
||||
composable(Screen.home.route) { HomeScreen(viewModel = viewModel,vpnPermissionLauncher) }
|
||||
composable(Screen.hosts.route) { HostsScreen(navController) }
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.app.PendingIntent
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
import android.net.VpnService
|
||||
import android.os.Build
|
||||
import android.os.ParcelFileDescriptor
|
||||
import android.util.Log
|
||||
import androidx.core.app.NotificationCompat
|
||||
@@ -20,7 +21,6 @@ import com.cherret.zaprett.utils.getActiveExcludeIpsets
|
||||
import com.cherret.zaprett.utils.getActiveExcludeLists
|
||||
import com.cherret.zaprett.utils.getActiveIpsets
|
||||
import com.cherret.zaprett.utils.getActiveLists
|
||||
import com.cherret.zaprett.utils.getActiveStrategy
|
||||
import com.cherret.zaprett.utils.getAppsListMode
|
||||
import com.cherret.zaprett.utils.getHostListMode
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
@@ -130,7 +130,9 @@ class ByeDpiVpnService : VpnService() {
|
||||
.addAddress("10.10.10.10", 32)
|
||||
.addDnsServer(dns)
|
||||
.addRoute("0.0.0.0", 0)
|
||||
.setMetered(false)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
builder.setMetered(false)
|
||||
}
|
||||
if (ipv6) {
|
||||
builder.addAddress("fd00::1", 128)
|
||||
.addRoute("::", 0)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.cherret.zaprett.ui.component
|
||||
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@file:OptIn(ExperimentalMaterial3ExpressiveApi::class)
|
||||
package com.cherret.zaprett.ui.screen
|
||||
|
||||
import android.app.Activity
|
||||
@@ -11,11 +12,9 @@ import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||
import androidx.compose.material.icons.filled.MoreVert
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.DropdownMenu
|
||||
import androidx.compose.material3.DropdownMenuItem
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.Scaffold
|
||||
@@ -23,10 +22,8 @@ import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@file:OptIn(ExperimentalMaterial3ExpressiveApi::class)
|
||||
package com.cherret.zaprett.ui.screen
|
||||
|
||||
import android.content.ClipData
|
||||
@@ -39,6 +40,7 @@ import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.CardDefaults
|
||||
import androidx.compose.material3.ElevatedCard
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
||||
import androidx.compose.material3.FilledTonalButton
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.material3.Icon
|
||||
@@ -69,15 +71,12 @@ import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import androidx.navigation.NavController
|
||||
import com.cherret.zaprett.BuildConfig
|
||||
import com.cherret.zaprett.R
|
||||
import com.cherret.zaprett.data.ServiceStatusUI
|
||||
import com.cherret.zaprett.ui.viewmodel.HomeViewModel
|
||||
import dev.jeziellago.compose.markdowntext.MarkdownText
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.serialization.SerializationException
|
||||
import java.io.IOException
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@file:OptIn(ExperimentalMaterial3ExpressiveApi::class)
|
||||
package com.cherret.zaprett.ui.screen
|
||||
|
||||
import android.content.ClipData
|
||||
@@ -27,6 +28,7 @@ import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.DropdownMenu
|
||||
import androidx.compose.material3.DropdownMenuItem
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
||||
import androidx.compose.material3.FloatingActionButton
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.Scaffold
|
||||
@@ -41,7 +43,6 @@ import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.pulltorefresh.PullToRefreshBox
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@file:OptIn(ExperimentalMaterial3ExpressiveApi::class)
|
||||
package com.cherret.zaprett.ui.screen
|
||||
|
||||
import android.content.ClipData
|
||||
@@ -27,6 +28,7 @@ import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.DropdownMenu
|
||||
import androidx.compose.material3.DropdownMenuItem
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
||||
import androidx.compose.material3.FloatingActionButton
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.Scaffold
|
||||
@@ -61,7 +63,6 @@ import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import androidx.navigation.NavController
|
||||
import com.cherret.zaprett.R
|
||||
import com.cherret.zaprett.ui.component.ListSwitchItem
|
||||
import com.cherret.zaprett.ui.viewmodel.HostsViewModel
|
||||
import com.cherret.zaprett.ui.viewmodel.IpsetViewModel
|
||||
import com.cherret.zaprett.utils.getHostListMode
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@file:OptIn(ExperimentalMaterial3ExpressiveApi::class)
|
||||
package com.cherret.zaprett.ui.screen
|
||||
|
||||
import android.content.ClipData
|
||||
@@ -15,6 +16,7 @@ import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.Scaffold
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@file:OptIn(ExperimentalMaterial3ExpressiveApi::class)
|
||||
package com.cherret.zaprett.ui.screen
|
||||
|
||||
import android.content.Context
|
||||
@@ -32,6 +33,7 @@ import androidx.compose.material3.Checkbox
|
||||
import androidx.compose.material3.DropdownMenu
|
||||
import androidx.compose.material3.DropdownMenuItem
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.ModalBottomSheet
|
||||
@@ -41,7 +43,6 @@ import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Switch
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.material3.TextField
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
@@ -73,23 +74,16 @@ import androidx.navigation.NavController
|
||||
import coil3.compose.AsyncImage
|
||||
import com.cherret.zaprett.BuildConfig
|
||||
import com.cherret.zaprett.R
|
||||
import com.cherret.zaprett.byedpi.ByeDpiVpnService
|
||||
import com.cherret.zaprett.data.AppListType
|
||||
import com.cherret.zaprett.data.Setting
|
||||
import com.cherret.zaprett.ui.component.InfoDialog
|
||||
import com.cherret.zaprett.ui.component.SettingsActionItem
|
||||
import com.cherret.zaprett.ui.component.SettingsItem
|
||||
import com.cherret.zaprett.ui.component.SettingsSection
|
||||
import com.cherret.zaprett.data.AppListType
|
||||
import com.cherret.zaprett.data.ServiceStatus
|
||||
import com.cherret.zaprett.ui.component.InfoDialog
|
||||
import com.cherret.zaprett.data.Setting
|
||||
import com.cherret.zaprett.ui.component.TextDialog
|
||||
import com.cherret.zaprett.ui.viewmodel.SettingsViewModel
|
||||
import com.cherret.zaprett.utils.checkModuleInstallation
|
||||
import com.cherret.zaprett.utils.checkRoot
|
||||
import com.cherret.zaprett.utils.getAppsListMode
|
||||
import com.cherret.zaprett.utils.getStartOnBoot
|
||||
import com.cherret.zaprett.utils.setAppsListMode
|
||||
import com.cherret.zaprett.utils.setStartOnBoot
|
||||
import com.cherret.zaprett.utils.stopService
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@file:OptIn(ExperimentalMaterial3ExpressiveApi::class)
|
||||
package com.cherret.zaprett.ui.screen
|
||||
|
||||
import android.content.ClipData
|
||||
@@ -24,6 +25,7 @@ import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.DropdownMenu
|
||||
import androidx.compose.material3.DropdownMenuItem
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
||||
import androidx.compose.material3.FloatingActionButton
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.Scaffold
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@file:OptIn(ExperimentalMaterial3ExpressiveApi::class)
|
||||
package com.cherret.zaprett.ui.screen
|
||||
|
||||
import android.content.ClipData
|
||||
@@ -16,33 +17,17 @@ import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||
import androidx.compose.material.icons.filled.Info
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.FilledTonalButton
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.SnackbarHost
|
||||
import androidx.compose.material3.SnackbarHostState
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
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.text.font.Font
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
@@ -50,6 +35,22 @@ import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||
import androidx.compose.material.icons.filled.Info
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
||||
import androidx.compose.material3.FilledTonalButton
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import androidx.navigation.NavController
|
||||
@@ -235,4 +236,4 @@ private fun NoHostsCard(noHostsCard: MutableState<Boolean>) {
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,10 @@ package com.cherret.zaprett.ui.theme
|
||||
|
||||
import android.os.Build
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
||||
import androidx.compose.material3.MaterialExpressiveTheme
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.MotionScheme
|
||||
import androidx.compose.material3.darkColorScheme
|
||||
import androidx.compose.material3.dynamicDarkColorScheme
|
||||
import androidx.compose.material3.dynamicLightColorScheme
|
||||
@@ -32,6 +35,7 @@ private val LightColorScheme = lightColorScheme(
|
||||
*/
|
||||
)
|
||||
|
||||
@OptIn(ExperimentalMaterial3ExpressiveApi::class)
|
||||
@Composable
|
||||
fun ZaprettTheme(
|
||||
darkTheme: Boolean = isSystemInDarkTheme(),
|
||||
@@ -49,9 +53,10 @@ fun ZaprettTheme(
|
||||
else -> LightColorScheme
|
||||
}
|
||||
|
||||
MaterialTheme(
|
||||
MaterialExpressiveTheme(
|
||||
colorScheme = colorScheme,
|
||||
typography = Typography,
|
||||
motionScheme = MotionScheme.expressive(),
|
||||
content = content
|
||||
)
|
||||
}
|
||||
@@ -2,10 +2,12 @@ package com.cherret.zaprett.ui.viewmodel
|
||||
|
||||
import android.app.Application
|
||||
import com.cherret.zaprett.utils.RepoItemInfo
|
||||
import com.cherret.zaprett.utils.getAllExcludeLists
|
||||
import com.cherret.zaprett.utils.getAllLists
|
||||
import com.cherret.zaprett.utils.getHostList
|
||||
import com.cherret.zaprett.utils.getHostListMode
|
||||
|
||||
class HostRepoViewModel(application: Application): BaseRepoViewModel(application) {
|
||||
override fun getInstalledLists(): Array<String> = getAllLists()
|
||||
override fun getInstalledLists(): Array<String> = if (getHostListMode(sharedPreferences) == "whitelist") getAllLists() else getAllExcludeLists()
|
||||
override fun getRepoList(callback: (Result<List<RepoItemInfo>>) -> Unit) = getHostList(sharedPreferences, callback)
|
||||
}
|
||||
@@ -2,13 +2,13 @@ package com.cherret.zaprett.ui.viewmodel
|
||||
|
||||
import android.app.Application
|
||||
import com.cherret.zaprett.utils.RepoItemInfo
|
||||
import com.cherret.zaprett.utils.getAllExcludeIpsets
|
||||
import com.cherret.zaprett.utils.getAllIpsets
|
||||
import com.cherret.zaprett.utils.getAllLists
|
||||
import com.cherret.zaprett.utils.getHostList
|
||||
import com.cherret.zaprett.utils.getHostListMode
|
||||
import com.cherret.zaprett.utils.getIpsetList
|
||||
|
||||
class IpsetRepoViewModel(application: Application): BaseRepoViewModel(application) {
|
||||
override fun getInstalledLists(): Array<String> = getAllIpsets()
|
||||
override fun getInstalledLists(): Array<String> = if(getHostListMode(sharedPreferences) == "whitelist") getAllIpsets() else getAllExcludeIpsets()
|
||||
override fun getRepoList(callback: (Result<List<RepoItemInfo>>) -> Unit) =
|
||||
getIpsetList(sharedPreferences, callback)
|
||||
}
|
||||
@@ -4,11 +4,8 @@ import android.app.Application
|
||||
import android.content.Context
|
||||
import androidx.compose.material3.SnackbarHostState
|
||||
import com.cherret.zaprett.utils.disableIpset
|
||||
import com.cherret.zaprett.utils.disableList
|
||||
import com.cherret.zaprett.utils.enableIpset
|
||||
import com.cherret.zaprett.utils.enableList
|
||||
import com.cherret.zaprett.utils.getActiveExcludeIpsets
|
||||
import com.cherret.zaprett.utils.getActiveExcludeLists
|
||||
import com.cherret.zaprett.utils.getActiveIpsets
|
||||
import com.cherret.zaprett.utils.getAllExcludeIpsets
|
||||
import com.cherret.zaprett.utils.getAllIpsets
|
||||
|
||||
@@ -8,7 +8,6 @@ import androidx.compose.runtime.mutableStateListOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import com.cherret.zaprett.R
|
||||
import com.cherret.zaprett.byedpi.ByeDpiVpnService
|
||||
import com.cherret.zaprett.data.ServiceStatus
|
||||
import com.cherret.zaprett.data.StrategyCheckResult
|
||||
@@ -16,7 +15,6 @@ import com.cherret.zaprett.data.StrategyTestingStatus
|
||||
import com.cherret.zaprett.utils.disableStrategy
|
||||
import com.cherret.zaprett.utils.enableStrategy
|
||||
import com.cherret.zaprett.utils.getActiveLists
|
||||
import com.cherret.zaprett.utils.getActiveStrategy
|
||||
import com.cherret.zaprett.utils.getAllStrategies
|
||||
import com.cherret.zaprett.utils.getStatus
|
||||
import com.cherret.zaprett.utils.startService
|
||||
@@ -27,7 +25,6 @@ import kotlinx.coroutines.awaitAll
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlinx.coroutines.withTimeoutOrNull
|
||||
@@ -122,7 +119,7 @@ class StrategySelectionViewModel(application: Application) : AndroidViewModel(ap
|
||||
}
|
||||
suspend fun performTest() {
|
||||
val targets = readActiveListsLines()
|
||||
var stopTest : Boolean = false;
|
||||
var stopTest = false
|
||||
for (index in strategyStates.indices) {
|
||||
val current = strategyStates[index]
|
||||
if (stopTest) break
|
||||
@@ -133,9 +130,11 @@ class StrategySelectionViewModel(application: Application) : AndroidViewModel(ap
|
||||
_errorFlow.value = error
|
||||
if (error.isNotEmpty()) stopTest = true
|
||||
} }
|
||||
startService { error ->
|
||||
_errorFlow.value = error
|
||||
if (error.isNotEmpty()) stopTest = true
|
||||
getStatus {
|
||||
if (!it) startService { error ->
|
||||
_errorFlow.value = error
|
||||
if (error.isNotEmpty()) stopTest = true
|
||||
}
|
||||
}
|
||||
try {
|
||||
val progress = countReachable(index, targets)
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
package com.cherret.zaprett.utils
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.DownloadManager
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.content.SharedPreferences
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Environment
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.FileProvider
|
||||
import androidx.core.net.toUri
|
||||
import com.cherret.zaprett.BuildConfig
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
1. Изменения под новую версию модуля
|
||||
2. Исправление работы ipset с byedpi
|
||||
3. Исправление вылетов
|
||||
1. Добавление поддержки Android 9
|
||||
2. Исправление ошибок
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
[versions]
|
||||
agp = "8.13.1"
|
||||
kotlin = "2.2.10"
|
||||
agp = "8.13.2"
|
||||
kotlin = "2.2.21"
|
||||
coreKtx = "1.17.0"
|
||||
junit = "4.13.2"
|
||||
junitVersion = "1.3.0"
|
||||
espressoCore = "3.7.0"
|
||||
lifecycleRuntimeKtx = "2.9.2"
|
||||
activityCompose = "1.10.1"
|
||||
composeBom = "2025.08.00"
|
||||
compose-material3 = "1.3.2"
|
||||
compose-material3-adaptive = "1.4.0-beta02"
|
||||
navigation = "2.9.3"
|
||||
lifecycleRuntimeKtx = "2.10.0"
|
||||
activityCompose = "1.12.1"
|
||||
composeBom = "2025.12.00"
|
||||
compose-material3 = "1.5.0-alpha10"
|
||||
compose-material3-adaptive = "1.5.0-alpha10"
|
||||
navigation = "2.9.6"
|
||||
compose-icons = "1.7.8"
|
||||
libsu = "6.0.0"
|
||||
okhttp = "5.1.0"
|
||||
okhttp = "5.3.2"
|
||||
serialization = "1.9.0"
|
||||
firebase-bom = "34.1.0"
|
||||
firebase-bom = "34.6.0"
|
||||
fragment-compose = "1.8.9"
|
||||
coil3 = "3.3.0"
|
||||
compose-markdown = "0.5.7"
|
||||
|
||||
BIN
images/1.png
|
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 145 KiB |
BIN
images/2.png
|
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 158 KiB |
BIN
images/3.png
|
Before Width: | Height: | Size: 130 KiB After Width: | Height: | Size: 144 KiB |
BIN
images/4.png
|
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 108 KiB |
BIN
images/5.png
|
Before Width: | Height: | Size: 142 KiB After Width: | Height: | Size: 108 KiB |
BIN
images/6.png
|
Before Width: | Height: | Size: 113 KiB After Width: | Height: | Size: 133 KiB |
BIN
images/7.png
|
Before Width: | Height: | Size: 109 KiB After Width: | Height: | Size: 119 KiB |
BIN
images/8.png
Normal file
|
After Width: | Height: | Size: 108 KiB |
BIN
images/9.png
Normal file
|
After Width: | Height: | Size: 119 KiB |
43
rust/Cargo.lock
generated
@@ -28,6 +28,18 @@ dependencies = [
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"
|
||||
|
||||
[[package]]
|
||||
name = "byedpi"
|
||||
version = "0.1.0"
|
||||
@@ -35,9 +47,8 @@ dependencies = [
|
||||
"android_logger",
|
||||
"cmake",
|
||||
"jni",
|
||||
"libc",
|
||||
"log",
|
||||
"once_cell",
|
||||
"nix",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -68,6 +79,12 @@ version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9"
|
||||
|
||||
[[package]]
|
||||
name = "cfg_aliases"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
||||
|
||||
[[package]]
|
||||
name = "cmake"
|
||||
version = "0.1.54"
|
||||
@@ -144,10 +161,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.21.3"
|
||||
name = "memoffset"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
||||
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.30.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cfg-if",
|
||||
"cfg_aliases",
|
||||
"libc",
|
||||
"memoffset",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
|
||||
@@ -5,10 +5,9 @@ edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
jni = "0.21.1"
|
||||
libc = "0.2.0"
|
||||
android_logger = "0.15.1"
|
||||
log = "0.4"
|
||||
once_cell = "1.21.3"
|
||||
nix = { version = "0.30.1", features = ["socket"] }
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
@@ -19,5 +18,5 @@ cmake = "0.1.49"
|
||||
[profile.release]
|
||||
opt-level = "z"
|
||||
lto = true
|
||||
strip = true
|
||||
strip = "symbols"
|
||||
codegen-units = 1
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use android_logger::Config;
|
||||
use core::ffi::{c_char, c_int};
|
||||
use jni::JNIEnv;
|
||||
use jni::objects::{JClass, JObjectArray, JString};
|
||||
use jni::sys::jint;
|
||||
use libc::{SHUT_RDWR, shutdown};
|
||||
use log::{LevelFilter, info};
|
||||
use log::{LevelFilter, error, info};
|
||||
use nix::sys::socket::{Shutdown, shutdown};
|
||||
use std::ffi::CString;
|
||||
use std::os::raw::c_char;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
static PROXY_RUNNING: AtomicBool = AtomicBool::new(false);
|
||||
@@ -15,7 +15,7 @@ unsafe extern "C" {
|
||||
static mut server_fd: i32;
|
||||
static mut optind: i32;
|
||||
static mut optreset: i32;
|
||||
fn main(argc: libc::c_int, argv: *const *const c_char) -> libc::c_int;
|
||||
fn main(argc: c_int, argv: *const *const c_char) -> c_int;
|
||||
fn clear_params();
|
||||
}
|
||||
|
||||
@@ -65,10 +65,19 @@ pub unsafe extern "system" fn Java_com_cherret_zaprett_byedpi_NativeBridge_jniSt
|
||||
) -> jint {
|
||||
init_logger();
|
||||
if !PROXY_RUNNING.load(Ordering::SeqCst) {
|
||||
info!("failed to stop proxy");
|
||||
info!("proxy already stopped");
|
||||
return -1;
|
||||
}
|
||||
info!("stopping proxy");
|
||||
let ret = unsafe { shutdown(server_fd, SHUT_RDWR) };
|
||||
ret as jint
|
||||
let ret = unsafe { shutdown(server_fd, Shutdown::Both) };
|
||||
match ret {
|
||||
Ok(_) => {
|
||||
info!("proxy stopped successfully");
|
||||
0
|
||||
}
|
||||
Err(e) => {
|
||||
error!("failed to stop proxy {}", e);
|
||||
-1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"version": "2.12",
|
||||
"versionCode": 24,
|
||||
"downloadUrl": "https://github.com/CherretGit/zaprett-app/releases/download/2.12.0/app-release.apk",
|
||||
"version": "2.14",
|
||||
"versionCode": 26,
|
||||
"downloadUrl": "https://github.com/CherretGit/zaprett-app/releases/download/2.14.0/app-release.apk",
|
||||
"changelogUrl": "https://raw.githubusercontent.com/CherretGit/zaprett-app/refs/heads/main/changelog.md"
|
||||
}
|
||||
|
||||