This commit is contained in:
Tamás Kádár 2024-03-15 15:11:54 +00:00 committed by GitHub
commit 430f969ad5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 97 additions and 68 deletions

View File

@ -13,13 +13,13 @@ RUN pnpm run build
# BACKEND # BACKEND
FROM rust:1.76-alpine as backend FROM rust:1.76-alpine as backend
WORKDIR /tmp WORKDIR /tmp
RUN apk add libc-dev openssl-dev alpine-sdk RUN apk add --no-cache libc-dev openssl-dev alpine-sdk
COPY ./packages/backend ./ COPY ./packages/backend ./
RUN cargo build --release RUN cargo build --release
# RUNNER # RUNNER
FROM alpine FROM alpine:3.19
WORKDIR /app WORKDIR /app
RUN apk add --no-cache curl RUN apk add --no-cache curl
COPY --from=backend /tmp/target/release/cryptgeon . COPY --from=backend /tmp/target/release/cryptgeon .

View File

@ -69,6 +69,8 @@ of the notes even if it tried to.
| `MAX_VIEWS` | `100` | Maximal number of views. | | `MAX_VIEWS` | `100` | Maximal number of views. |
| `MAX_EXPIRATION` | `360` | Maximal expiration in minutes. | | `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_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_. | | `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` | | `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_IMAGE` | `""` | Custom image for replacing the logo. Must be publicly reachable |

View File

@ -13,7 +13,7 @@
}, },
"devDependencies": { "devDependencies": {
"@playwright/test": "^1.42.1", "@playwright/test": "^1.42.1",
"@types/node": "^20.11.24", "@types/node": "^20.11.28",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"shelljs": "^0.8.5" "shelljs": "^0.8.5"
}, },

View File

@ -34,6 +34,14 @@ lazy_static! {
.unwrap_or("32".to_string()) .unwrap_or("32".to_string())
.parse() .parse()
.unwrap(); .unwrap();
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")
.unwrap_or("true".to_string())
.parse()
.unwrap();
} }
// THEME // THEME

View File

@ -9,6 +9,8 @@ pub struct Status {
pub max_views: u32, pub max_views: u32,
pub max_expiration: u32, pub max_expiration: u32,
pub allow_advanced: bool, pub allow_advanced: bool,
pub allow_files: bool,
pub new_note_notice: bool,
// Theme // Theme
pub theme_image: String, pub theme_image: String,
pub theme_text: String, pub theme_text: String,

View File

@ -11,10 +11,12 @@ async fn get_status() -> impl Responder {
max_views: *config::MAX_VIEWS, max_views: *config::MAX_VIEWS,
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,
new_note_notice: *config::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(),
theme_page_title: config::THEME_PAGE_TITLE.to_string(), theme_page_title: config::THEME_PAGE_TITLE.to_string(),
theme_favicon: config::THEME_FAVICON.to_string() theme_favicon: config::THEME_FAVICON.to_string(),
}); });
} }

View File

@ -7,7 +7,7 @@
<script lang="ts"> <script lang="ts">
import { t } from 'svelte-intl-precompile' import { t } from 'svelte-intl-precompile'
import { status } from '$lib/stores/status'
import Button from '$lib/ui/Button.svelte' import Button from '$lib/ui/Button.svelte'
import TextInput from '$lib/ui/TextInput.svelte' import TextInput from '$lib/ui/TextInput.svelte'
import Canvas from './Canvas.svelte' import Canvas from './Canvas.svelte'
@ -35,9 +35,11 @@
<Canvas value={url} /> <Canvas value={url} />
</div> </div>
{#if $status?.new_note_notice}
<p> <p>
{@html $t('home.new_note_notice')} {@html $t('home.new_note_notice')}
</p> </p>
{/if}
<br /> <br />
<Button on:click={reset}>{$t('home.new_note')}</Button> <Button on:click={reset}>{$t('home.new_note')}</Button>

View File

@ -3,7 +3,8 @@
</script> </script>
<script lang="ts"> <script lang="ts">
import { saveAs } from 'file-saver' import pkg from 'file-saver'
const { saveAs } = pkg
import prettyBytes from 'pretty-bytes' import prettyBytes from 'pretty-bytes'
import { t } from 'svelte-intl-precompile' import { t } from 'svelte-intl-precompile'

View File

@ -118,12 +118,14 @@
{/if} {/if}
<div class="bottom"> <div class="bottom">
{#if $status?.allow_files}
<Switch <Switch
data-testid="switch-file" data-testid="switch-file"
class="file" class="file"
label={$t('common.file')} label={$t('common.file')}
bind:value={isFile} bind:value={isFile}
/> />
{/if}
{#if $status?.allow_advanced} {#if $status?.allow_advanced}
<Switch <Switch
data-testid="switch-advanced" data-testid="switch-advanced"

View File

@ -1,9 +1,13 @@
<script lang="ts"> <script lang="ts">
import { status } from '$lib/stores/status' import { status } from '$lib/stores/status'
function reset() {
window.location.reload()
}
</script> </script>
<header> <header>
<a href="/"> <a on:click={reset} href="/">
{#if $status?.theme_image} {#if $status?.theme_image}
<img alt="logo" src={$status.theme_image} /> <img alt="logo" src={$status.theme_image} />
{:else} {:else}

View File

@ -40,8 +40,8 @@
<br /> <br />
you are welcomed to check & audit the you are welcomed to check & audit the
<a href="https://github.com/cupcakearmy/cryptgeon" target="_blank" rel="noopener noreferrer"> <a href="https://github.com/cupcakearmy/cryptgeon" target="_blank" rel="noopener noreferrer">
source code source code</a
</a>. >.
</span> </span>
</AboutParagraph> </AboutParagraph>

66
pnpm-lock.yaml generated
View File

@ -12,8 +12,8 @@ importers:
specifier: ^1.42.1 specifier: ^1.42.1
version: 1.42.1 version: 1.42.1
'@types/node': '@types/node':
specifier: ^20.11.24 specifier: ^20.11.28
version: 20.11.24 version: 20.11.28
npm-run-all: npm-run-all:
specifier: ^4.1.5 specifier: ^4.1.5
version: 4.1.5 version: 4.1.5
@ -127,7 +127,7 @@ importers:
version: 5.3.3 version: 5.3.3
vite: vite:
specifier: ^5.1.4 specifier: ^5.1.4
version: 5.1.4(@types/node@20.11.24) version: 5.1.4(@types/node@20.11.28)
packages/proxy: packages/proxy:
dependencies: dependencies:
@ -1016,7 +1016,7 @@ packages:
sirv: 2.0.4 sirv: 2.0.4
svelte: 4.2.12 svelte: 4.2.12
tiny-glob: 0.2.9 tiny-glob: 0.2.9
vite: 5.1.4(@types/node@20.11.24) vite: 5.1.4(@types/node@20.11.28)
dev: true dev: true
/@sveltejs/vite-plugin-svelte-inspector@2.0.0(@sveltejs/vite-plugin-svelte@3.0.2)(svelte@4.2.12)(vite@5.1.4): /@sveltejs/vite-plugin-svelte-inspector@2.0.0(@sveltejs/vite-plugin-svelte@3.0.2)(svelte@4.2.12)(vite@5.1.4):
@ -1030,7 +1030,7 @@ packages:
'@sveltejs/vite-plugin-svelte': 3.0.2(svelte@4.2.12)(vite@5.1.4) '@sveltejs/vite-plugin-svelte': 3.0.2(svelte@4.2.12)(vite@5.1.4)
debug: 4.3.4 debug: 4.3.4
svelte: 4.2.12 svelte: 4.2.12
vite: 5.1.4(@types/node@20.11.24) vite: 5.1.4(@types/node@20.11.28)
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
dev: true dev: true
@ -1049,7 +1049,7 @@ packages:
magic-string: 0.30.7 magic-string: 0.30.7
svelte: 4.2.12 svelte: 4.2.12
svelte-hmr: 0.15.3(svelte@4.2.12) svelte-hmr: 0.15.3(svelte@4.2.12)
vite: 5.1.4(@types/node@20.11.24) vite: 5.1.4(@types/node@20.11.28)
vitefu: 0.2.5(vite@5.1.4) vitefu: 0.2.5(vite@5.1.4)
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
@ -1084,6 +1084,12 @@ packages:
undici-types: 5.26.5 undici-types: 5.26.5
dev: true dev: true
/@types/node@20.11.28:
resolution: {integrity: sha512-M/GPWVS2wLkSkNHVeLkrF2fD5Lx5UC4PxA0uZcKc6QqbIQUJyW1jVjueJYi1z8n0I5PxYrtpnPnWglE+y9A0KA==}
dependencies:
undici-types: 5.26.5
dev: true
/@types/pug@2.0.10: /@types/pug@2.0.10:
resolution: {integrity: sha512-Sk/uYFOBAB7mb74XcpizmH0KOR2Pv3D2Hmrh1Dmy5BmK3MpdSa5kqZcg6EKBdklU0bFXX9gCfzvpnyUehrPIuA==} resolution: {integrity: sha512-Sk/uYFOBAB7mb74XcpizmH0KOR2Pv3D2Hmrh1Dmy5BmK3MpdSa5kqZcg6EKBdklU0bFXX9gCfzvpnyUehrPIuA==}
dev: true dev: true
@ -1242,8 +1248,8 @@ packages:
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
hasBin: true hasBin: true
dependencies: dependencies:
caniuse-lite: 1.0.30001591 caniuse-lite: 1.0.30001597
electron-to-chromium: 1.4.690 electron-to-chromium: 1.4.707
node-releases: 2.0.14 node-releases: 2.0.14
update-browserslist-db: 1.0.13(browserslist@4.23.0) update-browserslist-db: 1.0.13(browserslist@4.23.0)
dev: true dev: true
@ -1275,8 +1281,8 @@ packages:
engines: {node: '>=6'} engines: {node: '>=6'}
dev: true dev: true
/caniuse-lite@1.0.30001591: /caniuse-lite@1.0.30001597:
resolution: {integrity: sha512-PCzRMei/vXjJyL5mJtzNiUCKP59dm8Apqc3PH8gJkMnMXZGox93RbE76jHsmLwmIo6/3nsYIpJtx0O7u5PqFuQ==} resolution: {integrity: sha512-7LjJvmQU6Sj7bL0j5b5WY/3n7utXUJvAe1lxhsHDbLmwX9mdL86Yjtr+5SRCyf8qME4M7pU2hswj0FpyBVCv9w==}
dev: true dev: true
/chalk@2.4.2: /chalk@2.4.2:
@ -1476,8 +1482,8 @@ packages:
engines: {node: '>=12'} engines: {node: '>=12'}
dev: true dev: true
/electron-to-chromium@1.4.690: /electron-to-chromium@1.4.707:
resolution: {integrity: sha512-+2OAGjUx68xElQhydpcbqH50hE8Vs2K6TkAeLhICYfndb67CVH0UsZaijmRUE3rHlIxU1u0jxwhgVe6fK3YANA==} resolution: {integrity: sha512-qRq74Mo7ChePOU6GHdfAJ0NREXU8vQTlVlfWz3wNygFay6xrd/fY2J7oGHwrhFeU30OVctGLdTh/FcnokTWpng==}
dev: true dev: true
/emoji-regex@8.0.0: /emoji-regex@8.0.0:
@ -1510,7 +1516,7 @@ packages:
has-property-descriptors: 1.0.2 has-property-descriptors: 1.0.2
has-proto: 1.0.3 has-proto: 1.0.3
has-symbols: 1.0.3 has-symbols: 1.0.3
hasown: 2.0.1 hasown: 2.0.2
internal-slot: 1.0.7 internal-slot: 1.0.7
is-array-buffer: 3.0.4 is-array-buffer: 3.0.4
is-callable: 1.2.7 is-callable: 1.2.7
@ -1524,7 +1530,7 @@ packages:
object-keys: 1.1.1 object-keys: 1.1.1
object.assign: 4.1.5 object.assign: 4.1.5
regexp.prototype.flags: 1.5.2 regexp.prototype.flags: 1.5.2
safe-array-concat: 1.1.0 safe-array-concat: 1.1.2
safe-regex-test: 1.0.3 safe-regex-test: 1.0.3
string.prototype.trim: 1.2.8 string.prototype.trim: 1.2.8
string.prototype.trimend: 1.0.7 string.prototype.trimend: 1.0.7
@ -1534,7 +1540,7 @@ packages:
typed-array-byte-offset: 1.0.2 typed-array-byte-offset: 1.0.2
typed-array-length: 1.0.5 typed-array-length: 1.0.5
unbox-primitive: 1.0.2 unbox-primitive: 1.0.2
which-typed-array: 1.1.14 which-typed-array: 1.1.15
dev: true dev: true
/es-define-property@1.0.0: /es-define-property@1.0.0:
@ -1555,7 +1561,7 @@ packages:
dependencies: dependencies:
get-intrinsic: 1.2.4 get-intrinsic: 1.2.4
has-tostringtag: 1.0.2 has-tostringtag: 1.0.2
hasown: 2.0.1 hasown: 2.0.2
dev: true dev: true
/es-to-primitive@1.2.1: /es-to-primitive@1.2.1:
@ -1884,15 +1890,15 @@ packages:
function-bind: 1.1.1 function-bind: 1.1.1
dev: true dev: true
/hasown@2.0.0: /hasown@2.0.1:
resolution: {integrity: sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==} resolution: {integrity: sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
dependencies: dependencies:
function-bind: 1.1.2 function-bind: 1.1.2
dev: true dev: true
/hasown@2.0.1: /hasown@2.0.2:
resolution: {integrity: sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA==} resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
dependencies: dependencies:
function-bind: 1.1.2 function-bind: 1.1.2
@ -1973,7 +1979,7 @@ packages:
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
dependencies: dependencies:
es-errors: 1.3.0 es-errors: 1.3.0
hasown: 2.0.1 hasown: 2.0.2
side-channel: 1.0.6 side-channel: 1.0.6
dev: true dev: true
@ -2023,7 +2029,7 @@ packages:
/is-core-module@2.13.1: /is-core-module@2.13.1:
resolution: {integrity: sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==} resolution: {integrity: sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==}
dependencies: dependencies:
hasown: 2.0.0 hasown: 2.0.2
dev: true dev: true
/is-date-object@1.0.5: /is-date-object@1.0.5:
@ -2111,7 +2117,7 @@ packages:
resolution: {integrity: sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==} resolution: {integrity: sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
dependencies: dependencies:
which-typed-array: 1.1.14 which-typed-array: 1.1.15
dev: true dev: true
/is-unicode-supported@0.1.0: /is-unicode-supported@0.1.0:
@ -2624,8 +2630,8 @@ packages:
mri: 1.2.0 mri: 1.2.0
dev: true dev: true
/safe-array-concat@1.1.0: /safe-array-concat@1.1.2:
resolution: {integrity: sha512-ZdQ0Jeb9Ofti4hbt5lX3T2JcAamT9hfzYU1MNB+z/jaEbB6wfFfPIR/zEORmZqobkCCJhSjodobH6WHNmJ97dg==} resolution: {integrity: sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q==}
engines: {node: '>=0.4'} engines: {node: '>=0.4'}
dependencies: dependencies:
call-bind: 1.0.7 call-bind: 1.0.7
@ -3121,7 +3127,7 @@ packages:
spdx-expression-parse: 3.0.1 spdx-expression-parse: 3.0.1
dev: true dev: true
/vite@5.1.4(@types/node@20.11.24): /vite@5.1.4(@types/node@20.11.28):
resolution: {integrity: sha512-n+MPqzq+d9nMVTKyewqw6kSt+R3CkvF9QAKY8obiQn8g1fwTscKxyfaYnC632HtBXAQGc1Yjomphwn1dtwGAHg==} resolution: {integrity: sha512-n+MPqzq+d9nMVTKyewqw6kSt+R3CkvF9QAKY8obiQn8g1fwTscKxyfaYnC632HtBXAQGc1Yjomphwn1dtwGAHg==}
engines: {node: ^18.0.0 || >=20.0.0} engines: {node: ^18.0.0 || >=20.0.0}
hasBin: true hasBin: true
@ -3149,7 +3155,7 @@ packages:
terser: terser:
optional: true optional: true
dependencies: dependencies:
'@types/node': 20.11.24 '@types/node': 20.11.28
esbuild: 0.19.12 esbuild: 0.19.12
postcss: 8.4.35 postcss: 8.4.35
rollup: 4.12.0 rollup: 4.12.0
@ -3165,7 +3171,7 @@ packages:
vite: vite:
optional: true optional: true
dependencies: dependencies:
vite: 5.1.4(@types/node@20.11.24) vite: 5.1.4(@types/node@20.11.28)
dev: true dev: true
/wcwidth@1.0.1: /wcwidth@1.0.1:
@ -3184,8 +3190,8 @@ packages:
is-symbol: 1.0.4 is-symbol: 1.0.4
dev: true dev: true
/which-typed-array@1.1.14: /which-typed-array@1.1.15:
resolution: {integrity: sha512-VnXFiIW8yNn9kIHN88xvZ4yOWchftKDsRJ8fEPacX/wl1lOvBrhsJ/OeJCXq7B0AaijRuqgzSKalJoPk+D8MPg==} resolution: {integrity: sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
dependencies: dependencies:
available-typed-arrays: 1.0.7 available-typed-arrays: 1.0.7