diff --git a/src/mailer.rs b/src/mailer.rs index 35d2ec3e..bf4c7a30 100644 --- a/src/mailer.rs +++ b/src/mailer.rs @@ -9,8 +9,8 @@ use serde::{Deserialize, Serialize}; use crate::config::Configuration; use crate::errors::ServiceError; -use crate::routes::API_VERSION; use crate::utils::clock; +use crate::web::api::API_VERSION; pub struct Service { cfg: Arc, diff --git a/src/routes/about.rs b/src/routes/about.rs index 2a32a74e..a88e3865 100644 --- a/src/routes/about.rs +++ b/src/routes/about.rs @@ -2,8 +2,8 @@ use actix_web::http::StatusCode; use actix_web::{web, HttpResponse, Responder}; use crate::errors::ServiceResult; -use crate::routes::API_VERSION; use crate::services::about::{index_page, license_page}; +use crate::web::api::API_VERSION; pub fn init(cfg: &mut web::ServiceConfig) { cfg.service( diff --git a/src/routes/category.rs b/src/routes/category.rs index 30d3643a..bd285867 100644 --- a/src/routes/category.rs +++ b/src/routes/category.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; use crate::common::WebAppData; use crate::errors::ServiceResult; use crate::models::response::OkResponse; -use crate::routes::API_VERSION; +use crate::web::api::API_VERSION; pub fn init(cfg: &mut web::ServiceConfig) { cfg.service( diff --git a/src/routes/mod.rs b/src/routes/mod.rs index bbb439a4..25ac1551 100644 --- a/src/routes/mod.rs +++ b/src/routes/mod.rs @@ -9,8 +9,6 @@ pub mod tag; pub mod torrent; pub mod user; -pub const API_VERSION: &str = "v1"; - pub fn init(cfg: &mut web::ServiceConfig) { user::init(cfg); torrent::init(cfg); diff --git a/src/routes/proxy.rs b/src/routes/proxy.rs index 0ff99d08..ac6e2967 100644 --- a/src/routes/proxy.rs +++ b/src/routes/proxy.rs @@ -4,8 +4,8 @@ use actix_web::{web, HttpRequest, HttpResponse, Responder}; use crate::cache::image::manager::Error; use crate::common::WebAppData; use crate::errors::ServiceResult; -use crate::routes::API_VERSION; use crate::ui::proxy::{load_error_images, map_error_to_image}; +use crate::web::api::API_VERSION; pub fn init(cfg: &mut web::ServiceConfig) { cfg.service( diff --git a/src/routes/root.rs b/src/routes/root.rs index 29004dd8..7c82ecbd 100644 --- a/src/routes/root.rs +++ b/src/routes/root.rs @@ -1,6 +1,7 @@ use actix_web::web; -use crate::routes::{about, API_VERSION}; +use crate::routes::about; +use crate::web::api::API_VERSION; pub fn init(cfg: &mut web::ServiceConfig) { cfg.service(web::scope("/").service(web::resource("").route(web::get().to(about::get)))); diff --git a/src/routes/settings.rs b/src/routes/settings.rs index 378a05dd..53d336c1 100644 --- a/src/routes/settings.rs +++ b/src/routes/settings.rs @@ -4,7 +4,7 @@ use crate::common::WebAppData; use crate::config; use crate::errors::ServiceResult; use crate::models::response::OkResponse; -use crate::routes::API_VERSION; +use crate::web::api::API_VERSION; pub fn init(cfg: &mut web::ServiceConfig) { cfg.service( diff --git a/src/routes/tag.rs b/src/routes/tag.rs index fb8f51bf..025031c6 100644 --- a/src/routes/tag.rs +++ b/src/routes/tag.rs @@ -5,7 +5,7 @@ use crate::common::WebAppData; use crate::errors::ServiceResult; use crate::models::response::OkResponse; use crate::models::torrent_tag::TagId; -use crate::routes::API_VERSION; +use crate::web::api::API_VERSION; pub fn init(cfg: &mut web::ServiceConfig) { cfg.service( diff --git a/src/routes/torrent.rs b/src/routes/torrent.rs index 40edc129..299a89e5 100644 --- a/src/routes/torrent.rs +++ b/src/routes/torrent.rs @@ -14,9 +14,9 @@ use crate::models::info_hash::InfoHash; use crate::models::response::{NewTorrentResponse, OkResponse}; use crate::models::torrent::TorrentRequest; use crate::models::torrent_tag::TagId; -use crate::routes::API_VERSION; use crate::services::torrent::ListingRequest; use crate::utils::parse_torrent; +use crate::web::api::API_VERSION; pub fn init(cfg: &mut web::ServiceConfig) { cfg.service( diff --git a/src/routes/user.rs b/src/routes/user.rs index 020726b3..6ff78170 100644 --- a/src/routes/user.rs +++ b/src/routes/user.rs @@ -4,8 +4,8 @@ use serde::{Deserialize, Serialize}; use crate::common::WebAppData; use crate::errors::{ServiceError, ServiceResult}; use crate::models::response::{OkResponse, TokenResponse}; -use crate::routes::API_VERSION; use crate::web::api::v1::contexts::user::forms::RegistrationForm; +use crate::web::api::API_VERSION; pub fn init(cfg: &mut web::ServiceConfig) { cfg.service( diff --git a/src/services/about.rs b/src/services/about.rs index b0b18c4a..fed3d973 100644 --- a/src/services/about.rs +++ b/src/services/about.rs @@ -1,5 +1,5 @@ //! Templates for "about" static pages. -use crate::routes::API_VERSION; +use crate::web::api::API_VERSION; #[must_use] pub fn index_page() -> String { diff --git a/src/web/api/mod.rs b/src/web/api/mod.rs index 9321f433..8159eae3 100644 --- a/src/web/api/mod.rs +++ b/src/web/api/mod.rs @@ -15,6 +15,8 @@ use tokio::task::JoinHandle; use crate::common::AppData; use crate::web::api; +pub const API_VERSION: &str = "v1"; + /// API implementations. pub enum Implementation { /// API implementation with Actix Web.