diff options
| author | Fuwn <[email protected]> | 2022-07-03 05:03:00 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-07-03 05:03:00 +0000 |
| commit | 4723a68e2b38da50e78cb1d95827cedfc99e22ee (patch) | |
| tree | 072cddd403253f8d2ff21d651375e762ba8dbd1d /src/response.rs | |
| parent | feat(response): url error handling (diff) | |
| download | september-4723a68e2b38da50e78cb1d95827cedfc99e22ee.tar.xz september-4723a68e2b38da50e78cb1d95827cedfc99e22ee.zip | |
feat(response): add nocss route
Diffstat (limited to 'src/response.rs')
| -rw-r--r-- | src/response.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/response.rs b/src/response.rs index 486ea3e..288a07f 100644 --- a/src/response.rs +++ b/src/response.rs @@ -28,6 +28,7 @@ pub async fn default( ) -> Result<HttpResponse, Error> { let mut is_proxy = false; let mut is_raw = false; + let mut is_nocss = false; // Try to construct a Gemini URL let url = match make_url( &format!("{}{}", req.path(), { @@ -41,6 +42,7 @@ pub async fn default( false, &mut is_proxy, &mut is_raw, + &mut is_nocss, ) { Ok(url) => url, Err(e) => { @@ -65,6 +67,7 @@ pub async fn default( true, &mut is_proxy, &mut is_raw, + &mut is_nocss, ) { Ok(url) => url, Err(e) => { @@ -123,6 +126,16 @@ pub async fn default( ); } + if is_nocss { + html_context.push_str(&gemini_html.1); + + return Ok( + HttpResponse::Ok() + .content_type(format!("text/html; charset={}", meta.mime())) + .body(html_context), + ); + } + // Try to add an external stylesheet from the `CSS_EXTERNAL` environment // variable. if let Ok(css) = var("CSS_EXTERNAL") { |