no-style-please2 0.5.2 → 0.6.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 50265dc5887dbce77e697614df742ab5e5f58edf9db5a2a1cae47b8af40f6b79
4
- data.tar.gz: fa1561da1295e1ec5d20127f5838304870e1649eb35498cb2075a28dee39db64
3
+ metadata.gz: d0c99df39b0e743327415cec4366cbaf21a7c52a5fc2b67040e443ed92fbe8df
4
+ data.tar.gz: 9ee3f4e378217b7683fecf0fbe640bdf8353ca409f5868659d697ad3c6b6a018
5
5
  SHA512:
6
- metadata.gz: e9c76ebe93fa850438814503dad66f2d503ca77c29fa49044f11b7f29e7eda503d9008464de6bb40ad5dbf1ca94cc9ea0aae9358d668b2a4ee0c78faac6d2c3a
7
- data.tar.gz: fb7c803793081f6ab2ee4824035cf3b0d5b023eea3aef3475f59bcc3fe84939eae6fb9de5187d6fbebaac3782af015a41278d09e52c95a10e361541c35213fe6
6
+ metadata.gz: ea652495e5857f22c787f91c2166e16642d9db4831b8251243c618e58193adefa17d91cf8d02067757ad560e667320c136c6c32d81ec6065e04a9b8537f51937
7
+ data.tar.gz: f3fff925aab0aa75bd082bb6dce24a5ac12f6d65f85080a310a3e8359e89ee702aeee2d21b17db145f44332aac8e2366462d1dde66825ca7d24eac3a1e02a8ce
data/_config.yml CHANGED
@@ -21,7 +21,12 @@ theme_config:
21
21
  encrypt_clear_btn: "清空缓存密码"
22
22
  decrypt_btn: 解密
23
23
  encrypt_btn: 重新加密
24
- encrypt_clear_btn: 清空密码缓存
24
+ tag_showall: true
25
+ all_tags_path: tags
26
+ all_tags_title: All Tags
27
+ archive_date_format: "%Y-%m"
28
+ archive_title_date_format: "%m-%d"
29
+
25
30
  #
26
31
  # forbid_cache_password: true
27
32
 
@@ -48,4 +53,3 @@ enc_tags:
48
53
  - tag: encrypt2
49
54
  # 123
50
55
  password: AQAQACAAIQCvWkhJdhn0b21Pz381AdTeMLb5bRO4d2F3usQtpIL0fDD0G8cg4klENXxJNX+rAHwD8VW2iJo4hZKDQrjdOjbJFugo60XnMmbdLEfzXpkqGpjjbe875/owWyNnGGPk3Vf4
51
-
@@ -5,6 +5,7 @@
5
5
  <input style="width:100%; " type="password" id="passwordinput" placeholder="输入密码"></input>
6
6
  <p>
7
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"/>
8
9
 
9
10
  </div>
10
11
 
@@ -14,7 +15,7 @@
14
15
 
15
16
  <input type="button" value= "{{ site.theme_config.encrypt_btn | default: 'Encrypt' }}" id="EncryptBtn"/>
16
17
 
17
- <input type="button" value= "{{ site.theme_config.encrypt_clear_btn | default: 'Clear password cache' }}" id="ClearBtn"/>
18
+ <input type="button" value= "{{ site.theme_config.encrypt_clear_btn | default: 'Clear password cache' }}" id="ClearBtn2"/>
18
19
 
19
20
  </div>
20
21
  <div id = 'decryptContent'>
@@ -25,27 +26,44 @@
25
26
  <script src="//cdn.jsdelivr.net/gh/vitock/jsdelivr@0.1.1/js/md5.js"></script>
26
27
  <script>
27
28
  !function(){
28
- 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)
29
37
 
30
38
  function hexToUint8Arr(hexString){
31
39
  return new Uint8Array(hexString.match(/.{1,2}/g).map(byte => parseInt(byte, 16)));
32
40
  }
33
- function decrypt (key0){
41
+
42
+
43
+ function decrypt (key0,isCached){
34
44
  // const key = Uint8Array([...]); // 32 bytes key
35
- var key = new TextEncoder("utf-8").encode(md5(key0));
36
45
 
37
- /// hex
38
- 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
+ }
39
57
  var nonce = hexToUint8Arr(nonceStr)
40
58
 
41
- const msg = encryptedContent.substring(17)
59
+
42
60
  const message = Base64.toUint8Array(msg)
43
61
  // Encrypt //
44
62
  const decrypt = new JSSalsa20(key, nonce).decrypt(message);
45
63
  var plain = new TextDecoder("utf-8").decode(decrypt)
46
64
  var check = md5(plain)
47
65
  if(check.indexOf(nonceStr) == 0){
48
- setKey(key0)
66
+ setKey(keyDgst)
49
67
  /// hide input
50
68
  document.getElementById("encrypted").style.display = 'none'
51
69
  // / show decrypted
@@ -94,7 +112,10 @@
94
112
  clearKey()
95
113
  }
96
114
 
97
- document.getElementById("ClearBtn").onclick = function(){
115
+ document.getElementById("ClearBtn1").onclick = function(){
116
+ localStorage.clear();
117
+ }
118
+ document.getElementById("ClearBtn2").onclick = function(){
98
119
  localStorage.clear();
99
120
  }
100
121
 
@@ -124,8 +145,9 @@
124
145
  }
125
146
  var cachekey = readKey()
126
147
  if(cachekey){
127
- decrypt(cachekey)
148
+ decrypt(cachekey,true)
128
149
  }
150
+
129
151
  {% endif %}
130
152
 
131
153
 
@@ -6,4 +6,30 @@ layout: default
6
6
 
7
7
  <h1>{{ page.title }}</h1>
8
8
 
9
- {%-include post_list.html category=page.which_category-%}
9
+
10
+ {%-assign posts = site.posts-%}
11
+ {%- if posts.size > 0 -%}
12
+
13
+ {% assign ymPre = "" %}
14
+ {% capture archive_date_format %} {{ site.theme_config.archive_date_format | default: "%Y"}}{% endcapture %}
15
+
16
+ {% capture archive_date_titleformat %} {{ site.theme_config.archive_title_date_format | default: "%m-%d"}}{% endcapture %}
17
+ {%- for post in posts limit: include.limit -%}
18
+ {% capture ymCur %} {{post.date | date: archive_date_format}} {% endcapture %}
19
+ {% if ymCur != ymPre %}
20
+ {{ymCur}}
21
+ {% endif %}
22
+ {% assign ymPre = ymCur %}
23
+
24
+
25
+ <ul>
26
+
27
+
28
+ <li>
29
+ <span>{{- post.date | date: archive_date_titleformat }}</span>
30
+ <a href="{{ post.url | relative_url }}">{{ post.title | downcase }}</a>
31
+ </li>
32
+
33
+ </ul>
34
+ {%- endfor -%}
35
+ {%- endif -%}
@@ -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.2
4
+ version: 0.6.1
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