aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-04-21 03:59:25 +0000
committerFuwn <[email protected]>2022-04-21 03:59:25 +0000
commitbbcd7b5f638e594a0cdd968ce5b09f6ec73e718f (patch)
treeffb424429c834ee4ac83d1c0e5cfabee8e59933f
parentfeat(proxy): create full html document (diff)
downloadseptember-0.1.3.tar.xz
september-0.1.3.zip
feat: favicon support0.1.3
-rw-r--r--.env.example1
-rw-r--r--Cargo.toml2
-rw-r--r--README.md8
-rw-r--r--src/main.rs9
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
diff --git a/Cargo.toml b/Cargo.toml
index 9731fac..b8d4dfa 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -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."
diff --git a/README.md b/README.md
index 91ea929..b5f7a18 100644
--- a/README.md
+++ b/README.md
@@ -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));