From ff1607d623bcbf2a2958095d3414d1504d41ccbc Mon Sep 17 00:00:00 2001 From: JMARyA Date: Tue, 22 Apr 2025 09:47:36 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.toml | 6 ++---- src/config.rs | 2 +- src/main.rs | 31 ++++++++++++++----------------- 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/config.toml b/config.toml index 01f9d25..1f79ac7 100644 --- a/config.toml +++ b/config.toml @@ -1,4 +1,3 @@ - [mirror] repos = [ "core", @@ -6,8 +5,7 @@ repos = [ "multilib" ] -[mirrorlist] -x86_64 = [ +mirrorlist.x86_64 = [ "http://mirrors.kernel.org/archlinux/$repo/os/$arch", "https://geo.mirror.pkgbuild.com/$repo/os/$arch", "https://ftpmirror.infania.net/mirror/archlinux/$repo/os/$arch", @@ -15,6 +13,6 @@ x86_64 = [ "https://mirror.rackspace.com/archlinux/$repo/os/$arch" ] -aarch64 = [ +mirrorlist.aarch64 = [ "https://mirror.archlinuxarm.org/$arch/$repo/" ] diff --git a/src/config.rs b/src/config.rs index 55750d9..f1e5f39 100644 --- a/src/config.rs +++ b/src/config.rs @@ -31,7 +31,7 @@ impl Mirrorlist { impl Config { pub fn is_mirrored_repo(&self, repo: &str) -> bool { if let Some(mirrorc) = &self.mirror { - return mirrorc.repos.iter().any(|x| x == repo); + return mirrorc.repos.iter().any(|x| x.trim() == repo.trim()); } false diff --git a/src/main.rs b/src/main.rs index 2dd137f..2789dbe 100644 --- a/src/main.rs +++ b/src/main.rs @@ -56,23 +56,20 @@ async fn launch(config: String) { ..Default::default() }) .mount_assets() - .mount( - "/", - routes![ - routes::index_page, - routes::pkg_route, - routes::push::upload_pkg, - routes::user::login, - routes::user::login_post, - routes::user::account_page, - routes::ui::pkg_ui, - routes::ui::repo_ui, - routes::user::new_api_key, - routes::user::end_session, - routes::user::change_password, - routes::user::change_password_post - ], - ) + .mount("/", routes![ + routes::index_page, + routes::pkg_route, + routes::push::upload_pkg, + routes::user::login, + routes::user::login_post, + routes::user::account_page, + routes::ui::pkg_ui, + routes::ui::repo_ui, + routes::user::new_api_key, + routes::user::end_session, + routes::user::change_password, + routes::user::change_password_post + ]) .manage(config) .manage(shell) .launch()