✨ feat: Encrypt
This commit is contained in:
parent
8b6074fef4
commit
c24db5e371
@ -240,9 +240,6 @@ katex:
|
||||
# since year
|
||||
since: 2019
|
||||
|
||||
# pageFooter (Set true can let more people know this theme, Thanks!)
|
||||
pageFooter: true
|
||||
|
||||
# only for chinese website
|
||||
# ICP
|
||||
icp:
|
||||
@ -324,6 +321,11 @@ ads:
|
||||
img: https://cdn.jsdelivr.net/gh/Shen-Yu/cdn/img/ten_2.jpg
|
||||
url: https://curl.qcloud.com/kvO7hb43
|
||||
width: 300
|
||||
|
||||
# encrypt settings
|
||||
lock:
|
||||
enable: false
|
||||
password: 123456
|
||||
```
|
||||
|
||||
## Plugins
|
||||
|
@ -166,9 +166,6 @@ mermaid:
|
||||
# 网站成立年份(默认为 2019,若填入年份小于当前年份,则显示为 2018-2019 类似的格式)
|
||||
since: 2015
|
||||
|
||||
# 是否显示页脚信息(建议保留)
|
||||
pageFooter: true
|
||||
|
||||
# ICP备案信息尾部显示
|
||||
icp:
|
||||
enable: false
|
||||
@ -251,3 +248,8 @@ ads:
|
||||
img: https://cdn.jsdelivr.net/gh/Shen-Yu/cdn/img/vultr.png
|
||||
url: https://www.vultr.com/?ref=8630075
|
||||
width: 300
|
||||
|
||||
# 网站开启加密访问,密码可设置任何字符
|
||||
lock:
|
||||
enable: false
|
||||
password: 123456
|
||||
|
@ -30,3 +30,9 @@ post:
|
||||
sticky: Oben
|
||||
copyright_title: Copyright-Hinweis
|
||||
copyright_content: Sofern nicht anders angegeben, liegt das Urheberrecht aller Artikel in diesem Blog beim Autor. Nachdruck bitte Quelle angeben!
|
||||
|
||||
lock:
|
||||
lock_info: Please enter password
|
||||
lock_error: Incorrect password, please try again
|
||||
confirm_text: Ok
|
||||
cancel_text: Cancel
|
||||
|
@ -30,3 +30,9 @@ post:
|
||||
sticky: Sticky
|
||||
copyright_title: Copyright
|
||||
copyright_content: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
|
||||
|
||||
lock:
|
||||
lock_info: Please enter password
|
||||
lock_error: Incorrect password, please try again
|
||||
confirm_text: Ok
|
||||
cancel_text: Cancel
|
||||
|
@ -30,3 +30,9 @@ post:
|
||||
sticky: Sticky
|
||||
copyright_title: Copyright
|
||||
copyright_content: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
|
||||
|
||||
lock:
|
||||
lock_info: Please enter password
|
||||
lock_error: Incorrect password, please try again
|
||||
confirm_text: Ok
|
||||
cancel_text: Cancel
|
||||
|
@ -30,3 +30,9 @@ post:
|
||||
sticky: Arriba
|
||||
copyright_title: Derechos de autor
|
||||
copyright_content: Los derechos de autor son propiedad del autor. Para reimpresiones comerciales, comuníquese con el autor para obtener autorización. Para reimpresiones no comerciales, indique la fuente.
|
||||
|
||||
lock:
|
||||
lock_info: Please enter password
|
||||
lock_error: Incorrect password, please try again
|
||||
confirm_text: Ok
|
||||
cancel_text: Cancel
|
||||
|
@ -30,3 +30,9 @@ post:
|
||||
sticky: Haut
|
||||
copyright_title: Avis de copyright
|
||||
copyright_content: Le droit d'auteur appartient à l'auteur. Pour les réimpressions commerciales, veuillez contacter l'auteur pour autorisation. Pour les réimpressions non commerciales, veuillez indiquer la source.
|
||||
|
||||
lock:
|
||||
lock_info: Please enter password
|
||||
lock_error: Incorrect password, please try again
|
||||
confirm_text: Ok
|
||||
cancel_text: Cancel
|
||||
|
@ -30,3 +30,9 @@ post:
|
||||
sticky: 上へ
|
||||
copyright_title: 著作権表示
|
||||
copyright_content: 著作権は著者が所有しています。商業版の複製については、承認について著者に連絡してください。非商業版の複製については、出典を明記してください。
|
||||
|
||||
lock:
|
||||
lock_info: Please enter password
|
||||
lock_error: Incorrect password, please try again
|
||||
confirm_text: Ok
|
||||
cancel_text: Cancel
|
||||
|
@ -30,3 +30,9 @@ post:
|
||||
sticky: 톱
|
||||
copyright_title: 저작권 고지
|
||||
copyright_content: 저작권은 저자가 소유합니다. 상업용 재 인쇄의 경우 승인을 위해 저자에게 문의하십시오. 비상업적 재 인쇄의 경우 출처를 명시하십시오.
|
||||
|
||||
lock:
|
||||
lock_info: Please enter password
|
||||
lock_error: Incorrect password, please try again
|
||||
confirm_text: Ok
|
||||
cancel_text: Cancel
|
||||
|
@ -30,3 +30,9 @@ post:
|
||||
sticky: Sticky
|
||||
copyright_title: Copyright melding
|
||||
copyright_content: Copyright is eigendom van de auteur. Neem voor commerciële herdrukken contact op met de auteur voor autorisatie. Geef de bron aan voor niet-commerciële herdrukken.
|
||||
|
||||
lock:
|
||||
lock_info: Please enter password
|
||||
lock_error: Incorrect password, please try again
|
||||
confirm_text: Ok
|
||||
cancel_text: Cancel
|
||||
|
@ -30,3 +30,9 @@ post:
|
||||
sticky: Sticky
|
||||
copyright_title: Opphavsrett
|
||||
copyright_content: Opphavsrett eies av forfatteren. For kommersielle opptrykk, vennligst kontakt forfatteren for godkjenning. For ikke-kommersiell uttrykk, vennligst oppgi kilden.
|
||||
|
||||
lock:
|
||||
lock_info: Please enter password
|
||||
lock_error: Incorrect password, please try again
|
||||
confirm_text: Ok
|
||||
cancel_text: Cancel
|
||||
|
@ -30,3 +30,9 @@ post:
|
||||
sticky: Sticky
|
||||
copyright_title: direito autoral
|
||||
copyright_content: Os direitos autorais são de propriedade do autor. Para reimpressões comerciais, entre em contato com o autor para obter autorização. Para reimpressões não comerciais, indique a fonte.
|
||||
|
||||
lock:
|
||||
lock_info: Please enter password
|
||||
lock_error: Incorrect password, please try again
|
||||
confirm_text: Ok
|
||||
cancel_text: Cancel
|
||||
|
@ -30,3 +30,9 @@ post:
|
||||
sticky: липкий
|
||||
copyright_title: Авторские права
|
||||
copyright_content: Авторские права принадлежат автору. Для коммерческих перепечаток, пожалуйста, свяжитесь с автором для авторизации. Для некоммерческих перепечаток, пожалуйста, укажите источник.
|
||||
|
||||
lock:
|
||||
lock_info: Please enter password
|
||||
lock_error: Incorrect password, please try again
|
||||
confirm_text: Ok
|
||||
cancel_text: Cancel
|
||||
|
@ -30,3 +30,9 @@ post:
|
||||
sticky: dính
|
||||
copyright_title: Bản quyền
|
||||
copyright_content: Bản quyền thuộc sở hữu của tác giả. Đối với tái bản thương mại, xin vui lòng liên hệ với tác giả cho phép. Đối với tái bản phi thương mại, xin vui lòng cho biết nguồn.
|
||||
|
||||
lock:
|
||||
lock_info: Please enter password
|
||||
lock_error: Incorrect password, please try again
|
||||
confirm_text: Ok
|
||||
cancel_text: Cancel
|
||||
|
@ -30,3 +30,9 @@ post:
|
||||
sticky: 置顶
|
||||
copyright_title: 版权声明
|
||||
copyright_content: 本博客所有文章除特别声明外,著作权归作者所有。转载请注明出处!
|
||||
|
||||
lock:
|
||||
lock_info: 请输入访问密码
|
||||
lock_error: 密码错误,请重试
|
||||
confirm_text: 确定
|
||||
cancel_text: 取消
|
||||
|
@ -30,3 +30,9 @@ post:
|
||||
sticky: 置頂
|
||||
copyright_title: 版權聲明
|
||||
copyright_content: 本博客所有文章除特別聲明外,著作權歸作者所有。轉載請註明出處!
|
||||
|
||||
lock:
|
||||
lock_info: 請輸入訪問密碼
|
||||
lock_error: 密碼錯誤,請重試
|
||||
confirm_text: 確定
|
||||
cancel_text: 取消
|
||||
|
@ -40,10 +40,21 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js"></script>
|
||||
<% } %> <%- partial('google-analytics') %> <%- partial('baidu-analytics')
|
||||
%>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/@sweetalert2/theme-bulma@5.0.1/bulma.min.css"
|
||||
/>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.0.19/dist/sweetalert2.min.js"></script>
|
||||
|
||||
<!-- mermaid -->
|
||||
<% if (theme.mermaid.enable) { %>
|
||||
<script src="<%= theme.mermaid.cdn %>"></script>
|
||||
<% } %>
|
||||
<style>
|
||||
.swal2-styled.swal2-confirm {
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
</html>
|
||||
</html>
|
||||
|
37
layout/_partial/lock.ejs
Normal file
37
layout/_partial/lock.ejs
Normal file
@ -0,0 +1,37 @@
|
||||
<% if (theme.lock.enable){ %>
|
||||
<script>
|
||||
const password = "<%= theme.lock.password %>";
|
||||
const lock_password = window.sessionStorage.getItem("lock_password");
|
||||
console.log(password, lock_password);
|
||||
if (lock_password !== password) {
|
||||
Swal.fire({
|
||||
title: "<%= __('lock.lock_info') %>",
|
||||
input: "text",
|
||||
inputAttributes: {
|
||||
autocapitalize: "off",
|
||||
},
|
||||
showCancelButton: false,
|
||||
showLoaderOnConfirm: true,
|
||||
allowOutsideClick: false,
|
||||
confirmButtonText: "<%= __('lock.confirm_text') %>",
|
||||
}).then((result) => {
|
||||
console.log(result);
|
||||
if (result.isConfirmed) {
|
||||
console.log(password);
|
||||
if (result.value === password) {
|
||||
window.sessionStorage.setItem("lock_password", result.value);
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: "error",
|
||||
title: "<%= __('lock.lock_error') %>",
|
||||
confirmButtonText: "<%= __('lock.confirm_text') %>",
|
||||
allowOutsideClick: false,
|
||||
}).then(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<% } %>
|
@ -34,6 +34,7 @@
|
||||
<% if (theme.music&&theme.music.enable){ %>
|
||||
<%- partial('_partial/music') %>
|
||||
<% } %>
|
||||
<%- partial('_partial/lock') %>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user