mirror of
https://github.com/cupcakearmy/cryptgeon.git
synced 2025-09-11 03:20:39 +00:00
update to svelte 5
This commit is contained in:
@@ -8,6 +8,11 @@
|
||||
import { init as initStores, status } from '$lib/stores/status'
|
||||
import Footer from '$lib/views/Footer.svelte'
|
||||
import Header from '$lib/views/Header.svelte'
|
||||
interface Props {
|
||||
children?: import('svelte').Snippet
|
||||
}
|
||||
|
||||
let { children }: Props = $props()
|
||||
|
||||
onMount(() => {
|
||||
initStores()
|
||||
@@ -22,7 +27,7 @@
|
||||
{#await waitLocale() then _}
|
||||
<main>
|
||||
<Header />
|
||||
<slot />
|
||||
{@render children?.()}
|
||||
</main>
|
||||
|
||||
<SvelteToast />
|
||||
|
@@ -1,18 +1,16 @@
|
||||
<script lang="ts">
|
||||
import { get } from 'svelte/store';
|
||||
import { goto } from '$app/navigation';
|
||||
import { goto } from '$app/navigation'
|
||||
import { status } from '$lib/stores/status'
|
||||
|
||||
|
||||
status.subscribe((config) => {
|
||||
if (config != null) {
|
||||
if (config.imprint_url) {
|
||||
window.location = config.imprint_url;
|
||||
}
|
||||
else if (config.imprint_html == "") {
|
||||
goto("/about");
|
||||
window.location.href = config.imprint_url
|
||||
} else if (config.imprint_html == '') {
|
||||
goto('/about')
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
@@ -20,9 +18,9 @@
|
||||
</svelte:head>
|
||||
|
||||
<section class="content">
|
||||
{#if $status?.imprint_html}
|
||||
{@html $status.imprint_html}
|
||||
{/if}
|
||||
{#if $status?.imprint_html}
|
||||
{@html $status.imprint_html}
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
<style>
|
||||
|
@@ -10,18 +10,22 @@
|
||||
import { Adapters, API, type NoteMeta } from 'cryptgeon/shared'
|
||||
import type { PageData } from './$types'
|
||||
|
||||
export let data: PageData
|
||||
interface Props {
|
||||
data: PageData
|
||||
}
|
||||
|
||||
let { data }: Props = $props()
|
||||
|
||||
let id = data.id
|
||||
let password: string | null = null
|
||||
let note: DecryptedNote | null = null
|
||||
let exists = false
|
||||
let meta: NoteMeta | null = null
|
||||
let password: string | null = $state<string | null>(null)
|
||||
let note: DecryptedNote | null = $state(null)
|
||||
let exists = $state(false)
|
||||
let meta: NoteMeta | null = $state(null)
|
||||
|
||||
let loading: string | null = null
|
||||
let error: string | null = null
|
||||
let loading: string | null = $state(null)
|
||||
let error: string | null = $state(null)
|
||||
|
||||
$: valid = !!password?.length
|
||||
let valid = $derived(!!password?.length)
|
||||
|
||||
onMount(async () => {
|
||||
// Check if note exists
|
||||
@@ -41,7 +45,8 @@
|
||||
/**
|
||||
* Get the actual contents of the note and decrypt it.
|
||||
*/
|
||||
async function show() {
|
||||
async function show(e: SubmitEvent) {
|
||||
e.preventDefault()
|
||||
try {
|
||||
if (!valid) {
|
||||
error = $t('show.errors.no_password')
|
||||
@@ -86,7 +91,7 @@
|
||||
{:else if note && !error}
|
||||
<ShowNote {note} />
|
||||
{:else}
|
||||
<form on:submit|preventDefault={show}>
|
||||
<form onsubmit={show}>
|
||||
<fieldset>
|
||||
<p>{$t('show.explanation')}</p>
|
||||
{#if meta?.derivation}
|
||||
|
Reference in New Issue
Block a user