aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-04-08 22:36:18 -0700
committerFuwn <[email protected]>2024-04-08 22:36:18 -0700
commit7421ec8d463a65f8b306660680effd1168b911c1 (patch)
treef050a0df6a87535d6dc28d39965ef2df59f008be
parentfeat(tor): add pia (diff)
downloadlocus-7421ec8d463a65f8b306660680effd1168b911c1.tar.xz
locus-7421ec8d463a65f8b306660680effd1168b911c1.zip
feat(router): remove translation engine
-rw-r--r--content/templates/partials/footer.hbs1
-rw-r--r--src/modules/router.rs2
-rw-r--r--src/modules/router/module.rs48
-rw-r--r--src/modules/static.rs10
4 files changed, 28 insertions, 33 deletions
diff --git a/content/templates/partials/footer.hbs b/content/templates/partials/footer.hbs
index f3ddccb..f96cafb 100644
--- a/content/templates/partials/footer.hbs
+++ b/content/templates/partials/footer.hbs
@@ -16,7 +16,6 @@
=> http://fuwnme4wbs5x36jjf2usedw2zscozwhazykhyfkjsmudtb7egs3mb7yd.onion Onion Service (Tor)
=> http://fuwn.i2p/?i2paddresshelper=umaux4l3q3j33pfsz3mzxk6o5c7f6lu47wln5vo5nqvv5nyufgra.b32.i2p Epsite (I2P)
-=> /translations View this page in a language of your choice!
Copyright (c) 2021-2024 Fuwn. All rights reserved.
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\"",