Fixed and improved encryption handling. Also wrapping up for the day.
This commit is contained in:
@@ -740,7 +740,7 @@ export async function db_save_ae_obj_li__journal(
|
|||||||
// tmp_sort_1: `${obj.original_datetime}_${obj.group}_${obj.priority}_${obj.sort}`,
|
// tmp_sort_1: `${obj.original_datetime}_${obj.group}_${obj.priority}_${obj.sort}`,
|
||||||
// tmp_sort_2: `${obj.group}_${obj.original_datetime}_${obj.priority}_${obj.sort}`,
|
// tmp_sort_2: `${obj.group}_${obj.original_datetime}_${obj.priority}_${obj.sort}`,
|
||||||
|
|
||||||
combined_passcode: `${obj.passcode}:${obj.private_passcode}`, // Combined Journal passcode and Journal private passcode to encrypt and decrypt Entries
|
combined_passcode: `${obj.passcode}:${obj.private_passcode ?? ''}`, // Combined Journal passcode and Journal private passcode to encrypt and decrypt Entries
|
||||||
|
|
||||||
// From SQL view
|
// From SQL view
|
||||||
journal_entry_count: obj.journal_entry_count,
|
journal_entry_count: obj.journal_entry_count,
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ export let decrypt_wrapper = async function decrypt_wrapper(
|
|||||||
) {
|
) {
|
||||||
if (!combined) {
|
if (!combined) {
|
||||||
console.error('No combined string provided. Returning empty string.');
|
console.error('No combined string provided. Returning empty string.');
|
||||||
return '';
|
return false;
|
||||||
}
|
}
|
||||||
const { iv, base64 } = split_iv_and_base64(combined);
|
const { iv, base64 } = split_iv_and_base64(combined);
|
||||||
let decrypted;
|
let decrypted;
|
||||||
@@ -114,7 +114,7 @@ export let decrypt_wrapper = async function decrypt_wrapper(
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Decryption failed:', error);
|
console.error('Decryption failed:', error);
|
||||||
return '';
|
return false;
|
||||||
}
|
}
|
||||||
return decrypted;
|
return decrypted;
|
||||||
}
|
}
|
||||||
@@ -59,6 +59,7 @@ let lq__journal_obj = $derived(liveQuery(async () => {
|
|||||||
.get($journals_slct?.journal_id ?? ''); // null or undefined does not reset things like '' does
|
.get($journals_slct?.journal_id ?? ''); // null or undefined does not reset things like '' does
|
||||||
|
|
||||||
$journals_slct.journal_obj = results;
|
$journals_slct.journal_obj = results;
|
||||||
|
tmp_journal_obj = { ...results };
|
||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log(`lq__journal_obj: results = `, results);
|
console.log(`lq__journal_obj: results = `, results);
|
||||||
}
|
}
|
||||||
@@ -66,11 +67,12 @@ let lq__journal_obj = $derived(liveQuery(async () => {
|
|||||||
return results;
|
return results;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
$effect(() => {
|
// $effect(() => {
|
||||||
if ($lq__journal_obj) {
|
// if ($lq__journal_obj) {
|
||||||
tmp_journal_obj = { ...$lq__journal_obj };
|
// tmp_journal_obj = { ...$lq__journal_obj };
|
||||||
}
|
// console.log('tmp_journal_obj:', tmp_journal_obj);
|
||||||
});
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if (tmp_journal_obj) {
|
if (tmp_journal_obj) {
|
||||||
@@ -79,18 +81,19 @@ $effect(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
async function handle_update_journal() {
|
async function handle_update_journal() {
|
||||||
if ($journals_slct.tmp_journal_obj.name && $journals_slct.tmp_journal_obj.type_code) {
|
if (tmp_journal_obj.name && tmp_journal_obj.type_code) {
|
||||||
try {
|
try {
|
||||||
let data_kv = {
|
let data_kv = {
|
||||||
// account: $slct.account_id,
|
// account: $slct.account_id,
|
||||||
name: $journals_slct.tmp_journal_obj.name,
|
name: tmp_journal_obj.name,
|
||||||
description: $journals_slct.tmp_journal_obj.description ?? '', // Ensure description is at least an empty string
|
description: tmp_journal_obj.description ?? '', // Ensure description is at least an empty string
|
||||||
type_code: $journals_slct.tmp_journal_obj.type_code,
|
type_code: tmp_journal_obj.type_code,
|
||||||
passcode: $journals_slct.tmp_journal_obj.passcode,
|
passcode: tmp_journal_obj.passcode,
|
||||||
passcode_timeout: $journals_slct.tmp_journal_obj.passcode_timeout,
|
private_passcode: tmp_journal_obj.private_passcode,
|
||||||
auth_key: $journals_slct.tmp_journal_obj.auth_key, // The Journal Entry encryption password
|
passcode_timeout: tmp_journal_obj.passcode_timeout,
|
||||||
|
auth_key: tmp_journal_obj.auth_key, // The Journal Entry encryption password
|
||||||
|
|
||||||
cfg_json: $journals_slct.tmp_journal_obj.cfg_json
|
cfg_json: tmp_journal_obj.cfg_json
|
||||||
|
|
||||||
};
|
};
|
||||||
journals_func.update_ae_obj__journal({
|
journals_func.update_ae_obj__journal({
|
||||||
@@ -199,7 +202,7 @@ async function handle_update_journal() {
|
|||||||
<!-- <button
|
<!-- <button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
$journals_slct.tmp_journal_obj = {
|
tmp_journal_obj = {
|
||||||
name: $lq__journal_obj?.name,
|
name: $lq__journal_obj?.name,
|
||||||
description: $lq__journal_obj?.description,
|
description: $lq__journal_obj?.description,
|
||||||
type_code: $lq__journal_obj?.type_code,
|
type_code: $lq__journal_obj?.type_code,
|
||||||
@@ -390,7 +393,7 @@ async function handle_update_journal() {
|
|||||||
<div class="space-y-2 py-2 mb-2">
|
<div class="space-y-2 py-2 mb-2">
|
||||||
<label class="text-sm text-gray-500 hidden sm:inline">
|
<label class="text-sm text-gray-500 hidden sm:inline">
|
||||||
Journal Name:
|
Journal Name:
|
||||||
<input type="text" placeholder="Journal Name" bind:value={$journals_slct.tmp_journal_obj.name} class="input input-bordered w-full mb-2" />
|
<input type="text" placeholder="Journal Name" bind:value={tmp_journal_obj.name} class="input input-bordered w-full mb-2" />
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<!-- Journal Description (Markdown) -->
|
<!-- Journal Description (Markdown) -->
|
||||||
@@ -398,7 +401,7 @@ async function handle_update_journal() {
|
|||||||
Journal Description:
|
Journal Description:
|
||||||
<textarea
|
<textarea
|
||||||
placeholder="Journal Description (Markdown format)"
|
placeholder="Journal Description (Markdown format)"
|
||||||
bind:value={$journals_slct.tmp_journal_obj.description}
|
bind:value={tmp_journal_obj.description}
|
||||||
class="input input-bordered w-full mb-2 h-32 resize-none"
|
class="input input-bordered w-full mb-2 h-32 resize-none"
|
||||||
title="Description of the journal (supports Markdown)"
|
title="Description of the journal (supports Markdown)"
|
||||||
></textarea>
|
></textarea>
|
||||||
@@ -406,31 +409,47 @@ async function handle_update_journal() {
|
|||||||
|
|
||||||
<div class="*:hover:inline">
|
<div class="*:hover:inline">
|
||||||
<!-- input for passcode -->
|
<!-- input for passcode -->
|
||||||
<label
|
<div class="*:hover:inline">
|
||||||
class="text-sm text-gray-500">
|
<label
|
||||||
Passcode:
|
class="text-sm text-gray-500">
|
||||||
<input type="text" placeholder="Passcode" bind:value={$journals_slct.tmp_journal_obj.passcode} class="input input-bordered w-64 mb-2" />
|
Passcode:
|
||||||
</label>
|
<input type="text" placeholder="Passcode" bind:value={tmp_journal_obj.passcode} class="input input-bordered w-64 mb-2" />
|
||||||
<div class="text-xs text-gray-500 hidden md:inline">
|
</label>
|
||||||
<span class="text-red-500">*</span> This passcode is used to encrypt the Journal Entries.
|
<div class="text-xs text-gray-500 hidden md:inline">
|
||||||
|
<span class="text-red-500">*</span> This passcode is used to encrypt the Journal Entries.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- input for private passcode -->
|
||||||
|
<div class="*:hover:inline">
|
||||||
|
<label
|
||||||
|
class="text-sm text-gray-500">
|
||||||
|
Private Passcode:
|
||||||
|
<input type="text" placeholder="Private Passcode" bind:value={tmp_journal_obj.private_passcode} class="input input-bordered w-64 mb-2" />
|
||||||
|
</label>
|
||||||
|
<div class="text-xs text-gray-500 hidden md:inline">
|
||||||
|
<span class="text-red-500">*</span> This passcode is combined with the regular passcode and used to encrypt the Journal Entries.
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- input for passcode timeout -->
|
<!-- input for passcode timeout -->
|
||||||
<label class="text-sm text-gray-500">
|
<div class="*:hover:inline">
|
||||||
Passcode Timeout:
|
<label class="text-sm text-gray-500">
|
||||||
<input type="number" placeholder="Passcode Timeout" bind:value={$journals_slct.tmp_journal_obj.passcode_timeout} class="input input-bordered w-32 mb-2" />
|
Passcode Timeout:
|
||||||
</label>
|
<input type="number" placeholder="Passcode Timeout" bind:value={tmp_journal_obj.passcode_timeout} class="input input-bordered w-32 mb-2" />
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- input for auth_key -->
|
<!-- input for auth_key -->
|
||||||
<label class="text-sm text-gray-500 sm:inline">
|
<label class="text-sm text-gray-500 sm:inline">
|
||||||
Auth Key:
|
Auth Key:
|
||||||
<input type="text" placeholder="Auth Key" bind:value={$journals_slct.tmp_journal_obj.auth_key} class="input input-bordered w-64 mb-2" />
|
<input type="text" placeholder="Auth Key" bind:value={tmp_journal_obj.auth_key} class="input input-bordered w-64 mb-2" />
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label class="text-sm text-gray-500">
|
<label class="text-sm text-gray-500">
|
||||||
Journal Type:
|
Journal Type:
|
||||||
<input type="text" placeholder="Journal Type" bind:value={$journals_slct.tmp_journal_obj.type_code} class="input input-bordered w-48 mb-2" />
|
<input type="text" placeholder="Journal Type" bind:value={tmp_journal_obj.type_code} class="input input-bordered w-48 mb-2" />
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<!-- select option for journal type_code -->
|
<!-- select option for journal type_code -->
|
||||||
@@ -445,11 +464,11 @@ async function handle_update_journal() {
|
|||||||
transition
|
transition
|
||||||
text-xs
|
text-xs
|
||||||
"
|
"
|
||||||
bind:value={$journals_slct.tmp_journal_obj.type_code}
|
bind:value={tmp_journal_obj.type_code}
|
||||||
onchange={(event) => {
|
onchange={(event) => {
|
||||||
// Update the cfg_json with the selected journal type. Example cate
|
// Update the cfg_json with the selected journal type. Example cate
|
||||||
$journals_slct.tmp_journal_obj.type_code = event.target.value;
|
tmp_journal_obj.type_code = event.target.value;
|
||||||
console.log('Selected journal type:', $journals_slct.tmp_journal_obj.type_code);
|
console.log('Selected journal type:', tmp_journal_obj.type_code);
|
||||||
}}
|
}}
|
||||||
title="Select a journal type"
|
title="Select a journal type"
|
||||||
>
|
>
|
||||||
@@ -460,23 +479,23 @@ async function handle_update_journal() {
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-row gap-1 items-center justify-start">
|
<div class="flex flex-row flex-wrap gap-1 items-start justify-start">
|
||||||
<!-- inputs for customizable journal category list -->
|
<!-- inputs for customizable journal category list -->
|
||||||
<!-- each category has a code and name; need to be able to add and remove categories -->
|
<!-- each category has a code and name; need to be able to add and remove categories -->
|
||||||
<div class="text-sm text-gray-500 hidden sm:inline">
|
<div class="text-sm text-gray-500 hidden sm:inline">
|
||||||
Journal Categories:
|
Journal Categories:
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col gap-1 p-4">
|
<div class="flex flex-col gap-1 p-4">
|
||||||
{#each $journals_slct.tmp_journal_obj.cfg_json.category_li as category, index}
|
{#each tmp_journal_obj?.cfg_json?.category_li as category, index}
|
||||||
<div class="flex flex-row items-center gap-1">
|
<div class="flex flex-row items-center gap-1">
|
||||||
<input type="text" placeholder="Category Code" bind:value={$journals_slct.tmp_journal_obj.cfg_json.category_li[index].code} class="input input-bordered w-48" />
|
<input type="text" placeholder="Category Code" bind:value={tmp_journal_obj.cfg_json.category_li[index].code} class="input input-bordered w-48" />
|
||||||
<input type="text" placeholder="Category Name" bind:value={$journals_slct.tmp_journal_obj.cfg_json.category_li[index].name} class="input input-bordered w-full" />
|
<input type="text" placeholder="Category Name" bind:value={tmp_journal_obj.cfg_json.category_li[index].name} class="input input-bordered w-full" />
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="btn btn-sm variant-ghost-danger hover:variant-filled-danger transition"
|
class="btn btn-sm variant-ghost-danger hover:variant-filled-danger transition"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.category_li.splice(index, 1);
|
tmp_journal_obj.cfg_json.category_li.splice(index, 1);
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.category_li = $journals_slct.tmp_journal_obj.cfg_json.category_li;
|
tmp_journal_obj.cfg_json.category_li = tmp_journal_obj.cfg_json.category_li;
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Minus />
|
<Minus />
|
||||||
@@ -487,8 +506,8 @@ async function handle_update_journal() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.category_li.push({ code: '', name: '' });
|
tmp_journal_obj.cfg_json.category_li.push({ code: '', name: '' });
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.category_li = $journals_slct.tmp_journal_obj.cfg_json.category_li;
|
tmp_journal_obj.cfg_json.category_li = tmp_journal_obj.cfg_json.category_li;
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition max-w-48 p-1"
|
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition max-w-48 p-1"
|
||||||
>
|
>
|
||||||
@@ -504,10 +523,10 @@ async function handle_update_journal() {
|
|||||||
Journal Entry List Max Height:
|
Journal Entry List Max Height:
|
||||||
</span>
|
</span>
|
||||||
<select
|
<select
|
||||||
bind:value={$journals_slct.tmp_journal_obj.cfg_json.entry_li_max_height}
|
bind:value={tmp_journal_obj.cfg_json.entry_li_max_height}
|
||||||
onchange={(event) => {
|
onchange={(event) => {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.entry_li_max_height = event.target.value;
|
tmp_journal_obj.cfg_json.entry_li_max_height = event.target.value;
|
||||||
console.log('Selected max height:', $journals_slct.tmp_journal_obj.cfg_json.entry_li_max_height);
|
console.log('Selected max height:', tmp_journal_obj.cfg_json.entry_li_max_height);
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-ghost-surface hover:variant-filled-surface transition text-xs w-full mb-2 max-w-48"
|
class="btn btn-sm variant-ghost-surface hover:variant-filled-surface transition text-xs w-full mb-2 max-w-48"
|
||||||
title="Select maximum height for journal entries in the list"
|
title="Select maximum height for journal entries in the list"
|
||||||
@@ -529,10 +548,10 @@ async function handle_update_journal() {
|
|||||||
Journal Entry List Hover Max Height:
|
Journal Entry List Hover Max Height:
|
||||||
</span>
|
</span>
|
||||||
<select
|
<select
|
||||||
bind:value={$journals_slct.tmp_journal_obj.cfg_json.entry_li_hover_max_height}
|
bind:value={tmp_journal_obj.cfg_json.entry_li_hover_max_height}
|
||||||
onchange={(event) => {
|
onchange={(event) => {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.entry_li_hover_max_height = event.target.value;
|
tmp_journal_obj.cfg_json.entry_li_hover_max_height = event.target.value;
|
||||||
console.log('Selected max height:', $journals_slct.tmp_journal_obj.cfg_json.entry_li_hover_max_height);
|
console.log('Selected max height:', tmp_journal_obj.cfg_json.entry_li_hover_max_height);
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-ghost-surface hover:variant-filled-surface transition text-xs w-full mb-2 max-w-48"
|
class="btn btn-sm variant-ghost-surface hover:variant-filled-surface transition text-xs w-full mb-2 max-w-48"
|
||||||
title="Select maximum height for journal entries in the list"
|
title="Select maximum height for journal entries in the list"
|
||||||
@@ -554,10 +573,10 @@ async function handle_update_journal() {
|
|||||||
Journal Entry List Active (click/press) Max Height:
|
Journal Entry List Active (click/press) Max Height:
|
||||||
</span>
|
</span>
|
||||||
<select
|
<select
|
||||||
bind:value={$journals_slct.tmp_journal_obj.cfg_json.entry_li_click_max_height}
|
bind:value={tmp_journal_obj.cfg_json.entry_li_click_max_height}
|
||||||
onchange={(event) => {
|
onchange={(event) => {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.entry_li_click_max_height = event.target.value;
|
tmp_journal_obj.cfg_json.entry_li_click_max_height = event.target.value;
|
||||||
console.log('Selected max height:', $journals_slct.tmp_journal_obj.cfg_json.entry_li_click_max_height);
|
console.log('Selected max height:', tmp_journal_obj.cfg_json.entry_li_click_max_height);
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-ghost-surface hover:variant-filled-surface transition text-xs w-full mb-2 max-w-48"
|
class="btn btn-sm variant-ghost-surface hover:variant-filled-surface transition text-xs w-full mb-2 max-w-48"
|
||||||
title="Select maximum height for journal entries in the list"
|
title="Select maximum height for journal entries in the list"
|
||||||
@@ -584,16 +603,16 @@ async function handle_update_journal() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
if ($journals_slct.tmp_journal_obj.cfg_json.expand_li_content == 'hover') {
|
if (tmp_journal_obj.cfg_json.expand_li_content == 'hover') {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.expand_li_content = 'click';
|
tmp_journal_obj.cfg_json.expand_li_content = 'click';
|
||||||
} else {
|
} else {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.expand_li_content = 'hover';
|
tmp_journal_obj.cfg_json.expand_li_content = 'hover';
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
||||||
title="Toggle visibility of Markdown copy button(s) on Journal Entry view page"
|
title="Toggle visibility of Markdown copy button(s) on Journal Entry view page"
|
||||||
>
|
>
|
||||||
{#if $journals_slct.tmp_journal_obj.cfg_json.expand_li_content == 'hover'}
|
{#if tmp_journal_obj.cfg_json.expand_li_content == 'hover'}
|
||||||
<!-- <EyeOff strokeWidth="1" color="red" /> -->
|
<!-- <EyeOff strokeWidth="1" color="red" /> -->
|
||||||
<ToggleLeft strokeWidth="1" color="red" class="mx-1" />
|
<ToggleLeft strokeWidth="1" color="red" class="mx-1" />
|
||||||
|
|
||||||
@@ -627,16 +646,16 @@ async function handle_update_journal() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
if ($journals_slct.tmp_journal_obj.cfg_json.entry_add_text == 'append') {
|
if (tmp_journal_obj.cfg_json.entry_add_text == 'append') {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.entry_add_text = 'prepend';
|
tmp_journal_obj.cfg_json.entry_add_text = 'prepend';
|
||||||
} else {
|
} else {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.entry_add_text = 'append';
|
tmp_journal_obj.cfg_json.entry_add_text = 'append';
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
||||||
title="Toggle visibility of Markdown copy button(s) on Journal Entry view page"
|
title="Toggle visibility of Markdown copy button(s) on Journal Entry view page"
|
||||||
>
|
>
|
||||||
{#if $journals_slct.tmp_journal_obj.cfg_json.entry_add_text == 'append'}
|
{#if tmp_journal_obj.cfg_json.entry_add_text == 'append'}
|
||||||
<!-- <EyeOff strokeWidth="1" color="red" /> -->
|
<!-- <EyeOff strokeWidth="1" color="red" /> -->
|
||||||
<ToggleLeft strokeWidth="1" color="red" class="mx-1" />
|
<ToggleLeft strokeWidth="1" color="red" class="mx-1" />
|
||||||
|
|
||||||
@@ -669,10 +688,10 @@ async function handle_update_journal() {
|
|||||||
Color Scheme:
|
Color Scheme:
|
||||||
</span>
|
</span>
|
||||||
<select
|
<select
|
||||||
bind:value={$journals_slct.tmp_journal_obj.cfg_json.color_scheme}
|
bind:value={tmp_journal_obj.cfg_json.color_scheme}
|
||||||
onchange={(event) => {
|
onchange={(event) => {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.color_scheme = event.target.value;
|
tmp_journal_obj.cfg_json.color_scheme = event.target.value;
|
||||||
console.log('Selected color scheme:', $journals_slct.tmp_journal_obj.cfg_json.color_scheme);
|
console.log('Selected color scheme:', tmp_journal_obj.cfg_json.color_scheme);
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-ghost-surface hover:variant-filled-surface transition text-xs w-full mb-2 max-w-48"
|
class="btn btn-sm variant-ghost-surface hover:variant-filled-surface transition text-xs w-full mb-2 max-w-48"
|
||||||
title="Select color scheme for journal entries"
|
title="Select color scheme for journal entries"
|
||||||
@@ -693,10 +712,10 @@ async function handle_update_journal() {
|
|||||||
Preferred Viewer:
|
Preferred Viewer:
|
||||||
</span>
|
</span>
|
||||||
<select
|
<select
|
||||||
bind:value={$journals_slct.tmp_journal_obj.cfg_json.pref_viewer}
|
bind:value={tmp_journal_obj.cfg_json.pref_viewer}
|
||||||
onchange={(event) => {
|
onchange={(event) => {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.pref_viewer = event.target.value;
|
tmp_journal_obj.cfg_json.pref_viewer = event.target.value;
|
||||||
console.log('Selected viewer:', $journals_slct.tmp_journal_obj.cfg_json.pref_viewer);
|
console.log('Selected viewer:', tmp_journal_obj.cfg_json.pref_viewer);
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-ghost-surface hover:variant-filled-surface transition text-xs w-full mb-2 max-w-48"
|
class="btn btn-sm variant-ghost-surface hover:variant-filled-surface transition text-xs w-full mb-2 max-w-48"
|
||||||
title="Select preferred viewer for journal entries"
|
title="Select preferred viewer for journal entries"
|
||||||
@@ -714,10 +733,10 @@ async function handle_update_journal() {
|
|||||||
Preferred Editor:
|
Preferred Editor:
|
||||||
</span>
|
</span>
|
||||||
<select
|
<select
|
||||||
bind:value={$journals_slct.tmp_journal_obj.cfg_json.pref_editor}
|
bind:value={tmp_journal_obj.cfg_json.pref_editor}
|
||||||
onchange={(event) => {
|
onchange={(event) => {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.pref_editor = event.target.value;
|
tmp_journal_obj.cfg_json.pref_editor = event.target.value;
|
||||||
console.log('Selected editor:', $journals_slct.tmp_journal_obj.cfg_json.pref_editor);
|
console.log('Selected editor:', tmp_journal_obj.cfg_json.pref_editor);
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-ghost-surface hover:variant-filled-surface transition text-xs w-full mb-2 max-w-48"
|
class="btn btn-sm variant-ghost-surface hover:variant-filled-surface transition text-xs w-full mb-2 max-w-48"
|
||||||
title="Select preferred editor for journal entries"
|
title="Select preferred editor for journal entries"
|
||||||
@@ -739,12 +758,12 @@ async function handle_update_journal() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.hide_copy_plain_md = !$journals_slct.tmp_journal_obj.cfg_json.hide_copy_plain_md;
|
tmp_journal_obj.cfg_json.hide_copy_plain_md = !tmp_journal_obj.cfg_json.hide_copy_plain_md;
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
||||||
title="Toggle visibility of Markdown copy button(s) on Journal Entry view page"
|
title="Toggle visibility of Markdown copy button(s) on Journal Entry view page"
|
||||||
>
|
>
|
||||||
{#if $journals_slct.tmp_journal_obj.cfg_json.hide_copy_plain_md}
|
{#if tmp_journal_obj.cfg_json.hide_copy_plain_md}
|
||||||
<!-- <EyeOff strokeWidth="1" color="red" /> -->
|
<!-- <EyeOff strokeWidth="1" color="red" /> -->
|
||||||
<ToggleLeft strokeWidth="1" color="red" class="mx-1" />
|
<ToggleLeft strokeWidth="1" color="red" class="mx-1" />
|
||||||
<EyeOff strokeWidth="1" color="gray" />
|
<EyeOff strokeWidth="1" color="gray" />
|
||||||
@@ -767,12 +786,12 @@ async function handle_update_journal() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.hide_copy_html = !$journals_slct.tmp_journal_obj.cfg_json.hide_copy_html;
|
tmp_journal_obj.cfg_json.hide_copy_html = !tmp_journal_obj.cfg_json.hide_copy_html;
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
||||||
title="Toggle visibility of HTML copy button(s) on Journal Entry view page"
|
title="Toggle visibility of HTML copy button(s) on Journal Entry view page"
|
||||||
>
|
>
|
||||||
{#if $journals_slct.tmp_journal_obj.cfg_json.hide_copy_html}
|
{#if tmp_journal_obj.cfg_json.hide_copy_html}
|
||||||
<!-- <EyeOff strokeWidth="1" color="red" /> -->
|
<!-- <EyeOff strokeWidth="1" color="red" /> -->
|
||||||
<ToggleLeft strokeWidth="1" color="red" class="mx-1" />
|
<ToggleLeft strokeWidth="1" color="red" class="mx-1" />
|
||||||
<EyeOff strokeWidth="1" color="gray" />
|
<EyeOff strokeWidth="1" color="gray" />
|
||||||
@@ -795,12 +814,12 @@ async function handle_update_journal() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.hide_copy_rich = !$journals_slct.tmp_journal_obj.cfg_json.hide_copy_rich;
|
tmp_journal_obj.cfg_json.hide_copy_rich = !tmp_journal_obj.cfg_json.hide_copy_rich;
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
||||||
title="Toggle visibility of rendered copy button(s) on Journal Entry view page"
|
title="Toggle visibility of rendered copy button(s) on Journal Entry view page"
|
||||||
>
|
>
|
||||||
{#if $journals_slct.tmp_journal_obj.cfg_json.hide_copy_rich}
|
{#if tmp_journal_obj.cfg_json.hide_copy_rich}
|
||||||
<!-- <EyeOff strokeWidth="1" color="red" /> -->
|
<!-- <EyeOff strokeWidth="1" color="red" /> -->
|
||||||
<ToggleLeft strokeWidth="1" color="red" class="mx-1" />
|
<ToggleLeft strokeWidth="1" color="red" class="mx-1" />
|
||||||
<EyeOff strokeWidth="1" color="gray" />
|
<EyeOff strokeWidth="1" color="gray" />
|
||||||
@@ -823,12 +842,12 @@ async function handle_update_journal() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.hide_copy_encrypted = !$journals_slct.tmp_journal_obj.cfg_json.hide_copy_encrypted;
|
tmp_journal_obj.cfg_json.hide_copy_encrypted = !tmp_journal_obj.cfg_json.hide_copy_encrypted;
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
||||||
title="Toggle visibility of encrypted copy button(s) on Journal Entry view page"
|
title="Toggle visibility of encrypted copy button(s) on Journal Entry view page"
|
||||||
>
|
>
|
||||||
{#if $journals_slct.tmp_journal_obj.cfg_json.hide_copy_encrypted}
|
{#if tmp_journal_obj.cfg_json.hide_copy_encrypted}
|
||||||
<!-- <EyeOff strokeWidth="1" color="red" /> -->
|
<!-- <EyeOff strokeWidth="1" color="red" /> -->
|
||||||
<ToggleLeft strokeWidth="1" color="red" class="mx-1" />
|
<ToggleLeft strokeWidth="1" color="red" class="mx-1" />
|
||||||
<EyeOff strokeWidth="1" color="gray" />
|
<EyeOff strokeWidth="1" color="gray" />
|
||||||
@@ -851,12 +870,12 @@ async function handle_update_journal() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.hide_clone = !$journals_slct.tmp_journal_obj.cfg_json.hide_clone;
|
tmp_journal_obj.cfg_json.hide_clone = !tmp_journal_obj.cfg_json.hide_clone;
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
||||||
title="Toggle visibility of clone button(s) on Journal Entry view page"
|
title="Toggle visibility of clone button(s) on Journal Entry view page"
|
||||||
>
|
>
|
||||||
{#if $journals_slct.tmp_journal_obj.cfg_json.hide_clone}
|
{#if tmp_journal_obj.cfg_json.hide_clone}
|
||||||
<!-- <EyeOff strokeWidth="1" color="red" /> -->
|
<!-- <EyeOff strokeWidth="1" color="red" /> -->
|
||||||
<ToggleLeft strokeWidth="1" color="red" class="mx-1" />
|
<ToggleLeft strokeWidth="1" color="red" class="mx-1" />
|
||||||
<Copy strokeWidth="1" color="gray" />
|
<Copy strokeWidth="1" color="gray" />
|
||||||
@@ -891,12 +910,12 @@ async function handle_update_journal() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.hide_private = !$journals_slct.tmp_journal_obj.cfg_json.hide_private;
|
tmp_journal_obj.cfg_json.hide_private = !tmp_journal_obj.cfg_json.hide_private;
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
||||||
title="Toggle visibility of private entries"
|
title="Toggle visibility of private entries"
|
||||||
>
|
>
|
||||||
{#if $journals_slct.tmp_journal_obj.cfg_json.hide_private}
|
{#if tmp_journal_obj.cfg_json.hide_private}
|
||||||
<!-- <EyeOff strokeWidth="1" color="red" /> -->
|
<!-- <EyeOff strokeWidth="1" color="red" /> -->
|
||||||
<ToggleLeft strokeWidth="1" color="red" class="mx-1" />
|
<ToggleLeft strokeWidth="1" color="red" class="mx-1" />
|
||||||
<Fingerprint strokeWidth="1" color="gray" class="mx-1" />
|
<Fingerprint strokeWidth="1" color="gray" class="mx-1" />
|
||||||
@@ -919,12 +938,12 @@ async function handle_update_journal() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.hide_personal = !$journals_slct.tmp_journal_obj.cfg_json.hide_personal;
|
tmp_journal_obj.cfg_json.hide_personal = !tmp_journal_obj.cfg_json.hide_personal;
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
||||||
title="Toggle visibility of personal entries"
|
title="Toggle visibility of personal entries"
|
||||||
>
|
>
|
||||||
{#if $journals_slct.tmp_journal_obj.cfg_json.hide_personal}
|
{#if tmp_journal_obj.cfg_json.hide_personal}
|
||||||
<!-- <EyeOff strokeWidth="1" color="red" /> -->
|
<!-- <EyeOff strokeWidth="1" color="red" /> -->
|
||||||
<ToggleLeft strokeWidth="1" color="red" class="mx-1" />
|
<ToggleLeft strokeWidth="1" color="red" class="mx-1" />
|
||||||
<BookHeart strokeWidth="1" color="gray" />
|
<BookHeart strokeWidth="1" color="gray" />
|
||||||
@@ -947,12 +966,12 @@ async function handle_update_journal() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.hide_professional = !$journals_slct.tmp_journal_obj.cfg_json.hide_professional;
|
tmp_journal_obj.cfg_json.hide_professional = !tmp_journal_obj.cfg_json.hide_professional;
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
||||||
title="Toggle visibility of professional entries"
|
title="Toggle visibility of professional entries"
|
||||||
>
|
>
|
||||||
{#if $journals_slct.tmp_journal_obj.cfg_json.hide_professional}
|
{#if tmp_journal_obj.cfg_json.hide_professional}
|
||||||
<!-- <EyeOff strokeWidth="1" color="red" /> -->
|
<!-- <EyeOff strokeWidth="1" color="red" /> -->
|
||||||
<ToggleLeft strokeWidth="1" color="red" class="mx-1" />
|
<ToggleLeft strokeWidth="1" color="red" class="mx-1" />
|
||||||
<BriefcaseBusiness strokeWidth="1" color="gray" />
|
<BriefcaseBusiness strokeWidth="1" color="gray" />
|
||||||
@@ -986,7 +1005,7 @@ async function handle_update_journal() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.hide_btn_alert = !$journals_slct.tmp_journal_obj.cfg_json.hide_btn_alert;
|
tmp_journal_obj.cfg_json.hide_btn_alert = !tmp_journal_obj.cfg_json.hide_btn_alert;
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
||||||
title="Toggle visibility of alert icon button(s) on Journal Entry view page"
|
title="Toggle visibility of alert icon button(s) on Journal Entry view page"
|
||||||
@@ -1014,7 +1033,7 @@ async function handle_update_journal() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.hide_btn_alert_msg = !$journals_slct.tmp_journal_obj.cfg_json.hide_btn_alert_msg;
|
tmp_journal_obj.cfg_json.hide_btn_alert_msg = !tmp_journal_obj.cfg_json.hide_btn_alert_msg;
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
||||||
title="Toggle visibility of alert message icon button(s) on Journal Entry view page"
|
title="Toggle visibility of alert message icon button(s) on Journal Entry view page"
|
||||||
@@ -1042,7 +1061,7 @@ async function handle_update_journal() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.hide_btn_private = !$journals_slct.tmp_journal_obj.cfg_json.hide_btn_private;
|
tmp_journal_obj.cfg_json.hide_btn_private = !tmp_journal_obj.cfg_json.hide_btn_private;
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
||||||
title="Toggle visibility of private icon button(s) on Journal Entry view page"
|
title="Toggle visibility of private icon button(s) on Journal Entry view page"
|
||||||
@@ -1070,7 +1089,7 @@ async function handle_update_journal() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.hide_btn_public = !$journals_slct.tmp_journal_obj.cfg_json.hide_btn_public;
|
tmp_journal_obj.cfg_json.hide_btn_public = !tmp_journal_obj.cfg_json.hide_btn_public;
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
||||||
title="Toggle visibility of public icon button(s) on Journal Entry view page"
|
title="Toggle visibility of public icon button(s) on Journal Entry view page"
|
||||||
@@ -1098,7 +1117,7 @@ async function handle_update_journal() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.hide_btn_personal = !$journals_slct.tmp_journal_obj.cfg_json.hide_btn_personal;
|
tmp_journal_obj.cfg_json.hide_btn_personal = !tmp_journal_obj.cfg_json.hide_btn_personal;
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
||||||
title="Toggle visibility of personal icon button(s) on Journal Entry view page"
|
title="Toggle visibility of personal icon button(s) on Journal Entry view page"
|
||||||
@@ -1126,7 +1145,7 @@ async function handle_update_journal() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.hide_btn_professional = !$journals_slct.tmp_journal_obj.cfg_json.hide_btn_professional;
|
tmp_journal_obj.cfg_json.hide_btn_professional = !tmp_journal_obj.cfg_json.hide_btn_professional;
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
||||||
title="Toggle visibility of professional icon button(s) on Journal Entry view page"
|
title="Toggle visibility of professional icon button(s) on Journal Entry view page"
|
||||||
@@ -1154,7 +1173,7 @@ async function handle_update_journal() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
$journals_slct.tmp_journal_obj.cfg_json.hide_btn_template = !$journals_slct.tmp_journal_obj.cfg_json.hide_btn_template;
|
tmp_journal_obj.cfg_json.hide_btn_template = !tmp_journal_obj.cfg_json.hide_btn_template;
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
class="btn btn-sm variant-ghost-secondary hover:variant-filled-secondary transition *:hover:inline"
|
||||||
title="Toggle visibility of template icon button(s) on Journal Entry view page"
|
title="Toggle visibility of template icon button(s) on Journal Entry view page"
|
||||||
|
|||||||
@@ -272,6 +272,21 @@ $effect(() => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$effect(async () => {
|
||||||
|
if ($journals_sess?.journal_kv[$lq__journal_obj?.id]?.journal_passcode_verified && tmp_entry_obj?.content_encrypted && !tmp_entry_obj.content) {
|
||||||
|
console.log('TEST: Decrypting the content before displaying it...');
|
||||||
|
tmp_entry_obj.content = await ae_util.decrypt_wrapper(tmp_entry_obj?.content_encrypted, journal_key);
|
||||||
|
tmp_entry_obj.content_md_html = handle_marked(tmp_entry_obj?.content);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($journals_sess?.journal_kv[$lq__journal_obj?.id]?.journal_passcode_verified && tmp_entry_obj?.history_encrypted && !tmp_entry_obj.history) {
|
||||||
|
console.log('TEST: Decrypting the history before displaying it...');
|
||||||
|
tmp_entry_obj.history = await ae_util.decrypt_wrapper(tmp_entry_obj?.history_encrypted, journal_key);
|
||||||
|
tmp_entry_obj.history_md_html = handle_marked(tmp_entry_obj?.history);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// const test_html = marked.parse('# Marked in Node.js\n\nRendered by **marked**.');
|
// const test_html = marked.parse('# Marked in Node.js\n\nRendered by **marked**.');
|
||||||
|
|
||||||
async function update_journal_entry() {
|
async function update_journal_entry() {
|
||||||
@@ -2046,10 +2061,25 @@ tabindex={$ae_loc.edit_mode ? 0 : -1} -->
|
|||||||
shadow-lg rounded-lg
|
shadow-lg rounded-lg
|
||||||
border border-red-200 dark:border-red-700
|
border border-red-200 dark:border-red-700
|
||||||
hover:border-red-500 dark:hover:border-red-500
|
hover:border-red-500 dark:hover:border-red-500
|
||||||
|
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
The entry must be decrypted before it can be edited.
|
<div>The entry must be decrypted before it can be edited.</div>
|
||||||
|
{#if tmp_entry_obj?.content === false && $journals_sess?.journal_kv[$lq__journal_obj?.id]?.journal_passcode_verified}
|
||||||
|
<div class="text-sm text-red-500">
|
||||||
|
<LockKeyhole strokeWidth="1.5" color="red" class="inline-block" />
|
||||||
|
Decryption failed. Check the passcode(s).
|
||||||
|
</div>
|
||||||
|
{:else if tmp_entry_obj?.content === false}
|
||||||
|
<div class="text-sm text-red-500">
|
||||||
|
<LockKeyhole strokeWidth="1.5" color="red" class="inline-block" />
|
||||||
|
Decryption failed. You may need to enter the Journal's private passcode.
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{#if tmp_entry_obj?.content === false && $lq__journal_obj?.id && $journals_sess?.journal_kv[$lq__journal_obj?.id]?.journal_passcode_verified}
|
||||||
|
<div class="text-sm text-red-500">
|
||||||
|
This might not be encoded with the private passcode or a passcode has changed?
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
<!-- <span class="text-sm text-gray-500">
|
<!-- <span class="text-sm text-gray-500">
|
||||||
<Lock key={0} strokeWidth="2.5" color="red" />
|
<Lock key={0} strokeWidth="2.5" color="red" />
|
||||||
<span class="hidden sm:inline">Encrypted</span>
|
<span class="hidden sm:inline">Encrypted</span>
|
||||||
|
|||||||
@@ -35,7 +35,13 @@ let passcode_timer: any = $state(null);
|
|||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if (typed_journal_passcode?.length > 4) {
|
if (typed_journal_passcode?.length > 4) {
|
||||||
// log_lvl = 1;
|
if (!$journals_sess?.journal_kv) {
|
||||||
|
$journals_sess.journal_kv = {};
|
||||||
|
}
|
||||||
|
if (!$journals_sess.journal_kv[$lq__journal_obj?.id]) {
|
||||||
|
$journals_sess.journal_kv[$lq__journal_obj?.id] = {};
|
||||||
|
}
|
||||||
|
|
||||||
verify_journal_passcode();
|
verify_journal_passcode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,6 +59,9 @@ $effect(() => {
|
|||||||
console.log('Passcode timer expired');
|
console.log('Passcode timer expired');
|
||||||
}
|
}
|
||||||
typed_journal_passcode = '';
|
typed_journal_passcode = '';
|
||||||
|
if (!$journals_sess?.journal_kv[$lq__journal_obj?.id]) {
|
||||||
|
$journals_sess.journal_kv[$lq__journal_obj?.id] = {};
|
||||||
|
}
|
||||||
$journals_sess.journal_kv[$lq__journal_obj?.id].journal_passcode_verified = false;
|
$journals_sess.journal_kv[$lq__journal_obj?.id].journal_passcode_verified = false;
|
||||||
}, 1000 * 60 * 1); // 1 minutes
|
}, 1000 * 60 * 1); // 1 minutes
|
||||||
// }, 1000 * $lq__journal_obj?.passcode_timeout); // 5 minutes
|
// }, 1000 * $lq__journal_obj?.passcode_timeout); // 5 minutes
|
||||||
@@ -227,7 +236,7 @@ function verify_journal_passcode() {
|
|||||||
title="Enter private passcode of this journal"
|
title="Enter private passcode of this journal"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{#if $journals_sess.journal_kv[$lq__journal_obj?.id]?.journal_passcode_verified}
|
{#if $journals_sess?.journal_kv[$lq__journal_obj?.id]?.journal_passcode_verified}
|
||||||
<div class="text-sm text-gray-500">
|
<div class="text-sm text-gray-500">
|
||||||
<span class="fas fa-check-circle text-green-500"></span>
|
<span class="fas fa-check-circle text-green-500"></span>
|
||||||
Journal passcode verified
|
Journal passcode verified
|
||||||
|
|||||||
Reference in New Issue
Block a user