5 Commits

Author SHA1 Message Date
CherretGit
59e7970bf2 Update changelog.md 2025-11-17 21:49:28 +07:00
CherretGit
18e1ad9ebd Update changelog.md 2025-11-17 21:49:08 +07:00
CherretGit
85a3f9321c Update update's.json and changelog 2025-11-17 14:46:06 +00:00
CherretGit
f29ed9de63 change path 2025-11-17 21:32:48 +07:00
CherretGit
d58792fbfc fix set-autostart command 2025-11-17 21:27:52 +07:00
5 changed files with 19 additions and 20 deletions

View File

@@ -1 +1,3 @@
Исправление ошибки запуска сервиса
Исправлен автозапуск
Добавлена возможность прямого обращения к zapret
Обновлен hosts-файл

View File

@@ -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();
}

View File

@@ -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,
@@ -59,12 +55,12 @@ 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(" "))?,

View File

@@ -1,6 +1,6 @@
{
"version": "6.1",
"versionCode": 61,
"zipUrl": "https://github.com/egor-white/zaprett/releases/download/6.0.0/zaprett-hosts.zip",
"version": "6.2",
"versionCode": 62,
"zipUrl": "https://github.com/egor-white/zaprett/releases/download/6.2.0/zaprett-hosts.zip",
"changelog": "https://raw.githubusercontent.com/egor-white/zaprett/refs/heads/main/changelog.md"
}

View File

@@ -1,6 +1,6 @@
{
"version": "6.1",
"versionCode": 61,
"zipUrl": "https://github.com/egor-white/zaprett/releases/download/6.0.0/zaprett.zip",
"version": "6.2",
"versionCode": 62,
"zipUrl": "https://github.com/egor-white/zaprett/releases/download/6.2.0/zaprett.zip",
"changelog": "https://raw.githubusercontent.com/egor-white/zaprett/refs/heads/main/changelog.md"
}