More work on encryption of content and history.
This commit is contained in:
@@ -606,8 +606,9 @@ export function db_save_ae_obj_li__journal(
|
||||
updated_on: obj.updated_on,
|
||||
|
||||
// Generated fields for sorting locally only
|
||||
tmp_sort_1: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on}_${obj.created_on}`,
|
||||
tmp_sort_2: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on ?? obj.created_on}`,
|
||||
tmp_sort_1: `${obj.group ?? '0'}_${obj.priority ? 1 : 0}_${obj.sort ?? '0'}_${obj.updated_on}_${obj.created_on}`,
|
||||
tmp_sort_2: `${obj.group ?? '0'}_${obj.priority ? 1 : 0}_${obj.sort ?? '0'}_${obj.updated_on ?? obj.created_on}`,
|
||||
tmp_sort_3: `${obj.group ?? '0'}_${obj.priority ? 1 : 0}_${obj.sort ?? '0'}_${obj.name}_${obj.updated_on ?? obj.created_on}`,
|
||||
// tmp_sort_1: `${obj.original_datetime}_${obj.group}_${obj.priority}_${obj.sort}`,
|
||||
// tmp_sort_2: `${obj.group}_${obj.original_datetime}_${obj.priority}_${obj.sort}`,
|
||||
|
||||
|
||||
@@ -356,6 +356,20 @@ export async function db_save_ae_obj_li__journal_entry(
|
||||
content_md_html = await marked.parse(content_cleaned ?? '') ?? null;
|
||||
}
|
||||
|
||||
let history = obj.history ?? '';
|
||||
let history_cleaned: null|string = null;
|
||||
let history_md_html: null|string = null; // await marked.parse(history_cleaned ?? '') ?? null;
|
||||
|
||||
if (obj.history_encrypted) {
|
||||
// In theory "history" should be null if "history_encrypted" has a value.
|
||||
history = null; // obj.history_encrypted;
|
||||
history_cleaned = null;
|
||||
history_md_html = null;
|
||||
} else {
|
||||
history_cleaned = history.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/,"");
|
||||
history_md_html = await marked.parse(history_cleaned ?? '') ?? null;
|
||||
}
|
||||
|
||||
let obj_record = {
|
||||
id: obj.journal_entry_id_random,
|
||||
journal_entry_id: obj.journal_entry_id_random,
|
||||
@@ -397,6 +411,12 @@ export async function db_save_ae_obj_li__journal_entry(
|
||||
content_json: obj.content_json,
|
||||
content_encrypted: obj.content_encrypted,
|
||||
|
||||
history: obj.history,
|
||||
history_md_html: history_md_html,
|
||||
history_encrypted: obj.history_encrypted,
|
||||
|
||||
passcode_hash: obj.passcode_hash,
|
||||
|
||||
// url: obj.url,
|
||||
// url_text: obj.url_text,
|
||||
|
||||
|
||||
@@ -76,6 +76,8 @@ let journals_session_data_struct: key_val = {
|
||||
show__modal_view__journal_entry_id: null,
|
||||
show__modal_edit__journal_entry_id: null,
|
||||
|
||||
show__content__journal_entry_history: false,
|
||||
|
||||
journal: {
|
||||
edit: false,
|
||||
edit_kv: {},
|
||||
|
||||
@@ -87,6 +87,7 @@ export interface Journal {
|
||||
// Generated fields for sorting locally only
|
||||
tmp_sort_1?: null|string;
|
||||
tmp_sort_2?: null|string;
|
||||
tmp_sort_3?: null|string;
|
||||
|
||||
// Additional fields for convenience (database views)
|
||||
file_count?: null|number; // Only files directly under a journal
|
||||
@@ -198,6 +199,11 @@ export interface Journal_Entry {
|
||||
content_json?: null|string;
|
||||
content_encrypted?: null|string; // This is the encrypted content of the journal entry
|
||||
|
||||
history?: null|string; // This is the history of the journal entry; a log
|
||||
history_encrypted?: null|string; // This is the encrypted history of the journal entry
|
||||
|
||||
passcode_hash?: null|string; // This is the passcode hash for the journal entry to look up the passcode
|
||||
|
||||
start_datetime?: null|Date;
|
||||
end_datetime?: null|Date;
|
||||
timezone?: null|string;
|
||||
@@ -239,6 +245,7 @@ export interface Journal_Entry {
|
||||
// Generated fields for sorting locally only
|
||||
tmp_sort_1?: null|string;
|
||||
tmp_sort_2?: null|string;
|
||||
tmp_sort_3?: null|string;
|
||||
|
||||
// Additional fields for convenience (database views)
|
||||
file_count?: null|number; // Only files directly under a journal
|
||||
@@ -299,7 +306,7 @@ export class MySubClassedDexie extends Dexie {
|
||||
|
||||
constructor() {
|
||||
super('ae_journals_db');
|
||||
this.version(1).stores({
|
||||
this.version(3).stores({
|
||||
journal: `
|
||||
id, journal_id,
|
||||
code,
|
||||
@@ -309,7 +316,7 @@ export class MySubClassedDexie extends Dexie {
|
||||
name,
|
||||
start_datetime, end_datetime,
|
||||
timezone,
|
||||
tmp_sort_1, tmp_sort_2,
|
||||
tmp_sort_1, tmp_sort_2, tmp_sort_3,
|
||||
enable, hide, priority, sort, group, notes, created_on, updated_on`,
|
||||
journal_entry: `
|
||||
id, journal_entry_id,
|
||||
@@ -320,7 +327,7 @@ export class MySubClassedDexie extends Dexie {
|
||||
name,
|
||||
start_datetime, end_datetime,
|
||||
timezone,
|
||||
tmp_sort_1, tmp_sort_2,
|
||||
tmp_sort_1, tmp_sort_2, tmp_sort_3,
|
||||
enable, hide, priority, sort, group, notes, created_on, updated_on`,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -45,10 +45,13 @@ let lq__journal_obj_li = $derived(liveQuery(async () => {
|
||||
let results = await db_journals.journal
|
||||
.where('person_id')
|
||||
.equals($ae_loc.person_id)
|
||||
// .sortBy('group')
|
||||
// .sortBy('priority')
|
||||
// .sortBy('sort')
|
||||
.reverse()
|
||||
.sortBy('tmp_sort_2')
|
||||
.sortBy('tmp_sort_3')
|
||||
|
||||
// .orderBy('tmp_sort_2')
|
||||
// .orderBy('tmp_sort_3')
|
||||
// .reverse()
|
||||
// .toArray()
|
||||
|
||||
|
||||
@@ -661,7 +661,7 @@ async function handle_update_journal() {
|
||||
data_kv: data_kv,
|
||||
log_lvl: log_lvl
|
||||
}).then(() => {
|
||||
alert('Journal sort order incremented!');
|
||||
// alert('Journal sort order incremented!');
|
||||
}).catch((error) => {
|
||||
console.error('Error updating journal sort order:', error);
|
||||
alert('Failed to update journal sort order.');
|
||||
@@ -691,7 +691,7 @@ async function handle_update_journal() {
|
||||
data_kv: data_kv,
|
||||
log_lvl: log_lvl
|
||||
}).then(() => {
|
||||
alert('Journal sort order decremented!');
|
||||
// alert('Journal sort order decremented!');
|
||||
}).catch((error) => {
|
||||
console.error('Error updating journal sort order:', error);
|
||||
alert('Failed to update journal sort order.');
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -140,11 +140,11 @@ $effect(() => {
|
||||
{/if}
|
||||
|
||||
{#if (journals_journal_entry_obj.priority)}
|
||||
<Flag size="1.25emem" class="mx-1 inline-block text-yellow-500"/>
|
||||
<Flag size="1.25em" class="mx-1 inline-block text-yellow-500"/>
|
||||
{/if}
|
||||
|
||||
{#if (journals_journal_entry_obj.group)}
|
||||
<Group size="1.25emem" class="mx-1 inline-block text-green-500"/>
|
||||
<Group size="1.25em" class="mx-1 inline-block text-green-500"/>
|
||||
<span class="text-xs text-gray-500 hidden">Group:</span>
|
||||
<span class="font-semibold text-sm text-gray-500 hidden md:inline">
|
||||
{journals_journal_entry_obj.group}
|
||||
|
||||
@@ -48,6 +48,8 @@ let { lq__journal_obj_li }: Props = $props();
|
||||
{/if}
|
||||
</header>
|
||||
|
||||
<!-- {journals_journal_obj?.tmp_sort_3} -->
|
||||
|
||||
{#if journals_journal_obj.description}
|
||||
<div
|
||||
class="
|
||||
|
||||
Reference in New Issue
Block a user