aboutsummaryrefslogtreecommitdiff
path: root/src/modules/router
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 /src/modules/router
parentfeat(tor): add pia (diff)
downloadlocus-7421ec8d463a65f8b306660680effd1168b911c1.tar.xz
locus-7421ec8d463a65f8b306660680effd1168b911c1.zip
feat(router): remove translation engine
Diffstat (limited to 'src/modules/router')
-rw-r--r--src/modules/router/module.rs48
1 files changed, 22 insertions, 26 deletions
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
+ // );
+ // }
+ // }
}
});
}