From 8a5f667ff6a23981e6746cb35af89855c093b9c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tama=CC=81s=20Ka=CC=81da=CC=81r?= Date: Fri, 15 Mar 2024 13:53:12 +0000 Subject: [PATCH 1/8] Fix file-saver CommonJS error --- packages/frontend/src/lib/ui/ShowNote.svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/lib/ui/ShowNote.svelte b/packages/frontend/src/lib/ui/ShowNote.svelte index 05250f3..2198c98 100644 --- a/packages/frontend/src/lib/ui/ShowNote.svelte +++ b/packages/frontend/src/lib/ui/ShowNote.svelte @@ -3,7 +3,8 @@
- + {#if $status?.theme_image} logo {:else} From 239e950f8eae475615a8c16e1cc5a0f75794b417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tama=CC=81s=20Ka=CC=81da=CC=81r?= Date: Tue, 19 Mar 2024 12:06:46 +0000 Subject: [PATCH 8/8] NEW_NOTE_NOTICE -> THEME_NEW_NOTE_NOTICE --- README.md | 30 +++++++++---------- packages/backend/src/config.rs | 2 +- packages/backend/src/status/model.rs | 2 +- packages/backend/src/status/routes.rs | 2 +- .../frontend/src/lib/ui/NoteResult.svelte | 4 +-- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index b8f37d2..7726583 100644 --- a/README.md +++ b/README.md @@ -62,21 +62,21 @@ of the notes even if it tried to. ## Environment Variables -| Variable | Default | Description | -| ------------------ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `REDIS` | `redis://redis/` | Redis URL to connect to. [According to format](https://docs.rs/redis/latest/redis/#connection-parameters) | -| `SIZE_LIMIT` | `1 KiB` | Max size for body. Accepted values according to [byte-unit](https://docs.rs/byte-unit/).
`512 MiB` is the maximum allowed.
The frontend will show that number including the ~35% encoding overhead. | -| `MAX_VIEWS` | `100` | Maximal number of views. | -| `MAX_EXPIRATION` | `360` | Maximal expiration in minutes. | -| `ALLOW_ADVANCED` | `true` | Allow custom configuration. If set to `false` all notes will be one view only. | -| `ALLOW_FILES` | `true` | Allow uploading files. If set to `false`, users will only be allowed to create text notes. | -| `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`. | -| `ID_LENGTH` | `32` | Set the size of the note `id` in bytes. By default this is `32` bytes. This is useful for reducing link size. _This setting does not affect encryption strength_. | -| `VERBOSITY` | `warn` | Verbosity level for the backend. [Possible values](https://docs.rs/env_logger/latest/env_logger/#enabling-logging) are: `error`, `warn`, `info`, `debug`, `trace` | -| `THEME_IMAGE` | `""` | Custom image for replacing the logo. Must be publicly reachable | -| `THEME_TEXT` | `""` | Custom text for replacing the description below the logo | -| `THEME_PAGE_TITLE` | `""` | Custom text the page title | -| `THEME_FAVICON` | `""` | Custom url for the favicon. Must be publicly reachable | +| Variable | Default | Description | +| ----------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `REDIS` | `redis://redis/` | Redis URL to connect to. [According to format](https://docs.rs/redis/latest/redis/#connection-parameters) | +| `SIZE_LIMIT` | `1 KiB` | Max size for body. Accepted values according to [byte-unit](https://docs.rs/byte-unit/).
`512 MiB` is the maximum allowed.
The frontend will show that number including the ~35% encoding overhead. | +| `MAX_VIEWS` | `100` | Maximal number of views. | +| `MAX_EXPIRATION` | `360` | Maximal expiration in minutes. | +| `ALLOW_ADVANCED` | `true` | Allow custom configuration. If set to `false` all notes will be one view only. | +| `ALLOW_FILES` | `true` | Allow uploading files. If set to `false`, users will only be allowed to create text notes. | +| `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`. | +| `ID_LENGTH` | `32` | Set the size of the note `id` in bytes. By default this is `32` bytes. This is useful for reducing link size. _This setting does not affect encryption strength_. | +| `VERBOSITY` | `warn` | Verbosity level for the backend. [Possible values](https://docs.rs/env_logger/latest/env_logger/#enabling-logging) are: `error`, `warn`, `info`, `debug`, `trace` | +| `THEME_IMAGE` | `""` | Custom image for replacing the logo. Must be publicly reachable | +| `THEME_TEXT` | `""` | Custom text for replacing the description below the logo | +| `THEME_PAGE_TITLE` | `""` | Custom text the page title | +| `THEME_FAVICON` | `""` | Custom url for the favicon. Must be publicly reachable | ## Deployment diff --git a/packages/backend/src/config.rs b/packages/backend/src/config.rs index ce94df2..e86e4da 100644 --- a/packages/backend/src/config.rs +++ b/packages/backend/src/config.rs @@ -38,7 +38,7 @@ pub static ref ALLOW_FILES: bool = std::env::var("ALLOW_FILES") .unwrap_or("true".to_string()) .parse() .unwrap(); -pub static ref NEW_NOTE_NOTICE: bool = std::env::var("NEW_NOTE_NOTICE") +pub static ref THEME_NEW_NOTE_NOTICE: bool = std::env::var("THEME_NEW_NOTE_NOTICE") .unwrap_or("true".to_string()) .parse() .unwrap(); diff --git a/packages/backend/src/status/model.rs b/packages/backend/src/status/model.rs index 58843b1..6e77771 100644 --- a/packages/backend/src/status/model.rs +++ b/packages/backend/src/status/model.rs @@ -10,7 +10,7 @@ pub struct Status { pub max_expiration: u32, pub allow_advanced: bool, pub allow_files: bool, - pub new_note_notice: bool, + pub theme_new_note_notice: bool, // Theme pub theme_image: String, pub theme_text: String, diff --git a/packages/backend/src/status/routes.rs b/packages/backend/src/status/routes.rs index 3866d10..9f767a6 100644 --- a/packages/backend/src/status/routes.rs +++ b/packages/backend/src/status/routes.rs @@ -12,7 +12,7 @@ async fn get_status() -> impl Responder { max_expiration: *config::MAX_EXPIRATION, allow_advanced: *config::ALLOW_ADVANCED, allow_files: *config::ALLOW_FILES, - new_note_notice: *config::NEW_NOTE_NOTICE, + theme_new_note_notice: *config::THEME_NEW_NOTE_NOTICE, theme_image: config::THEME_IMAGE.to_string(), theme_text: config::THEME_TEXT.to_string(), theme_page_title: config::THEME_PAGE_TITLE.to_string(), diff --git a/packages/frontend/src/lib/ui/NoteResult.svelte b/packages/frontend/src/lib/ui/NoteResult.svelte index f5f6f9e..651cd4d 100644 --- a/packages/frontend/src/lib/ui/NoteResult.svelte +++ b/packages/frontend/src/lib/ui/NoteResult.svelte @@ -35,9 +35,9 @@ -{#if $status?.new_note_notice} +{#if $status?.theme_new_note_notice}

- {@html $t('home.new_note_notice')} + {@html $t('home.theme_new_note_notice')}

{/if}