no-style-please2 0.5.1 → 0.6.0

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: d26ad74aacb375a90dca0665fc7f4d4f5b75050f8cd1d51e629e593d098348b5
4
- data.tar.gz: 59cdcb62447b336295853ffcd2f8ceb6fd4359e933507959ac6f1b48cfac48d7
3
+ metadata.gz: d9afc4c08d2e387cb510730849d4365927060f101b60f4fd8222cfd94d0a6a13
4
+ data.tar.gz: fbc828eb73facfb2a644e6092b98050ffb869916c16e2211d6a7434c04522132
5
5
  SHA512:
6
- metadata.gz: 63a7ca32a0099fde7ddbebc1f83303b1a2e73a080d9689ab6c2bb972f3c5e3e2da64199006a49f091c9b564f2a38bd9851d997ccc8727a6db311ba8e424e369e
7
- data.tar.gz: 7c0700461ffd0b57ed1a4107a112a37d66394316f17165049bd55844c2a5283f77cb8c707f678e85bbbab2e1faf80a6f6577f5ca67cf7d265b0a124ee5af14b0
6
+ metadata.gz: bbea77bad9bb678e98415b87109e8928b4e6baae9b5c53fa7b0b26f7280b8567fb853d129858f480e4d9402c546e28e26b4a840e4e12ad6bc6069fddc74ff38a
7
+ data.tar.gz: c9a88c78fa49f29ea80041fba960c39e257dd38b65c9c2e9423e8e6889552442baf2700d8d6689e54216cae73b30fe68bc2104f2ef2b87ee3a67d102c4bb17ec
data/_config.yml CHANGED
@@ -18,8 +18,13 @@ theme_config:
18
18
  date_format: "%Y-%m-%d" # customize how date is formatted
19
19
  show_description: false # show blog description in home page
20
20
  encrypt_title: "Content is Encryped :)"
21
- # decrypt_btn: 解密
22
- # encrypt_btn: 重新加密
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
+
23
28
  #
24
29
  # forbid_cache_password: true
25
30
 
@@ -46,4 +51,3 @@ enc_tags:
46
51
  - tag: encrypt2
47
52
  # 123
48
53
  password: AQAQACAAIQCvWkhJdhn0b21Pz381AdTeMLb5bRO4d2F3usQtpIL0fDD0G8cg4klENXxJNX+rAHwD8VW2iJo4hZKDQrjdOjbJFugo60XnMmbdLEfzXpkqGpjjbe875/owWyNnGGPk3Vf4
49
-
@@ -1,28 +1,22 @@
1
1
 
2
2
  <div id="encrypted">
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 %}
3
+ <h3> {{ site.theme_config.encrypt_title | default : 'Content is Encrypted'}} </h3>
4
+
8
5
  <input style="width:100%; " type="password" id="passwordinput" placeholder="输入密码"></input>
9
6
  <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 %}
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"/>
15
9
 
16
10
  </div>
17
11
 
18
12
  <div id="decrypted" style = "display:none">
19
13
  <p>
20
14
  <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 %}
15
+
16
+ <input type="button" value= "{{ site.theme_config.encrypt_btn | default: 'Encrypt' }}" id="EncryptBtn"/>
17
+
18
+ <input type="button" value= "{{ site.theme_config.encrypt_clear_btn | default: 'Clear password cache' }}" id="ClearBtn2"/>
19
+
26
20
  </div>
27
21
  <div id = 'decryptContent'>
28
22
  </div>
@@ -32,27 +26,44 @@
32
26
  <script src="//cdn.jsdelivr.net/gh/vitock/jsdelivr@0.1.1/js/md5.js"></script>
33
27
  <script>
34
28
  !function(){
35
- var encryptedContent = '{{ content | contentEncrypt:page}}'
29
+
30
+ {%- capture prefix0 %} {{page.url |default: "no-style-please2" }} {% endcapture -%}
31
+ {%- capture prefix %} {{prefix0 | strip }} {% endcapture -%}
32
+
33
+ const preFix = "{{prefix}}"
34
+ var encryptedContent = '{{ content | contentEncrypt:page, prefix}}'
35
+ const nonceStr = encryptedContent.substring(0,16);
36
+ const msg = encryptedContent.substring(17)
36
37
 
37
38
  function hexToUint8Arr(hexString){
38
39
  return new Uint8Array(hexString.match(/.{1,2}/g).map(byte => parseInt(byte, 16)));
39
40
  }
40
- function decrypt (key0){
41
+
42
+
43
+ function decrypt (key0,isCached){
41
44
  // const key = Uint8Array([...]); // 32 bytes key
42
- var key = new TextEncoder("utf-8").encode(md5(key0));
43
45
 
44
- /// hex
45
- var nonceStr = encryptedContent.substring(0,16)
46
+ var key = ''
47
+ var keyDgst = ""
48
+ if(isCached){
49
+ keyDgst= key0
50
+ key = new TextEncoder("utf-8").encode(keyDgst);
51
+ }
52
+ else{
53
+ var keyS = preFix + key0 + preFix
54
+ keyDgst = md5(keyS)
55
+ key = new TextEncoder("utf-8").encode(keyDgst);
56
+ }
46
57
  var nonce = hexToUint8Arr(nonceStr)
47
58
 
48
- const msg = encryptedContent.substring(17)
59
+
49
60
  const message = Base64.toUint8Array(msg)
50
61
  // Encrypt //
51
62
  const decrypt = new JSSalsa20(key, nonce).decrypt(message);
52
63
  var plain = new TextDecoder("utf-8").decode(decrypt)
53
64
  var check = md5(plain)
54
65
  if(check.indexOf(nonceStr) == 0){
55
- setKey(key0)
66
+ setKey(keyDgst)
56
67
  /// hide input
57
68
  document.getElementById("encrypted").style.display = 'none'
58
69
  // / show decrypted
@@ -91,6 +102,26 @@
91
102
 
92
103
  clearKey()
93
104
  }
105
+
106
+ document.getElementById("EncryptBtn").onclick = function(){
107
+ /// hide input
108
+ document.getElementById("encrypted").style.display = 'block'
109
+ // / show decrypted
110
+ document.getElementById("decrypted").style.display = "none"
111
+
112
+ clearKey()
113
+ }
114
+
115
+ document.getElementById("ClearBtn1").onclick = function(){
116
+ localStorage.clear();
117
+ }
118
+ document.getElementById("ClearBtn2").onclick = function(){
119
+ localStorage.clear();
120
+ }
121
+
122
+
123
+
124
+
94
125
 
95
126
  {% if site.theme_config.forbid_cache_password %}
96
127
  function readKey(){
@@ -114,8 +145,9 @@
114
145
  }
115
146
  var cachekey = readKey()
116
147
  if(cachekey){
117
- decrypt(cachekey)
148
+ decrypt(cachekey,true)
118
149
  }
150
+
119
151
  {% endif %}
120
152
 
121
153
 
@@ -3,13 +3,22 @@ layout: default
3
3
  ---
4
4
  {%-include back_link.html -%}
5
5
  <div class="post">
6
- <h1>Tag: {{ page.tag }}</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
- <hr>
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
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: no-style-please2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - vitock
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-17 00:00:00.000000000 Z
11
+ date: 2022-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.2.0
33
+ version: 0.3.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.2.0
40
+ version: 0.3.0
41
41
  description:
42
42
  email:
43
43
  - r