Fix pipeline

This commit is contained in:
Yigit Colakoglu 2025-07-30 19:52:44 +02:00
parent 33e4e8ea52
commit c0a6fa35ac
5 changed files with 18 additions and 15 deletions

View File

@ -44,7 +44,6 @@ function getRelevantPasswords(filePath: string): string[] {
}) })
// Get passwords by directory hierarchy (closest first) // Get passwords by directory hierarchy (closest first)
const pathParts = filePath.split("/")
// Sort cache keys by how many directory levels they share with current file // Sort cache keys by how many directory levels they share with current file
const sortedPaths = Object.keys(cache).sort((a, b) => { const sortedPaths = Object.keys(cache).sort((a, b) => {
@ -102,7 +101,7 @@ function arrayBufferToHex(buffer: ArrayBuffer): string {
// Helper: string to ArrayBuffer // Helper: string to ArrayBuffer
function stringToArrayBuffer(str: string): ArrayBuffer { function stringToArrayBuffer(str: string): ArrayBuffer {
const encoder = new TextEncoder() const encoder = new TextEncoder()
return encoder.encode(str) return encoder.encode(str).buffer as ArrayBuffer
} }
// Helper: ArrayBuffer to string // Helper: ArrayBuffer to string

View File

@ -120,8 +120,12 @@
} }
@keyframes spin { @keyframes spin {
0% { transform: rotate(0deg); } 0% {
100% { transform: rotate(360deg); } transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
} }
.decrypt-error { .decrypt-error {

View File

@ -59,7 +59,7 @@ function generateRSSFeed(cfg: GlobalConfiguration, idx: ContentIndexMap, limit?:
<title>${escapeHTML(content.title)}</title> <title>${escapeHTML(content.title)}</title>
<link>https://${joinSegments(base, encodeURI(slug))}</link> <link>https://${joinSegments(base, encodeURI(slug))}</link>
<guid>https://${joinSegments(base, encodeURI(slug))}</guid> <guid>https://${joinSegments(base, encodeURI(slug))}</guid>
<description><![CDATA[ ${content.encrypted ? content.description : content.richContent ?? content.description} ]]></description> <description><![CDATA[ ${content.encrypted ? content.description : (content.richContent ?? content.description)} ]]></description>
<pubDate>${content.date?.toUTCString()}</pubDate> <pubDate>${content.date?.toUTCString()}</pubDate>
</item>` </item>`
@ -146,7 +146,7 @@ export const ContentIndex: QuartzEmitterPlugin<Partial<Options>> = (opts) => {
// actually uses it. we only keep it in the index as we need it // actually uses it. we only keep it in the index as we need it
// for the RSS feed // for the RSS feed
if (content.encrypted) { if (content.encrypted) {
delete content.content content.description = ""
delete content.richContent delete content.richContent
} }

View File

@ -30,7 +30,7 @@ export const Description: QuartzTransformerPlugin<Partial<Options>> = (userOpts)
return async (tree: HTMLRoot, file) => { return async (tree: HTMLRoot, file) => {
if (file.data?.encrypted) { if (file.data?.encrypted) {
file.data.description = "This file is encrypted. Open it to see the contents." file.data.description = "This file is encrypted. Open it to see the contents."
return; return
} }
let frontMatterDescription = file.data.frontmatter?.description let frontMatterDescription = file.data.frontmatter?.description

View File

@ -115,19 +115,20 @@ export const EncryptPlugin: QuartzTransformerPlugin<Partial<Options>> = (userOpt
return frontmatter.password as string return frontmatter.password as string
} }
let deepestFolder = ""; let deepestFolder = ""
for (const folder of Object.keys(opts.encryptedFolders ?? {})) { for (const folder of Object.keys(opts.encryptedFolders ?? {})) {
if (file.data?.relativePath?.startsWith(folder) && deepestFolder.length < folder.length) { if (file.data?.relativePath?.startsWith(folder) && deepestFolder.length < folder.length) {
deepestFolder = folder; deepestFolder = folder
} }
} }
if (deepestFolder) { if (deepestFolder) {
if (frontmatter?.password) { // if frontmatter has a password, use it if (frontmatter?.password) {
return frontmatter.password as string; // 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<Partial<Options>> = (userOpt
} }
} }
declare module "vfile" { declare module "vfile" {
interface DataMap { interface DataMap {
encrypted: boolean encrypted: boolean