mirror of
https://github.com/cupcakearmy/cryptgeon.git
synced 2024-12-22 08:16:28 +00:00
fix types
This commit is contained in:
parent
a5809c216c
commit
80e64ad207
@ -8,10 +8,11 @@
|
|||||||
|
|
||||||
export let note: Note
|
export let note: Note
|
||||||
export let timeExpiration = false
|
export let timeExpiration = false
|
||||||
|
export let customPassword: string | null = null
|
||||||
|
|
||||||
let customPassword = false
|
let hasCustomPassword = false
|
||||||
|
|
||||||
$: if (!customPassword) note.password = undefined
|
$: if (!hasCustomPassword) customPassword = null
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex col">
|
<div class="flex col">
|
||||||
@ -49,15 +50,15 @@
|
|||||||
<div class="flex">
|
<div class="flex">
|
||||||
<Switch
|
<Switch
|
||||||
data-testid="custom-password"
|
data-testid="custom-password"
|
||||||
bind:value={customPassword}
|
bind:value={hasCustomPassword}
|
||||||
label={$t('home.advanced.custom_password')}
|
label={$t('home.advanced.custom_password')}
|
||||||
/>
|
/>
|
||||||
<TextInput
|
<TextInput
|
||||||
data-testid="password"
|
data-testid="password"
|
||||||
type="password"
|
type="password"
|
||||||
bind:value={note.password}
|
bind:value={customPassword}
|
||||||
label={$t('common.password')}
|
label={$t('common.password')}
|
||||||
disabled={!customPassword}
|
disabled={!hasCustomPassword}
|
||||||
random
|
random
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
let advanced = false
|
let advanced = false
|
||||||
let isFile = false
|
let isFile = false
|
||||||
let timeExpiration = false
|
let timeExpiration = false
|
||||||
|
let customPassword: string | null = null
|
||||||
let description = ''
|
let description = ''
|
||||||
let loading: string | null = null
|
let loading: string | null = null
|
||||||
|
|
||||||
@ -57,7 +58,7 @@
|
|||||||
try {
|
try {
|
||||||
loading = $t('common.encrypting')
|
loading = $t('common.encrypting')
|
||||||
|
|
||||||
const derived = note.password && (await AES.derive(note.password))
|
const derived = customPassword && (await AES.derive(customPassword))
|
||||||
const key = derived ? derived[0] : await AES.generateKey()
|
const key = derived ? derived[0] : await AES.generateKey()
|
||||||
|
|
||||||
const data: Note = {
|
const data: Note = {
|
||||||
@ -79,7 +80,7 @@
|
|||||||
const response = await create(data)
|
const response = await create(data)
|
||||||
result = {
|
result = {
|
||||||
id: response.id,
|
id: response.id,
|
||||||
password: note.password ? undefined : Hex.encode(key),
|
password: customPassword ? undefined : Hex.encode(key),
|
||||||
}
|
}
|
||||||
notify.success($t('home.messages.note_created'))
|
notify.success($t('home.messages.note_created'))
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -150,7 +151,7 @@
|
|||||||
{#if advanced}
|
{#if advanced}
|
||||||
<div transition:blur={{ duration: 250 }}>
|
<div transition:blur={{ duration: 250 }}>
|
||||||
<hr />
|
<hr />
|
||||||
<AdvancedParameters bind:note bind:timeExpiration />
|
<AdvancedParameters bind:note bind:timeExpiration bind:customPassword />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
Loading…
Reference in New Issue
Block a user