mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-19 19:04:06 -06:00
Fix pipeline
This commit is contained in:
parent
33e4e8ea52
commit
c0a6fa35ac
@ -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
|
||||
|
||||
@ -120,8 +120,12 @@
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.decrypt-error {
|
||||
|
||||
@ -59,7 +59,7 @@ function generateRSSFeed(cfg: GlobalConfiguration, idx: ContentIndexMap, limit?:
|
||||
<title>${escapeHTML(content.title)}</title>
|
||||
<link>https://${joinSegments(base, encodeURI(slug))}</link>
|
||||
<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>
|
||||
</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
|
||||
// for the RSS feed
|
||||
if (content.encrypted) {
|
||||
delete content.content
|
||||
content.description = ""
|
||||
delete content.richContent
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ export const Description: QuartzTransformerPlugin<Partial<Options>> = (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
|
||||
|
||||
@ -115,19 +115,20 @@ export const EncryptPlugin: QuartzTransformerPlugin<Partial<Options>> = (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;
|
||||
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<Partial<Options>> = (userOpt
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
declare module "vfile" {
|
||||
interface DataMap {
|
||||
encrypted: boolean
|
||||
|
||||
Loading…
Reference in New Issue
Block a user