mirror of
https://github.com/egor-white/zaprett.git
synced 2025-12-10 05:19:42 +05:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f29ed9de63 | ||
|
|
d58792fbfc | ||
|
|
860dc21272 | ||
|
|
277f6756bd | ||
|
|
ac35be8e57 | ||
|
|
82de796d25 | ||
|
|
4e5c3e3847 | ||
|
|
c500997d74 | ||
|
|
f94acaa830 | ||
|
|
b5fa8e0abf | ||
|
|
85e3c5ce0f |
13
README.md
13
README.md
@@ -22,18 +22,9 @@
|
||||
|
||||
## Какую версию модуля выбрать?
|
||||
|
||||
В актуальных релизах есть 3 версии модуля, а именно:
|
||||
В актуальных релизах есть 2 версии модуля, а именно:
|
||||
- zaprett.zip
|
||||
- zaprett-hosts.zip
|
||||
- zaprett-tv.zip
|
||||
|
||||
Основные их отличия представленны в таблице ниже.
|
||||
Для устройств на Android TV **рекомендуется использовать именно TV версию** из-за некоторых особенностей работы этой ОС.
|
||||
|Версия|Списки|/etc/hosts|
|
||||
|------|------|----------|
|
||||
|zaprett|list-youtube.txt, list-discord.txt|:x: Нет|
|
||||
|zaprett-tv|list-youtube.txt|:x: Нет|
|
||||
|zaprett-hosts|list-youtube.txt,list-discord.txt|:white_check_mark: Есть|
|
||||
- zaprett-hosts.zip (с /etc/hosts)
|
||||
|
||||
## Что такое /etc/hosts?
|
||||
Говоря грубо, это файл, который влияет на работу нейросетей и других недоступных сервисов, перенаправляя ваш траффик на сторонние сервера.
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
Обновление бинарников zapret до версии 72.2
|
||||
Обновление hosts файла в zaprett hosts
|
||||
|
||||
Исправление ошибки запуска сервиса
|
||||
|
||||
46
hosts/hosts
46
hosts/hosts
@@ -1,5 +1,5 @@
|
||||
### dns.malw.link: hosts file
|
||||
# Последнее обновление: 17 октября 2025
|
||||
# Последнее обновление: 9 ноября 2025
|
||||
# Дополнение к zapret:
|
||||
157.240.245.174 instagram.com
|
||||
157.240.245.174 www.instagram.com
|
||||
@@ -15,6 +15,7 @@
|
||||
172.64.33.155 rutor.info
|
||||
173.245.59.155 rutor.is
|
||||
185.87.51.182 controlplane.tailscale.com
|
||||
172.64.33.155 d.rutor.info
|
||||
|
||||
# ChatGPT, OpenAI:
|
||||
185.246.223.127 chatgpt.com
|
||||
@@ -33,6 +34,7 @@
|
||||
185.246.223.127 sora.chatgpt.com
|
||||
185.246.223.127 sora.com
|
||||
185.246.223.127 videos.openai.com
|
||||
185.246.223.127 ios.chat.openai.com
|
||||
|
||||
# Сервисы Google:
|
||||
185.246.223.127 gemini.google.com
|
||||
@@ -74,10 +76,10 @@
|
||||
185.246.223.127 aet.spotify.com
|
||||
185.246.223.127 www.spotify.com
|
||||
185.246.223.127 accounts.spotify.com
|
||||
45.95.233.23 open.spotify.com
|
||||
185.246.223.127 open.spotify.com
|
||||
|
||||
# GitHub Copilot:
|
||||
50.7.87.84 api.github.com
|
||||
185.246.223.127 api.github.com
|
||||
185.246.223.127 api.individual.githubcopilot.com
|
||||
185.246.223.127 proxy.individual.githubcopilot.com
|
||||
|
||||
@@ -95,10 +97,6 @@
|
||||
185.246.223.127 api.elevenlabs.io
|
||||
185.246.223.127 help.elevenlabs.io
|
||||
|
||||
# Truth Social
|
||||
204.12.192.219 truthsocial.com
|
||||
204.12.192.219 static-assets-1.truthsocial.com
|
||||
|
||||
# Grok
|
||||
185.246.223.127 grok.com
|
||||
185.246.223.127 accounts.x.ai
|
||||
@@ -165,10 +163,6 @@
|
||||
185.246.223.127 weather.com
|
||||
185.246.223.127 upsx.weather.com
|
||||
|
||||
# Guilded
|
||||
204.12.192.219 guilded.gg
|
||||
204.12.192.219 www.guilded.gg
|
||||
|
||||
# Fitbit
|
||||
185.246.223.127 api.fitbit.com
|
||||
185.246.223.127 fitbit-pa.googleapis.com
|
||||
@@ -181,18 +175,33 @@
|
||||
185.246.223.127 auth.anthropic.com
|
||||
185.246.223.127 api.anthropic.com
|
||||
|
||||
#4PDA
|
||||
185.246.223.127 4pda.to
|
||||
185.246.223.127 app.4pda.to
|
||||
185.246.223.127 s.4pda.to
|
||||
185.246.223.127 appbk.4pda.to
|
||||
|
||||
# Trae.ai
|
||||
185.246.223.127 trae-api-sg.mchost.guru
|
||||
185.246.223.127 api.trae.ai
|
||||
185.246.223.127 api-sg-central.trae.ai
|
||||
185.246.223.127 api16-normal-alisg.mchost.guru
|
||||
|
||||
# Linear.app
|
||||
185.246.223.127 linear.app
|
||||
185.246.223.127 client-api.linear.app
|
||||
185.246.223.127 static.linear.app
|
||||
185.246.223.127 constellation.linear.app
|
||||
185.246.223.127 uploads.linear.app
|
||||
185.246.223.127 public.linear.app
|
||||
185.246.223.127 s.linear.app
|
||||
|
||||
# Windsurf
|
||||
185.246.223.127 windsurf.com
|
||||
185.246.223.127 codeium.com
|
||||
185.246.223.127 server.codeium.com
|
||||
185.246.223.127 web-backend.codeium.com
|
||||
185.246.223.127 unleash.codeium.com
|
||||
185.246.223.127 inference.codeium.com
|
||||
185.246.223.127 codeiumdata.com
|
||||
185.246.223.127 windsurf-stable.codeium.com
|
||||
185.246.223.127 windsurf-telemetry.codeium.com
|
||||
185.246.223.127 marketplace.windsurf.com
|
||||
|
||||
# Другое:
|
||||
185.246.223.127 www.notion.so
|
||||
50.7.85.222 www.canva.com
|
||||
@@ -213,6 +222,7 @@
|
||||
45.95.233.23 eu.posthog.com
|
||||
185.246.223.127 www.qwant.com
|
||||
185.246.223.127 guidedhacking.com
|
||||
185.246.223.127 framer.com
|
||||
|
||||
# Блокировка реально плохих сайтов
|
||||
# Скримеры:
|
||||
@@ -243,4 +253,6 @@
|
||||
0.0.0.0 appmetrica.yandex.ru
|
||||
0.0.0.0 mc.yandex.ru
|
||||
0.0.0.0 amc.yandex.ru
|
||||
0.0.0.0 tigr1234566.github.io
|
||||
0.0.0.0 rezvorck.github.io
|
||||
### dns.malw.link: end hosts file
|
||||
|
||||
@@ -30,3 +30,4 @@ panic = "abort"
|
||||
opt-level = "z"
|
||||
lto = true
|
||||
strip = true
|
||||
codegen-units = 1
|
||||
|
||||
@@ -2,19 +2,20 @@ use crate::MODULE_PATH;
|
||||
use tokio::fs;
|
||||
use tokio::fs::File;
|
||||
|
||||
pub async fn set_autostart(autostart: bool) -> Result<(), anyhow::Error> {
|
||||
pub async fn set_autostart() -> Result<(), anyhow::Error> {
|
||||
let autostart_path = MODULE_PATH.join("autostart");
|
||||
|
||||
if autostart {
|
||||
if !get_autostart() {
|
||||
File::create(autostart_path).await?;
|
||||
} else {
|
||||
fs::remove_file(autostart_path).await?;
|
||||
}
|
||||
|
||||
println!("{}", get_autostart());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn get_autostart() {
|
||||
let file = MODULE_PATH.join("autostart");
|
||||
println!("{}", file.exists());
|
||||
pub fn get_autostart() -> bool {
|
||||
return MODULE_PATH.join("autostart").exists();
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use crate::autostart::{get_autostart, set_autostart};
|
||||
use crate::service::{restart_service, service_status, start_service, stop_service};
|
||||
use crate::{bin_version, module_version};
|
||||
use crate::{bin_version, module_version, run_nfqws};
|
||||
use clap::Subcommand;
|
||||
use log::error;
|
||||
use crate::autostart::{get_autostart, set_autostart};
|
||||
|
||||
#[derive(Subcommand)]
|
||||
pub enum Command {
|
||||
@@ -19,11 +19,7 @@ pub enum Command {
|
||||
Status,
|
||||
|
||||
/// Enable or disable automatic restart
|
||||
SetAutostart {
|
||||
/// Whether to enable (true) or disable (false) autostart
|
||||
#[arg(value_parser = clap::value_parser!(bool))]
|
||||
autostart: bool,
|
||||
},
|
||||
SetAutostart,
|
||||
|
||||
/// Show whether autostart is enabled
|
||||
GetAutostart,
|
||||
@@ -33,6 +29,12 @@ pub enum Command {
|
||||
|
||||
/// Show the nfqws binary version
|
||||
BinaryVersion,
|
||||
|
||||
/// Run nfqws
|
||||
Args {
|
||||
#[arg(allow_hyphen_values=true, trailing_var_arg = true, num_args = 0..)]
|
||||
args: Vec<String>,
|
||||
},
|
||||
}
|
||||
|
||||
impl Command {
|
||||
@@ -53,14 +55,15 @@ impl Command {
|
||||
}
|
||||
);
|
||||
}
|
||||
Command::SetAutostart { autostart } => {
|
||||
if let Err(err) = set_autostart(*autostart).await {
|
||||
Command::SetAutostart => {
|
||||
if let Err(err) = set_autostart().await {
|
||||
error!("Failed to set auto start: {err}")
|
||||
}
|
||||
}
|
||||
Command::GetAutostart => get_autostart(),
|
||||
Command::GetAutostart => println!("{}", get_autostart()),
|
||||
Command::ModuleVersion => println!("{}", module_version().await?),
|
||||
Command::BinaryVersion => println!("{}", bin_version()),
|
||||
Command::Args { args } => run_nfqws(&args.join(" "))?,
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -8,12 +8,12 @@ use nix::sys::signal::{Signal, kill};
|
||||
use nix::unistd::{Pid, Uid};
|
||||
use regex::Regex;
|
||||
use std::borrow::Cow;
|
||||
use std::io::ErrorKind;
|
||||
use std::path::Path;
|
||||
use sysctl::{Ctl, CtlValue, Sysctl};
|
||||
use sysinfo::{Pid as SysPid, System};
|
||||
use tokio::fs;
|
||||
use tokio::fs::File;
|
||||
use tokio::io::AsyncReadExt;
|
||||
use std::path::Path;
|
||||
|
||||
pub async fn start_service() -> anyhow::Result<()> {
|
||||
if !Uid::effective().is_root() {
|
||||
@@ -32,14 +32,26 @@ pub async fn start_service() -> anyhow::Result<()> {
|
||||
fs::create_dir_all(&tmp_dir).await?;
|
||||
}
|
||||
|
||||
let config_path = ZAPRETT_DIR_PATH.join("config.json");
|
||||
let mut config_contents = String::new();
|
||||
File::open(ZAPRETT_DIR_PATH.join("config.json"))
|
||||
.await
|
||||
.expect("cannot open config.json")
|
||||
.read_to_string(&mut config_contents)
|
||||
.await?;
|
||||
|
||||
let config: Config = serde_json::from_str(&config_contents).expect("invalid json");
|
||||
match fs::File::open(&config_path).await {
|
||||
Ok(mut file) => {
|
||||
file.read_to_string(&mut config_contents).await?;
|
||||
}
|
||||
Err(e) if e.kind() == ErrorKind::NotFound => {
|
||||
let default_config = Config::default();
|
||||
let json = serde_json::to_string_pretty(&default_config)?;
|
||||
if let Some(parent) = config_path.parent() {
|
||||
fs::create_dir_all(parent).await?;
|
||||
}
|
||||
fs::write(&config_path, &json).await?;
|
||||
config_contents = json;
|
||||
}
|
||||
Err(e) => return Err(e.into()),
|
||||
}
|
||||
|
||||
let config: Config = serde_json::from_str(&config_contents)?;
|
||||
|
||||
let start = fs::read_to_string(config.strategy())
|
||||
.await
|
||||
|
||||
@@ -17,26 +17,12 @@ unzip -o "$ZIPFILE" -x 'META-INF/*' -d $MODPATH >&2
|
||||
ui_print "Creating zaprett directory..."
|
||||
mkdir /sdcard/zaprett; mkdir /sdcard/zaprett/lists; mkdir /sdcard/zaprett/bin; mkdir /sdcard/zaprett/strategies;
|
||||
|
||||
ui_print "Filling configuration file if not exist..."
|
||||
if [ ! -f "/sdcard/zaprett/config.json" ]; then
|
||||
cat > /sdcard/zaprett/config.json << EOL
|
||||
{
|
||||
"active_lists": ["/sdcard/zaprett/lists/include/list-youtube.txt", "/sdcard/zaprett/lists/include/list-discord.txt"],
|
||||
"active_ipsets": [],
|
||||
"active_exclude_lists": [],
|
||||
"active_exclude_ipsets": [],
|
||||
"list_type": "whitelist",
|
||||
"strategy": "",
|
||||
"app_list": "whitelist",
|
||||
"whitelist": [],
|
||||
"blacklist": []
|
||||
}
|
||||
EOL
|
||||
fi
|
||||
|
||||
ui_print "Copying lists and binaries to /sdcard/zaprett..."
|
||||
cp -r $MODPATH/system/etc/zaprett/. /sdcard/zaprett/
|
||||
|
||||
ui_print "Remove exiting config.json"
|
||||
rm /sdcard/zaprett/config.json
|
||||
|
||||
ui_print "Copying files to /bin"
|
||||
arch=$(uname -m)
|
||||
case "$arch" in
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"version": "5.2",
|
||||
"versionCode": 52,
|
||||
"zipUrl": "https://github.com/egor-white/zaprett/releases/download/5.2.0/zaprett-hosts.zip",
|
||||
"version": "6.1",
|
||||
"versionCode": 61,
|
||||
"zipUrl": "https://github.com/egor-white/zaprett/releases/download/6.0.0/zaprett-hosts.zip",
|
||||
"changelog": "https://raw.githubusercontent.com/egor-white/zaprett/refs/heads/main/changelog.md"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"version": "5.2",
|
||||
"versionCode": 52,
|
||||
"zipUrl": "https://github.com/egor-white/zaprett/releases/download/5.2.0/zaprett-tv.zip",
|
||||
"version": "6.0",
|
||||
"versionCode": 60,
|
||||
"zipUrl": "https://github.com/egor-white/zaprett/releases/download/6.0.0/zaprett.zip",
|
||||
"changelog": "https://raw.githubusercontent.com/egor-white/zaprett/refs/heads/main/changelog.md"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"version": "5.2",
|
||||
"versionCode": 52,
|
||||
"zipUrl": "https://github.com/egor-white/zaprett/releases/download/5.2.0/zaprett.zip",
|
||||
"version": "6.1",
|
||||
"versionCode": 61,
|
||||
"zipUrl": "https://github.com/egor-white/zaprett/releases/download/6.0.0/zaprett.zip",
|
||||
"changelog": "https://raw.githubusercontent.com/egor-white/zaprett/refs/heads/main/changelog.md"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user