From fca876151584c266b6ea838f156ccd65d9f392d8 Mon Sep 17 00:00:00 2001 From: Uli Roth Date: Mon, 23 Sep 2024 15:44:21 +0200 Subject: [PATCH 1/2] Added option to have an imprint The environment Variable IMPRINT_URL simply adds a /imprint button in footer to the url --- README.md | 1 + packages/backend/src/config.rs | 4 ++++ packages/backend/src/status/mod.rs | 2 ++ packages/cli/src/shared/api.ts | 1 + packages/frontend/src/lib/views/Footer.svelte | 4 ++++ 5 files changed, 12 insertions(+) diff --git a/README.md b/README.md index 5e86a32..6c4c085 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,7 @@ of the notes even if it tried to. | `THEME_PAGE_TITLE` | `""` | Custom text the page title | | `THEME_FAVICON` | `""` | Custom url for the favicon. Must be publicly reachable | | `THEME_NEW_NOTE_NOTICE` | `true` | Show the message about how notes are stored in the memory and may be evicted after creating a new note. Defaults to `true`. | +| `IMPRINT_URL` | `""` | Custom url for an Imprint hosted somewhere else. Must be publicly reachable. | ## Deployment diff --git a/packages/backend/src/config.rs b/packages/backend/src/config.rs index 1d86cd0..6dbd700 100644 --- a/packages/backend/src/config.rs +++ b/packages/backend/src/config.rs @@ -38,6 +38,10 @@ pub static ref ALLOW_FILES: bool = std::env::var("ALLOW_FILES") .unwrap_or("true".to_string()) .parse() .unwrap(); +pub static ref IMPRINT_URL: String = std::env::var("IMPRINT_URL") + .unwrap_or("".to_string()) + .parse() + .unwrap(); } // THEME diff --git a/packages/backend/src/status/mod.rs b/packages/backend/src/status/mod.rs index 80deeae..db8a4d9 100644 --- a/packages/backend/src/status/mod.rs +++ b/packages/backend/src/status/mod.rs @@ -12,6 +12,7 @@ pub struct Status { pub max_expiration: u32, pub allow_advanced: bool, pub allow_files: bool, + pub imprint_url: String, // Theme pub theme_image: String, pub theme_text: String, @@ -28,6 +29,7 @@ pub async fn get_status() -> (StatusCode, Json) { max_expiration: *config::MAX_EXPIRATION, allow_advanced: *config::ALLOW_ADVANCED, allow_files: *config::ALLOW_FILES, + imprint_url: config::IMPRINT_URL.to_string(), theme_new_note_notice: *config::THEME_NEW_NOTE_NOTICE, theme_image: config::THEME_IMAGE.to_string(), theme_text: config::THEME_TEXT.to_string(), diff --git a/packages/cli/src/shared/api.ts b/packages/cli/src/shared/api.ts index fa085ac..abc50f9 100644 --- a/packages/cli/src/shared/api.ts +++ b/packages/cli/src/shared/api.ts @@ -113,6 +113,7 @@ export type Status = { max_expiration: number allow_advanced: boolean allow_files: boolean + imprint_url: string theme_image: string theme_text: string theme_favicon: string diff --git a/packages/frontend/src/lib/views/Footer.svelte b/packages/frontend/src/lib/views/Footer.svelte index 7753373..481139e 100644 --- a/packages/frontend/src/lib/views/Footer.svelte +++ b/packages/frontend/src/lib/views/Footer.svelte @@ -1,5 +1,6 @@