diff options
| author | Fuwn <[email protected]> | 2023-04-06 01:53:22 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-04-06 01:53:22 -0700 |
| commit | 9235be2eedc2c4f3a78cb704b0a107f33607e530 (patch) | |
| tree | fc927ec6d5a58d2e995cf6ff80ae2804a2265531 /src/modules/router | |
| parent | deps(windmark): bump 0.2.5 -> 0.3.1 (diff) | |
| download | locus-9235be2eedc2c4f3a78cb704b0a107f33607e530.tar.xz locus-9235be2eedc2c4f3a78cb704b0a107f33607e530.zip | |
feat: native async reqwest calls
Diffstat (limited to 'src/modules/router')
| -rw-r--r-- | src/modules/router/module.rs | 10 | ||||
| -rw-r--r-- | src/modules/router/ticker.rs | 2 | ||||
| -rw-r--r-- | src/modules/router/translate/module.rs | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/modules/router/module.rs b/src/modules/router/module.rs index 34d20db..cd7c862 100644 --- a/src/modules/router/module.rs +++ b/src/modules/router/module.rs @@ -19,25 +19,25 @@ use windmark::context::HookContext; pub fn module(router: &mut windmark::Router) { - router.set_pre_route_callback(move |context: HookContext<'_>| { + router.set_pre_route_callback(move |context: HookContext| { info!( "accepted connection from {} to {}", - context.tcp.peer_addr().unwrap().ip(), + context.peer_address.unwrap().ip(), context.url.to_string(), ); super::ticker::module(&context); }); router.set_post_route_callback({ - |context: HookContext<'_>, response: &mut windmark::Response| { + |context: HookContext, response: &mut windmark::Response| { info!( "closed connection from {} to {}", - context.tcp.peer_addr().unwrap().ip(), + context.peer_address.unwrap().ip(), context.url.to_string(), ); if let Some(language) = - windmark::utilities::queries_from_url(context.url).get("translate") + windmark::utilities::queries_from_url(&context.url).get("translate") { if super::translate::module(&context, response, language).is_err() { response.content = format!( diff --git a/src/modules/router/ticker.rs b/src/modules/router/ticker.rs index d193c9b..a5384db 100644 --- a/src/modules/router/ticker.rs +++ b/src/modules/router/ticker.rs @@ -18,7 +18,7 @@ use crate::DATABASE; -pub fn module(context: &windmark::context::HookContext<'_>) { +pub fn module(context: &windmark::context::HookContext) { let url_path = if context.url.path().is_empty() { "/" } else { diff --git a/src/modules/router/translate/module.rs b/src/modules/router/translate/module.rs index 4c105e1..70e4829 100644 --- a/src/modules/router/translate/module.rs +++ b/src/modules/router/translate/module.rs @@ -20,7 +20,7 @@ use super::deepl::translate; use crate::modules::router::translate::deepl::language_code_to_language_name; pub fn module<S>( - context: &windmark::context::HookContext<'_>, + context: &windmark::context::HookContext, response: &mut windmark::Response, language: S, ) -> Result<(), serde_json::Error> |