diff options
| author | Fuwn <[email protected]> | 2022-06-02 00:40:54 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-06-02 00:40:54 +0000 |
| commit | c1a8f8b3c8453d9ef8b08c40544934f7f03dcefb (patch) | |
| tree | c25fc12f7f92f15c8a9a686d3dc223e2999fe5e1 /src | |
| parent | fix(gemini_to_html): replace redundancies (diff) | |
| download | september-c1a8f8b3c8453d9ef8b08c40544934f7f03dcefb.tar.xz september-c1a8f8b3c8453d9ef8b08c40544934f7f03dcefb.zip | |
feat(response): plain text routes
Diffstat (limited to 'src')
| -rw-r--r-- | src/response.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/response.rs b/src/response.rs index 46acfa6..d69efb2 100644 --- a/src/response.rs +++ b/src/response.rs @@ -120,7 +120,15 @@ pub async fn default( env!("VERGEN_GIT_SHA").get(0..5).unwrap_or("UNKNOWN"), )); - // Return HTML response + if let Ok(plain_texts) = var("PLAIN_TEXT_ROUTE") { + if plain_texts.split(',').any(|r| r == req.path()) { + return Ok( + HttpResponse::Ok() + .body(String::from_utf8_lossy(&response.data).to_string()), + ); + } + } + Ok( HttpResponse::Ok() .content_type("text/html; charset=utf-8") |