From c0a6fa35ac1d3f89fe6b32fd2f9837b9535a0d15 Mon Sep 17 00:00:00 2001 From: Yigit Colakoglu Date: Wed, 30 Jul 2025 19:52:44 +0200 Subject: [PATCH] Fix pipeline --- quartz/components/scripts/encrypt.inline.ts | 3 +-- quartz/components/styles/encrypt.scss | 8 ++++++-- quartz/plugins/emitters/contentIndex.tsx | 4 ++-- quartz/plugins/transformers/description.ts | 2 +- quartz/plugins/transformers/encrypt.ts | 16 ++++++++-------- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/quartz/components/scripts/encrypt.inline.ts b/quartz/components/scripts/encrypt.inline.ts index ca28f30e8..90f0aed7b 100644 --- a/quartz/components/scripts/encrypt.inline.ts +++ b/quartz/components/scripts/encrypt.inline.ts @@ -44,7 +44,6 @@ function getRelevantPasswords(filePath: string): string[] { }) // Get passwords by directory hierarchy (closest first) - const pathParts = filePath.split("/") // Sort cache keys by how many directory levels they share with current file const sortedPaths = Object.keys(cache).sort((a, b) => { @@ -102,7 +101,7 @@ function arrayBufferToHex(buffer: ArrayBuffer): string { // Helper: string to ArrayBuffer function stringToArrayBuffer(str: string): ArrayBuffer { const encoder = new TextEncoder() - return encoder.encode(str) + return encoder.encode(str).buffer as ArrayBuffer } // Helper: ArrayBuffer to string diff --git a/quartz/components/styles/encrypt.scss b/quartz/components/styles/encrypt.scss index 4128f6af8..44a74eba5 100644 --- a/quartz/components/styles/encrypt.scss +++ b/quartz/components/styles/encrypt.scss @@ -120,8 +120,12 @@ } @keyframes spin { - 0% { transform: rotate(0deg); } - 100% { transform: rotate(360deg); } + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } } .decrypt-error { diff --git a/quartz/plugins/emitters/contentIndex.tsx b/quartz/plugins/emitters/contentIndex.tsx index ddfcf752b..416a2515c 100644 --- a/quartz/plugins/emitters/contentIndex.tsx +++ b/quartz/plugins/emitters/contentIndex.tsx @@ -59,7 +59,7 @@ function generateRSSFeed(cfg: GlobalConfiguration, idx: ContentIndexMap, limit?: ${escapeHTML(content.title)} https://${joinSegments(base, encodeURI(slug))} https://${joinSegments(base, encodeURI(slug))} - + ${content.date?.toUTCString()} ` @@ -146,7 +146,7 @@ export const ContentIndex: QuartzEmitterPlugin> = (opts) => { // actually uses it. we only keep it in the index as we need it // for the RSS feed if (content.encrypted) { - delete content.content + content.description = "" delete content.richContent } diff --git a/quartz/plugins/transformers/description.ts b/quartz/plugins/transformers/description.ts index bc075e5a1..d6a9e3c1f 100644 --- a/quartz/plugins/transformers/description.ts +++ b/quartz/plugins/transformers/description.ts @@ -30,7 +30,7 @@ export const Description: QuartzTransformerPlugin> = (userOpts) return async (tree: HTMLRoot, file) => { if (file.data?.encrypted) { file.data.description = "This file is encrypted. Open it to see the contents." - return; + return } let frontMatterDescription = file.data.frontmatter?.description diff --git a/quartz/plugins/transformers/encrypt.ts b/quartz/plugins/transformers/encrypt.ts index 64ba7aa38..dbf3a104b 100644 --- a/quartz/plugins/transformers/encrypt.ts +++ b/quartz/plugins/transformers/encrypt.ts @@ -115,19 +115,20 @@ export const EncryptPlugin: QuartzTransformerPlugin> = (userOpt return frontmatter.password as string } - let deepestFolder = ""; + let deepestFolder = "" for (const folder of Object.keys(opts.encryptedFolders ?? {})) { - if (file.data?.relativePath?.startsWith(folder) && deepestFolder.length < folder.length) { - deepestFolder = folder; - } + if (file.data?.relativePath?.startsWith(folder) && deepestFolder.length < folder.length) { + deepestFolder = folder + } } if (deepestFolder) { - if (frontmatter?.password) { // if frontmatter has a password, use it - return frontmatter.password as string; + if (frontmatter?.password) { + // if frontmatter has a password, use it + return frontmatter.password as string } - return opts.encryptedFolders[deepestFolder] as string; + return opts.encryptedFolders!![deepestFolder] as string } } @@ -220,7 +221,6 @@ export const EncryptPlugin: QuartzTransformerPlugin> = (userOpt } } - declare module "vfile" { interface DataMap { encrypted: boolean