jekyll-zeta 0.10.4 → 0.10.5

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: 04f046288eef53805a767c724de29307eda5dd49b28c88e6de1d75c2d6a5eccb
4
- data.tar.gz: a9e9362923d0d6603d985ca6df5499e8bae782cb05abaf77da17447a4abe56dc
3
+ metadata.gz: 1c09659ecef1d43a946ea10de25c69095436f9487cea5dc0b331a6d736cdea5e
4
+ data.tar.gz: a87673d297775cfd505948aa86292609bd5bbd59188ce8165a771fc013ee99f3
5
5
  SHA512:
6
- metadata.gz: 7f8b8a1a201b88c4550d1f7d29a71738bac20b4554da4b7d20823ba4ad12dd6b4f1f8d8eebe127e8d4609df7fb12dfdebd2d2bd79cdb85eb53f8fd97dfdb8e82
7
- data.tar.gz: 20df7c3f1be88b3946ad2ac5721b6c27c8e244773c807a6dcff047b6235bc34dcd81dfc6bd655d70b54b7260e3a0f6d16ce3abfabe85874f38430d8a5e7d8525
6
+ metadata.gz: c30589f4a0f83c10ef0bee30b60f8c50ccf03dbfe42381cfd2139d3f11244012ce08a4641fae04b91456e6828156239216bf65bd7562b32fd04677161aac66e3
7
+ data.tar.gz: 92ca3edb079fde72c27ab8c0c0abdadddc09ed81c9aecd7b289895793e05f72525ac34be280ee48a9ceb295e232bdc9d3bc17cfc9ba1c92f79cd8650de879e13
@@ -0,0 +1,17 @@
1
+ function _InitEnc(e,t,n,c,o){!function(){const a=crypto.subtle,r=e,i=t.substring(3),d=base64js.decode(i);d.subarray(0,12),d.subarray(12);async function l(e,t,n){
2
+ if(e.length<8)throw n&&(n.count=e.length),"err";let c=0;for(let t=0;t<4;t++)c|=(e[t]^e[t+4]^t)<<8*(3-t);if(n&&(n.count=c),e.length<c)return;let o=e.slice(4,20),r=e.slice(20,c)
3
+ ;var i=await a.importKey("raw",t,{name:"AES-CTR"},!1,["decrypt"]),d={name:"AES-CTR",counter:o,length:64};try{let e=await a.decrypt(d,i,r);return new Uint8Array(e)}catch(e){throw e}}
4
+ async function s(o,r){var i="";if(r)i=u();else{var d=e+o+e;i=await async function(e){var t=(new TextEncoder).encode(e),n=await a.importKey("raw",t,"PBKDF2",!1,["deriveBits"]);let c={name:"PBKDF2",
5
+ hash:"SHA-256",iterations:12345,salt:(new TextEncoder).encode("this is a salt string 20221019")};return await a.deriveBits(c,n,256)}(d)}if(0!=i.length)try{let e=await async function(e){
6
+ const t=c.split("."),o=t[0],a=t[1],r=base64js.decode(a),i=base64js.decode(n);let d=null,s=0,u=0;for(;s++<400&&!(u>=i.length);){let t=i.slice(u);try{let n={count:0},c=await l(t,e,n);if(u+=n.count,c){
7
+ let e=await l(r,c);if((new TextDecoder).decode(e)==o){d=c;break}}}catch(e){}}return d}(i);if(!e)throw"error psw";var s=await async function(e,t){const n=e,c=base64js.decode(n);return await l(c,t)
8
+ }(t,e),m=(new TextDecoder).decode(s);y(i),document.getElementById("encrypted").style.display="none",document.getElementById("decrypted").style.display="block",
9
+ document.getElementById("decryptContent").innerHTML=m;const o=window._after_dec_fun;o&&"function"==typeof o&&o(),setTimeout((function(){var e=document.createEvent("Event");e.initEvent("load",!0,!0)
10
+ ;var t=document.createEvent("Event");t.initEvent("DOMContentLoaded",!0,!0),window.dispatchEvent(e),window.dispatchEvent(t)}),100)}catch(e){
11
+ document.getElementById("passwordinput").classList.add("errPsw"),setTimeout((()=>{document.getElementById("passwordinput").classList.remove("errPsw")}),500)}}
12
+ document.getElementById("DecryptBtn").onclick=function(){s(document.getElementById("passwordinput").value)},document.getElementById("EncryptBtn").onclick=function(){
13
+ document.getElementById("encrypted").style.display="block",document.getElementById("decrypted").style.display="none",document.getElementById("decryptContent").innerHTML=":)",m()
14
+ ;const e=window._after_enc_fun;e&&"function"==typeof e&&e()},document.getElementById("ClearBtn1").onclick=function(){localStorage.clear(),document.getElementById("passwordinput").value=""},
15
+ document.getElementById("ClearBtn2").onclick=function(){localStorage.clear()};const u=o?function(){}:function(){var e=r,t=localStorage.getItem(e);return t?base64js.decode(t):null
16
+ },y=o?function(e){}:function(e){var t=r,n=new Uint8Array(e),c=base64js.encode(n);return localStorage.setItem(t,c)},m=o?function(){}:function(){var e=r;localStorage.removeItem(e)};var w=u();w&&s(w,!0)
17
+ }()}
@@ -54,252 +54,26 @@
54
54
  </script>
55
55
  <script src="//cdn.jsdelivr.net/gh/vitock/jsdelivr@0.1.2/js/base64js.js"></script>
56
56
  <script>
57
-
58
- function uint8ArrayToHex(uint8Array) {
59
- return Array.from(uint8Array)
60
- .map(byte => byte.toString(16).padStart(2, '0')) // 转换每个字节为2位16进制
61
- .join(''); // 连接成字符串
62
- }
63
-
64
-
65
-
66
- {%- assign HEXKEY = '' | rand_bytes:32 %}
67
- const contentEnc = '{{ content | encrypt_content_v2:HEXKEY }}';
68
-
69
- !function(){
70
-
71
- const substl = crypto.subtle
72
- const preFix = '{{encid}}';
73
- const encid = preFix
74
- const encryptedContent = contentEnc;
75
- const base64str = encryptedContent.substring(3)
76
- const bfMsg = base64js.decode(base64str)
77
- const bfIv = bfMsg.subarray(0,12)
78
- const bfCipher = bfMsg.subarray(12)
79
-
80
- async function genKey(psw){
81
- var keyRaw = new TextEncoder().encode(psw)
82
- var key = await substl.importKey('raw',keyRaw,'PBKDF2',false,["deriveBits"])
83
- const salt = 'this is a salt string 20221019'
84
- let pbkdf2 = {
85
- name:"PBKDF2",hash: "SHA-256",iterations: 12345,salt: new TextEncoder().encode(salt)
86
- }
87
- return await substl.deriveBits(pbkdf2,key,256);
88
- }
89
-
90
- async function decryptRaw(bf,key,outV){
91
- if(bf.length < 8){
92
- if(outV){
93
- outV.count = bf.length
94
- }
95
- throw 'err'
96
- }
97
- let count = 0;
98
- for (let i = 0; i < 4; i ++) {
99
- count |= ((bf[i] ^ bf[i + 4] ^ i) << ((3 - i) * 8))
100
- }
101
-
102
- if(outV){
103
- outV.count = count
104
- }
105
- if (bf.length < count) {
106
- return
107
- }
108
-
109
- let bfIv = bf.slice(4,20)
110
- let bfCipher = bf.slice(20,count )
111
-
112
- var aeskey = {
113
- name:"AES-CTR",
114
- }
115
- var keyObj = await substl.importKey('raw',key,aeskey,false,['decrypt'])
116
- var aesDec= {name: "AES-CTR",counter:bfIv,length:64};
117
- try{
118
- let bfDec = await substl.decrypt(aesDec,keyObj,bfCipher)
119
- return new Uint8Array(bfDec)
120
- }catch (error) {
121
- throw error
122
- }
123
-
124
- }
125
-
126
- async function decryptBase64Msg(msg64,key){
127
- const base64str = msg64;
128
- const bfMsg = base64js.decode(base64str)
129
- return await decryptRaw(bfMsg,key)
130
-
131
- }
132
- async function checkKey(key){
133
- const keyData = "{{ '' | encrypt_key:page,HEXKEY ,encid}}";
134
- {% assign TestData = HEXKEY | gen_test_data_forkey %}
135
- const arrTest = '{{ TestData }}'.split('.');
136
- const testData = arrTest[0];
137
- const testDataEnc = arrTest[1];
138
- const bfTestData = base64js.decode(testDataEnc)
139
-
140
-
141
- const bfKeyData = base64js.decode(keyData)
142
- let keyBf = null
143
- let C = 0;
144
- let sum = 0;
145
- while (C ++ < 400 ) {
146
- if (sum >= bfKeyData.length ) {
147
- break
148
- }
149
- let bfSub = bfKeyData.slice(sum)
150
-
151
- try {
152
- let outV = {count:0}
153
- let d = await decryptRaw(bfSub,key,outV)
154
-
155
- sum += outV.count
156
- if (d) {
157
- let dec = await decryptRaw(bfTestData,d)
158
- let s = new TextDecoder().decode(dec)
159
- if(s == testData){
160
- keyBf = d;
161
- break;
162
- }
163
- }else{
164
-
165
- }
166
-
167
-
168
- } catch (error) {
169
-
170
- }
171
- }
172
-
173
- return keyBf
174
- }
175
-
176
- async function decrypt (key0,isCached){
177
- // const key = Uint8Array([...]); // 32 bytes key
178
- var key = ''
179
- if(isCached){
180
- key = readKey()
181
- }
182
- else{
183
- var keyS = preFix + key0 + preFix
184
- key = await genKey(keyS)
185
- }
186
- if (key.length == 0) {
187
- return
188
- }
189
- try {
190
- let keyBf = await checkKey(key)
191
- if(!keyBf){
192
- throw 'error psw'
193
- }
194
- var bfDec = await decryptBase64Msg(contentEnc,keyBf)
195
- var plain = new TextDecoder().decode(bfDec);
196
- setKey(key)
197
- document.getElementById("encrypted").style.display = 'none'
198
- // / show decrypted
199
-
200
- document.getElementById("decrypted").style.display = 'block'
201
- document.getElementById("decryptContent").innerHTML = plain
57
+ {% include encrypt_page.js %}
202
58
 
203
- const DECFUN = window['_after_dec_fun']
204
-
205
- if (DECFUN && typeof DECFUN == 'function') {
206
- DECFUN()
207
- }
208
- setTimeout(function(){
209
- var loadevent = document.createEvent("Event")
210
- loadevent.initEvent("load", true, true)
211
-
212
- var DOMContentLoaded_event = document.createEvent("Event")
213
- DOMContentLoaded_event.initEvent("DOMContentLoaded", true, true)
214
-
215
- window.dispatchEvent(loadevent)
216
- window.dispatchEvent(DOMContentLoaded_event)
217
-
218
-
219
-
220
- }, 100);
221
- } catch (error) {
222
- console.log(error)
223
- // alert("wrong password.")
224
- document.getElementById('passwordinput').classList.add('errPsw');
225
- setTimeout(() => {
226
- document.getElementById('passwordinput').classList.remove('errPsw')
227
- }, 500);
228
- }
229
- }
230
-
231
- document.getElementById("DecryptBtn").onclick = function(){
232
- var key = document.getElementById("passwordinput").value
233
- decrypt(key);
234
- }
235
-
236
- document.getElementById("EncryptBtn").onclick = function(){
237
- /// hide input
238
- document.getElementById("encrypted").style.display = 'block'
239
- // / show decrypted
240
- document.getElementById("decrypted").style.display = "none"
241
- document.getElementById('decryptContent').innerHTML = ':)'
242
-
243
- clearKey()
244
59
 
245
- const ENCFUN = window['_after_enc_fun']
246
- if (ENCFUN && typeof ENCFUN == 'function') {
247
- ENCFUN()
248
- }
249
- }
60
+ /******************************************************************/
250
61
 
251
-
252
62
 
253
- document.getElementById("ClearBtn1").onclick = function(){
254
- localStorage.clear();
255
- document.getElementById('passwordinput').value = ''
256
- }
257
- document.getElementById("ClearBtn2").onclick = function(){
258
- localStorage.clear();
259
- }
63
+ {%- assign HEXKEY = '' | rand_bytes:32 %}
64
+ {% assign TestData = HEXKEY | gen_test_data_forkey %}
260
65
 
261
66
 
262
-
263
-
264
-
265
- {% if site.theme_config.forbid_cache_password %}
266
- function readKey(){
267
- }
268
- function setKey(value){
269
- }
270
- function clearKey() {
271
- }
272
- {% else %}
273
- function readKey(){
274
- var key = encid;
275
- var v = localStorage.getItem(key)
276
- if (v) {
277
- return base64js.decode(v)
278
- }else{
279
- return null
280
- }
281
- }
282
- function setKey(value){
283
- var key = encid
284
- var arr = new Uint8Array(value)
285
- var b64 = base64js.encode(arr)
286
- return localStorage.setItem(key,b64)
287
- }
288
- function clearKey() {
289
- var key = encid
290
- localStorage.removeItem(key)
291
- }
292
- var cachekey = readKey()
293
- if(cachekey){
294
- decrypt(cachekey,true)
295
- }
296
-
297
- {% endif %}
298
-
299
-
300
-
301
- }()
302
-
303
-
67
+ const contentEnc = '{{ content | encrypt_content_v2:HEXKEY }}';
68
+ const keyData = '{{ '' | encrypt_key:page,HEXKEY ,encid}}';
69
+ const TestData = '{{ TestData }}'
70
+ const preFix = '{{encid}}';
71
+ {% if site.theme_config.forbid_cache_password -%}
72
+ const forbid_cache_password = true;
73
+ {% else -%}
74
+ const forbid_cache_password = false;
75
+ {%- endif %}
76
+
77
+ _InitEnc(preFix,contentEnc,keyData,TestData,forbid_cache_password)
304
78
  </script>
305
79
 
@@ -1,128 +1,6 @@
1
- ;function hm_getPostData( endYear ,_allyearurl) {
2
- endYear = ('' + endYear).substring(0,4)
3
-
4
- let arr = _allyearurl.split("/");
5
- arr.pop();
6
- const jsonUrlBase = arr.join("/");
7
-
8
- var GDATA = window['__GDATA__']
9
- if (!GDATA) {
10
- GDATA = {}
11
- window['__GDATA__']
12
- }
13
-
14
-
15
- let queue = window._y_queue || []
16
- window._y_queue = queue;
17
-
18
-
19
- function getAllYearCfg(){
20
-
21
-
22
- if (GDATA['_allYear']) {
23
- return GDATA['_allYear'];
24
- }
25
-
26
- if (window._isFetchAllYearData == 1) {
27
- return new Promise(r=>{
28
- queue.push(r);
29
- })
30
- }
31
-
32
-
33
- window._isFetchAllYearData = 1;
34
- return fetch(_allyearurl)
35
- .then((r) => r.json())
36
- .then(d => {
37
- window._isFetchAllYearData = 0;
38
- if (queue.length) {
39
- queue.forEach(calback=>{calback(d)});
40
- queue.length = 0;
41
- }
42
- GDATA['_allYear'] = d ;return d ;})
43
- }
44
-
45
- function getYearData(year) {
46
- year = '' + year
47
-
48
- if(GDATA[year]){
49
- return GDATA[year]
50
- }
51
-
52
- let queueFlgKey = '_singleyearFlg' + year
53
- let queueArrKey = '_singleyearQueue' + year
54
- if (GDATA[queueFlgKey] == 1) {
55
- // console.log('put in queue',year,Math.random())
56
- let arrQueue = GDATA[queueArrKey]
57
- if (!arrQueue) {
58
- arrQueue = []
59
- GDATA[queueArrKey] = arrQueue;
60
- }
61
-
62
- return new Promise(r=>{
63
- arrQueue.push(r);
64
- });
65
- }
66
-
67
-
68
- GDATA[queueFlgKey] = 1;
69
- // console.log('RealQuery',year,Math.random())
70
- return fetch(`${jsonUrlBase}/${year}.json`)
71
- .then((r) => r.json())
72
- .then(d=>{
73
- GDATA[queueFlgKey] = 0 ;GDATA[year] = d;
74
- let queue = GDATA[queueArrKey];
75
- // console.log('queryFinish',year)
76
- if(queue && queue.length){
77
- queue.forEach(cb=>{
78
- // console.log('queryFinishQueue',year,queue.length,Math.random());
79
- cb(d);})
80
- queue.length = 0;
81
- GDATA[queueArrKey] = undefined
82
- }
83
-
84
- return d})
85
- .catch((e) => {
86
- return null;
87
- });
88
- }
89
-
90
- function _getAllData() {
91
- let year = "" + endYear
92
- let preYear = "" + (Number(year) - 1);
93
- return getAllYearCfg()
94
- .then((d) => {
95
- let yearCfg = d;
96
-
97
- let arr = [];
98
- if (yearCfg[year]) {
99
- arr.push(getYearData(year));
100
- }
101
-
102
- if (yearCfg[preYear]) {
103
- arr.push(getYearData(preYear));
104
- }
105
- return Promise.all(arr).then((alldata) => {
106
- let combineData = {};
107
- let d1 = alldata[0];
108
- let d2 = alldata[1];
109
-
110
-
111
-
112
- if(d1 && d1.year){
113
- combineData[d1.year] = d1
114
- }
115
-
116
- if(d2 && d2.year){
117
- combineData[d2.year] = d2
118
- }
119
-
120
- return Promise.resolve(combineData)
121
- });
122
- });
123
- }
124
-
125
-
126
- return _getAllData()
127
-
128
- };
1
+ function hm_getPostData(e,t){e=(""+e).substring(0,4);let n=t.split("/");n.pop();const r=n.join("/");var l=window.__GDATA__;l||(l={},window.__GDATA__);let a=window._y_queue||[];function i(e){
2
+ if(l[e=""+e])return l[e];let t="_singleyearFlg"+e,n="_singleyearQueue"+e;if(1==l[t]){let e=l[n];return e||(e=[],l[n]=e),new Promise((t=>{e.push(t)}))}return l[t]=1,
3
+ fetch(`${r}/${e}.json`).then((e=>e.json())).then((r=>{l[t]=0,l[e]=r;let a=l[n];return a&&a.length&&(a.forEach((e=>{e(r)})),a.length=0,l[n]=void 0),r})).catch((e=>null))}return window._y_queue=a,
4
+ function(){let n=""+e,r=""+(Number(n)-1);return(l._allYear?l._allYear:1==window._isFetchAllYearData?new Promise((e=>{a.push(e)})):(window._isFetchAllYearData=1,
5
+ fetch(t).then((e=>e.json())).then((e=>(window._isFetchAllYearData=0,a.length&&(a.forEach((t=>{t(e)})),a.length=0),l._allYear=e,e))))).then((e=>{let t=e,l=[];return t[n]&&l.push(i(n)),
6
+ t[r]&&l.push(i(r)),Promise.all(l).then((e=>{let t={},n=e[0],r=e[1];return n&&n.year&&(t[n.year]=n),r&&r.year&&(t[r.year]=r),Promise.resolve(t)}))}))}()}