diff --git a/assets/css/_common.scss b/assets/css/_common.scss index e15511f3..0a744d27 100644 --- a/assets/css/_common.scss +++ b/assets/css/_common.scss @@ -18,7 +18,9 @@ text-align: center !important; } -.d-none, +.d-none { + display: none !important; +} .d-none-desktop { display: none; } diff --git a/assets/css/_partial/_single/_toc.scss b/assets/css/_partial/_single/_toc.scss index cbf43cee..da7a0deb 100644 --- a/assets/css/_partial/_single/_toc.scss +++ b/assets/css/_partial/_single/_toc.scss @@ -132,9 +132,6 @@ &[kept='true'] { display: block; } - &.d-none { - display: none; - } .toc-title { display: flex; diff --git a/assets/js/fixit-decryptor.js b/assets/js/fixit-decryptor.js index 6c07f154..06ad46ec 100644 --- a/assets/js/fixit-decryptor.js +++ b/assets/js/fixit-decryptor.js @@ -30,7 +30,8 @@ FixItDecryptor = function (option = {}) { const inputMd5 = CryptoJS.MD5(input).toString(); const inputSha256 = CryptoJS.SHA256(input).toString(); if (inputMd5 !== password) { - return console.log('password error: ', input, inputMd5); + // TODO show message + return console.warn('Password error:', input, 'not the correct password!'); } const base64DecodeContent = CryptoJS.enc.Base64.parse(base64EncodeContent.replace(inputSha256.slice(saltLen), '')).toString(CryptoJS.enc.Utf8); // TODO 记住解密状态 diff --git a/exampleSite/content/tests/encryption.md b/exampleSite/content/tests/encryption.md index 8457add5..53fef7a3 100644 --- a/exampleSite/content/tests/encryption.md +++ b/exampleSite/content/tests/encryption.md @@ -29,7 +29,7 @@ menu: I was shy, so I hid. - + ![Hugo Theme FixIt](/images/Apple-Devices-Preview.png "Hugo Theme FixIt") @@ -57,7 +57,6 @@ That is so funny! :joy: ### ruby [Hugo]^(An open-source static site generator) - ### math $$ \ce{CO2 + C -> 2 CO} $$ diff --git a/i18n/de.toml b/i18n/de.toml index c6518ed7..a1438a07 100644 --- a/i18n/de.toml +++ b/i18n/de.toml @@ -189,6 +189,9 @@ other = "Mehr lesen" [expirationReminder] other = "Dieser Artikel wurde zuletzt auf {{ .Date }} aktualisiert, der Inhalt kann veraltet sein." + +[encryptedMessage] +other = "" # waitting for translation # === posts/single.html === # === 404.html === diff --git a/i18n/en.toml b/i18n/en.toml index 12c40a48..05f9a4cd 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -185,6 +185,9 @@ other = "Read More" [expirationReminder] other = "This article was last updated on {{ .Date }}, the content may be out of date." + +[encryptedMessage] +other = "This article was encrypted, please enter the correct password to view!" # === posts/single.html === # === 404.html === diff --git a/i18n/es.toml b/i18n/es.toml index 0c264923..8ced058a 100644 --- a/i18n/es.toml +++ b/i18n/es.toml @@ -189,6 +189,9 @@ other = "Leer más" [expirationReminder] other = "Este artículo se actualizó por última vez el {{ .Date }}, es posible que el contenido no esté actualizado." + +[encryptedMessage] +other = "" # waitting for translation # === posts/single.html === # === 404.html === diff --git a/i18n/fr.toml b/i18n/fr.toml index dec8fb00..becda35a 100644 --- a/i18n/fr.toml +++ b/i18n/fr.toml @@ -186,6 +186,9 @@ other = "Accueil" [readMore] other = "En savoir plus" + +[encryptedMessage] +other = "" # waitting for translation # === posts/single.html === # === 404.html === diff --git a/i18n/it.toml b/i18n/it.toml index c0c47316..c9dc262d 100644 --- a/i18n/it.toml +++ b/i18n/it.toml @@ -189,6 +189,9 @@ other = "Leggi di più" [expirationReminder] other = "Questo articolo è stato aggiornato l'ultima volta il {{ .Date }}, il contenuto potrebbe non essere aggiornato." + +[encryptedMessage] +other = "" # waitting for translation # === posts/single.html === # === 404.html === diff --git a/i18n/pl.toml b/i18n/pl.toml index b765a634..97131c5b 100644 --- a/i18n/pl.toml +++ b/i18n/pl.toml @@ -186,6 +186,9 @@ other = "Czytaj więcej" [expirationReminder] other = "Ten artykuł był ostatnio aktualizowany {{ .Date }}, jego treść może być nieaktualna." + +[encryptedMessage] +other = "" # waitting for translation # === posts/single.html === # === 404.html === diff --git a/i18n/pt-BR.toml b/i18n/pt-BR.toml index 06a14614..c64b520c 100644 --- a/i18n/pt-BR.toml +++ b/i18n/pt-BR.toml @@ -189,6 +189,9 @@ other = "Leia mais" [expirationReminder] other = "Este artigo foi atualizado pela última vez em {{ .Date }}, o conteúdo pode estar desatualizado." + +[encryptedMessage] +other = "" # waitting for translation # === posts/single.html === # === 404.html === diff --git a/i18n/ro.toml b/i18n/ro.toml index f8a49077..545438f7 100644 --- a/i18n/ro.toml +++ b/i18n/ro.toml @@ -189,6 +189,9 @@ other = "Citește mai mult" [expirationReminder] other = "Acest articol a fost actualizat ultima dată pe {{ .Date }}, conținutul poate fi depășit." + +[encryptedMessage] +other = "" # waitting for translation # === posts/single.html === # === 404.html === diff --git a/i18n/ru.toml b/i18n/ru.toml index 0e877dab..4dd33935 100644 --- a/i18n/ru.toml +++ b/i18n/ru.toml @@ -189,6 +189,9 @@ other = "Читать больше" [expirationReminder] other = "Эта статья последний раз обновлялась {{ .Date }}, содержание может быть устаревшим." + +[encryptedMessage] +other = "" # waitting for translation # === posts/single.html === # === 404.html === diff --git a/i18n/sr.toml b/i18n/sr.toml index 930b6841..c9e3738e 100644 --- a/i18n/sr.toml +++ b/i18n/sr.toml @@ -186,6 +186,9 @@ other = "Прочитај више" [expirationReminder] other = "Овај чланак је последњи пут ажуриран {{ .Date }}, садржај је можда застарео." + +[encryptedMessage] +other = "" # waitting for translation # === posts/single.html === # === 404.html === diff --git a/i18n/vi.toml b/i18n/vi.toml index bf5b7fe1..78c7ce45 100644 --- a/i18n/vi.toml +++ b/i18n/vi.toml @@ -188,6 +188,9 @@ other = "Đọc thêm" [expirationReminder] other = "Bài viết này được cập nhật lần cuối vào {{ .Date }}, nội dung có thể đã lỗi thời." + +[encryptedMessage] +other = "" # waitting for translation # === posts/single.html === # === 404.html === diff --git a/i18n/zh-CN.toml b/i18n/zh-CN.toml index c6e4e5d7..d9a1a8db 100644 --- a/i18n/zh-CN.toml +++ b/i18n/zh-CN.toml @@ -189,6 +189,9 @@ other = "阅读全文" [expirationReminder] other = "本文最后更新于 {{ .Date }},文中内容可能已过时。" + +[encryptedMessage] +other = "本文已加密,请输入正确密码后查看!" # === posts/single.html === # === 404.html === diff --git a/i18n/zh-TW.toml b/i18n/zh-TW.toml index d3d01908..ac98dbfb 100644 --- a/i18n/zh-TW.toml +++ b/i18n/zh-TW.toml @@ -189,6 +189,9 @@ other = "閱讀全文" [expirationReminder] other = "本文最後更新於 {{ .Date }},文中內容可能已過時。" + +[encryptedMessage] +other = "本文已加密,請輸入正確密碼後查看!" # === posts/single.html === # === 404.html === diff --git a/layouts/_default/single.md b/layouts/_default/single.md index e34c2d40..5311de02 100644 --- a/layouts/_default/single.md +++ b/layouts/_default/single.md @@ -1,3 +1,13 @@ +{{- $params := .Scratch.Get "params" -}} # {{ .Title }} -{{ .RawContent }} +{{ if $params.password -}} + ***{{ T "encryptedMessage" }}*** +{{- else -}} + {{ .RawContent }} +{{- end }} + +--- + +> {{ T "author"}}: {{ .Site.Author.name }} +> {{ .Permalink }} diff --git a/layouts/partials/single/fixit-decryptor.html b/layouts/partials/single/fixit-decryptor.html index 83cedab6..11f36972 100644 --- a/layouts/partials/single/fixit-decryptor.html +++ b/layouts/partials/single/fixit-decryptor.html @@ -1,4 +1,8 @@ +{{- $params := .Scratch.Get "params" -}} + -
- -
\ No newline at end of file +
+ +
diff --git a/layouts/partials/single/footer.html b/layouts/partials/single/footer.html index 1d62b772..e9de8ca6 100644 --- a/layouts/partials/single/footer.html +++ b/layouts/partials/single/footer.html @@ -17,7 +17,7 @@ {{- end -}} -
+
{{- with $params.license | string -}} {{- . | safeHTML -}} @@ -25,7 +25,7 @@ {{- end -}}
-
+