diff options
| author | Fuwn <[email protected]> | 2022-04-21 03:59:25 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-04-21 03:59:25 +0000 |
| commit | bbcd7b5f638e594a0cdd968ce5b09f6ec73e718f (patch) | |
| tree | ffb424429c834ee4ac83d1c0e5cfabee8e59933f | |
| parent | feat(proxy): create full html document (diff) | |
| download | september-0.1.3.tar.xz september-0.1.3.zip | |
feat: favicon support0.1.3
| -rw-r--r-- | .env.example | 1 | ||||
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | README.md | 8 | ||||
| -rw-r--r-- | src/main.rs | 9 |
4 files changed, 19 insertions, 1 deletions
diff --git a/.env.example b/.env.example index 75bcb55..cb69204 100644 --- a/.env.example +++ b/.env.example @@ -4,3 +4,4 @@ CSS_EXTERNAL=https://example.com/style.css KEEP_GEMINI_EXACT=gemini://fuwn.me/skills # KEEP_GEMINI_DOMAIN=fuwn.me # PROXY_BY_DEFAULT=true +FAVICON_EXTERNAL=https://host.fuwn.me/8te8lw0lxm03.webp @@ -2,7 +2,7 @@ [package] name = "september" -version = "0.1.2" +version = "0.1.3" authors = ["Fuwn <[email protected]>"] edition = "2021" description = "A simple and efficient Gemini-to-HTTP proxy." @@ -117,6 +117,14 @@ Defaults to `true`. PROXY_BY_DEFAULT=false ``` +### `FAVICON_EXTERNAL` + +An external favicon file to apply to the HTML response. + +```dotenv +FAVICON_EXTERNAL=https://host.fuwn.me/8te8lw0lxm03.webp +``` + ## Capsules using September [Add yours!](https://github.com/gemrest/september/edit/main/README.md) diff --git a/src/main.rs b/src/main.rs index ade91ed..327117d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -327,6 +327,15 @@ async fn default(req: actix_web::HttpRequest) -> Result<HttpResponse, Error> { )); } + // Try to add an external favicon from the `FAVICON_EXTERNAL` environment + // variable. + if let Ok(favicon) = var("FAVICON_EXTERNAL") { + html_context.push_str(&format!( + "<link rel=\"icon\" type=\"image/x-icon\" href=\"{}\">", + favicon + )); + } + // Add a title to HTML response html_context.push_str(&format!("<title>{}</title>", gemini_title)); |