From 3dbc2029ae147fa213e33cd4d9f9c624ed9deeaa Mon Sep 17 00:00:00 2001 From: Fuwn Date: Mon, 29 May 2023 04:46:03 +0000 Subject: feat(response): optional proxy header --- README.md | 11 +++++++++++ src/response.rs | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/README.md b/README.md index 4196ab9..4f97859 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,17 @@ Defaults to `false`. MATHJAX=true ``` +### `HEADER` + +Adds a large header to the top of a proxy page. Only available in styled +routes. + +Defaults to off. + +```dotenv +HEADER="This will show up at the top of my proxied capsule." +``` + ## Styling Want to give your website a shiny new look? Try using one of sources diff --git a/src/response.rs b/src/response.rs index d7142c4..f156603 100644 --- a/src/response.rs +++ b/src/response.rs @@ -184,6 +184,11 @@ For example: to proxy "gemini://fuwn.me/uptime", visit "/proxy/fuwn.me/uptime".< html_context.push_str(&format!("{gemini_title}")); html_context.push_str(""); + if let Ok(header) = var("HEADER") { + html_context + .push_str(&format!("
{header}
")); + } + match response.status() { germ::request::Status::Success => { html_context.push_str(&gemini_html.1); -- cgit v1.2.3