aboutsummaryrefslogtreecommitdiff
path: root/src/url.rs
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-07-24 00:38:05 +0000
committerFuwn <[email protected]>2024-07-24 00:38:05 +0000
commitcaeddebbb83e0ea0f495d1ce598f7daa288591e4 (patch)
tree7c1cd50dc598f17f0a6b006c6ff8f858cf18b39c /src/url.rs
parentchore: remove semi-outdated technical information (diff)
downloadseptember-caeddebbb83e0ea0f495d1ce598f7daa288591e4.tar.xz
september-caeddebbb83e0ea0f495d1ce598f7daa288591e4.zip
refactor(response): move configuration into struct
Diffstat (limited to 'src/url.rs')
-rw-r--r--src/url.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/url.rs b/src/url.rs
index 29cb99c..f6863a5 100644
--- a/src/url.rs
+++ b/src/url.rs
@@ -3,14 +3,12 @@ use url::Url;
pub fn from_path(
path: &str,
fallback: bool,
- is_proxy: &mut bool,
- is_raw: &mut bool,
- is_nocss: &mut bool,
+ configuration: &mut crate::response::configuration::Configuration,
) -> Result<Url, url::ParseError> {
Ok(
#[allow(clippy::blocks_in_conditions)]
match Url::try_from(&*if path.starts_with("/proxy") {
- *is_proxy = true;
+ configuration.set_proxy(true);
format!(
"gemini://{}{}",
@@ -18,7 +16,7 @@ pub fn from_path(
if fallback { "/" } else { "" }
)
} else if path.starts_with("/x") {
- *is_proxy = true;
+ configuration.set_proxy(true);
format!(
"gemini://{}{}",
@@ -26,8 +24,8 @@ pub fn from_path(
if fallback { "/" } else { "" }
)
} else if path.starts_with("/raw") {
- *is_proxy = true;
- *is_raw = true;
+ configuration.set_proxy(true);
+ configuration.set_raw(true);
format!(
"gemini://{}{}",
@@ -35,8 +33,8 @@ pub fn from_path(
if fallback { "/" } else { "" }
)
} else if path.starts_with("/nocss") {
- *is_proxy = true;
- *is_nocss = true;
+ configuration.set_proxy(true);
+ configuration.set_no_css(true);
format!(
"gemini://{}{}",