Now with actual encryption!

This commit is contained in:
Scott Idem
2025-04-28 17:18:29 -04:00
parent 8c3f05a2ed
commit 12167a3bc6
2 changed files with 198 additions and 80 deletions

View File

@@ -342,10 +342,20 @@ export async function db_save_ae_obj_li__journal_entry(
let content = obj.content ?? '';
// remove the most common zerowidth characters from the start of the file
let content_cleaned: string = content.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/,"");
let content_md_html: null|string = await marked.parse(content_cleaned ?? '') ?? null;
let content_cleaned: null|string = null;
let content_md_html: null|string = null; // await marked.parse(content_cleaned ?? '') ?? null;
// let content_md_html_alt: null|string = await marked.parse(content_cleaned ?? '', { gfm: false }) ?? null;
if (obj.content_encrypted) {
// In theory "content" should be null if "content_encrypted" has a value.
content = null; // obj.content_encrypted;
content_cleaned = null;
content_md_html = null;
} else {
content_cleaned = content.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/,"");
content_md_html = await marked.parse(content_cleaned ?? '') ?? null;
}
let obj_record = {
id: obj.journal_entry_id_random,
journal_entry_id: obj.journal_entry_id_random,