mirror of
https://git.ethanthesleepy.one/ethanaobrien/ew
synced 2026-01-12 08:12:36 +08:00
Add flag to purge dead accounts on startup
This commit is contained in:
11
src/main.rs
11
src/main.rs
@@ -64,7 +64,10 @@ pub struct Args {
|
||||
max_time: u64,
|
||||
|
||||
#[arg(long, default_value_t = false, help = "Disable webui, act completely like the original server")]
|
||||
hidden: bool
|
||||
hidden: bool,
|
||||
|
||||
#[arg(long, default_value_t = false, help = "Purge dead user accounts on startup")]
|
||||
purge: bool
|
||||
}
|
||||
|
||||
#[actix_web::main]
|
||||
@@ -72,6 +75,12 @@ async fn main() -> std::io::Result<()> {
|
||||
let args = get_args();
|
||||
let port = args.port;
|
||||
|
||||
if args.purge {
|
||||
println!("Purging accounts...");
|
||||
let ct = crate::router::userdata::purge_accounts();
|
||||
println!("Purged {} accounts", ct);
|
||||
}
|
||||
|
||||
let rv = HttpServer::new(|| App::new()
|
||||
.wrap_fn(|req, srv| {
|
||||
println!("Request: {}", req.path());
|
||||
|
||||
Reference in New Issue
Block a user