diff options
| author | Fuwn <[email protected]> | 2024-04-08 22:36:18 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-04-08 22:36:18 -0700 |
| commit | 7421ec8d463a65f8b306660680effd1168b911c1 (patch) | |
| tree | f050a0df6a87535d6dc28d39965ef2df59f008be /src/modules | |
| parent | feat(tor): add pia (diff) | |
| download | locus-7421ec8d463a65f8b306660680effd1168b911c1.tar.xz locus-7421ec8d463a65f8b306660680effd1168b911c1.zip | |
feat(router): remove translation engine
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/router.rs | 2 | ||||
| -rw-r--r-- | src/modules/router/module.rs | 48 | ||||
| -rw-r--r-- | src/modules/static.rs | 10 |
3 files changed, 28 insertions, 32 deletions
diff --git a/src/modules/router.rs b/src/modules/router.rs index 46e72ec..d269513 100644 --- a/src/modules/router.rs +++ b/src/modules/router.rs @@ -18,6 +18,6 @@ mod module; mod ticker; -mod translate; +// mod translate; pub use module::module; diff --git a/src/modules/router/module.rs b/src/modules/router/module.rs index a51812b..a9539e4 100644 --- a/src/modules/router/module.rs +++ b/src/modules/router/module.rs @@ -16,12 +16,12 @@ // Copyright (C) 2022-2022 Fuwn <[email protected]> // SPDX-License-Identifier: GPL-3.0-only -use std::sync::{LazyLock, Mutex}; - -use tokio::time::Instant; -use windmark::context::HookContext; - -use crate::route::{CACHE_RATE, ROUTES}; +use { + crate::route::{CACHE_RATE, ROUTES}, + std::sync::{LazyLock, Mutex}, + tokio::time::Instant, + windmark::context::HookContext, +}; fn cache(context: &windmark::context::HookContext, response: &str) { static LAST_CACHED: LazyLock<Mutex<Instant>> = @@ -48,11 +48,7 @@ fn cache(context: &windmark::context::HookContext, response: &str) { trace!("recache for {}", { let path = context.url.path(); - if path.is_empty() { - "/" - } else { - path - } + if path.is_empty() { "/" } else { path } }); } } @@ -77,21 +73,21 @@ pub fn module(router: &mut windmark::router::Router) { cache(&context, &response.content); - if let Some(language) = - windmark::utilities::queries_from_url(&context.url).get("translate") - { - if super::translate::module(&context, response, language).is_err() { - response.content = format!( - "An error occurred during the translation process. Your language \ - might not be supported.\n\n=> {} View Original\n\n{}", - context - .url - .to_string() - .replace(&format!("translate={language}"), ""), - response.content - ); - } - } + // if let Some(language) = + // windmark::utilities::queries_from_url(&context.url).get("translate") + // { + // if super::translate::module(&context, response, language).is_err() { + // response.content = format!( + // "An error occurred during the translation process. Your language + // \ might not be supported.\n\n=> {} View Original\n\n{}", + // context + // .url + // .to_string() + // .replace(&format!("translate={language}"), ""), + // response.content + // ); + // } + // } } }); } diff --git a/src/modules/static.rs b/src/modules/static.rs index 518f67c..b4cdcdc 100644 --- a/src/modules/static.rs +++ b/src/modules/static.rs @@ -73,11 +73,11 @@ pub fn module(router: &mut windmark::router::Router) { "Stock Market Related Telegram Groups", "stocks_telegram" ), - ( - "/translations", - "Translate a page to your language of choice!", - "translations" - ), + // ( + // "/translations", + // "Translate a page to your language of choice!", + // "translations" + // ), ( "/useful", "Useful quick links that don't fit in the \"quick links\"", |