Compare commits

...

4 Commits

Author SHA1 Message Date
mini_admin_bot
b0e98d085a add rar and zip to prohibited extensions 2025-06-18 12:35:34 +02:00
ca333d1964
add apk to prohibited extensions 2025-06-01 19:06:45 +02:00
7903e2baf4
get version from Cargo.toml 2025-05-11 22:04:51 +02:00
87ad83f473
add version command and more tests 2025-05-11 21:40:41 +02:00
7 changed files with 22 additions and 5 deletions

2
Cargo.lock generated
View File

@ -1145,7 +1145,7 @@ dependencies = [
[[package]]
name = "mini_admin_bot"
version = "0.1.0"
version = "0.2.5"
dependencies = [
"anyhow",
"chrono",

View File

@ -1,10 +1,9 @@
[package]
name = "mini_admin_bot"
version = "0.1.0"
version = "0.2.5"
edition = "2018"
[dependencies]
#teloxide = { version = "0.11.3", features = ["macros", "auto-send"] }
teloxide = { version = "0.12", features = ["macros", "auto-send"] }
futures = "0.3.5"
log = "0.4"

BIN
polesDB

Binary file not shown.

View File

@ -1,6 +1,7 @@
use std::collections::LinkedList;
use std::fs;
use std::sync::RwLock;
#[cfg(not(test))]
use std::fs;
#[cfg(not(debug_assertions))]
const ALLOW_PATH: &str = "/opt/mini_admin_bot/allow_users";

View File

@ -1,6 +1,6 @@
use teloxide::{prelude::*, types::Document};
static EXTENSIONS: [&str; 3] = ["exe", "deb", "rpm"];
static EXTENSIONS: [&str; 6] = ["exe", "deb", "rpm", "apk", "zip", "rar"];
pub fn check_file(msg: Message) -> bool {
match msg.document() {

View File

@ -24,6 +24,8 @@ enum Command {
Top,
#[command(description = "get the server time")]
Time,
#[command(description = "get the bot version")]
Version,
}
/*#[tokio::main]
@ -117,6 +119,10 @@ async fn answer(bot: Bot, msg: Message, command: Command) -> anyhow::Result<()>
)
.await?
}
Command::Version => {
bot.send_message(msg.chat.id, env!("CARGO_PKG_VERSION"))
.await?
}
};
Ok(())

View File

@ -94,3 +94,14 @@ fn test_rewrite_refered_tiktok() {
Some("https://vxtiktok.com/@/video/7417808362957589778".to_string())
);
}
#[test]
fn test_rewrite_refered_instagram() {
let url_and_domain =
get_domain_from_text("https://www.instagram.com/reel/DJAE4JXSvHn/".to_string());
let domain = filter_string(url_and_domain.0, url_and_domain.1);
assert_eq!(
domain,
Some("https://ddinstagram.com/reel/DJAE4JXSvHn/".to_string())
);
}