diff --git a/docs/plugins/Frontmatter.md b/docs/plugins/Frontmatter.md index 16b1d4cd0..5fc293362 100644 --- a/docs/plugins/Frontmatter.md +++ b/docs/plugins/Frontmatter.md @@ -67,10 +67,8 @@ Quartz supports the following frontmatter: - encrypt - `encrypt` - `encrypted` -- encryptMessage - - `encrypt_message` - - `encryptMessage` - - `encrypt-message` +- encryptConfig + - Overrides for the [[plugins/Encrypt|encryptConfig]] - password - `password` diff --git a/quartz/components/scripts/search.inline.ts b/quartz/components/scripts/search.inline.ts index e966bf4bc..f7dfc6610 100644 --- a/quartz/components/scripts/search.inline.ts +++ b/quartz/components/scripts/search.inline.ts @@ -488,10 +488,10 @@ async function fillDocument(data: ContentIndex) { const promises: Array> = [] for (const [slug, fileData] of Object.entries(data)) { if (fileData.encryptionResult) { - const slugId = id + let slugId = id promises.push( - index.addAsync(id, { - id: id++, + index.addAsync(id++, { + id: id, slug: slug as FullSlug, title: fileData.title, content: "", @@ -511,11 +511,10 @@ async function fillDocument(data: ContentIndex) { fileData.encryptionConfig!, password, ) - fileData.decrypted = true - index.updateAsync(slugId, { - id, + index.update(slugId++, { + id: slugId, slug: slug as FullSlug, title: fileData.title, content: decryptedContent, diff --git a/quartz/plugins/emitters/contentIndex.tsx b/quartz/plugins/emitters/contentIndex.tsx index c4234dc2e..c8d43152b 100644 --- a/quartz/plugins/emitters/contentIndex.tsx +++ b/quartz/plugins/emitters/contentIndex.tsx @@ -117,7 +117,7 @@ export const ContentIndex: QuartzEmitterPlugin> = (opts) => { tags: file.data.frontmatter?.tags ?? [], content: file.data.text ?? "", richContent: - !file.data.encryptionResult && opts?.rssFullHtml + opts?.rssFullHtml && !file.data.encryptionResult ? escapeHTML(toHtml(tree as Root, { allowDangerousHtml: true })) : undefined, date: date, diff --git a/quartz/util/encryption.ts b/quartz/util/encryption.ts index c09d06210..cfcce3dcc 100644 --- a/quartz/util/encryption.ts +++ b/quartz/util/encryption.ts @@ -429,7 +429,7 @@ export async function addPasswordToCache( cache[filePath] = { password, - ttl: ttl <= 0 ? 0 : now + ttl, + ttl: ttl == 0 ? 0 : now + ttl, } savePasswordCache(cache) @@ -449,7 +449,7 @@ export function getRelevantPasswords(filePath: string): string[] { } }) - if (cache[filePath] && cache[filePath].ttl > now) { + if (cache[filePath] && (cache[filePath].ttl > now || cache[filePath].ttl === 0)) { // If the exact file path is cached, return its password return [cache[filePath].password] }