Added option to have an imprint

The environment Variable IMPRINT_URL simply adds a /imprint button in footer to the url
This commit is contained in:
Uli Roth 2024-09-23 15:44:21 +02:00
parent 847fc9677d
commit fca8761515
5 changed files with 12 additions and 0 deletions

View File

@ -84,6 +84,7 @@ of the notes even if it tried to.
| `THEME_PAGE_TITLE` | `""` | Custom text the page title | | `THEME_PAGE_TITLE` | `""` | Custom text the page title |
| `THEME_FAVICON` | `""` | Custom url for the favicon. Must be publicly reachable | | `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`. | | `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 ## Deployment

View File

@ -38,6 +38,10 @@ pub static ref ALLOW_FILES: bool = std::env::var("ALLOW_FILES")
.unwrap_or("true".to_string()) .unwrap_or("true".to_string())
.parse() .parse()
.unwrap(); .unwrap();
pub static ref IMPRINT_URL: String = std::env::var("IMPRINT_URL")
.unwrap_or("".to_string())
.parse()
.unwrap();
} }
// THEME // THEME

View File

@ -12,6 +12,7 @@ pub struct Status {
pub max_expiration: u32, pub max_expiration: u32,
pub allow_advanced: bool, pub allow_advanced: bool,
pub allow_files: bool, pub allow_files: bool,
pub imprint_url: String,
// Theme // Theme
pub theme_image: String, pub theme_image: String,
pub theme_text: String, pub theme_text: String,
@ -28,6 +29,7 @@ pub async fn get_status() -> (StatusCode, Json<Status>) {
max_expiration: *config::MAX_EXPIRATION, max_expiration: *config::MAX_EXPIRATION,
allow_advanced: *config::ALLOW_ADVANCED, allow_advanced: *config::ALLOW_ADVANCED,
allow_files: *config::ALLOW_FILES, allow_files: *config::ALLOW_FILES,
imprint_url: config::IMPRINT_URL.to_string(),
theme_new_note_notice: *config::THEME_NEW_NOTE_NOTICE, theme_new_note_notice: *config::THEME_NEW_NOTE_NOTICE,
theme_image: config::THEME_IMAGE.to_string(), theme_image: config::THEME_IMAGE.to_string(),
theme_text: config::THEME_TEXT.to_string(), theme_text: config::THEME_TEXT.to_string(),

View File

@ -113,6 +113,7 @@ export type Status = {
max_expiration: number max_expiration: number
allow_advanced: boolean allow_advanced: boolean
allow_files: boolean allow_files: boolean
imprint_url: string
theme_image: string theme_image: string
theme_text: string theme_text: string
theme_favicon: string theme_favicon: string

View File

@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import ThemeToggle from '$lib/ui/ThemeToggle.svelte' import ThemeToggle from '$lib/ui/ThemeToggle.svelte'
import { status } from '$lib/stores/status'
</script> </script>
<footer> <footer>
@ -7,6 +8,9 @@
<nav> <nav>
<a href="/">/home</a> <a href="/">/home</a>
<a href="/about">/about</a> <a href="/about">/about</a>
{#if $status?.imprint_url}
<a href={$status.imprint_url} target="_blank" rel="noopener noreferrer">/imprint</a>
{/if}
<a href="https://github.com/cupcakearmy/cryptgeon" target="_blank" rel="noopener noreferrer"> <a href="https://github.com/cupcakearmy/cryptgeon" target="_blank" rel="noopener noreferrer">
code code
</a> </a>