From 48f3928c6d82f949564ba071a39d1e923dc29899 Mon Sep 17 00:00:00 2001 From: Ludwig Lehnert Date: Sun, 22 Jun 2025 22:26:25 +0200 Subject: [PATCH] small changes --- src/app.css | 2 +- src/lib/auth.ts | 13 ++++-- src/routes/(area)/login/+page.svelte | 21 +++++++-- src/routes/+page.svelte | 68 ++++++++++++++++------------ 4 files changed, 65 insertions(+), 39 deletions(-) diff --git a/src/app.css b/src/app.css index 59b28ce..1b42b73 100644 --- a/src/app.css +++ b/src/app.css @@ -17,7 +17,7 @@ html, body { height: 100%; scroll-behavior: smooth; - background-color: #e7f7df; + /* background-color: #e7f7df; */ font-family: var(--font-sans); } diff --git a/src/lib/auth.ts b/src/lib/auth.ts index 7254483..fc2290f 100644 --- a/src/lib/auth.ts +++ b/src/lib/auth.ts @@ -2,18 +2,22 @@ import { decodeKeyVault, deriveKeyVault, encodeKeyVault, type KeyVault } from ". export function loggedIn() { if (typeof window !== 'object') return false; - return !!sessionStorage['_vault']; + const vault = localStorage['_vault'] ?? sessionStorage['_vault']; + return !!vault; } -export async function login(passkey: string): Promise { +export async function login(passkey: string, persistent: boolean = false): Promise { + const storage = persistent ? localStorage : sessionStorage; + const keyVault = await deriveKeyVault(passkey); - sessionStorage['_vault'] = encodeKeyVault(keyVault); + storage['_vault'] = encodeKeyVault(keyVault); return keyVault; } export function getKeyVault(): KeyVault | null { try { - return decodeKeyVault(sessionStorage['_vault']); + const vault = localStorage['_vault'] ?? sessionStorage['_vault']; + return decodeKeyVault(vault); } catch (e) { console.log(e); return null; @@ -21,6 +25,7 @@ export function getKeyVault(): KeyVault | null { } export function logout() { + delete localStorage['_vault']; delete sessionStorage['_vault']; } diff --git a/src/routes/(area)/login/+page.svelte b/src/routes/(area)/login/+page.svelte index 516954b..a7b55a6 100644 --- a/src/routes/(area)/login/+page.svelte +++ b/src/routes/(area)/login/+page.svelte @@ -5,9 +5,13 @@ const onSubmit = async (e: SubmitEvent) => { e.preventDefault(); + const formData = new FormData(e.target as any); const passkey = formData.get('passkey') as string; - await login(passkey); + if (!passkey) return; + + + await login(passkey, !!formData.get('persistent')); window.location.href = '/today'; }; @@ -24,14 +28,21 @@ Somri Login -
+
-

Login

+

Login

+ -
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index b23ffc7..428752f 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -11,42 +11,52 @@ }); -
+
-
-
-
-

- Sonri: Your Private Life, Truly Yours. -

-

- Capture your moments with unmatched privacy and total freedom. Sonri ensures your video diary is for your eyes only, and it's currently free. -

- -
+
+
- -
+
+ +
+

+ Sonri: Your Private Life,
Truly Yours. +

+

+ Capture your moments with unmatched privacy and total freedom. + Sonri is your safe space — and it’s free. +

+
+ +
+
+ + + +
+
+
+
+ +

The Sonri Advantage

- +

Anonymous

No email, no phone number, nothing else.

@@ -55,7 +65,7 @@
- +

Fully Encrypted

Every log entry is encrypted using your unique passphrase.

@@ -64,7 +74,7 @@
- +

Free

Currently, Sonri is completely free to use. Experience true privacy and security in your video journaling journey without any cost barriers.