mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
🚧 Feat: hide raw markdown content and hide related buttons for encrypted pages (#123)
This commit is contained in:
@@ -18,7 +18,9 @@
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
.d-none,
|
||||
.d-none {
|
||||
display: none !important;
|
||||
}
|
||||
.d-none-desktop {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@@ -132,9 +132,6 @@
|
||||
&[kept='true'] {
|
||||
display: block;
|
||||
}
|
||||
&.d-none {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.toc-title {
|
||||
display: flex;
|
||||
|
||||
@@ -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 记住解密状态
|
||||
|
||||
@@ -29,7 +29,7 @@ menu:
|
||||
|
||||
I was shy, so I hid.
|
||||
|
||||
<!-- more -->
|
||||
<!--more-->
|
||||
|
||||

|
||||
|
||||
@@ -57,7 +57,6 @@ That is so funny! :joy:
|
||||
### ruby
|
||||
[Hugo]^(An open-source static site generator)
|
||||
|
||||
|
||||
### math
|
||||
$$ \ce{CO2 + C -> 2 CO} $$
|
||||
|
||||
|
||||
@@ -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 ===
|
||||
|
||||
@@ -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 ===
|
||||
|
||||
@@ -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 ===
|
||||
|
||||
@@ -186,6 +186,9 @@ other = "Accueil"
|
||||
|
||||
[readMore]
|
||||
other = "En savoir plus"
|
||||
|
||||
[encryptedMessage]
|
||||
other = "" # waitting for translation
|
||||
# === posts/single.html ===
|
||||
|
||||
# === 404.html ===
|
||||
|
||||
@@ -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 ===
|
||||
|
||||
@@ -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 ===
|
||||
|
||||
@@ -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 ===
|
||||
|
||||
@@ -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 ===
|
||||
|
||||
@@ -189,6 +189,9 @@ other = "Читать больше"
|
||||
|
||||
[expirationReminder]
|
||||
other = "Эта статья последний раз обновлялась {{ .Date }}, содержание может быть устаревшим."
|
||||
|
||||
[encryptedMessage]
|
||||
other = "" # waitting for translation
|
||||
# === posts/single.html ===
|
||||
|
||||
# === 404.html ===
|
||||
|
||||
@@ -186,6 +186,9 @@ other = "Прочитај више"
|
||||
|
||||
[expirationReminder]
|
||||
other = "Овај чланак је последњи пут ажуриран {{ .Date }}, садржај је можда застарео."
|
||||
|
||||
[encryptedMessage]
|
||||
other = "" # waitting for translation
|
||||
# === posts/single.html ===
|
||||
|
||||
# === 404.html ===
|
||||
|
||||
@@ -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 ===
|
||||
|
||||
@@ -189,6 +189,9 @@ other = "阅读全文"
|
||||
|
||||
[expirationReminder]
|
||||
other = "本文最后更新于 {{ .Date }},文中内容可能已过时。"
|
||||
|
||||
[encryptedMessage]
|
||||
other = "本文已加密,请输入正确密码后查看!"
|
||||
# === posts/single.html ===
|
||||
|
||||
# === 404.html ===
|
||||
|
||||
@@ -189,6 +189,9 @@ other = "閱讀全文"
|
||||
|
||||
[expirationReminder]
|
||||
other = "本文最後更新於 {{ .Date }},文中內容可能已過時。"
|
||||
|
||||
[encryptedMessage]
|
||||
other = "本文已加密,請輸入正確密碼後查看!"
|
||||
# === posts/single.html ===
|
||||
|
||||
# === 404.html ===
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
# {{ .Title }}
|
||||
|
||||
{{ .RawContent }}
|
||||
{{ if $params.password -}}
|
||||
***{{ T "encryptedMessage" }}***
|
||||
{{- else -}}
|
||||
{{ .RawContent }}
|
||||
{{- end }}
|
||||
|
||||
---
|
||||
|
||||
> {{ T "author"}}: {{ .Site.Author.name }}
|
||||
> {{ .Permalink }}
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
|
||||
<!-- TODO UI style -->
|
||||
<div class="text-center" style="margin-top: 1rem;">
|
||||
<input type="password" id="fixit-decryptor" placeholder='{{ .Message }}'>
|
||||
</div>
|
||||
<div class="fixit-decryptor-container text-center" style="margin-top: 1rem">
|
||||
<label for="fixit-decryptor">
|
||||
<input type="password" id="fixit-decryptor" placeholder="{{ $params.message }}" />
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
{{- end -}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="post-info-license">
|
||||
<div class="post-info-license {{ with $params.password }} d-none{{ end }}">
|
||||
{{- with $params.license | string -}}
|
||||
<span>
|
||||
{{- . | safeHTML -}}
|
||||
@@ -25,7 +25,7 @@
|
||||
{{- end -}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="post-info-line">
|
||||
<div class="post-info-line{{ with $params.password }} d-none{{ end }}">
|
||||
<div class="post-info-md">
|
||||
{{- if $params.linktomarkdown -}}
|
||||
{{- with .OutputFormats.Get "markdown" -}}
|
||||
|
||||
@@ -151,7 +151,7 @@
|
||||
{{- partial "single/expiration-reminder.html" . -}}
|
||||
{{- $content -}}
|
||||
{{- else -}}
|
||||
{{- partial "single/fixit-decryptor.html" $params -}}
|
||||
{{- partial "single/fixit-decryptor.html" . -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user