no-style-please2 0.5.0 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/_config.yml +12 -0
- data/_includes/encrypted.html +130 -51
- data/_layouts/tagpage.html +12 -3
- data/_sass/no-style-please.scss +3 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2461eca97e61c3f33512d5dac781ee5136f3d56fec9a7a6dd6231de205a5f6c3
|
4
|
+
data.tar.gz: 64cca40402fa13421ad158a8db0d1fe3025096e7afe6e2e7c890ff735d6c31eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a03bf0b15b4c0ea7df4f3e8873d7761efd6060978114ba865afe57af65ed6bdb2c279148c35d1b8e7ecf1f0e221ecdf279dee3e7772a205ab4952a728b9b27a
|
7
|
+
data.tar.gz: 4afe8a137187b62c5cc3d4bd47b3d147169c3d51a32b4227d268ca1f126ddb1b8dfd5b5e756915a3128cb8798360a0e62c779c7ae423deba80ab7d7435819878
|
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# no style, please!
|
2
2
|
|
3
3
|
<img src="https://raw.githubusercontent.com/riggraz/no-style-please/master/logo.png" width="64" align="left" />A (nearly) no-CSS, fast, minimalist [Jekyll](https://jekyllrb.com/) theme.
|
4
|
-
Inspired by [elly's site](http://tilde.town/~elly/)
|
4
|
+
Inspired by [elly's site](http://tilde.town/~elly/) [riggraz](https://riggraz.dev/)
|
5
5
|
|
6
|
-
<h3 align="center"><a href="https://
|
6
|
+
<h3 align="center"><a href="https://vitock.github.io/no-style-please-demo">Try the demo out!</a></h3>
|
7
7
|
|
8
8
|
<img src="https://raw.githubusercontent.com/riggraz/no-style-please/master/_screenshots/featured-image.png" />
|
9
9
|
|
@@ -14,6 +14,10 @@ Inspired by [elly's site](http://tilde.town/~elly/), expressly created for [my p
|
|
14
14
|
+ mathjax , inluce_code post_link support, include
|
15
15
|
+ support, link to other post
|
16
16
|
+ encrytion support. Only those who know the password can view the article
|
17
|
+
|
18
|
+
**IMPORTANT NOTE**
|
19
|
+
ONLY textual contents of article will be encrypted ,the pictures will **NOT** be encrypted
|
20
|
+
|
17
21
|
|
18
22
|
#### how to encrypt your post
|
19
23
|
1. generate your own public & private key to protect your password
|
data/_config.yml
CHANGED
@@ -17,6 +17,18 @@ theme_config:
|
|
17
17
|
back_home_text: ".." # customize text for homepage link in post layout
|
18
18
|
date_format: "%Y-%m-%d" # customize how date is formatted
|
19
19
|
show_description: false # show blog description in home page
|
20
|
+
encrypt_title: "Content is Encryped :)"
|
21
|
+
encrypt_clear_btn: "清空缓存密码"
|
22
|
+
decrypt_btn: 解密
|
23
|
+
encrypt_btn: 重新加密
|
24
|
+
tag_showall: true
|
25
|
+
all_tags_path: tags
|
26
|
+
all_tags_title: All Tags
|
27
|
+
|
28
|
+
#
|
29
|
+
# forbid_cache_password: true
|
30
|
+
|
31
|
+
|
20
32
|
|
21
33
|
sass:
|
22
34
|
style: :compressed
|
data/_includes/encrypted.html
CHANGED
@@ -1,61 +1,140 @@
|
|
1
1
|
|
2
2
|
<div id="encrypted">
|
3
|
-
<h3>
|
4
|
-
|
5
|
-
<
|
6
|
-
<
|
7
|
-
|
8
|
-
<
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
<
|
13
|
-
<
|
14
|
-
|
3
|
+
<h3> {{ site.theme_config.encrypt_title | default : 'Content is Encrypted'}} </h3>
|
4
|
+
|
5
|
+
<input style="width:100%; " type="password" id="passwordinput" placeholder="输入密码"></input>
|
6
|
+
<p>
|
7
|
+
<input type="button" value= "{{ site.theme_config.decrypt_btn | default : 'Decrypt' }}" id="DecryptBtn"/>
|
8
|
+
<input type="button" value= "{{ site.theme_config.encrypt_clear_btn | default: 'Clear password cache' }}" id="ClearBtn1"/>
|
9
|
+
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div id="decrypted" style = "display:none">
|
13
|
+
<p>
|
14
|
+
<div>
|
15
|
+
|
16
|
+
<input type="button" value= "{{ site.theme_config.encrypt_btn | default: 'Encrypt' }}" id="EncryptBtn"/>
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
<input type="button" value= "{{ site.theme_config.encrypt_clear_btn | default: 'Clear password cache' }}" id="ClearBtn2"/>
|
19
|
+
|
20
|
+
</div>
|
21
|
+
<div id = 'decryptContent'>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
<script src="//cdn.jsdelivr.net/gh/vitock/jsdelivr@0.1.1/js/salsa20.min.js"></script>
|
25
|
+
<script src="//cdn.jsdelivr.net/gh/vitock/jsdelivr@0.1.1/js/base64.js"></script>
|
26
|
+
<script src="//cdn.jsdelivr.net/gh/vitock/jsdelivr@0.1.1/js/md5.js"></script>
|
27
|
+
<script>
|
28
|
+
!function(){
|
29
|
+
var encryptedContent = '{{ content | contentEncrypt:page}}'
|
30
|
+
|
31
|
+
function hexToUint8Arr(hexString){
|
32
|
+
return new Uint8Array(hexString.match(/.{1,2}/g).map(byte => parseInt(byte, 16)));
|
33
|
+
}
|
34
|
+
function decrypt (key0){
|
35
|
+
// const key = Uint8Array([...]); // 32 bytes key
|
36
|
+
var key = new TextEncoder("utf-8").encode(md5(key0));
|
37
|
+
|
38
|
+
/// hex
|
39
|
+
var nonceStr = encryptedContent.substring(0,16)
|
40
|
+
var nonce = hexToUint8Arr(nonceStr)
|
41
|
+
|
42
|
+
const msg = encryptedContent.substring(17)
|
43
|
+
const message = Base64.toUint8Array(msg)
|
44
|
+
// Encrypt //
|
45
|
+
const decrypt = new JSSalsa20(key, nonce).decrypt(message);
|
46
|
+
var plain = new TextDecoder("utf-8").decode(decrypt)
|
47
|
+
var check = md5(plain)
|
48
|
+
if(check.indexOf(nonceStr) == 0){
|
49
|
+
setKey(key0)
|
50
|
+
/// hide input
|
51
|
+
document.getElementById("encrypted").style.display = 'none'
|
52
|
+
// / show decrypted
|
53
|
+
|
54
|
+
document.getElementById("decrypted").style.display = 'block'
|
55
|
+
document.getElementById("decryptContent").innerHTML = plain
|
56
|
+
|
57
|
+
setTimeout(function(){
|
58
|
+
var loadevent = document.createEvent("Event")
|
59
|
+
loadevent.initEvent("load", true, true)
|
60
|
+
|
61
|
+
var DOMContentLoaded_event = document.createEvent("Event")
|
62
|
+
DOMContentLoaded_event.initEvent("DOMContentLoaded", true, true)
|
63
|
+
|
64
|
+
window.dispatchEvent(loadevent)
|
65
|
+
window.dispatchEvent(DOMContentLoaded_event)
|
66
|
+
console.log('333a334a')
|
67
|
+
|
68
|
+
}, 500);
|
69
|
+
|
70
|
+
}else{
|
71
|
+
alert("wrong password.")
|
72
|
+
}
|
73
|
+
}
|
22
74
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
// Encrypt //
|
30
|
-
const decrypt = new JSSalsa20(key, nonce).decrypt(message);
|
31
|
-
var plain = new TextDecoder("utf-8").decode(decrypt)
|
32
|
-
var check = md5(plain)
|
33
|
-
if(check.indexOf(nonceStr) == 0){
|
75
|
+
document.getElementById("DecryptBtn").onclick = function(){
|
76
|
+
var key = document.getElementById("passwordinput").value
|
77
|
+
decrypt(key);
|
78
|
+
}
|
79
|
+
|
80
|
+
document.getElementById("EncryptBtn").onclick = function(){
|
34
81
|
/// hide input
|
35
|
-
document.getElementById("encrypted").style.display = '
|
82
|
+
document.getElementById("encrypted").style.display = 'block'
|
36
83
|
// / show decrypted
|
37
|
-
document.getElementById("decrypted").
|
84
|
+
document.getElementById("decrypted").style.display = "none"
|
85
|
+
|
86
|
+
clearKey()
|
87
|
+
}
|
38
88
|
|
39
|
-
|
40
|
-
|
41
|
-
|
89
|
+
document.getElementById("EncryptBtn").onclick = function(){
|
90
|
+
/// hide input
|
91
|
+
document.getElementById("encrypted").style.display = 'block'
|
92
|
+
// / show decrypted
|
93
|
+
document.getElementById("decrypted").style.display = "none"
|
94
|
+
|
95
|
+
clearKey()
|
96
|
+
}
|
42
97
|
|
43
|
-
|
44
|
-
|
98
|
+
document.getElementById("ClearBtn1").onclick = function(){
|
99
|
+
localStorage.clear();
|
100
|
+
}
|
101
|
+
document.getElementById("ClearBtn2").onclick = function(){
|
102
|
+
localStorage.clear();
|
103
|
+
}
|
45
104
|
|
46
|
-
|
47
|
-
window.dispatchEvent(DOMContentLoaded_event)
|
48
|
-
console.log('333a334a')
|
105
|
+
|
49
106
|
|
50
|
-
|
51
|
-
|
52
|
-
}
|
53
|
-
|
54
|
-
}
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
107
|
+
|
108
|
+
|
109
|
+
{% if site.theme_config.forbid_cache_password %}
|
110
|
+
function readKey(){
|
111
|
+
}
|
112
|
+
function setKey(value){
|
113
|
+
}
|
114
|
+
function clearKey() {
|
115
|
+
}
|
116
|
+
{% else %}
|
117
|
+
function readKey(){
|
118
|
+
var key = md5(location.pathname)
|
119
|
+
return localStorage.getItem(key)
|
120
|
+
}
|
121
|
+
function setKey(value){
|
122
|
+
var key = md5(location.pathname)
|
123
|
+
return localStorage.setItem(key,value)
|
124
|
+
}
|
125
|
+
function clearKey() {
|
126
|
+
var key = md5(location.pathname)
|
127
|
+
localStorage.removeItem(key)
|
128
|
+
}
|
129
|
+
var cachekey = readKey()
|
130
|
+
if(cachekey){
|
131
|
+
decrypt(cachekey)
|
132
|
+
}
|
133
|
+
{% endif %}
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
}()
|
138
|
+
|
139
|
+
</script>
|
140
|
+
|
data/_layouts/tagpage.html
CHANGED
@@ -3,13 +3,22 @@ layout: default
|
|
3
3
|
---
|
4
4
|
{%-include back_link.html -%}
|
5
5
|
<div class="post">
|
6
|
-
<h1
|
6
|
+
<h1></h1>
|
7
|
+
<li>Tag: {{ page.tag }}</li>
|
8
|
+
|
7
9
|
<ul>
|
8
|
-
{% for post in site.tags[page.tag] %}
|
10
|
+
{% for post in site.tags[page.tag] %}
|
9
11
|
<li><a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a> ({{ post.date | date_to_string }})<br>
|
10
12
|
{{ post.description }}
|
11
13
|
</li>
|
12
14
|
{% endfor %}
|
13
15
|
</ul>
|
14
16
|
</div>
|
15
|
-
|
17
|
+
{% if site.theme_config.tag_showall %}
|
18
|
+
<li><a href="{{ site.baseurl }}/{{site.theme_config.all_tags_path | default:'tags' }}.html"> {{site.theme_config.all_tags_title | default:'All Tags' }}</a>
|
19
|
+
</li>
|
20
|
+
|
21
|
+
{% endif %}
|
22
|
+
|
23
|
+
<hr>
|
24
|
+
|
data/_sass/no-style-please.scss
CHANGED