aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-03-30 20:20:27 -0700
committerFuwn <[email protected]>2023-03-30 20:20:27 -0700
commit9fc83f8d4fa360a2eb9812880e1db0fba6d4bad8 (patch)
treea9f566fb606de56334f4be9390d48ad8912bd5e3 /src
parentfeat(translation): add translation header (diff)
downloadlocus-9fc83f8d4fa360a2eb9812880e1db0fba6d4bad8.tar.xz
locus-9fc83f8d4fa360a2eb9812880e1db0fba6d4bad8.zip
deps(windmark): bump 0.2.1 -> 0.2.2
Diffstat (limited to 'src')
-rw-r--r--src/macros.rs4
-rw-r--r--src/main.rs2
-rw-r--r--src/modules/api/sydney.rs4
-rw-r--r--src/modules/blog/module.rs7
-rw-r--r--src/modules/random.rs5
-rw-r--r--src/modules/search.rs4
-rw-r--r--src/modules/stocks.rs4
-rw-r--r--src/modules/uptime.rs2
8 files changed, 16 insertions, 16 deletions
diff --git a/src/macros.rs b/src/macros.rs
index 7a39dbd..32703e9 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -37,7 +37,7 @@ macro_rules! success {
($body:expr, $context:ident) => {{
$crate::route::cache(&$context, &$body);
- windmark::Response::Success(
+ windmark::Response::success(
$crate::macros::Main {
body: &$body,
hits: &$crate::route::hits_from($context.url.path()),
@@ -85,7 +85,7 @@ macro_rules! mount_file {
($router).mount(
$at,
Box::new(|_| {
- windmark::Response::SuccessFileAuto(include_bytes!(concat!(
+ windmark::Response::binary_success_auto(include_bytes!(concat!(
"../../content/meta/",
$file
)))
diff --git a/src/main.rs b/src/main.rs
index 38109cf..793a651 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -99,7 +99,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
router.set_private_key_file(".locus/locus_private.pem");
router.set_certificate_file(".locus/locus_public.pem");
router.set_error_handler(Box::new(|_| {
- windmark::Response::NotFound(ERROR_HANDLER_RESPONSE.into())
+ windmark::Response::not_found(ERROR_HANDLER_RESPONSE)
}));
router.set_fix_path(true);
diff --git a/src/modules/api/sydney.rs b/src/modules/api/sydney.rs
index f24a4f7..1adc07d 100644
--- a/src/modules/api/sydney.rs
+++ b/src/modules/api/sydney.rs
@@ -52,7 +52,9 @@ pub fn module(router: &mut windmark::Router) {
crate::route::cache(&context, &content);
- windmark::Response::SuccessWithMime(content, "text/plain".to_string())
+ windmark::Response::success(content)
+ .with_mime("text/plain")
+ .clone()
}),
);
}
diff --git a/src/modules/blog/module.rs b/src/modules/blog/module.rs
index e2ac456..dbdf7ed 100644
--- a/src/modules/blog/module.rs
+++ b/src/modules/blog/module.rs
@@ -322,10 +322,9 @@ pub fn module(router: &mut windmark::Router) {
&format!("/blog/{}.xml", fixed_blog_name),
&format!("Really Simple Syndication for the {} blog", name),
Box::new(move |_| {
- windmark::Response::SuccessWithMime(
- xml.to_string(),
- "text/rss+xml".to_string(),
- )
+ windmark::Response::success(xml.to_string())
+ .with_mime("text/rss+xml")
+ .clone()
}),
);
}
diff --git a/src/modules/random.rs b/src/modules/random.rs
index 9320ac6..885782c 100644
--- a/src/modules/random.rs
+++ b/src/modules/random.rs
@@ -24,14 +24,13 @@ pub fn module(router: &mut windmark::Router) {
"/random",
"Get redirected to a random route",
Box::new(|_| {
- windmark::Response::TemporaryRedirect(
+ windmark::Response::temporary_redirect(
(*crate::route::ROUTES.lock().unwrap())
.iter()
.collect::<Vec<_>>()
.choose(&mut rand::thread_rng())
.unwrap()
- .0
- .to_string(),
+ .0,
)
}),
);
diff --git a/src/modules/search.rs b/src/modules/search.rs
index 6ad3898..bf0b7bb 100644
--- a/src/modules/search.rs
+++ b/src/modules/search.rs
@@ -64,8 +64,8 @@ pub(super) fn module(router: &mut windmark::Router) {
if let Some(query) = context.url.query_pairs().next() {
if query.0 == "action" && query.1 == "go" {
- return windmark::Response::Input(
- "What would you like to search for?".to_string(),
+ return windmark::Response::input(
+ "What would you like to search for?",
);
}
diff --git a/src/modules/stocks.rs b/src/modules/stocks.rs
index bc07f71..832a1ad 100644
--- a/src/modules/stocks.rs
+++ b/src/modules/stocks.rs
@@ -169,8 +169,8 @@ pub fn module(router: &mut windmark::Router) {
if symbol != "Symbol Search" {
if let Some(query) = context.url.query_pairs().next() {
if query.0 == "action" && query.1 == "go" {
- return windmark::Response::Input(
- "Which symbol would you like to explore?".to_string(),
+ return windmark::Response::input(
+ "Which symbol would you like to explore?",
);
}
diff --git a/src/modules/uptime.rs b/src/modules/uptime.rs
index 6f33433..9a9e1b5 100644
--- a/src/modules/uptime.rs
+++ b/src/modules/uptime.rs
@@ -48,7 +48,7 @@ pub fn module(router: &mut windmark::Router) {
crate::route::cache(&context, &response);
- windmark::Response::Success(response)
+ windmark::Response::success(response)
}),
);
}