no-style-please2 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/_config.yml +7 -0
- data/_includes/encrypted.html +121 -56
- 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: d26ad74aacb375a90dca0665fc7f4d4f5b75050f8cd1d51e629e593d098348b5
|
4
|
+
data.tar.gz: 59cdcb62447b336295853ffcd2f8ceb6fd4359e933507959ac6f1b48cfac48d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63a7ca32a0099fde7ddbebc1f83303b1a2e73a080d9689ab6c2bb972f3c5e3e2da64199006a49f091c9b564f2a38bd9851d997ccc8727a6db311ba8e424e369e
|
7
|
+
data.tar.gz: 7c0700461ffd0b57ed1a4107a112a37d66394316f17165049bd55844c2a5283f77cb8c707f678e85bbbab2e1faf80a6f6577f5ca67cf7d265b0a124ee5af14b0
|
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,13 @@ 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
|
+
# decrypt_btn: 解密
|
22
|
+
# encrypt_btn: 重新加密
|
23
|
+
#
|
24
|
+
# forbid_cache_password: true
|
25
|
+
|
26
|
+
|
20
27
|
|
21
28
|
sass:
|
22
29
|
style: :compressed
|
data/_includes/encrypted.html
CHANGED
@@ -1,61 +1,126 @@
|
|
1
1
|
|
2
2
|
<div id="encrypted">
|
3
|
-
|
4
|
-
<
|
5
|
-
|
6
|
-
<
|
7
|
-
|
8
|
-
<
|
9
|
-
|
10
|
-
|
11
|
-
<
|
12
|
-
|
13
|
-
<
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
3
|
+
{% if site.theme_config.encrypt_title %}
|
4
|
+
<h3> {{ site.theme_config.encrypt_title }} </h3>
|
5
|
+
{% else %}
|
6
|
+
<h3>Content is Encrypted</h3>
|
7
|
+
{% endif %}
|
8
|
+
<input style="width:100%; " type="password" id="passwordinput" placeholder="输入密码"></input>
|
9
|
+
<p>
|
10
|
+
{% if site.theme_config.decrypt_btn %}
|
11
|
+
<input type="button" value= "{{ site.theme_config.decrypt_btn }}" id="DecryptBtn"/>
|
12
|
+
{% else %}
|
13
|
+
<input type="button" value= "Decrypt" id="DecryptBtn"/>
|
14
|
+
{% endif %}
|
15
|
+
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div id="decrypted" style = "display:none">
|
19
|
+
<p>
|
20
|
+
<div>
|
21
|
+
{% if site.theme_config.encrypt_btn %}
|
22
|
+
<input type="button" value= "{{ site.theme_config.encrypt_btn }}" id="EncryptBtn"/>
|
23
|
+
{% else %}
|
24
|
+
<input type="button" value= "Encrypt" id="EncryptBtn"/>
|
25
|
+
{% endif %}
|
26
|
+
</div>
|
27
|
+
<div id = 'decryptContent'>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
<script src="//cdn.jsdelivr.net/gh/vitock/jsdelivr@0.1.1/js/salsa20.min.js"></script>
|
31
|
+
<script src="//cdn.jsdelivr.net/gh/vitock/jsdelivr@0.1.1/js/base64.js"></script>
|
32
|
+
<script src="//cdn.jsdelivr.net/gh/vitock/jsdelivr@0.1.1/js/md5.js"></script>
|
33
|
+
<script>
|
34
|
+
!function(){
|
35
|
+
var encryptedContent = '{{ content | contentEncrypt:page}}'
|
36
|
+
|
37
|
+
function hexToUint8Arr(hexString){
|
38
|
+
return new Uint8Array(hexString.match(/.{1,2}/g).map(byte => parseInt(byte, 16)));
|
39
|
+
}
|
40
|
+
function decrypt (key0){
|
41
|
+
// const key = Uint8Array([...]); // 32 bytes key
|
42
|
+
var key = new TextEncoder("utf-8").encode(md5(key0));
|
43
|
+
|
44
|
+
/// hex
|
45
|
+
var nonceStr = encryptedContent.substring(0,16)
|
46
|
+
var nonce = hexToUint8Arr(nonceStr)
|
47
|
+
|
48
|
+
const msg = encryptedContent.substring(17)
|
49
|
+
const message = Base64.toUint8Array(msg)
|
50
|
+
// Encrypt //
|
51
|
+
const decrypt = new JSSalsa20(key, nonce).decrypt(message);
|
52
|
+
var plain = new TextDecoder("utf-8").decode(decrypt)
|
53
|
+
var check = md5(plain)
|
54
|
+
if(check.indexOf(nonceStr) == 0){
|
55
|
+
setKey(key0)
|
56
|
+
/// hide input
|
57
|
+
document.getElementById("encrypted").style.display = 'none'
|
58
|
+
// / show decrypted
|
59
|
+
|
60
|
+
document.getElementById("decrypted").style.display = 'block'
|
61
|
+
document.getElementById("decryptContent").innerHTML = plain
|
62
|
+
|
63
|
+
setTimeout(function(){
|
64
|
+
var loadevent = document.createEvent("Event")
|
65
|
+
loadevent.initEvent("load", true, true)
|
66
|
+
|
67
|
+
var DOMContentLoaded_event = document.createEvent("Event")
|
68
|
+
DOMContentLoaded_event.initEvent("DOMContentLoaded", true, true)
|
69
|
+
|
70
|
+
window.dispatchEvent(loadevent)
|
71
|
+
window.dispatchEvent(DOMContentLoaded_event)
|
72
|
+
console.log('333a334a')
|
73
|
+
|
74
|
+
}, 500);
|
75
|
+
|
76
|
+
}else{
|
77
|
+
alert("wrong password.")
|
78
|
+
}
|
79
|
+
}
|
22
80
|
|
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){
|
81
|
+
document.getElementById("DecryptBtn").onclick = function(){
|
82
|
+
var key = document.getElementById("passwordinput").value
|
83
|
+
decrypt(key);
|
84
|
+
}
|
85
|
+
|
86
|
+
document.getElementById("EncryptBtn").onclick = function(){
|
34
87
|
/// hide input
|
35
|
-
document.getElementById("encrypted").style.display = '
|
88
|
+
document.getElementById("encrypted").style.display = 'block'
|
36
89
|
// / show decrypted
|
37
|
-
document.getElementById("decrypted").
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
90
|
+
document.getElementById("decrypted").style.display = "none"
|
91
|
+
|
92
|
+
clearKey()
|
93
|
+
}
|
94
|
+
|
95
|
+
{% if site.theme_config.forbid_cache_password %}
|
96
|
+
function readKey(){
|
97
|
+
}
|
98
|
+
function setKey(value){
|
99
|
+
}
|
100
|
+
function clearKey() {
|
101
|
+
}
|
102
|
+
{% else %}
|
103
|
+
function readKey(){
|
104
|
+
var key = md5(location.pathname)
|
105
|
+
return localStorage.getItem(key)
|
106
|
+
}
|
107
|
+
function setKey(value){
|
108
|
+
var key = md5(location.pathname)
|
109
|
+
return localStorage.setItem(key,value)
|
110
|
+
}
|
111
|
+
function clearKey() {
|
112
|
+
var key = md5(location.pathname)
|
113
|
+
localStorage.removeItem(key)
|
114
|
+
}
|
115
|
+
var cachekey = readKey()
|
116
|
+
if(cachekey){
|
117
|
+
decrypt(cachekey)
|
118
|
+
}
|
119
|
+
{% endif %}
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
}()
|
124
|
+
|
125
|
+
</script>
|
126
|
+
|
data/_sass/no-style-please.scss
CHANGED