mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-05-18 14:34:23 +02:00
fix: hide content of password-protected pages in searching and rss
This commit is contained in:
parent
142a08a6f8
commit
3623d0a047
@ -94,6 +94,7 @@ export default {
|
||||
wrongPassword: "خاطئة. يرجى إعادة إدخال كلمة المرور لفتح القفل:",
|
||||
noPayload: "حمولة مشفرة.",
|
||||
decrypting: "جاري فك التشفير...",
|
||||
defaultDescription: "هذه صفحة مشفرة",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -90,6 +90,7 @@ export default {
|
||||
wrongPassword: "Contrasenya incorrecta. Introduïu de nou la contrasenya per desbloquejar:",
|
||||
noPayload: "No hi ha càrrega útil xifrada.",
|
||||
decrypting: "Desxifrant...",
|
||||
defaultDescription: "Aquesta és una pàgina xifrada",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -89,6 +89,7 @@ export default {
|
||||
wrongPassword: "Nesprávné heslo. Zadejte heslo znovu pro odemknutí:",
|
||||
noPayload: "Není žádné šifrované užitečné zatížení.",
|
||||
decrypting: "Dekódování...",
|
||||
defaultDescription: "Toto je šifrovaná stránka",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -91,6 +91,7 @@ export default {
|
||||
"Falsches Passwort. Bitte geben Sie das Passwort erneut ein, um zu entsperren:",
|
||||
noPayload: "Keine verschlüsselte Nutzlast.",
|
||||
decrypting: "Entschlüsseln...",
|
||||
defaultDescription: "Dies ist eine verschlüsselte Seite",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -89,6 +89,7 @@ export interface Translation {
|
||||
wrongPassword: string
|
||||
noPayload: string
|
||||
decrypting: string
|
||||
defaultDescription: string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,6 +89,7 @@ export default {
|
||||
wrongPassword: "Wrong password. Please re-enter passsword to unlock:",
|
||||
noPayload: "No encrypted payload.",
|
||||
decrypting: "Decrypting...",
|
||||
defaultDescription: "This is encrypted page",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -89,6 +89,7 @@ export default {
|
||||
wrongPassword: "Wrong password. Please re-enter passsword to unlock:",
|
||||
noPayload: "No encrypted payload.",
|
||||
decrypting: "Decrypting...",
|
||||
defaultDescription: "This is encrypted page",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -90,6 +90,7 @@ export default {
|
||||
wrongPassword: "Contraseña incorrecta. Vuelva a introducir la contraseña para desbloquear:",
|
||||
noPayload: "No hay ninguna carga útil cifrada.",
|
||||
decrypting: "Descifrando...",
|
||||
defaultDescription: "Esta es una página encriptada",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -90,6 +90,7 @@ export default {
|
||||
wrongPassword: "رمز عبور اشتباه است. لطفا رمز عبور را دوباره وارد کنید تا قفل باز شود:",
|
||||
noPayload: "هیچ محموله رمزگذاری شده ای وجود ندارد.",
|
||||
decrypting: "در حال رمزگشایی...",
|
||||
defaultDescription: "این صفحه رمزگذاری شده است",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -91,6 +91,7 @@ export default {
|
||||
"Mot de passe incorrect. Veuillez saisir à nouveau le mot de passe pour déverrouiller :",
|
||||
noPayload: "Aucune charge utile cryptée.",
|
||||
decrypting: "Décryptage en cours...",
|
||||
defaultDescription: "Ceci est une page cryptée",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -88,6 +88,7 @@ export default {
|
||||
wrongPassword: "Helytelen jelszó. Kérjük, adja meg újra a jelszót a feloldáshoz:",
|
||||
noPayload: "Nincs titkosított hasznos teher.",
|
||||
decrypting: "Dekódolás...",
|
||||
defaultDescription: "Ez egy titkosított oldal",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -90,6 +90,7 @@ export default {
|
||||
wrongPassword: "Password errato. Si prega di reinserire la password per sbloccare:",
|
||||
noPayload: "Nessun payload crittografato.",
|
||||
decrypting: "Decifrazione in corso...",
|
||||
defaultDescription: "Questa è una pagina crittografata",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -89,6 +89,7 @@ export default {
|
||||
"パスワードが間違っています。ロックを解除するにはパスワードを再度入力してください:",
|
||||
noPayload: "暗号化されたペイロードはありません。",
|
||||
decrypting: "解読中...",
|
||||
defaultDescription: "これは暗号化されたページです",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -87,6 +87,7 @@ export default {
|
||||
wrongPassword: "비밀번호가 잘못되었습니다. 잠금을 해제하려면 암호를 다시 입력하십시오:",
|
||||
noPayload: "암호화된 페이로드가 없습니다.",
|
||||
decrypting: "해독 중...",
|
||||
defaultDescription: "이 페이지는 암호화된 페이지입니다",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -110,6 +110,7 @@ export default {
|
||||
wrongPassword: "Neteisingas slaptažodis. Norėdami atrakinti, iš naujo įveskite slaptažodį:",
|
||||
noPayload: "Nėra užšifruoto naudingojo krovinio.",
|
||||
decrypting: "Iššifruojama...",
|
||||
defaultDescription: "Tai yra šifruotas puslapis",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -93,6 +93,7 @@ export default {
|
||||
"Verkeerd wachtwoord. Voer alstublieft uw wachtwoord opnieuw in om te ontgrendelen:",
|
||||
noPayload: "Geen versleutelde payload.",
|
||||
decrypting: "Ontsleutelen..",
|
||||
defaultDescription: "Dit is een gecodeerde pagina",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -89,6 +89,7 @@ export default {
|
||||
wrongPassword: "Senha incorreta. Digite a senha novamente para desbloquear:",
|
||||
noPayload: "Nie ma zaszyfrowanego ładunku.",
|
||||
decrypting: "Deszyfrowanie...",
|
||||
defaultDescription: "To jest zaszyfrowana strona",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -89,6 +89,7 @@ export default {
|
||||
wrongPassword: "Parolă greșită. Vă rugăm să reintroduceți parola pentru a debloca:",
|
||||
noPayload: "Não há nenhuma carga útil criptografada.",
|
||||
decrypting: "Descifrando...",
|
||||
defaultDescription: "Esta é uma página criptografada",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -91,6 +91,7 @@ export default {
|
||||
wrongPassword: "Неправильний пароль. Будь ласка, введіть пароль ще раз, щоб розблокувати:",
|
||||
noPayload: "Nu există nicio sarcină utilă criptată.",
|
||||
decrypting: "Decriptare...",
|
||||
defaultDescription: "Aceasta este o pagină criptată",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -92,6 +92,7 @@ export default {
|
||||
wrongPassword: "Неверный пароль. Пожалуйста, введите пароль еще раз для разблокировки:",
|
||||
noPayload: "Нет зашифрованной полезной нагрузки.",
|
||||
decrypting: "Расшифровка...",
|
||||
defaultDescription: "Это зашифрованная страница",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -87,6 +87,7 @@ export default {
|
||||
wrongPassword: "รหัสผ่านผิด กรุณากรอกรหัสผ่านอีกครั้งเพื่อปลดล็อค:",
|
||||
noPayload: "ไม่มีเพย์โหลดที่เข้ารหัส",
|
||||
decrypting: "กำลังถอดรหัส...",
|
||||
defaultDescription: "หน้านี้เป็นหน้าเข้ารหัส",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -90,6 +90,7 @@ export default {
|
||||
wrongPassword: "Yanlış şifre. Kilidi açmak için lütfen şifreyi tekrar girin:",
|
||||
noPayload: "Şifrelenmiş yük yok.",
|
||||
decrypting: "Şifre çözülüyor...",
|
||||
defaultDescription: "Bu şifrelenmiş bir sayfadır",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -89,6 +89,7 @@ export default {
|
||||
wrongPassword: "Неправильний пароль. Будь ласка, введіть пароль ще раз, щоб розблокувати:",
|
||||
noPayload: "Немає зашифрованого корисного навантаження.",
|
||||
decrypting: "Розшифровка...",
|
||||
defaultDescription: "Це зашифрована сторінка",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -89,6 +89,7 @@ export default {
|
||||
wrongPassword: "Sai mật khẩu. Vui lòng điền lại mật khẩu để mở khóa:",
|
||||
noPayload: "Không có nội dung được mã hóa.",
|
||||
decrypting: "Đang giải mã...",
|
||||
defaultDescription: "Trang này đã được mã hóa",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -87,6 +87,7 @@ export default {
|
||||
wrongPassword: "密码错误。请重新输入密码解锁:",
|
||||
noPayload: "没有加密的有效负载。",
|
||||
decrypting: "解密中...",
|
||||
defaultDescription: "这是加密页面",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -87,6 +87,7 @@ export default {
|
||||
wrongPassword: "密碼錯誤。請重新輸入密碼解鎖:",
|
||||
noPayload: "沒有加密的有效負載。",
|
||||
decrypting: "解密中...",
|
||||
defaultDescription: "這是加密頁面",
|
||||
},
|
||||
},
|
||||
} as const satisfies Translation
|
||||
|
@ -125,8 +125,9 @@ export const ContentIndex: QuartzEmitterPlugin<Partial<Options>> = (opts) => {
|
||||
title: file.data.frontmatter?.title!,
|
||||
links: file.data.links ?? [],
|
||||
tags: file.data.frontmatter?.tags ?? [],
|
||||
content: file.data.text ?? "",
|
||||
richContent: opts?.rssFullHtml
|
||||
content: file.data.text && !file.data.frontmatter?.password ? file.data.text : "",
|
||||
richContent:
|
||||
opts?.rssFullHtml && !file.data.frontmatter?.password
|
||||
? escapeHTML(toHtml(tree as Root, { allowDangerousHtml: true }))
|
||||
: undefined,
|
||||
date: date,
|
||||
|
@ -2,6 +2,7 @@ import { Root as HTMLRoot } from "hast"
|
||||
import { toString } from "hast-util-to-string"
|
||||
import { QuartzTransformerPlugin } from "../types"
|
||||
import { escapeHTML } from "../../util/escape"
|
||||
import { i18n } from "../../i18n"
|
||||
|
||||
export interface Options {
|
||||
descriptionLength: number
|
||||
@ -22,7 +23,7 @@ export const Description: QuartzTransformerPlugin<Partial<Options>> = (userOpts)
|
||||
const opts = { ...defaultOptions, ...userOpts }
|
||||
return {
|
||||
name: "Description",
|
||||
htmlPlugins() {
|
||||
htmlPlugins(ctx) {
|
||||
return [
|
||||
() => {
|
||||
return async (tree: HTMLRoot, file) => {
|
||||
@ -37,7 +38,10 @@ export const Description: QuartzTransformerPlugin<Partial<Options>> = (userOpts)
|
||||
text = text.replace(urlRegex, "$<domain>" + "$<path>")
|
||||
}
|
||||
|
||||
const desc = frontMatterDescription ?? text
|
||||
const desc =
|
||||
(frontMatterDescription ?? file.data.frontmatter?.password)
|
||||
? i18n(ctx.cfg.configuration.locale).pages.encryptedContent.defaultDescription
|
||||
: text
|
||||
const sentences = desc.replace(/\s+/g, " ").split(/\.\s/)
|
||||
const finalDesc: string[] = []
|
||||
const len = opts.descriptionLength
|
||||
|
Loading…
x
Reference in New Issue
Block a user