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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7108dbd31a792d4cb97d54e262a91e7c043247de152a1a394261384cd5c37dc6
4
- data.tar.gz: 2c59bb78129cc08c5e48ff02573975fa77ebb58038d4bf120787dcf854a2d85c
3
+ metadata.gz: d26ad74aacb375a90dca0665fc7f4d4f5b75050f8cd1d51e629e593d098348b5
4
+ data.tar.gz: 59cdcb62447b336295853ffcd2f8ceb6fd4359e933507959ac6f1b48cfac48d7
5
5
  SHA512:
6
- metadata.gz: fed97a7243ffc82dc5aed673ec6eb41200f5f60c815c4f9cc26c83200170c2012ab2ecc6d9b308e9e86b913c324c981339e61ce2a3a44aa32d11c09068a47541
7
- data.tar.gz: 6f0916dad46e01a1990569139af5ba5b910cc3a144e4ff3d4d9a1412084478137e36f8f19d1ed217f653318a20604147e2d91675beb38be9c8c9073e8365f07a
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/), expressly created for [my personal blog](https://riggraz.dev/).
4
+ Inspired by [elly's site](http://tilde.town/~elly/) [riggraz](https://riggraz.dev/)
5
5
 
6
- <h3 align="center"><a href="https://riggraz.dev/no-style-please/">Try the demo out!</a></h3>
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
@@ -1,61 +1,126 @@
1
1
 
2
2
  <div id="encrypted">
3
- <h3> 内容已经加密</h3>
4
- <input style="width:100%; " type="password" id="passwordinput" placeholder="输入密码"></input>
5
- <p>
6
- <input type="button" value="解密" id="DecryptBtn"/>
7
- </div>
8
- <div id="decrypted">
9
- </div>
10
- <script src="//cdn.jsdelivr.net/gh/vitock/jsdelivr@0.1.1/js/salsa20.min.js"></script>
11
- <script src="//cdn.jsdelivr.net/gh/vitock/jsdelivr@0.1.1/js/base64.js"></script>
12
- <script src="//cdn.jsdelivr.net/gh/vitock/jsdelivr@0.1.1/js/md5.js"></script>
13
- <script>
14
- var encryptedContent = '{{ content | contentEncrypt:page}}'
15
-
16
- function hexToUint8Arr(hexString){
17
- return new Uint8Array(hexString.match(/.{1,2}/g).map(byte => parseInt(byte, 16)));
18
- }
19
- function decrypt (key0){
20
- // const key = Uint8Array([...]); // 32 bytes key
21
- var key = new TextEncoder("utf-8").encode(md5(key0));
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
- /// hex
24
- var nonceStr = encryptedContent.substring(0,16)
25
- var nonce = hexToUint8Arr(nonceStr)
26
-
27
- const msg = encryptedContent.substring(17)
28
- const message = Base64.toUint8Array(msg)
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 = 'none'
88
+ document.getElementById("encrypted").style.display = 'block'
36
89
  // / show decrypted
37
- document.getElementById("decrypted").innerHTML = plain
38
-
39
- setTimeout(function(){
40
- var loadevent = document.createEvent("Event")
41
- loadevent.initEvent("load", true, true)
42
-
43
- var DOMContentLoaded_event = document.createEvent("Event")
44
- DOMContentLoaded_event.initEvent("DOMContentLoaded", true, true)
45
-
46
- window.dispatchEvent(loadevent)
47
- window.dispatchEvent(DOMContentLoaded_event)
48
- console.log('333a334a')
49
-
50
- }, 500);
51
-
52
- }else{
53
- alert("wrong password.")
54
- }
55
- }
56
-
57
- document.getElementById("DecryptBtn").onclick = function(){
58
- var key = document.getElementById("passwordinput").value
59
- decrypt(key);
60
- }
61
- </script>
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
+
@@ -70,6 +70,9 @@ table, th, td {
70
70
  code {
71
71
  color: white;
72
72
  background: black;
73
+ // border-radius: 2px;
74
+ // padding-left: 2px;
75
+ // padding-right: 2px;
73
76
  }
74
77
 
75
78
  div.highlighter-rouge code {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: no-style-please2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - vitock