diff --git a/client/src/lib/ui/Icon.svelte b/client/src/lib/ui/Icon.svelte index 7af1f80..30e0d78 100644 --- a/client/src/lib/ui/Icon.svelte +++ b/client/src/lib/ui/Icon.svelte @@ -7,7 +7,6 @@ let html = null onMount(async () => { - console.log(src) html = await fetch(src).then((res) => res.text()) }) diff --git a/client/src/lib/views/Create.svelte b/client/src/lib/views/Create.svelte index 69bfa93..ad0e7c3 100644 --- a/client/src/lib/views/Create.svelte +++ b/client/src/lib/views/Create.svelte @@ -18,8 +18,9 @@ let result: { password: string; id: string } | null = null let advanced = false let type = false - let loading = false let message = '' + let loading = false + let error: string | null = null $: if (!advanced) { note.views = 1 @@ -34,6 +35,7 @@ async function submit() { try { + error = null loading = true const data: Note = { contents: note.contents, @@ -53,6 +55,8 @@ password: password, id: response.id, } + } catch { + error = 'could not create note.' } finally { loading = false } @@ -81,6 +85,10 @@ + {#if error} +
{error}
+ {/if} +


{message}

diff --git a/client/src/routes/about.svelte b/client/src/routes/about.svelte index eccae73..93bb9b7 100644 --- a/client/src/routes/about.svelte +++ b/client/src/routes/about.svelte @@ -37,7 +37,8 @@ the backend is written in rust and the frontend is svelte and typescript.
you are welcomed to check & audit the - source code. + source code.

diff --git a/src/note/routes.rs b/src/note/routes.rs index e9c69f5..f77f144 100644 --- a/src/note/routes.rs +++ b/src/note/routes.rs @@ -41,6 +41,9 @@ async fn create(note: web::Json) -> impl Responder { let mut n = note.into_inner(); let id = generate_id(); let bad_req = HttpResponse::BadRequest().finish(); + if n.contents.chars().count() > 8192 { + return bad_req; + } if n.views == None && n.expiration == None { return bad_req; }