diff options
| author | Fuwn <[email protected]> | 2024-07-24 00:38:05 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-07-24 00:38:05 +0000 |
| commit | caeddebbb83e0ea0f495d1ce598f7daa288591e4 (patch) | |
| tree | 7c1cd50dc598f17f0a6b006c6ff8f858cf18b39c /src/url.rs | |
| parent | chore: remove semi-outdated technical information (diff) | |
| download | september-caeddebbb83e0ea0f495d1ce598f7daa288591e4.tar.xz september-caeddebbb83e0ea0f495d1ce598f7daa288591e4.zip | |
refactor(response): move configuration into struct
Diffstat (limited to 'src/url.rs')
| -rw-r--r-- | src/url.rs | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -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://{}{}", |