From 001958dd307faacea581b8ad385761150da91812 Mon Sep 17 00:00:00 2001 From: Chavy Date: Wed, 24 Jun 2020 13:32:38 +0800 Subject: [PATCH 001/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[chavy.boxjs.json]:?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E8=8B=8F=E5=AE=81=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/chavy.boxjs.json | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/box/chavy.boxjs.json b/box/chavy.boxjs.json index 0d60e6a40..e3fa81337 100644 --- a/box/chavy.boxjs.json +++ b/box/chavy.boxjs.json @@ -11,10 +11,7 @@ "keys": ["chavy_tokenurl_10086", "chavy_tokenheader_10086", "chavy_signurl_10086", "chavy_signheader_10086"], "author": "@chavyleung", "repo": "https://github.com/chavyleung/scripts/blob/master/10086/10086.js", - "icons": [ - "https://raw.githubusercontent.com/Orz-3/mini/master/10086.png", - "https://raw.githubusercontent.com/Orz-3/task/master/10086.png" - ] + "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/10086.png", "https://raw.githubusercontent.com/Orz-3/task/master/10086.png"] }, { "id": "chavyleung.suning", @@ -22,10 +19,7 @@ "keys": ["chavy_login_url_suning", "chavy_login_body_suning", "chavy_login_header_suning", "chavy_sign_url_suning", "chavy_sign_header_suning", "chavy_signweb_url_suning", "snyg_userTokenKey", "chavy_signweb_header_suning", "chavy_signgame_url_suning", "chavy_signgame_header_suning", "chavy_signgetgame_url_suning", "chavy_signgetgame_header_suning"], "author": "@chavyleung", "repo": "https://github.com/chavyleung/scripts/blob/master/suning/suning.js", - "icons": [ - "https://raw.githubusercontent.com/Orz-3/mini/master/suning.png", - "https://raw.githubusercontent.com/Orz-3/task/master/weibo.png" - ] + "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/suning.png", "https://raw.githubusercontent.com/Orz-3/task/master/suning.png"] }, { "id": "chavyleung.bilibili.live", @@ -33,10 +27,7 @@ "keys": ["chavy_cookie_bilibili"], "author": "@chavyleung", "repo": "https://github.com/chavyleung/scripts/blob/master/bilibili/bilibili.js", - "icons": [ - "https://raw.githubusercontent.com/Orz-3/mini/master/bilibili.png", - "https://raw.githubusercontent.com/Orz-3/task/master/bilibili.png" - ] + "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/bilibili.png", "https://raw.githubusercontent.com/Orz-3/task/master/bilibili.png"] }, { "id": "chavyleung.meituan", @@ -44,10 +35,7 @@ "keys": ["chavy_tokenurl_meituan", "chavy_tokenheader_meituan", "chavy_signurl_meituan", "chavy_signheader_meituan", "chavy_signbody_meituan"], "author": "@chavyleung", "repo": "https://github.com/chavyleung/scripts/blob/master/meituan/meituan.js", - "icons": [ - "https://raw.githubusercontent.com/Orz-3/mini/master/meituan.png", - "https://raw.githubusercontent.com/Orz-3/task/master/meituan.png" - ] + "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/meituan.png", "https://raw.githubusercontent.com/Orz-3/task/master/meituan.png"] }, { "id": "chavyleung.mgtv", @@ -55,10 +43,7 @@ "keys": ["chavy_signurl_mgtv", "chavy_signheader_mgtv"], "author": "@chavyleung", "repo": "https://github.com/chavyleung/scripts/blob/master/mgtv/mgtv.js", - "icons": [ - "https://raw.githubusercontent.com/Orz-3/mini/master/mgtv.png", - "https://raw.githubusercontent.com/Orz-3/task/master/mgtv.png" - ] + "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/mgtv.png", "https://raw.githubusercontent.com/Orz-3/task/master/mgtv.png"] } ] -} \ No newline at end of file +} From 301493bffc6c1b036fd110b9a46d8b6caedeba8c Mon Sep 17 00:00:00 2001 From: Chavy Date: Wed, 24 Jun 2020 18:58:48 +0800 Subject: [PATCH 002/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[chavy.boxjs.json]:?= =?UTF-8?q?=20=E5=A2=9E=E5=8A=A0=E5=8A=A0=E6=B2=B9=E5=B9=BF=E4=B8=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/chavy.boxjs.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/box/chavy.boxjs.json b/box/chavy.boxjs.json index e3fa81337..85fe492b2 100644 --- a/box/chavy.boxjs.json +++ b/box/chavy.boxjs.json @@ -44,6 +44,14 @@ "author": "@chavyleung", "repo": "https://github.com/chavyleung/scripts/blob/master/mgtv/mgtv.js", "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/mgtv.png", "https://raw.githubusercontent.com/Orz-3/task/master/mgtv.png"] + }, + { + "id": "gdoil", + "name": "加油广东", + "keys": ["chavy_signurl_gdoil", "chavy_signheader_gdoil"], + "author": "@chavyleung", + "repo": "https://github.com/chavyleung/scripts/tree/master/gdoil", + "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/gdoil.png", "https://raw.githubusercontent.com/Orz-3/task/master/gdoil.png"] } ] } From 54a74b922d4b0e54dfe8e0ae54b8223dfcc9d4b9 Mon Sep 17 00:00:00 2001 From: Chavy Date: Wed, 24 Jun 2020 23:59:50 +0800 Subject: [PATCH 003/626] =?UTF-8?q?=E6=B7=BB=E5=8A=A0[10086]=E6=9F=A5?= =?UTF-8?q?=E8=AF=9D=E8=B4=B9=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 10086/10086.fee.cookie.js | 48 ++++++++++++++++++++++ 10086/10086.fee.js | 84 +++++++++++++++++++++++++++++++++++++++ box/chavy.boxjs.json | 2 +- package.json | 1 + yarn.lock | 5 +++ 5 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 10086/10086.fee.cookie.js create mode 100644 10086/10086.fee.js diff --git a/10086/10086.fee.cookie.js b/10086/10086.fee.cookie.js new file mode 100644 index 000000000..04fa653ee --- /dev/null +++ b/10086/10086.fee.cookie.js @@ -0,0 +1,48 @@ +/** + * + * hostname = clientaccess.10086.cn + * + * # Surge + * Rewrite: CMCC = type=http-request,pattern=^https:\/\/clientaccess.10086.cn\/biz-orange\/LN\/uamrandcodelogin\/autoLogin,script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/10086/10086.fee.cookie.js,requires-body=true,debug=true + * Rewrite: CMCC = type=http-request,pattern=^https:\/\/clientaccess.10086.cn\/biz-orange\/BN\/realFeeQuery\/getRealFee,script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/10086/10086.fee.cookie.js,requires-body=true,debug=true + * Tasks: 10086-查话费 = type=cron,cronexp=10 0 * * *,script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/10086/10086.fee.js,wake-system=true + * + * # QuanX + * ^https:\/\/clientaccess.10086.cn\/biz-orange\/LN\/uamrandcodelogin\/autoLogin url script-request-body https://raw.githubusercontent.com/chavyleung/scripts/master/10086/10086.fee.cookie.js + * ^https:\/\/clientaccess.10086.cn\/biz-orange\/BN\/realFeeQuery\/getRealFee url script-request-body https://raw.githubusercontent.com/chavyleung/scripts/master/10086/10086.fee.cookie.js + * 10 0 * * * https://raw.githubusercontent.com/chavyleung/scripts/master/10086/10086.fee.js, tag=10086-查话费 + * + * # Loon + * http-response ^https:\/\/clientaccess.10086.cn\/biz-orange\/LN\/uamrandcodelogin\/autoLogin script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/10086/10086.fee.cookie.js, requires-body=true + * http-response ^https:\/\/clientaccess.10086.cn\/biz-orange\/BN\/realFeeQuery\/getRealFee script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/10086/10086.fee.cookie.js, requires-body=true + * cron "10 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/10086/10086.fee.cookie.js + * + */ + +const $ = new Env('中国移动') +$.KEY_autologin = 'chavy_autologin_cmcc' +$.KEY_getfee = 'chavy_getfee_cmcc' + +!(async () => { + const session = {} + session.url = $request.url + session.body = $request.body + session.headers = $request.headers + let key = '' + if (/autoLogin/.test(session.url)) { + key = $.KEY_autologin + } else if (/getRealFee/.test(session.url)) { + key = $.KEY_getfee + } + if ($.setdata(JSON.stringify(session), key)) { + $.subt = `获取会话: 成功! (${key})` + } else { + $.subt = `获取会话: 失败! (${key})` + } + $.msg($.name, $.subt, $.desc) +})() + .catch((e) => $.logErr(e)) + .finally(() => $.done()) + +// prettier-ignore +function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),h=JSON.stringify(this.data);e?this.fs.writeFileSync(t,h):i?this.fs.writeFileSync(s,h):this.fs.writeFileSync(t,h)}}getdata(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setdata(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t)):this.isNode()&&(this.got=this.got?this.got:require("got"),this.got(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t));else if(this.isNode()){this.got=this.got?this.got:require("got");const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t))}}msg(s=t,e="",i="",h){this.isSurge()||this.isLoon()?$notification.post(s,e,i):this.isQuanX()&&$notify(s,e,i),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} diff --git a/10086/10086.fee.js b/10086/10086.fee.js new file mode 100644 index 000000000..d8335e245 --- /dev/null +++ b/10086/10086.fee.js @@ -0,0 +1,84 @@ +// prettier-ignore +!function (t, r) { "object" == typeof exports ? module.exports = exports = r() : "function" == typeof define && define.amd ? define([], r) : t.CryptoJS = r() }(this, function () { + var t = t || function (t, r) { var e = Object.create || function () { function t() { } return function (r) { var e; return t.prototype = r, e = new t, t.prototype = null, e } }(), i = {}, n = i.lib = {}, o = n.Base = function () { return { extend: function (t) { var r = e(this); return t && r.mixIn(t), r.hasOwnProperty("init") && this.init !== r.init || (r.init = function () { r.$super.init.apply(this, arguments) }), r.init.prototype = r, r.$super = this, r }, create: function () { var t = this.extend(); return t.init.apply(t, arguments), t }, init: function () { }, mixIn: function (t) { for (var r in t) t.hasOwnProperty(r) && (this[r] = t[r]); t.hasOwnProperty("toString") && (this.toString = t.toString) }, clone: function () { return this.init.prototype.extend(this) } } }(), s = n.WordArray = o.extend({ init: function (t, e) { t = this.words = t || [], e != r ? this.sigBytes = e : this.sigBytes = 4 * t.length }, toString: function (t) { return (t || c).stringify(this) }, concat: function (t) { var r = this.words, e = t.words, i = this.sigBytes, n = t.sigBytes; if (this.clamp(), i % 4) for (var o = 0; o < n; o++) { var s = e[o >>> 2] >>> 24 - o % 4 * 8 & 255; r[i + o >>> 2] |= s << 24 - (i + o) % 4 * 8 } else for (var o = 0; o < n; o += 4)r[i + o >>> 2] = e[o >>> 2]; return this.sigBytes += n, this }, clamp: function () { var r = this.words, e = this.sigBytes; r[e >>> 2] &= 4294967295 << 32 - e % 4 * 8, r.length = t.ceil(e / 4) }, clone: function () { var t = o.clone.call(this); return t.words = this.words.slice(0), t }, random: function (r) { for (var e, i = [], n = function (r) { var r = r, e = 987654321, i = 4294967295; return function () { e = 36969 * (65535 & e) + (e >> 16) & i, r = 18e3 * (65535 & r) + (r >> 16) & i; var n = (e << 16) + r & i; return n /= 4294967296, n += .5, n * (t.random() > .5 ? 1 : -1) } }, o = 0; o < r; o += 4) { var a = n(4294967296 * (e || t.random())); e = 987654071 * a(), i.push(4294967296 * a() | 0) } return new s.init(i, r) } }), a = i.enc = {}, c = a.Hex = { stringify: function (t) { for (var r = t.words, e = t.sigBytes, i = [], n = 0; n < e; n++) { var o = r[n >>> 2] >>> 24 - n % 4 * 8 & 255; i.push((o >>> 4).toString(16)), i.push((15 & o).toString(16)) } return i.join("") }, parse: function (t) { for (var r = t.length, e = [], i = 0; i < r; i += 2)e[i >>> 3] |= parseInt(t.substr(i, 2), 16) << 24 - i % 8 * 4; return new s.init(e, r / 2) } }, h = a.Latin1 = { stringify: function (t) { for (var r = t.words, e = t.sigBytes, i = [], n = 0; n < e; n++) { var o = r[n >>> 2] >>> 24 - n % 4 * 8 & 255; i.push(String.fromCharCode(o)) } return i.join("") }, parse: function (t) { for (var r = t.length, e = [], i = 0; i < r; i++)e[i >>> 2] |= (255 & t.charCodeAt(i)) << 24 - i % 4 * 8; return new s.init(e, r) } }, l = a.Utf8 = { stringify: function (t) { try { return decodeURIComponent(escape(h.stringify(t))) } catch (t) { throw new Error("Malformed UTF-8 data") } }, parse: function (t) { return h.parse(unescape(encodeURIComponent(t))) } }, f = n.BufferedBlockAlgorithm = o.extend({ reset: function () { this._data = new s.init, this._nDataBytes = 0 }, _append: function (t) { "string" == typeof t && (t = l.parse(t)), this._data.concat(t), this._nDataBytes += t.sigBytes }, _process: function (r) { var e = this._data, i = e.words, n = e.sigBytes, o = this.blockSize, a = 4 * o, c = n / a; c = r ? t.ceil(c) : t.max((0 | c) - this._minBufferSize, 0); var h = c * o, l = t.min(4 * h, n); if (h) { for (var f = 0; f < h; f += o)this._doProcessBlock(i, f); var u = i.splice(0, h); e.sigBytes -= l } return new s.init(u, l) }, clone: function () { var t = o.clone.call(this); return t._data = this._data.clone(), t }, _minBufferSize: 0 }), u = (n.Hasher = f.extend({ cfg: o.extend(), init: function (t) { this.cfg = this.cfg.extend(t), this.reset() }, reset: function () { f.reset.call(this), this._doReset() }, update: function (t) { return this._append(t), this._process(), this }, finalize: function (t) { t && this._append(t); var r = this._doFinalize(); return r }, blockSize: 16, _createHelper: function (t) { return function (r, e) { return new t.init(e).finalize(r) } }, _createHmacHelper: function (t) { return function (r, e) { return new u.HMAC.init(t, e).finalize(r) } } }), i.algo = {}); return i }(Math); return function () { function r(t, r, e) { for (var i = [], o = 0, s = 0; s < r; s++)if (s % 4) { var a = e[t.charCodeAt(s - 1)] << s % 4 * 2, c = e[t.charCodeAt(s)] >>> 6 - s % 4 * 2; i[o >>> 2] |= (a | c) << 24 - o % 4 * 8, o++ } return n.create(i, o) } var e = t, i = e.lib, n = i.WordArray, o = e.enc; o.Base64 = { stringify: function (t) { var r = t.words, e = t.sigBytes, i = this._map; t.clamp(); for (var n = [], o = 0; o < e; o += 3)for (var s = r[o >>> 2] >>> 24 - o % 4 * 8 & 255, a = r[o + 1 >>> 2] >>> 24 - (o + 1) % 4 * 8 & 255, c = r[o + 2 >>> 2] >>> 24 - (o + 2) % 4 * 8 & 255, h = s << 16 | a << 8 | c, l = 0; l < 4 && o + .75 * l < e; l++)n.push(i.charAt(h >>> 6 * (3 - l) & 63)); var f = i.charAt(64); if (f) for (; n.length % 4;)n.push(f); return n.join("") }, parse: function (t) { var e = t.length, i = this._map, n = this._reverseMap; if (!n) { n = this._reverseMap = []; for (var o = 0; o < i.length; o++)n[i.charCodeAt(o)] = o } var s = i.charAt(64); if (s) { var a = t.indexOf(s); a !== -1 && (e = a) } return r(t, e, n) }, _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" } }(), function (r) { function e(t, r, e, i, n, o, s) { var a = t + (r & e | ~r & i) + n + s; return (a << o | a >>> 32 - o) + r } function i(t, r, e, i, n, o, s) { var a = t + (r & i | e & ~i) + n + s; return (a << o | a >>> 32 - o) + r } function n(t, r, e, i, n, o, s) { var a = t + (r ^ e ^ i) + n + s; return (a << o | a >>> 32 - o) + r } function o(t, r, e, i, n, o, s) { var a = t + (e ^ (r | ~i)) + n + s; return (a << o | a >>> 32 - o) + r } var s = t, a = s.lib, c = a.WordArray, h = a.Hasher, l = s.algo, f = []; !function () { for (var t = 0; t < 64; t++)f[t] = 4294967296 * r.abs(r.sin(t + 1)) | 0 }(); var u = l.MD5 = h.extend({ _doReset: function () { this._hash = new c.init([1732584193, 4023233417, 2562383102, 271733878]) }, _doProcessBlock: function (t, r) { for (var s = 0; s < 16; s++) { var a = r + s, c = t[a]; t[a] = 16711935 & (c << 8 | c >>> 24) | 4278255360 & (c << 24 | c >>> 8) } var h = this._hash.words, l = t[r + 0], u = t[r + 1], d = t[r + 2], v = t[r + 3], p = t[r + 4], _ = t[r + 5], y = t[r + 6], g = t[r + 7], B = t[r + 8], w = t[r + 9], k = t[r + 10], S = t[r + 11], m = t[r + 12], x = t[r + 13], b = t[r + 14], H = t[r + 15], z = h[0], A = h[1], C = h[2], D = h[3]; z = e(z, A, C, D, l, 7, f[0]), D = e(D, z, A, C, u, 12, f[1]), C = e(C, D, z, A, d, 17, f[2]), A = e(A, C, D, z, v, 22, f[3]), z = e(z, A, C, D, p, 7, f[4]), D = e(D, z, A, C, _, 12, f[5]), C = e(C, D, z, A, y, 17, f[6]), A = e(A, C, D, z, g, 22, f[7]), z = e(z, A, C, D, B, 7, f[8]), D = e(D, z, A, C, w, 12, f[9]), C = e(C, D, z, A, k, 17, f[10]), A = e(A, C, D, z, S, 22, f[11]), z = e(z, A, C, D, m, 7, f[12]), D = e(D, z, A, C, x, 12, f[13]), C = e(C, D, z, A, b, 17, f[14]), A = e(A, C, D, z, H, 22, f[15]), z = i(z, A, C, D, u, 5, f[16]), D = i(D, z, A, C, y, 9, f[17]), C = i(C, D, z, A, S, 14, f[18]), A = i(A, C, D, z, l, 20, f[19]), z = i(z, A, C, D, _, 5, f[20]), D = i(D, z, A, C, k, 9, f[21]), C = i(C, D, z, A, H, 14, f[22]), A = i(A, C, D, z, p, 20, f[23]), z = i(z, A, C, D, w, 5, f[24]), D = i(D, z, A, C, b, 9, f[25]), C = i(C, D, z, A, v, 14, f[26]), A = i(A, C, D, z, B, 20, f[27]), z = i(z, A, C, D, x, 5, f[28]), D = i(D, z, A, C, d, 9, f[29]), C = i(C, D, z, A, g, 14, f[30]), A = i(A, C, D, z, m, 20, f[31]), z = n(z, A, C, D, _, 4, f[32]), D = n(D, z, A, C, B, 11, f[33]), C = n(C, D, z, A, S, 16, f[34]), A = n(A, C, D, z, b, 23, f[35]), z = n(z, A, C, D, u, 4, f[36]), D = n(D, z, A, C, p, 11, f[37]), C = n(C, D, z, A, g, 16, f[38]), A = n(A, C, D, z, k, 23, f[39]), z = n(z, A, C, D, x, 4, f[40]), D = n(D, z, A, C, l, 11, f[41]), C = n(C, D, z, A, v, 16, f[42]), A = n(A, C, D, z, y, 23, f[43]), z = n(z, A, C, D, w, 4, f[44]), D = n(D, z, A, C, m, 11, f[45]), C = n(C, D, z, A, H, 16, f[46]), A = n(A, C, D, z, d, 23, f[47]), z = o(z, A, C, D, l, 6, f[48]), D = o(D, z, A, C, g, 10, f[49]), C = o(C, D, z, A, b, 15, f[50]), A = o(A, C, D, z, _, 21, f[51]), z = o(z, A, C, D, m, 6, f[52]), D = o(D, z, A, C, v, 10, f[53]), C = o(C, D, z, A, k, 15, f[54]), A = o(A, C, D, z, u, 21, f[55]), z = o(z, A, C, D, B, 6, f[56]), D = o(D, z, A, C, H, 10, f[57]), C = o(C, D, z, A, y, 15, f[58]), A = o(A, C, D, z, x, 21, f[59]), z = o(z, A, C, D, p, 6, f[60]), D = o(D, z, A, C, S, 10, f[61]), C = o(C, D, z, A, d, 15, f[62]), A = o(A, C, D, z, w, 21, f[63]), h[0] = h[0] + z | 0, h[1] = h[1] + A | 0, h[2] = h[2] + C | 0, h[3] = h[3] + D | 0 }, _doFinalize: function () { var t = this._data, e = t.words, i = 8 * this._nDataBytes, n = 8 * t.sigBytes; e[n >>> 5] |= 128 << 24 - n % 32; var o = r.floor(i / 4294967296), s = i; e[(n + 64 >>> 9 << 4) + 15] = 16711935 & (o << 8 | o >>> 24) | 4278255360 & (o << 24 | o >>> 8), e[(n + 64 >>> 9 << 4) + 14] = 16711935 & (s << 8 | s >>> 24) | 4278255360 & (s << 24 | s >>> 8), t.sigBytes = 4 * (e.length + 1), this._process(); for (var a = this._hash, c = a.words, h = 0; h < 4; h++) { var l = c[h]; c[h] = 16711935 & (l << 8 | l >>> 24) | 4278255360 & (l << 24 | l >>> 8) } return a }, clone: function () { var t = h.clone.call(this); return t._hash = this._hash.clone(), t } }); s.MD5 = h._createHelper(u), s.HmacMD5 = h._createHmacHelper(u) }(Math), function () { var r = t, e = r.lib, i = e.WordArray, n = e.Hasher, o = r.algo, s = [], a = o.SHA1 = n.extend({ _doReset: function () { this._hash = new i.init([1732584193, 4023233417, 2562383102, 271733878, 3285377520]) }, _doProcessBlock: function (t, r) { for (var e = this._hash.words, i = e[0], n = e[1], o = e[2], a = e[3], c = e[4], h = 0; h < 80; h++) { if (h < 16) s[h] = 0 | t[r + h]; else { var l = s[h - 3] ^ s[h - 8] ^ s[h - 14] ^ s[h - 16]; s[h] = l << 1 | l >>> 31 } var f = (i << 5 | i >>> 27) + c + s[h]; f += h < 20 ? (n & o | ~n & a) + 1518500249 : h < 40 ? (n ^ o ^ a) + 1859775393 : h < 60 ? (n & o | n & a | o & a) - 1894007588 : (n ^ o ^ a) - 899497514, c = a, a = o, o = n << 30 | n >>> 2, n = i, i = f } e[0] = e[0] + i | 0, e[1] = e[1] + n | 0, e[2] = e[2] + o | 0, e[3] = e[3] + a | 0, e[4] = e[4] + c | 0 }, _doFinalize: function () { var t = this._data, r = t.words, e = 8 * this._nDataBytes, i = 8 * t.sigBytes; return r[i >>> 5] |= 128 << 24 - i % 32, r[(i + 64 >>> 9 << 4) + 14] = Math.floor(e / 4294967296), r[(i + 64 >>> 9 << 4) + 15] = e, t.sigBytes = 4 * r.length, this._process(), this._hash }, clone: function () { var t = n.clone.call(this); return t._hash = this._hash.clone(), t } }); r.SHA1 = n._createHelper(a), r.HmacSHA1 = n._createHmacHelper(a) }(), function (r) { var e = t, i = e.lib, n = i.WordArray, o = i.Hasher, s = e.algo, a = [], c = []; !function () { function t(t) { for (var e = r.sqrt(t), i = 2; i <= e; i++)if (!(t % i)) return !1; return !0 } function e(t) { return 4294967296 * (t - (0 | t)) | 0 } for (var i = 2, n = 0; n < 64;)t(i) && (n < 8 && (a[n] = e(r.pow(i, .5))), c[n] = e(r.pow(i, 1 / 3)), n++), i++ }(); var h = [], l = s.SHA256 = o.extend({ _doReset: function () { this._hash = new n.init(a.slice(0)) }, _doProcessBlock: function (t, r) { for (var e = this._hash.words, i = e[0], n = e[1], o = e[2], s = e[3], a = e[4], l = e[5], f = e[6], u = e[7], d = 0; d < 64; d++) { if (d < 16) h[d] = 0 | t[r + d]; else { var v = h[d - 15], p = (v << 25 | v >>> 7) ^ (v << 14 | v >>> 18) ^ v >>> 3, _ = h[d - 2], y = (_ << 15 | _ >>> 17) ^ (_ << 13 | _ >>> 19) ^ _ >>> 10; h[d] = p + h[d - 7] + y + h[d - 16] } var g = a & l ^ ~a & f, B = i & n ^ i & o ^ n & o, w = (i << 30 | i >>> 2) ^ (i << 19 | i >>> 13) ^ (i << 10 | i >>> 22), k = (a << 26 | a >>> 6) ^ (a << 21 | a >>> 11) ^ (a << 7 | a >>> 25), S = u + k + g + c[d] + h[d], m = w + B; u = f, f = l, l = a, a = s + S | 0, s = o, o = n, n = i, i = S + m | 0 } e[0] = e[0] + i | 0, e[1] = e[1] + n | 0, e[2] = e[2] + o | 0, e[3] = e[3] + s | 0, e[4] = e[4] + a | 0, e[5] = e[5] + l | 0, e[6] = e[6] + f | 0, e[7] = e[7] + u | 0 }, _doFinalize: function () { var t = this._data, e = t.words, i = 8 * this._nDataBytes, n = 8 * t.sigBytes; return e[n >>> 5] |= 128 << 24 - n % 32, e[(n + 64 >>> 9 << 4) + 14] = r.floor(i / 4294967296), e[(n + 64 >>> 9 << 4) + 15] = i, t.sigBytes = 4 * e.length, this._process(), this._hash }, clone: function () { var t = o.clone.call(this); return t._hash = this._hash.clone(), t } }); e.SHA256 = o._createHelper(l), e.HmacSHA256 = o._createHmacHelper(l) }(Math), function () { function r(t) { return t << 8 & 4278255360 | t >>> 8 & 16711935 } var e = t, i = e.lib, n = i.WordArray, o = e.enc; o.Utf16 = o.Utf16BE = { stringify: function (t) { for (var r = t.words, e = t.sigBytes, i = [], n = 0; n < e; n += 2) { var o = r[n >>> 2] >>> 16 - n % 4 * 8 & 65535; i.push(String.fromCharCode(o)) } return i.join("") }, parse: function (t) { for (var r = t.length, e = [], i = 0; i < r; i++)e[i >>> 1] |= t.charCodeAt(i) << 16 - i % 2 * 16; return n.create(e, 2 * r) } }; o.Utf16LE = { stringify: function (t) { for (var e = t.words, i = t.sigBytes, n = [], o = 0; o < i; o += 2) { var s = r(e[o >>> 2] >>> 16 - o % 4 * 8 & 65535); n.push(String.fromCharCode(s)) } return n.join("") }, parse: function (t) { for (var e = t.length, i = [], o = 0; o < e; o++)i[o >>> 1] |= r(t.charCodeAt(o) << 16 - o % 2 * 16); return n.create(i, 2 * e) } } }(), function () { if ("function" == typeof ArrayBuffer) { var r = t, e = r.lib, i = e.WordArray, n = i.init, o = i.init = function (t) { if (t instanceof ArrayBuffer && (t = new Uint8Array(t)), (t instanceof Int8Array || "undefined" != typeof Uint8ClampedArray && t instanceof Uint8ClampedArray || t instanceof Int16Array || t instanceof Uint16Array || t instanceof Int32Array || t instanceof Uint32Array || t instanceof Float32Array || t instanceof Float64Array) && (t = new Uint8Array(t.buffer, t.byteOffset, t.byteLength)), t instanceof Uint8Array) { for (var r = t.byteLength, e = [], i = 0; i < r; i++)e[i >>> 2] |= t[i] << 24 - i % 4 * 8; n.call(this, e, r) } else n.apply(this, arguments) }; o.prototype = i } }(), function (r) { function e(t, r, e) { return t ^ r ^ e } function i(t, r, e) { return t & r | ~t & e } function n(t, r, e) { return (t | ~r) ^ e } function o(t, r, e) { return t & e | r & ~e } function s(t, r, e) { return t ^ (r | ~e) } function a(t, r) { return t << r | t >>> 32 - r } var c = t, h = c.lib, l = h.WordArray, f = h.Hasher, u = c.algo, d = l.create([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]), v = l.create([5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]), p = l.create([11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6]), _ = l.create([8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11]), y = l.create([0, 1518500249, 1859775393, 2400959708, 2840853838]), g = l.create([1352829926, 1548603684, 1836072691, 2053994217, 0]), B = u.RIPEMD160 = f.extend({ _doReset: function () { this._hash = l.create([1732584193, 4023233417, 2562383102, 271733878, 3285377520]) }, _doProcessBlock: function (t, r) { for (var c = 0; c < 16; c++) { var h = r + c, l = t[h]; t[h] = 16711935 & (l << 8 | l >>> 24) | 4278255360 & (l << 24 | l >>> 8) } var f, u, B, w, k, S, m, x, b, H, z = this._hash.words, A = y.words, C = g.words, D = d.words, R = v.words, E = p.words, M = _.words; S = f = z[0], m = u = z[1], x = B = z[2], b = w = z[3], H = k = z[4]; for (var F, c = 0; c < 80; c += 1)F = f + t[r + D[c]] | 0, F += c < 16 ? e(u, B, w) + A[0] : c < 32 ? i(u, B, w) + A[1] : c < 48 ? n(u, B, w) + A[2] : c < 64 ? o(u, B, w) + A[3] : s(u, B, w) + A[4], F |= 0, F = a(F, E[c]), F = F + k | 0, f = k, k = w, w = a(B, 10), B = u, u = F, F = S + t[r + R[c]] | 0, F += c < 16 ? s(m, x, b) + C[0] : c < 32 ? o(m, x, b) + C[1] : c < 48 ? n(m, x, b) + C[2] : c < 64 ? i(m, x, b) + C[3] : e(m, x, b) + C[4], F |= 0, F = a(F, M[c]), F = F + H | 0, S = H, H = b, b = a(x, 10), x = m, m = F; F = z[1] + B + b | 0, z[1] = z[2] + w + H | 0, z[2] = z[3] + k + S | 0, z[3] = z[4] + f + m | 0, z[4] = z[0] + u + x | 0, z[0] = F }, _doFinalize: function () { var t = this._data, r = t.words, e = 8 * this._nDataBytes, i = 8 * t.sigBytes; r[i >>> 5] |= 128 << 24 - i % 32, r[(i + 64 >>> 9 << 4) + 14] = 16711935 & (e << 8 | e >>> 24) | 4278255360 & (e << 24 | e >>> 8), t.sigBytes = 4 * (r.length + 1), this._process(); for (var n = this._hash, o = n.words, s = 0; s < 5; s++) { var a = o[s]; o[s] = 16711935 & (a << 8 | a >>> 24) | 4278255360 & (a << 24 | a >>> 8) } return n }, clone: function () { var t = f.clone.call(this); return t._hash = this._hash.clone(), t } }); c.RIPEMD160 = f._createHelper(B), c.HmacRIPEMD160 = f._createHmacHelper(B) }(Math), function () { var r = t, e = r.lib, i = e.Base, n = r.enc, o = n.Utf8, s = r.algo; s.HMAC = i.extend({ init: function (t, r) { t = this._hasher = new t.init, "string" == typeof r && (r = o.parse(r)); var e = t.blockSize, i = 4 * e; r.sigBytes > i && (r = t.finalize(r)), r.clamp(); for (var n = this._oKey = r.clone(), s = this._iKey = r.clone(), a = n.words, c = s.words, h = 0; h < e; h++)a[h] ^= 1549556828, c[h] ^= 909522486; n.sigBytes = s.sigBytes = i, this.reset() }, reset: function () { var t = this._hasher; t.reset(), t.update(this._iKey) }, update: function (t) { return this._hasher.update(t), this }, finalize: function (t) { var r = this._hasher, e = r.finalize(t); r.reset(); var i = r.finalize(this._oKey.clone().concat(e)); return i } }) }(), function () { var r = t, e = r.lib, i = e.Base, n = e.WordArray, o = r.algo, s = o.SHA1, a = o.HMAC, c = o.PBKDF2 = i.extend({ cfg: i.extend({ keySize: 4, hasher: s, iterations: 1 }), init: function (t) { this.cfg = this.cfg.extend(t) }, compute: function (t, r) { for (var e = this.cfg, i = a.create(e.hasher, t), o = n.create(), s = n.create([1]), c = o.words, h = s.words, l = e.keySize, f = e.iterations; c.length < l;) { var u = i.update(r).finalize(s); i.reset(); for (var d = u.words, v = d.length, p = u, _ = 1; _ < f; _++) { p = i.finalize(p), i.reset(); for (var y = p.words, g = 0; g < v; g++)d[g] ^= y[g] } o.concat(u), h[0]++ } return o.sigBytes = 4 * l, o } }); r.PBKDF2 = function (t, r, e) { return c.create(e).compute(t, r) } }(), function () { var r = t, e = r.lib, i = e.Base, n = e.WordArray, o = r.algo, s = o.MD5, a = o.EvpKDF = i.extend({ cfg: i.extend({ keySize: 4, hasher: s, iterations: 1 }), init: function (t) { this.cfg = this.cfg.extend(t) }, compute: function (t, r) { for (var e = this.cfg, i = e.hasher.create(), o = n.create(), s = o.words, a = e.keySize, c = e.iterations; s.length < a;) { h && i.update(h); var h = i.update(t).finalize(r); i.reset(); for (var l = 1; l < c; l++)h = i.finalize(h), i.reset(); o.concat(h) } return o.sigBytes = 4 * a, o } }); r.EvpKDF = function (t, r, e) { return a.create(e).compute(t, r) } }(), function () { var r = t, e = r.lib, i = e.WordArray, n = r.algo, o = n.SHA256, s = n.SHA224 = o.extend({ _doReset: function () { this._hash = new i.init([3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, 1694076839, 3204075428]) }, _doFinalize: function () { var t = o._doFinalize.call(this); return t.sigBytes -= 4, t } }); r.SHA224 = o._createHelper(s), r.HmacSHA224 = o._createHmacHelper(s) }(), function (r) { var e = t, i = e.lib, n = i.Base, o = i.WordArray, s = e.x64 = {}; s.Word = n.extend({ init: function (t, r) { this.high = t, this.low = r } }), s.WordArray = n.extend({ init: function (t, e) { t = this.words = t || [], e != r ? this.sigBytes = e : this.sigBytes = 8 * t.length }, toX32: function () { for (var t = this.words, r = t.length, e = [], i = 0; i < r; i++) { var n = t[i]; e.push(n.high), e.push(n.low) } return o.create(e, this.sigBytes) }, clone: function () { for (var t = n.clone.call(this), r = t.words = this.words.slice(0), e = r.length, i = 0; i < e; i++)r[i] = r[i].clone(); return t } }) }(), function (r) { var e = t, i = e.lib, n = i.WordArray, o = i.Hasher, s = e.x64, a = s.Word, c = e.algo, h = [], l = [], f = []; !function () { for (var t = 1, r = 0, e = 0; e < 24; e++) { h[t + 5 * r] = (e + 1) * (e + 2) / 2 % 64; var i = r % 5, n = (2 * t + 3 * r) % 5; t = i, r = n } for (var t = 0; t < 5; t++)for (var r = 0; r < 5; r++)l[t + 5 * r] = r + (2 * t + 3 * r) % 5 * 5; for (var o = 1, s = 0; s < 24; s++) { for (var c = 0, u = 0, d = 0; d < 7; d++) { if (1 & o) { var v = (1 << d) - 1; v < 32 ? u ^= 1 << v : c ^= 1 << v - 32 } 128 & o ? o = o << 1 ^ 113 : o <<= 1 } f[s] = a.create(c, u) } }(); var u = []; !function () { for (var t = 0; t < 25; t++)u[t] = a.create() }(); var d = c.SHA3 = o.extend({ cfg: o.cfg.extend({ outputLength: 512 }), _doReset: function () { for (var t = this._state = [], r = 0; r < 25; r++)t[r] = new a.init; this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32 }, _doProcessBlock: function (t, r) { for (var e = this._state, i = this.blockSize / 2, n = 0; n < i; n++) { var o = t[r + 2 * n], s = t[r + 2 * n + 1]; o = 16711935 & (o << 8 | o >>> 24) | 4278255360 & (o << 24 | o >>> 8), s = 16711935 & (s << 8 | s >>> 24) | 4278255360 & (s << 24 | s >>> 8); var a = e[n]; a.high ^= s, a.low ^= o } for (var c = 0; c < 24; c++) { for (var d = 0; d < 5; d++) { for (var v = 0, p = 0, _ = 0; _ < 5; _++) { var a = e[d + 5 * _]; v ^= a.high, p ^= a.low } var y = u[d]; y.high = v, y.low = p } for (var d = 0; d < 5; d++)for (var g = u[(d + 4) % 5], B = u[(d + 1) % 5], w = B.high, k = B.low, v = g.high ^ (w << 1 | k >>> 31), p = g.low ^ (k << 1 | w >>> 31), _ = 0; _ < 5; _++) { var a = e[d + 5 * _]; a.high ^= v, a.low ^= p } for (var S = 1; S < 25; S++) { var a = e[S], m = a.high, x = a.low, b = h[S]; if (b < 32) var v = m << b | x >>> 32 - b, p = x << b | m >>> 32 - b; else var v = x << b - 32 | m >>> 64 - b, p = m << b - 32 | x >>> 64 - b; var H = u[l[S]]; H.high = v, H.low = p } var z = u[0], A = e[0]; z.high = A.high, z.low = A.low; for (var d = 0; d < 5; d++)for (var _ = 0; _ < 5; _++) { var S = d + 5 * _, a = e[S], C = u[S], D = u[(d + 1) % 5 + 5 * _], R = u[(d + 2) % 5 + 5 * _]; a.high = C.high ^ ~D.high & R.high, a.low = C.low ^ ~D.low & R.low } var a = e[0], E = f[c]; a.high ^= E.high, a.low ^= E.low } }, _doFinalize: function () { var t = this._data, e = t.words, i = (8 * this._nDataBytes, 8 * t.sigBytes), o = 32 * this.blockSize; e[i >>> 5] |= 1 << 24 - i % 32, e[(r.ceil((i + 1) / o) * o >>> 5) - 1] |= 128, t.sigBytes = 4 * e.length, this._process(); for (var s = this._state, a = this.cfg.outputLength / 8, c = a / 8, h = [], l = 0; l < c; l++) { var f = s[l], u = f.high, d = f.low; u = 16711935 & (u << 8 | u >>> 24) | 4278255360 & (u << 24 | u >>> 8), d = 16711935 & (d << 8 | d >>> 24) | 4278255360 & (d << 24 | d >>> 8), h.push(d), h.push(u) } return new n.init(h, a) }, clone: function () { for (var t = o.clone.call(this), r = t._state = this._state.slice(0), e = 0; e < 25; e++)r[e] = r[e].clone(); return t } }); e.SHA3 = o._createHelper(d), e.HmacSHA3 = o._createHmacHelper(d) }(Math), function () { function r() { return s.create.apply(s, arguments) } var e = t, i = e.lib, n = i.Hasher, o = e.x64, s = o.Word, a = o.WordArray, c = e.algo, h = [r(1116352408, 3609767458), r(1899447441, 602891725), r(3049323471, 3964484399), r(3921009573, 2173295548), r(961987163, 4081628472), r(1508970993, 3053834265), r(2453635748, 2937671579), r(2870763221, 3664609560), r(3624381080, 2734883394), r(310598401, 1164996542), r(607225278, 1323610764), r(1426881987, 3590304994), r(1925078388, 4068182383), r(2162078206, 991336113), r(2614888103, 633803317), r(3248222580, 3479774868), r(3835390401, 2666613458), r(4022224774, 944711139), r(264347078, 2341262773), r(604807628, 2007800933), r(770255983, 1495990901), r(1249150122, 1856431235), r(1555081692, 3175218132), r(1996064986, 2198950837), r(2554220882, 3999719339), r(2821834349, 766784016), r(2952996808, 2566594879), r(3210313671, 3203337956), r(3336571891, 1034457026), r(3584528711, 2466948901), r(113926993, 3758326383), r(338241895, 168717936), r(666307205, 1188179964), r(773529912, 1546045734), r(1294757372, 1522805485), r(1396182291, 2643833823), r(1695183700, 2343527390), r(1986661051, 1014477480), r(2177026350, 1206759142), r(2456956037, 344077627), r(2730485921, 1290863460), r(2820302411, 3158454273), r(3259730800, 3505952657), r(3345764771, 106217008), r(3516065817, 3606008344), r(3600352804, 1432725776), r(4094571909, 1467031594), r(275423344, 851169720), r(430227734, 3100823752), r(506948616, 1363258195), r(659060556, 3750685593), r(883997877, 3785050280), r(958139571, 3318307427), r(1322822218, 3812723403), r(1537002063, 2003034995), r(1747873779, 3602036899), r(1955562222, 1575990012), r(2024104815, 1125592928), r(2227730452, 2716904306), r(2361852424, 442776044), r(2428436474, 593698344), r(2756734187, 3733110249), r(3204031479, 2999351573), r(3329325298, 3815920427), r(3391569614, 3928383900), r(3515267271, 566280711), r(3940187606, 3454069534), r(4118630271, 4000239992), r(116418474, 1914138554), r(174292421, 2731055270), r(289380356, 3203993006), r(460393269, 320620315), r(685471733, 587496836), r(852142971, 1086792851), r(1017036298, 365543100), r(1126000580, 2618297676), r(1288033470, 3409855158), r(1501505948, 4234509866), r(1607167915, 987167468), r(1816402316, 1246189591)], l = []; !function () { for (var t = 0; t < 80; t++)l[t] = r() }(); var f = c.SHA512 = n.extend({ _doReset: function () { this._hash = new a.init([new s.init(1779033703, 4089235720), new s.init(3144134277, 2227873595), new s.init(1013904242, 4271175723), new s.init(2773480762, 1595750129), new s.init(1359893119, 2917565137), new s.init(2600822924, 725511199), new s.init(528734635, 4215389547), new s.init(1541459225, 327033209)]) }, _doProcessBlock: function (t, r) { for (var e = this._hash.words, i = e[0], n = e[1], o = e[2], s = e[3], a = e[4], c = e[5], f = e[6], u = e[7], d = i.high, v = i.low, p = n.high, _ = n.low, y = o.high, g = o.low, B = s.high, w = s.low, k = a.high, S = a.low, m = c.high, x = c.low, b = f.high, H = f.low, z = u.high, A = u.low, C = d, D = v, R = p, E = _, M = y, F = g, P = B, W = w, O = k, U = S, I = m, K = x, X = b, L = H, j = z, N = A, T = 0; T < 80; T++) { var Z = l[T]; if (T < 16) var q = Z.high = 0 | t[r + 2 * T], G = Z.low = 0 | t[r + 2 * T + 1]; else { var J = l[T - 15], $ = J.high, Q = J.low, V = ($ >>> 1 | Q << 31) ^ ($ >>> 8 | Q << 24) ^ $ >>> 7, Y = (Q >>> 1 | $ << 31) ^ (Q >>> 8 | $ << 24) ^ (Q >>> 7 | $ << 25), tt = l[T - 2], rt = tt.high, et = tt.low, it = (rt >>> 19 | et << 13) ^ (rt << 3 | et >>> 29) ^ rt >>> 6, nt = (et >>> 19 | rt << 13) ^ (et << 3 | rt >>> 29) ^ (et >>> 6 | rt << 26), ot = l[T - 7], st = ot.high, at = ot.low, ct = l[T - 16], ht = ct.high, lt = ct.low, G = Y + at, q = V + st + (G >>> 0 < Y >>> 0 ? 1 : 0), G = G + nt, q = q + it + (G >>> 0 < nt >>> 0 ? 1 : 0), G = G + lt, q = q + ht + (G >>> 0 < lt >>> 0 ? 1 : 0); Z.high = q, Z.low = G } var ft = O & I ^ ~O & X, ut = U & K ^ ~U & L, dt = C & R ^ C & M ^ R & M, vt = D & E ^ D & F ^ E & F, pt = (C >>> 28 | D << 4) ^ (C << 30 | D >>> 2) ^ (C << 25 | D >>> 7), _t = (D >>> 28 | C << 4) ^ (D << 30 | C >>> 2) ^ (D << 25 | C >>> 7), yt = (O >>> 14 | U << 18) ^ (O >>> 18 | U << 14) ^ (O << 23 | U >>> 9), gt = (U >>> 14 | O << 18) ^ (U >>> 18 | O << 14) ^ (U << 23 | O >>> 9), Bt = h[T], wt = Bt.high, kt = Bt.low, St = N + gt, mt = j + yt + (St >>> 0 < N >>> 0 ? 1 : 0), St = St + ut, mt = mt + ft + (St >>> 0 < ut >>> 0 ? 1 : 0), St = St + kt, mt = mt + wt + (St >>> 0 < kt >>> 0 ? 1 : 0), St = St + G, mt = mt + q + (St >>> 0 < G >>> 0 ? 1 : 0), xt = _t + vt, bt = pt + dt + (xt >>> 0 < _t >>> 0 ? 1 : 0); j = X, N = L, X = I, L = K, I = O, K = U, U = W + St | 0, O = P + mt + (U >>> 0 < W >>> 0 ? 1 : 0) | 0, P = M, W = F, M = R, F = E, R = C, E = D, D = St + xt | 0, C = mt + bt + (D >>> 0 < St >>> 0 ? 1 : 0) | 0 } v = i.low = v + D, i.high = d + C + (v >>> 0 < D >>> 0 ? 1 : 0), _ = n.low = _ + E, n.high = p + R + (_ >>> 0 < E >>> 0 ? 1 : 0), g = o.low = g + F, o.high = y + M + (g >>> 0 < F >>> 0 ? 1 : 0), w = s.low = w + W, s.high = B + P + (w >>> 0 < W >>> 0 ? 1 : 0), S = a.low = S + U, a.high = k + O + (S >>> 0 < U >>> 0 ? 1 : 0), x = c.low = x + K, c.high = m + I + (x >>> 0 < K >>> 0 ? 1 : 0), H = f.low = H + L, f.high = b + X + (H >>> 0 < L >>> 0 ? 1 : 0), A = u.low = A + N, u.high = z + j + (A >>> 0 < N >>> 0 ? 1 : 0) }, _doFinalize: function () { var t = this._data, r = t.words, e = 8 * this._nDataBytes, i = 8 * t.sigBytes; r[i >>> 5] |= 128 << 24 - i % 32, r[(i + 128 >>> 10 << 5) + 30] = Math.floor(e / 4294967296), r[(i + 128 >>> 10 << 5) + 31] = e, t.sigBytes = 4 * r.length, this._process(); var n = this._hash.toX32(); return n }, clone: function () { var t = n.clone.call(this); return t._hash = this._hash.clone(), t }, blockSize: 32 }); e.SHA512 = n._createHelper(f), e.HmacSHA512 = n._createHmacHelper(f) }(), function () { var r = t, e = r.x64, i = e.Word, n = e.WordArray, o = r.algo, s = o.SHA512, a = o.SHA384 = s.extend({ _doReset: function () { this._hash = new n.init([new i.init(3418070365, 3238371032), new i.init(1654270250, 914150663), new i.init(2438529370, 812702999), new i.init(355462360, 4144912697), new i.init(1731405415, 4290775857), new i.init(2394180231, 1750603025), new i.init(3675008525, 1694076839), new i.init(1203062813, 3204075428)]) }, _doFinalize: function () { var t = s._doFinalize.call(this); return t.sigBytes -= 16, t } }); r.SHA384 = s._createHelper(a), r.HmacSHA384 = s._createHmacHelper(a) }(), t.lib.Cipher || function (r) { var e = t, i = e.lib, n = i.Base, o = i.WordArray, s = i.BufferedBlockAlgorithm, a = e.enc, c = (a.Utf8, a.Base64), h = e.algo, l = h.EvpKDF, f = i.Cipher = s.extend({ cfg: n.extend(), createEncryptor: function (t, r) { return this.create(this._ENC_XFORM_MODE, t, r) }, createDecryptor: function (t, r) { return this.create(this._DEC_XFORM_MODE, t, r) }, init: function (t, r, e) { this.cfg = this.cfg.extend(e), this._xformMode = t, this._key = r, this.reset() }, reset: function () { s.reset.call(this), this._doReset() }, process: function (t) { return this._append(t), this._process() }, finalize: function (t) { t && this._append(t); var r = this._doFinalize(); return r }, keySize: 4, ivSize: 4, _ENC_XFORM_MODE: 1, _DEC_XFORM_MODE: 2, _createHelper: function () { function t(t) { return "string" == typeof t ? m : w } return function (r) { return { encrypt: function (e, i, n) { return t(i).encrypt(r, e, i, n) }, decrypt: function (e, i, n) { return t(i).decrypt(r, e, i, n) } } } }() }), u = (i.StreamCipher = f.extend({ _doFinalize: function () { var t = this._process(!0); return t }, blockSize: 1 }), e.mode = {}), d = i.BlockCipherMode = n.extend({ createEncryptor: function (t, r) { return this.Encryptor.create(t, r) }, createDecryptor: function (t, r) { return this.Decryptor.create(t, r) }, init: function (t, r) { this._cipher = t, this._iv = r } }), v = u.CBC = function () { function t(t, e, i) { var n = this._iv; if (n) { var o = n; this._iv = r } else var o = this._prevBlock; for (var s = 0; s < i; s++)t[e + s] ^= o[s] } var e = d.extend(); return e.Encryptor = e.extend({ processBlock: function (r, e) { var i = this._cipher, n = i.blockSize; t.call(this, r, e, n), i.encryptBlock(r, e), this._prevBlock = r.slice(e, e + n) } }), e.Decryptor = e.extend({ processBlock: function (r, e) { var i = this._cipher, n = i.blockSize, o = r.slice(e, e + n); i.decryptBlock(r, e), t.call(this, r, e, n), this._prevBlock = o } }), e }(), p = e.pad = {}, _ = p.Pkcs7 = { pad: function (t, r) { for (var e = 4 * r, i = e - t.sigBytes % e, n = i << 24 | i << 16 | i << 8 | i, s = [], a = 0; a < i; a += 4)s.push(n); var c = o.create(s, i); t.concat(c) }, unpad: function (t) { var r = 255 & t.words[t.sigBytes - 1 >>> 2]; t.sigBytes -= r } }, y = (i.BlockCipher = f.extend({ cfg: f.cfg.extend({ mode: v, padding: _ }), reset: function () { f.reset.call(this); var t = this.cfg, r = t.iv, e = t.mode; if (this._xformMode == this._ENC_XFORM_MODE) var i = e.createEncryptor; else { var i = e.createDecryptor; this._minBufferSize = 1 } this._mode && this._mode.__creator == i ? this._mode.init(this, r && r.words) : (this._mode = i.call(e, this, r && r.words), this._mode.__creator = i) }, _doProcessBlock: function (t, r) { this._mode.processBlock(t, r) }, _doFinalize: function () { var t = this.cfg.padding; if (this._xformMode == this._ENC_XFORM_MODE) { t.pad(this._data, this.blockSize); var r = this._process(!0) } else { var r = this._process(!0); t.unpad(r) } return r }, blockSize: 4 }), i.CipherParams = n.extend({ init: function (t) { this.mixIn(t) }, toString: function (t) { return (t || this.formatter).stringify(this) } })), g = e.format = {}, B = g.OpenSSL = { stringify: function (t) { var r = t.ciphertext, e = t.salt; if (e) var i = o.create([1398893684, 1701076831]).concat(e).concat(r); else var i = r; return i.toString(c) }, parse: function (t) { var r = c.parse(t), e = r.words; if (1398893684 == e[0] && 1701076831 == e[1]) { var i = o.create(e.slice(2, 4)); e.splice(0, 4), r.sigBytes -= 16 } return y.create({ ciphertext: r, salt: i }) } }, w = i.SerializableCipher = n.extend({ cfg: n.extend({ format: B }), encrypt: function (t, r, e, i) { i = this.cfg.extend(i); var n = t.createEncryptor(e, i), o = n.finalize(r), s = n.cfg; return y.create({ ciphertext: o, key: e, iv: s.iv, algorithm: t, mode: s.mode, padding: s.padding, blockSize: t.blockSize, formatter: i.format }) }, decrypt: function (t, r, e, i) { i = this.cfg.extend(i), r = this._parse(r, i.format); var n = t.createDecryptor(e, i).finalize(r.ciphertext); return n }, _parse: function (t, r) { return "string" == typeof t ? r.parse(t, this) : t } }), k = e.kdf = {}, S = k.OpenSSL = { execute: function (t, r, e, i) { i || (i = o.random(8)); var n = l.create({ keySize: r + e }).compute(t, i), s = o.create(n.words.slice(r), 4 * e); return n.sigBytes = 4 * r, y.create({ key: n, iv: s, salt: i }) } }, m = i.PasswordBasedCipher = w.extend({ cfg: w.cfg.extend({ kdf: S }), encrypt: function (t, r, e, i) { i = this.cfg.extend(i); var n = i.kdf.execute(e, t.keySize, t.ivSize); i.iv = n.iv; var o = w.encrypt.call(this, t, r, n.key, i); return o.mixIn(n), o }, decrypt: function (t, r, e, i) { i = this.cfg.extend(i), r = this._parse(r, i.format); var n = i.kdf.execute(e, t.keySize, t.ivSize, r.salt); i.iv = n.iv; var o = w.decrypt.call(this, t, r, n.key, i); return o } }) }(), t.mode.CFB = function () { function r(t, r, e, i) { var n = this._iv; if (n) { var o = n.slice(0); this._iv = void 0 } else var o = this._prevBlock; i.encryptBlock(o, 0); for (var s = 0; s < e; s++)t[r + s] ^= o[s] } var e = t.lib.BlockCipherMode.extend(); return e.Encryptor = e.extend({ processBlock: function (t, e) { var i = this._cipher, n = i.blockSize; r.call(this, t, e, n, i), this._prevBlock = t.slice(e, e + n) } }), e.Decryptor = e.extend({ processBlock: function (t, e) { var i = this._cipher, n = i.blockSize, o = t.slice(e, e + n); r.call(this, t, e, n, i), this._prevBlock = o } }), e }(), t.mode.ECB = function () { var r = t.lib.BlockCipherMode.extend(); return r.Encryptor = r.extend({ processBlock: function (t, r) { this._cipher.encryptBlock(t, r) } }), r.Decryptor = r.extend({ processBlock: function (t, r) { this._cipher.decryptBlock(t, r) } }), r }(), t.pad.AnsiX923 = { pad: function (t, r) { var e = t.sigBytes, i = 4 * r, n = i - e % i, o = e + n - 1; t.clamp(), t.words[o >>> 2] |= n << 24 - o % 4 * 8, t.sigBytes += n }, unpad: function (t) { var r = 255 & t.words[t.sigBytes - 1 >>> 2]; t.sigBytes -= r } }, t.pad.Iso10126 = { pad: function (r, e) { var i = 4 * e, n = i - r.sigBytes % i; r.concat(t.lib.WordArray.random(n - 1)).concat(t.lib.WordArray.create([n << 24], 1)) }, unpad: function (t) { var r = 255 & t.words[t.sigBytes - 1 >>> 2]; t.sigBytes -= r } }, t.pad.Iso97971 = { pad: function (r, e) { r.concat(t.lib.WordArray.create([2147483648], 1)), t.pad.ZeroPadding.pad(r, e) }, unpad: function (r) { t.pad.ZeroPadding.unpad(r), r.sigBytes-- } }, t.mode.OFB = function () { var r = t.lib.BlockCipherMode.extend(), e = r.Encryptor = r.extend({ processBlock: function (t, r) { var e = this._cipher, i = e.blockSize, n = this._iv, o = this._keystream; n && (o = this._keystream = n.slice(0), this._iv = void 0), e.encryptBlock(o, 0); for (var s = 0; s < i; s++)t[r + s] ^= o[s] } }); return r.Decryptor = e, r }(), t.pad.NoPadding = { pad: function () { }, unpad: function () { } }, function (r) { var e = t, i = e.lib, n = i.CipherParams, o = e.enc, s = o.Hex, a = e.format; a.Hex = { stringify: function (t) { return t.ciphertext.toString(s) }, parse: function (t) { var r = s.parse(t); return n.create({ ciphertext: r }) } } }(), function () { var r = t, e = r.lib, i = e.BlockCipher, n = r.algo, o = [], s = [], a = [], c = [], h = [], l = [], f = [], u = [], d = [], v = []; !function () { for (var t = [], r = 0; r < 256; r++)r < 128 ? t[r] = r << 1 : t[r] = r << 1 ^ 283; for (var e = 0, i = 0, r = 0; r < 256; r++) { var n = i ^ i << 1 ^ i << 2 ^ i << 3 ^ i << 4; n = n >>> 8 ^ 255 & n ^ 99, o[e] = n, s[n] = e; var p = t[e], _ = t[p], y = t[_], g = 257 * t[n] ^ 16843008 * n; a[e] = g << 24 | g >>> 8, c[e] = g << 16 | g >>> 16, h[e] = g << 8 | g >>> 24, l[e] = g; var g = 16843009 * y ^ 65537 * _ ^ 257 * p ^ 16843008 * e; f[n] = g << 24 | g >>> 8, u[n] = g << 16 | g >>> 16, d[n] = g << 8 | g >>> 24, v[n] = g, e ? (e = p ^ t[t[t[y ^ p]]], i ^= t[t[i]]) : e = i = 1 } }(); var p = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], _ = n.AES = i.extend({ _doReset: function () { if (!this._nRounds || this._keyPriorReset !== this._key) { for (var t = this._keyPriorReset = this._key, r = t.words, e = t.sigBytes / 4, i = this._nRounds = e + 6, n = 4 * (i + 1), s = this._keySchedule = [], a = 0; a < n; a++)if (a < e) s[a] = r[a]; else { var c = s[a - 1]; a % e ? e > 6 && a % e == 4 && (c = o[c >>> 24] << 24 | o[c >>> 16 & 255] << 16 | o[c >>> 8 & 255] << 8 | o[255 & c]) : (c = c << 8 | c >>> 24, c = o[c >>> 24] << 24 | o[c >>> 16 & 255] << 16 | o[c >>> 8 & 255] << 8 | o[255 & c], c ^= p[a / e | 0] << 24), s[a] = s[a - e] ^ c } for (var h = this._invKeySchedule = [], l = 0; l < n; l++) { var a = n - l; if (l % 4) var c = s[a]; else var c = s[a - 4]; l < 4 || a <= 4 ? h[l] = c : h[l] = f[o[c >>> 24]] ^ u[o[c >>> 16 & 255]] ^ d[o[c >>> 8 & 255]] ^ v[o[255 & c]] } } }, encryptBlock: function (t, r) { this._doCryptBlock(t, r, this._keySchedule, a, c, h, l, o) }, decryptBlock: function (t, r) { var e = t[r + 1]; t[r + 1] = t[r + 3], t[r + 3] = e, this._doCryptBlock(t, r, this._invKeySchedule, f, u, d, v, s); var e = t[r + 1]; t[r + 1] = t[r + 3], t[r + 3] = e }, _doCryptBlock: function (t, r, e, i, n, o, s, a) { for (var c = this._nRounds, h = t[r] ^ e[0], l = t[r + 1] ^ e[1], f = t[r + 2] ^ e[2], u = t[r + 3] ^ e[3], d = 4, v = 1; v < c; v++) { var p = i[h >>> 24] ^ n[l >>> 16 & 255] ^ o[f >>> 8 & 255] ^ s[255 & u] ^ e[d++], _ = i[l >>> 24] ^ n[f >>> 16 & 255] ^ o[u >>> 8 & 255] ^ s[255 & h] ^ e[d++], y = i[f >>> 24] ^ n[u >>> 16 & 255] ^ o[h >>> 8 & 255] ^ s[255 & l] ^ e[d++], g = i[u >>> 24] ^ n[h >>> 16 & 255] ^ o[l >>> 8 & 255] ^ s[255 & f] ^ e[d++]; h = p, l = _, f = y, u = g } var p = (a[h >>> 24] << 24 | a[l >>> 16 & 255] << 16 | a[f >>> 8 & 255] << 8 | a[255 & u]) ^ e[d++], _ = (a[l >>> 24] << 24 | a[f >>> 16 & 255] << 16 | a[u >>> 8 & 255] << 8 | a[255 & h]) ^ e[d++], y = (a[f >>> 24] << 24 | a[u >>> 16 & 255] << 16 | a[h >>> 8 & 255] << 8 | a[255 & l]) ^ e[d++], g = (a[u >>> 24] << 24 | a[h >>> 16 & 255] << 16 | a[l >>> 8 & 255] << 8 | a[255 & f]) ^ e[d++]; t[r] = p, t[r + 1] = _, t[r + 2] = y, t[r + 3] = g }, keySize: 8 }); r.AES = i._createHelper(_) }(), function () { + function r(t, r) { var e = (this._lBlock >>> t ^ this._rBlock) & r; this._rBlock ^= e, this._lBlock ^= e << t } function e(t, r) { + var e = (this._rBlock >>> t ^ this._lBlock) & r; this._lBlock ^= e, this._rBlock ^= e << t; + } var i = t, n = i.lib, o = n.WordArray, s = n.BlockCipher, a = i.algo, c = [57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4], h = [14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32], l = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28], f = [{ 0: 8421888, 268435456: 32768, 536870912: 8421378, 805306368: 2, 1073741824: 512, 1342177280: 8421890, 1610612736: 8389122, 1879048192: 8388608, 2147483648: 514, 2415919104: 8389120, 2684354560: 33280, 2952790016: 8421376, 3221225472: 32770, 3489660928: 8388610, 3758096384: 0, 4026531840: 33282, 134217728: 0, 402653184: 8421890, 671088640: 33282, 939524096: 32768, 1207959552: 8421888, 1476395008: 512, 1744830464: 8421378, 2013265920: 2, 2281701376: 8389120, 2550136832: 33280, 2818572288: 8421376, 3087007744: 8389122, 3355443200: 8388610, 3623878656: 32770, 3892314112: 514, 4160749568: 8388608, 1: 32768, 268435457: 2, 536870913: 8421888, 805306369: 8388608, 1073741825: 8421378, 1342177281: 33280, 1610612737: 512, 1879048193: 8389122, 2147483649: 8421890, 2415919105: 8421376, 2684354561: 8388610, 2952790017: 33282, 3221225473: 514, 3489660929: 8389120, 3758096385: 32770, 4026531841: 0, 134217729: 8421890, 402653185: 8421376, 671088641: 8388608, 939524097: 512, 1207959553: 32768, 1476395009: 8388610, 1744830465: 2, 2013265921: 33282, 2281701377: 32770, 2550136833: 8389122, 2818572289: 514, 3087007745: 8421888, 3355443201: 8389120, 3623878657: 0, 3892314113: 33280, 4160749569: 8421378 }, { 0: 1074282512, 16777216: 16384, 33554432: 524288, 50331648: 1074266128, 67108864: 1073741840, 83886080: 1074282496, 100663296: 1073758208, 117440512: 16, 134217728: 540672, 150994944: 1073758224, 167772160: 1073741824, 184549376: 540688, 201326592: 524304, 218103808: 0, 234881024: 16400, 251658240: 1074266112, 8388608: 1073758208, 25165824: 540688, 41943040: 16, 58720256: 1073758224, 75497472: 1074282512, 92274688: 1073741824, 109051904: 524288, 125829120: 1074266128, 142606336: 524304, 159383552: 0, 176160768: 16384, 192937984: 1074266112, 209715200: 1073741840, 226492416: 540672, 243269632: 1074282496, 260046848: 16400, 268435456: 0, 285212672: 1074266128, 301989888: 1073758224, 318767104: 1074282496, 335544320: 1074266112, 352321536: 16, 369098752: 540688, 385875968: 16384, 402653184: 16400, 419430400: 524288, 436207616: 524304, 452984832: 1073741840, 469762048: 540672, 486539264: 1073758208, 503316480: 1073741824, 520093696: 1074282512, 276824064: 540688, 293601280: 524288, 310378496: 1074266112, 327155712: 16384, 343932928: 1073758208, 360710144: 1074282512, 377487360: 16, 394264576: 1073741824, 411041792: 1074282496, 427819008: 1073741840, 444596224: 1073758224, 461373440: 524304, 478150656: 0, 494927872: 16400, 511705088: 1074266128, 528482304: 540672 }, { 0: 260, 1048576: 0, 2097152: 67109120, 3145728: 65796, 4194304: 65540, 5242880: 67108868, 6291456: 67174660, 7340032: 67174400, 8388608: 67108864, 9437184: 67174656, 10485760: 65792, 11534336: 67174404, 12582912: 67109124, 13631488: 65536, 14680064: 4, 15728640: 256, 524288: 67174656, 1572864: 67174404, 2621440: 0, 3670016: 67109120, 4718592: 67108868, 5767168: 65536, 6815744: 65540, 7864320: 260, 8912896: 4, 9961472: 256, 11010048: 67174400, 12058624: 65796, 13107200: 65792, 14155776: 67109124, 15204352: 67174660, 16252928: 67108864, 16777216: 67174656, 17825792: 65540, 18874368: 65536, 19922944: 67109120, 20971520: 256, 22020096: 67174660, 23068672: 67108868, 24117248: 0, 25165824: 67109124, 26214400: 67108864, 27262976: 4, 28311552: 65792, 29360128: 67174400, 30408704: 260, 31457280: 65796, 32505856: 67174404, 17301504: 67108864, 18350080: 260, 19398656: 67174656, 20447232: 0, 21495808: 65540, 22544384: 67109120, 23592960: 256, 24641536: 67174404, 25690112: 65536, 26738688: 67174660, 27787264: 65796, 28835840: 67108868, 29884416: 67109124, 30932992: 67174400, 31981568: 4, 33030144: 65792 }, { 0: 2151682048, 65536: 2147487808, 131072: 4198464, 196608: 2151677952, 262144: 0, 327680: 4198400, 393216: 2147483712, 458752: 4194368, 524288: 2147483648, 589824: 4194304, 655360: 64, 720896: 2147487744, 786432: 2151678016, 851968: 4160, 917504: 4096, 983040: 2151682112, 32768: 2147487808, 98304: 64, 163840: 2151678016, 229376: 2147487744, 294912: 4198400, 360448: 2151682112, 425984: 0, 491520: 2151677952, 557056: 4096, 622592: 2151682048, 688128: 4194304, 753664: 4160, 819200: 2147483648, 884736: 4194368, 950272: 4198464, 1015808: 2147483712, 1048576: 4194368, 1114112: 4198400, 1179648: 2147483712, 1245184: 0, 1310720: 4160, 1376256: 2151678016, 1441792: 2151682048, 1507328: 2147487808, 1572864: 2151682112, 1638400: 2147483648, 1703936: 2151677952, 1769472: 4198464, 1835008: 2147487744, 1900544: 4194304, 1966080: 64, 2031616: 4096, 1081344: 2151677952, 1146880: 2151682112, 1212416: 0, 1277952: 4198400, 1343488: 4194368, 1409024: 2147483648, 1474560: 2147487808, 1540096: 64, 1605632: 2147483712, 1671168: 4096, 1736704: 2147487744, 1802240: 2151678016, 1867776: 4160, 1933312: 2151682048, 1998848: 4194304, 2064384: 4198464 }, { 0: 128, 4096: 17039360, 8192: 262144, 12288: 536870912, 16384: 537133184, 20480: 16777344, 24576: 553648256, 28672: 262272, 32768: 16777216, 36864: 537133056, 40960: 536871040, 45056: 553910400, 49152: 553910272, 53248: 0, 57344: 17039488, 61440: 553648128, 2048: 17039488, 6144: 553648256, 10240: 128, 14336: 17039360, 18432: 262144, 22528: 537133184, 26624: 553910272, 30720: 536870912, 34816: 537133056, 38912: 0, 43008: 553910400, 47104: 16777344, 51200: 536871040, 55296: 553648128, 59392: 16777216, 63488: 262272, 65536: 262144, 69632: 128, 73728: 536870912, 77824: 553648256, 81920: 16777344, 86016: 553910272, 90112: 537133184, 94208: 16777216, 98304: 553910400, 102400: 553648128, 106496: 17039360, 110592: 537133056, 114688: 262272, 118784: 536871040, 122880: 0, 126976: 17039488, 67584: 553648256, 71680: 16777216, 75776: 17039360, 79872: 537133184, 83968: 536870912, 88064: 17039488, 92160: 128, 96256: 553910272, 100352: 262272, 104448: 553910400, 108544: 0, 112640: 553648128, 116736: 16777344, 120832: 262144, 124928: 537133056, 129024: 536871040 }, { 0: 268435464, 256: 8192, 512: 270532608, 768: 270540808, 1024: 268443648, 1280: 2097152, 1536: 2097160, 1792: 268435456, 2048: 0, 2304: 268443656, 2560: 2105344, 2816: 8, 3072: 270532616, 3328: 2105352, 3584: 8200, 3840: 270540800, 128: 270532608, 384: 270540808, 640: 8, 896: 2097152, 1152: 2105352, 1408: 268435464, 1664: 268443648, 1920: 8200, 2176: 2097160, 2432: 8192, 2688: 268443656, 2944: 270532616, 3200: 0, 3456: 270540800, 3712: 2105344, 3968: 268435456, 4096: 268443648, 4352: 270532616, 4608: 270540808, 4864: 8200, 5120: 2097152, 5376: 268435456, 5632: 268435464, 5888: 2105344, 6144: 2105352, 6400: 0, 6656: 8, 6912: 270532608, 7168: 8192, 7424: 268443656, 7680: 270540800, 7936: 2097160, 4224: 8, 4480: 2105344, 4736: 2097152, 4992: 268435464, 5248: 268443648, 5504: 8200, 5760: 270540808, 6016: 270532608, 6272: 270540800, 6528: 270532616, 6784: 8192, 7040: 2105352, 7296: 2097160, 7552: 0, 7808: 268435456, 8064: 268443656 }, { 0: 1048576, 16: 33555457, 32: 1024, 48: 1049601, 64: 34604033, 80: 0, 96: 1, 112: 34603009, 128: 33555456, 144: 1048577, 160: 33554433, 176: 34604032, 192: 34603008, 208: 1025, 224: 1049600, 240: 33554432, 8: 34603009, 24: 0, 40: 33555457, 56: 34604032, 72: 1048576, 88: 33554433, 104: 33554432, 120: 1025, 136: 1049601, 152: 33555456, 168: 34603008, 184: 1048577, 200: 1024, 216: 34604033, 232: 1, 248: 1049600, 256: 33554432, 272: 1048576, 288: 33555457, 304: 34603009, 320: 1048577, 336: 33555456, 352: 34604032, 368: 1049601, 384: 1025, 400: 34604033, 416: 1049600, 432: 1, 448: 0, 464: 34603008, 480: 33554433, 496: 1024, 264: 1049600, 280: 33555457, 296: 34603009, 312: 1, 328: 33554432, 344: 1048576, 360: 1025, 376: 34604032, 392: 33554433, 408: 34603008, 424: 0, 440: 34604033, 456: 1049601, 472: 1024, 488: 33555456, 504: 1048577 }, { 0: 134219808, 1: 131072, 2: 134217728, 3: 32, 4: 131104, 5: 134350880, 6: 134350848, 7: 2048, 8: 134348800, 9: 134219776, 10: 133120, 11: 134348832, 12: 2080, 13: 0, 14: 134217760, 15: 133152, 2147483648: 2048, 2147483649: 134350880, 2147483650: 134219808, 2147483651: 134217728, 2147483652: 134348800, 2147483653: 133120, 2147483654: 133152, 2147483655: 32, 2147483656: 134217760, 2147483657: 2080, 2147483658: 131104, 2147483659: 134350848, 2147483660: 0, 2147483661: 134348832, 2147483662: 134219776, 2147483663: 131072, 16: 133152, 17: 134350848, 18: 32, 19: 2048, 20: 134219776, 21: 134217760, 22: 134348832, 23: 131072, 24: 0, 25: 131104, 26: 134348800, 27: 134219808, 28: 134350880, 29: 133120, 30: 2080, 31: 134217728, 2147483664: 131072, 2147483665: 2048, 2147483666: 134348832, 2147483667: 133152, 2147483668: 32, 2147483669: 134348800, 2147483670: 134217728, 2147483671: 134219808, 2147483672: 134350880, 2147483673: 134217760, 2147483674: 134219776, 2147483675: 0, 2147483676: 133120, 2147483677: 2080, 2147483678: 131104, 2147483679: 134350848 }], u = [4160749569, 528482304, 33030144, 2064384, 129024, 8064, 504, 2147483679], d = a.DES = s.extend({ _doReset: function () { for (var t = this._key, r = t.words, e = [], i = 0; i < 56; i++) { var n = c[i] - 1; e[i] = r[n >>> 5] >>> 31 - n % 32 & 1 } for (var o = this._subKeys = [], s = 0; s < 16; s++) { for (var a = o[s] = [], f = l[s], i = 0; i < 24; i++)a[i / 6 | 0] |= e[(h[i] - 1 + f) % 28] << 31 - i % 6, a[4 + (i / 6 | 0)] |= e[28 + (h[i + 24] - 1 + f) % 28] << 31 - i % 6; a[0] = a[0] << 1 | a[0] >>> 31; for (var i = 1; i < 7; i++)a[i] = a[i] >>> 4 * (i - 1) + 3; a[7] = a[7] << 5 | a[7] >>> 27 } for (var u = this._invSubKeys = [], i = 0; i < 16; i++)u[i] = o[15 - i] }, encryptBlock: function (t, r) { this._doCryptBlock(t, r, this._subKeys) }, decryptBlock: function (t, r) { this._doCryptBlock(t, r, this._invSubKeys) }, _doCryptBlock: function (t, i, n) { this._lBlock = t[i], this._rBlock = t[i + 1], r.call(this, 4, 252645135), r.call(this, 16, 65535), e.call(this, 2, 858993459), e.call(this, 8, 16711935), r.call(this, 1, 1431655765); for (var o = 0; o < 16; o++) { for (var s = n[o], a = this._lBlock, c = this._rBlock, h = 0, l = 0; l < 8; l++)h |= f[l][((c ^ s[l]) & u[l]) >>> 0]; this._lBlock = c, this._rBlock = a ^ h } var d = this._lBlock; this._lBlock = this._rBlock, this._rBlock = d, r.call(this, 1, 1431655765), e.call(this, 8, 16711935), e.call(this, 2, 858993459), r.call(this, 16, 65535), r.call(this, 4, 252645135), t[i] = this._lBlock, t[i + 1] = this._rBlock }, keySize: 2, ivSize: 2, blockSize: 2 }); i.DES = s._createHelper(d); var v = a.TripleDES = s.extend({ _doReset: function () { var t = this._key, r = t.words; this._des1 = d.createEncryptor(o.create(r.slice(0, 2))), this._des2 = d.createEncryptor(o.create(r.slice(2, 4))), this._des3 = d.createEncryptor(o.create(r.slice(4, 6))) }, encryptBlock: function (t, r) { this._des1.encryptBlock(t, r), this._des2.decryptBlock(t, r), this._des3.encryptBlock(t, r) }, decryptBlock: function (t, r) { this._des3.decryptBlock(t, r), this._des2.encryptBlock(t, r), this._des1.decryptBlock(t, r) }, keySize: 6, ivSize: 2, blockSize: 2 }); i.TripleDES = s._createHelper(v) + }(), function () { function r() { for (var t = this._S, r = this._i, e = this._j, i = 0, n = 0; n < 4; n++) { r = (r + 1) % 256, e = (e + t[r]) % 256; var o = t[r]; t[r] = t[e], t[e] = o, i |= t[(t[r] + t[e]) % 256] << 24 - 8 * n } return this._i = r, this._j = e, i } var e = t, i = e.lib, n = i.StreamCipher, o = e.algo, s = o.RC4 = n.extend({ _doReset: function () { for (var t = this._key, r = t.words, e = t.sigBytes, i = this._S = [], n = 0; n < 256; n++)i[n] = n; for (var n = 0, o = 0; n < 256; n++) { var s = n % e, a = r[s >>> 2] >>> 24 - s % 4 * 8 & 255; o = (o + i[n] + a) % 256; var c = i[n]; i[n] = i[o], i[o] = c } this._i = this._j = 0 }, _doProcessBlock: function (t, e) { t[e] ^= r.call(this) }, keySize: 8, ivSize: 0 }); e.RC4 = n._createHelper(s); var a = o.RC4Drop = s.extend({ cfg: s.cfg.extend({ drop: 192 }), _doReset: function () { s._doReset.call(this); for (var t = this.cfg.drop; t > 0; t--)r.call(this) } }); e.RC4Drop = n._createHelper(a) }(), t.mode.CTRGladman = function () { function r(t) { if (255 === (t >> 24 & 255)) { var r = t >> 16 & 255, e = t >> 8 & 255, i = 255 & t; 255 === r ? (r = 0, 255 === e ? (e = 0, 255 === i ? i = 0 : ++i) : ++e) : ++r, t = 0, t += r << 16, t += e << 8, t += i } else t += 1 << 24; return t } function e(t) { return 0 === (t[0] = r(t[0])) && (t[1] = r(t[1])), t } var i = t.lib.BlockCipherMode.extend(), n = i.Encryptor = i.extend({ processBlock: function (t, r) { var i = this._cipher, n = i.blockSize, o = this._iv, s = this._counter; o && (s = this._counter = o.slice(0), this._iv = void 0), e(s); var a = s.slice(0); i.encryptBlock(a, 0); for (var c = 0; c < n; c++)t[r + c] ^= a[c] } }); return i.Decryptor = n, i }(), function () { function r() { for (var t = this._X, r = this._C, e = 0; e < 8; e++)a[e] = r[e]; r[0] = r[0] + 1295307597 + this._b | 0, r[1] = r[1] + 3545052371 + (r[0] >>> 0 < a[0] >>> 0 ? 1 : 0) | 0, r[2] = r[2] + 886263092 + (r[1] >>> 0 < a[1] >>> 0 ? 1 : 0) | 0, r[3] = r[3] + 1295307597 + (r[2] >>> 0 < a[2] >>> 0 ? 1 : 0) | 0, r[4] = r[4] + 3545052371 + (r[3] >>> 0 < a[3] >>> 0 ? 1 : 0) | 0, r[5] = r[5] + 886263092 + (r[4] >>> 0 < a[4] >>> 0 ? 1 : 0) | 0, r[6] = r[6] + 1295307597 + (r[5] >>> 0 < a[5] >>> 0 ? 1 : 0) | 0, r[7] = r[7] + 3545052371 + (r[6] >>> 0 < a[6] >>> 0 ? 1 : 0) | 0, this._b = r[7] >>> 0 < a[7] >>> 0 ? 1 : 0; for (var e = 0; e < 8; e++) { var i = t[e] + r[e], n = 65535 & i, o = i >>> 16, s = ((n * n >>> 17) + n * o >>> 15) + o * o, h = ((4294901760 & i) * i | 0) + ((65535 & i) * i | 0); c[e] = s ^ h } t[0] = c[0] + (c[7] << 16 | c[7] >>> 16) + (c[6] << 16 | c[6] >>> 16) | 0, t[1] = c[1] + (c[0] << 8 | c[0] >>> 24) + c[7] | 0, t[2] = c[2] + (c[1] << 16 | c[1] >>> 16) + (c[0] << 16 | c[0] >>> 16) | 0, t[3] = c[3] + (c[2] << 8 | c[2] >>> 24) + c[1] | 0, t[4] = c[4] + (c[3] << 16 | c[3] >>> 16) + (c[2] << 16 | c[2] >>> 16) | 0, t[5] = c[5] + (c[4] << 8 | c[4] >>> 24) + c[3] | 0, t[6] = c[6] + (c[5] << 16 | c[5] >>> 16) + (c[4] << 16 | c[4] >>> 16) | 0, t[7] = c[7] + (c[6] << 8 | c[6] >>> 24) + c[5] | 0 } var e = t, i = e.lib, n = i.StreamCipher, o = e.algo, s = [], a = [], c = [], h = o.Rabbit = n.extend({ _doReset: function () { for (var t = this._key.words, e = this.cfg.iv, i = 0; i < 4; i++)t[i] = 16711935 & (t[i] << 8 | t[i] >>> 24) | 4278255360 & (t[i] << 24 | t[i] >>> 8); var n = this._X = [t[0], t[3] << 16 | t[2] >>> 16, t[1], t[0] << 16 | t[3] >>> 16, t[2], t[1] << 16 | t[0] >>> 16, t[3], t[2] << 16 | t[1] >>> 16], o = this._C = [t[2] << 16 | t[2] >>> 16, 4294901760 & t[0] | 65535 & t[1], t[3] << 16 | t[3] >>> 16, 4294901760 & t[1] | 65535 & t[2], t[0] << 16 | t[0] >>> 16, 4294901760 & t[2] | 65535 & t[3], t[1] << 16 | t[1] >>> 16, 4294901760 & t[3] | 65535 & t[0]]; this._b = 0; for (var i = 0; i < 4; i++)r.call(this); for (var i = 0; i < 8; i++)o[i] ^= n[i + 4 & 7]; if (e) { var s = e.words, a = s[0], c = s[1], h = 16711935 & (a << 8 | a >>> 24) | 4278255360 & (a << 24 | a >>> 8), l = 16711935 & (c << 8 | c >>> 24) | 4278255360 & (c << 24 | c >>> 8), f = h >>> 16 | 4294901760 & l, u = l << 16 | 65535 & h; o[0] ^= h, o[1] ^= f, o[2] ^= l, o[3] ^= u, o[4] ^= h, o[5] ^= f, o[6] ^= l, o[7] ^= u; for (var i = 0; i < 4; i++)r.call(this) } }, _doProcessBlock: function (t, e) { var i = this._X; r.call(this), s[0] = i[0] ^ i[5] >>> 16 ^ i[3] << 16, s[1] = i[2] ^ i[7] >>> 16 ^ i[5] << 16, s[2] = i[4] ^ i[1] >>> 16 ^ i[7] << 16, s[3] = i[6] ^ i[3] >>> 16 ^ i[1] << 16; for (var n = 0; n < 4; n++)s[n] = 16711935 & (s[n] << 8 | s[n] >>> 24) | 4278255360 & (s[n] << 24 | s[n] >>> 8), t[e + n] ^= s[n] }, blockSize: 4, ivSize: 2 }); e.Rabbit = n._createHelper(h) }(), t.mode.CTR = function () { var r = t.lib.BlockCipherMode.extend(), e = r.Encryptor = r.extend({ processBlock: function (t, r) { var e = this._cipher, i = e.blockSize, n = this._iv, o = this._counter; n && (o = this._counter = n.slice(0), this._iv = void 0); var s = o.slice(0); e.encryptBlock(s, 0), o[i - 1] = o[i - 1] + 1 | 0; for (var a = 0; a < i; a++)t[r + a] ^= s[a] } }); return r.Decryptor = e, r }(), function () { function r() { for (var t = this._X, r = this._C, e = 0; e < 8; e++)a[e] = r[e]; r[0] = r[0] + 1295307597 + this._b | 0, r[1] = r[1] + 3545052371 + (r[0] >>> 0 < a[0] >>> 0 ? 1 : 0) | 0, r[2] = r[2] + 886263092 + (r[1] >>> 0 < a[1] >>> 0 ? 1 : 0) | 0, r[3] = r[3] + 1295307597 + (r[2] >>> 0 < a[2] >>> 0 ? 1 : 0) | 0, r[4] = r[4] + 3545052371 + (r[3] >>> 0 < a[3] >>> 0 ? 1 : 0) | 0, r[5] = r[5] + 886263092 + (r[4] >>> 0 < a[4] >>> 0 ? 1 : 0) | 0, r[6] = r[6] + 1295307597 + (r[5] >>> 0 < a[5] >>> 0 ? 1 : 0) | 0, r[7] = r[7] + 3545052371 + (r[6] >>> 0 < a[6] >>> 0 ? 1 : 0) | 0, this._b = r[7] >>> 0 < a[7] >>> 0 ? 1 : 0; for (var e = 0; e < 8; e++) { var i = t[e] + r[e], n = 65535 & i, o = i >>> 16, s = ((n * n >>> 17) + n * o >>> 15) + o * o, h = ((4294901760 & i) * i | 0) + ((65535 & i) * i | 0); c[e] = s ^ h } t[0] = c[0] + (c[7] << 16 | c[7] >>> 16) + (c[6] << 16 | c[6] >>> 16) | 0, t[1] = c[1] + (c[0] << 8 | c[0] >>> 24) + c[7] | 0, t[2] = c[2] + (c[1] << 16 | c[1] >>> 16) + (c[0] << 16 | c[0] >>> 16) | 0, t[3] = c[3] + (c[2] << 8 | c[2] >>> 24) + c[1] | 0, t[4] = c[4] + (c[3] << 16 | c[3] >>> 16) + (c[2] << 16 | c[2] >>> 16) | 0, t[5] = c[5] + (c[4] << 8 | c[4] >>> 24) + c[3] | 0, t[6] = c[6] + (c[5] << 16 | c[5] >>> 16) + (c[4] << 16 | c[4] >>> 16) | 0, t[7] = c[7] + (c[6] << 8 | c[6] >>> 24) + c[5] | 0 } var e = t, i = e.lib, n = i.StreamCipher, o = e.algo, s = [], a = [], c = [], h = o.RabbitLegacy = n.extend({ _doReset: function () { var t = this._key.words, e = this.cfg.iv, i = this._X = [t[0], t[3] << 16 | t[2] >>> 16, t[1], t[0] << 16 | t[3] >>> 16, t[2], t[1] << 16 | t[0] >>> 16, t[3], t[2] << 16 | t[1] >>> 16], n = this._C = [t[2] << 16 | t[2] >>> 16, 4294901760 & t[0] | 65535 & t[1], t[3] << 16 | t[3] >>> 16, 4294901760 & t[1] | 65535 & t[2], t[0] << 16 | t[0] >>> 16, 4294901760 & t[2] | 65535 & t[3], t[1] << 16 | t[1] >>> 16, 4294901760 & t[3] | 65535 & t[0]]; this._b = 0; for (var o = 0; o < 4; o++)r.call(this); for (var o = 0; o < 8; o++)n[o] ^= i[o + 4 & 7]; if (e) { var s = e.words, a = s[0], c = s[1], h = 16711935 & (a << 8 | a >>> 24) | 4278255360 & (a << 24 | a >>> 8), l = 16711935 & (c << 8 | c >>> 24) | 4278255360 & (c << 24 | c >>> 8), f = h >>> 16 | 4294901760 & l, u = l << 16 | 65535 & h; n[0] ^= h, n[1] ^= f, n[2] ^= l, n[3] ^= u, n[4] ^= h, n[5] ^= f, n[6] ^= l, n[7] ^= u; for (var o = 0; o < 4; o++)r.call(this) } }, _doProcessBlock: function (t, e) { var i = this._X; r.call(this), s[0] = i[0] ^ i[5] >>> 16 ^ i[3] << 16, s[1] = i[2] ^ i[7] >>> 16 ^ i[5] << 16, s[2] = i[4] ^ i[1] >>> 16 ^ i[7] << 16, s[3] = i[6] ^ i[3] >>> 16 ^ i[1] << 16; for (var n = 0; n < 4; n++)s[n] = 16711935 & (s[n] << 8 | s[n] >>> 24) | 4278255360 & (s[n] << 24 | s[n] >>> 8), t[e + n] ^= s[n] }, blockSize: 4, ivSize: 2 }); e.RabbitLegacy = n._createHelper(h) }(), t.pad.ZeroPadding = { pad: function (t, r) { var e = 4 * r; t.clamp(), t.sigBytes += e - (t.sigBytes % e || e) }, unpad: function (t) { for (var r = t.words, e = t.sigBytes - 1; !(r[e >>> 2] >>> 24 - e % 4 * 8 & 255);)e--; t.sigBytes = e + 1 } }, t +}); + +const $ = new Env('中国移动') +$.KEY_autologin = 'chavy_autologin_cmcc' +$.KEY_getfee = 'chavy_getfee_cmcc' + +!(async () => { + $.CryptoJS = $.isNode() ? require('crypto-js') : CryptoJS + await loginapp() + await queryfee() + await showmsg() +})() + .catch((e) => $.logErr(e)) + .finally(() => $.done()) + +function loginapp() { + return new Promise((resolve) => { + const url = JSON.parse($.getdata($.KEY_autologin)) + $.post(url, (err, resp, data) => { + try { + $.setck = $.isNode() ? resp.headers['set-cookie'] : resp.headers['Set-Cookie'] + } catch (e) { + $.logErr(e, resp) + } finally { + resolve() + } + }) + }) +} + +function queryfee() { + return new Promise((resolve) => { + const url = JSON.parse($.getdata($.KEY_getfee)) + const body = JSON.parse(decrypt(url.body, 'bAIgvwAuA4tbDr9d')) + const cellNum = body.reqBody.cellNum + const bodystr = `{"t":"${$.CryptoJS.MD5($.setck).toString()}","cv":"9.9.9","reqBody":{"cellNum":"${cellNum}"}}` + url.body = encrypt(bodystr, 'bAIgvwAuA4tbDr9d') + url.headers['Cookie'] = $.setck + url.headers['xs'] = $.CryptoJS.MD5(url.url + '_' + bodystr + '_Leadeon/SecurityOrganization').toString() + $.post(url, (err, resp, data) => { + try { + $.fee = JSON.parse(decrypt(data, 'GS7VelkJl5IT1uwQ')) + } catch (e) { + $.logErr(e, resp) + } finally { + resolve() + } + }) + }) +} + +function encrypt(str, key) { + return $.CryptoJS.AES.encrypt($.CryptoJS.enc.Utf8.parse(str), $.CryptoJS.enc.Utf8.parse(key), { + iv: $.CryptoJS.enc.Utf8.parse('9791027341711819'), + mode: $.CryptoJS.mode.CBC, + padding: $.CryptoJS.pad.Pkcs7 + }).toString() +} + +function decrypt(str, key) { + return $.CryptoJS.AES.decrypt(str, $.CryptoJS.enc.Utf8.parse(key), { + iv: $.CryptoJS.enc.Utf8.parse('9791027341711819'), + mode: $.CryptoJS.mode.CBC, + padding: $.CryptoJS.pad.Pkcs7 + }).toString($.CryptoJS.enc.Utf8) +} + +function showmsg() { + return new Promise((resolve) => { + $.subt = `余额: ${$.fee.rspBody.curFeeTotal}, 剩余: ${$.fee.rspBody.curFee}, 实际消费: ${$.fee.rspBody.realFee}` + $.msg($.name, $.subt, '') + resolve() + }) +} + +// prettier-ignore +function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),h=JSON.stringify(this.data);e?this.fs.writeFileSync(t,h):i?this.fs.writeFileSync(s,h):this.fs.writeFileSync(t,h)}}getdata(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setdata(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t)):this.isNode()&&(this.got=this.got?this.got:require("got"),this.got(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t));else if(this.isNode()){this.got=this.got?this.got:require("got");const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t))}}msg(s=t,e="",i="",h){this.isSurge()||this.isLoon()?$notification.post(s,e,i):this.isQuanX()&&$notify(s,e,i),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} diff --git a/box/chavy.boxjs.json b/box/chavy.boxjs.json index 85fe492b2..0648046f8 100644 --- a/box/chavy.boxjs.json +++ b/box/chavy.boxjs.json @@ -8,7 +8,7 @@ { "id": "chavyleung.10086", "name": "10086", - "keys": ["chavy_tokenurl_10086", "chavy_tokenheader_10086", "chavy_signurl_10086", "chavy_signheader_10086"], + "keys": ["chavy_autologin_cmcc", "chavy_getfee_cmcc", "chavy_tokenurl_10086", "chavy_tokenheader_10086", "chavy_signurl_10086", "chavy_signheader_10086"], "author": "@chavyleung", "repo": "https://github.com/chavyleung/scripts/blob/master/10086/10086.js", "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/10086.png", "https://raw.githubusercontent.com/Orz-3/task/master/10086.png"] diff --git a/package.json b/package.json index 293f65b05..c1202eba2 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "author": "Chavy ", "license": "MIT", "dependencies": { + "crypto-js": "^4.0.0", "got": "^11.3.0", "tough-cookie": "^4.0.0" } diff --git a/yarn.lock b/yarn.lock index e49f62cdf..8957f68e5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -73,6 +73,11 @@ clone-response@^1.0.2: dependencies: mimic-response "^1.0.0" +crypto-js@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-4.0.0.tgz#2904ab2677a9d042856a2ea2ef80de92e4a36dcc" + integrity sha512-bzHZN8Pn+gS7DQA6n+iUmBfl0hO5DJq++QP3U6uTucDtk/0iGpXd/Gg7CGR0p8tJhofJyaKoWBuJI4eAO00BBg== + decompress-response@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-6.0.0.tgz#ca387612ddb7e104bd16d85aab00d5ecf09c66fc" From ef5b493d50623811d2c058d471e2a2ef7cdedc36 Mon Sep 17 00:00:00 2001 From: Chavy Date: Thu, 25 Jun 2020 00:10:35 +0800 Subject: [PATCH 004/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E6=82=AC?= =?UTF-8?q?=E6=B5=AE=E5=9B=BE=E6=A0=87=E5=A2=9E=E5=8A=A0=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chavy.box.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/chavy.box.js b/chavy.box.js index 61d491463..a8288eee3 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -652,6 +652,9 @@ function printHtml(data, curapp = null, curview = 'app') { mdi-export-variant + + mdi-refresh + From 2fb5cf87f9b9f6ffc82605be1778fa488003a017 Mon Sep 17 00:00:00 2001 From: Chavy Date: Thu, 25 Jun 2020 02:48:55 +0800 Subject: [PATCH 005/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[10086]=E6=9F=A5?= =?UTF-8?q?=E8=AF=9D=E8=B4=B9:=20=E5=A2=9E=E5=8A=A0=E6=B5=81=E9=87=8F&?= =?UTF-8?q?=E8=AF=AD=E9=9F=B3=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 10086/10086.fee.js | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/10086/10086.fee.js b/10086/10086.fee.js index d8335e245..d5085d10b 100644 --- a/10086/10086.fee.js +++ b/10086/10086.fee.js @@ -15,6 +15,7 @@ $.KEY_getfee = 'chavy_getfee_cmcc' $.CryptoJS = $.isNode() ? require('crypto-js') : CryptoJS await loginapp() await queryfee() + await querymeal() await showmsg() })() .catch((e) => $.logErr(e)) @@ -55,6 +56,27 @@ function queryfee() { }) }) } +function querymeal() { + return new Promise((resolve) => { + const url = JSON.parse($.getdata($.KEY_getfee)) + url.url = 'https://clientaccess.10086.cn/biz-orange/BN/newComboMealResouceUnite/getNewComboMealResource' + const body = JSON.parse(decrypt(url.body, 'bAIgvwAuA4tbDr9d')) + const cellNum = body.reqBody.cellNum + const bodystr = `{"t":"${$.CryptoJS.MD5($.setck).toString()}","cv":"9.9.9","reqBody":{"cellNum":"${cellNum}","tag":"3"}}` + url.body = encrypt(bodystr, 'bAIgvwAuA4tbDr9d') + url.headers['Cookie'] = $.setck + url.headers['xs'] = $.CryptoJS.MD5(url.url + '_' + bodystr + '_Leadeon/SecurityOrganization').toString() + $.post(url, (err, resp, data) => { + try { + $.meal = JSON.parse(decrypt(data, 'GS7VelkJl5IT1uwQ')) + } catch (e) { + $.logErr(e, resp) + } finally { + resolve() + } + }) + }) +} function encrypt(str, key) { return $.CryptoJS.AES.encrypt($.CryptoJS.enc.Utf8.parse(str), $.CryptoJS.enc.Utf8.parse(key), { @@ -74,8 +96,26 @@ function decrypt(str, key) { function showmsg() { return new Promise((resolve) => { - $.subt = `余额: ${$.fee.rspBody.curFeeTotal}, 剩余: ${$.fee.rspBody.curFee}, 实际消费: ${$.fee.rspBody.realFee}` - $.msg($.name, $.subt, '') + $.subt = `话费: ${$.fee.rspBody.curFeeTotal}, 剩余: ${$.fee.rspBody.curFee}, 已用: ${$.fee.rspBody.realFee}` + const res = $.meal.rspBody.qryInfoRsp[0].resourcesTotal + + const flowRes = res.find((r) => r.resourcesCode === '04') + const voiceRes = res.find((r) => r.resourcesCode === '01') + console.log(JSON.stringify(flowRes)) + $.desc = [] + if (flowRes) { + const remUnit = flowRes.remUnit === '05' ? 'GB' : 'MB' + const usedUnit = flowRes.usedUnit === '05' ? 'GB' : 'MB' + const unit = flowRes.allUnit === '05' ? 'GB' : 'MB' + $.desc.push(`流量: ${flowRes.allUsedRes}${usedUnit}/${flowRes.allTotalRes}${unit}, 剩余: ${flowRes.allRemainRes}${remUnit}`) + } + if (voiceRes) { + const remUnit = flowRes.remUnit === '01' ? '分钟' : '' + const usedUnit = flowRes.usedUnit === '01' ? '分钟' : '' + const allUnit = '分钟' + $.desc.push(`语音: ${voiceRes.allUsedRes}/${voiceRes.allTotalRes}${allUnit}, 剩余: ${voiceRes.allRemainRes}${allUnit}`) + } + $.msg($.name, $.subt, $.desc.join('\n')) resolve() }) } From 54f7ac0492e30b3d75d2fa59263045d03f2ab350 Mon Sep 17 00:00:00 2001 From: Chavy Date: Fri, 26 Jun 2020 01:30:59 +0800 Subject: [PATCH 006/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=95=BF=E6=96=87=E6=9C=AC=E6=8E=A7=E4=BB=B6`textarea?= =?UTF-8?q?`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chavy.box.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/chavy.box.js b/chavy.box.js index a8288eee3..e12c83976 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -1,7 +1,7 @@ const $ = new Env('BoxJs') $.domain = '8.8.8.8' -$.version = '0.0.1' +$.version = '0.1.1' $.versionType = 'beta' $.KEY_sessions = 'chavy_boxjs_sessions' $.KEY_userCfgs = 'chavy_boxjs_userCfgs' @@ -785,9 +785,10 @@ function printHtml(data, curapp = null, curview = 'app') { From 31e1b3ede8344eb57970cf511e6db7e790e83823 Mon Sep 17 00:00:00 2001 From: Chavy Date: Fri, 26 Jun 2020 02:17:59 +0800 Subject: [PATCH 007/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=85=A8=E5=B1=80=E5=AF=BC=E5=85=A5&=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E7=BC=BA=E5=B0=91=E5=BA=94=E7=94=A8=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chavy.box.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/chavy.box.js b/chavy.box.js index e12c83976..af946d9c4 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -1,7 +1,7 @@ const $ = new Env('BoxJs') $.domain = '8.8.8.8' -$.version = '0.1.1' +$.version = '0.1.2' $.versionType = 'beta' $.KEY_sessions = 'chavy_boxjs_sessions' $.KEY_userCfgs = 'chavy_boxjs_userCfgs' @@ -1138,18 +1138,28 @@ function printHtml(data, curapp = null, curview = 'app') { dat[KEY_sysApps] = this.box.sysapps this.box.sysapps.forEach((app, appIdx) => { app.datas.forEach((data, dataIdx) => { - if (![undefined, null].includes(data.val)) { + if (![undefined, null, 'null'].includes(data.val) && !/^@/.test(data.key)) { dat[data.key] = data.val } }) + app.settings && app.settings.forEach((setting, settingIdx) => { + if (![undefined, null, 'null'].includes(setting.val) && !/^@/.test(setting.id)) { + dat[setting.id] = setting.val + } + }) }) this.box.appsubs.forEach((sub, subIdx) => { sub.apps.forEach((app, appIdx) => { app.datas.forEach((data, dataIdx) => { - if (![undefined, null].includes(data.val)) { + if (![undefined, null, 'null'].includes(data.val) && !/^@/.test(data.key)) { dat[data.key] = data.val } }) + app.settings && app.settings.forEach((setting, settingIdx) => { + if (![undefined, null, 'null'].includes(setting.val) && !/^@/.test(setting.id)) { + dat[setting.id] = setting.val + } + }) }) }) return dat From 19a28b9128028b3a812aa92d6b1935b09605b222 Mon Sep 17 00:00:00 2001 From: Chavy Date: Fri, 26 Jun 2020 15:05:06 +0800 Subject: [PATCH 008/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[EnvJs]:=20=E6=8C=81?= =?UTF-8?q?=E4=B9=85=E5=8C=96=E6=8E=A5=E5=8F=A3=E6=94=AF=E6=8C=81=E8=A1=A8?= =?UTF-8?q?=E8=BE=BE=E5=BC=8F:=20$.getdata("@foo.name")?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Env.js | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++- Env.min.js | 2 +- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/Env.js b/Env.js index bdb4d5dcf..2a946115b 100644 --- a/Env.js +++ b/Env.js @@ -65,7 +65,67 @@ function Env(name, opts) { } } + lodash_get(source, path, defaultValue = undefined) { + const paths = path.replace(/\[(\d+)\]/g, '.$1').split('.') + let result = source + for (const p of paths) { + result = Object(result)[p] + if (result === undefined) { + return defaultValue + } + } + return result + } + + lodash_set(obj, path, value) { + if (Object(obj) !== obj) return obj + if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || [] + path.slice(0, -1).reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[path[path.length - 1]] = value + return obj + } + getdata(key) { + let val = this.getval(key) + // 如果以 @ + if (/^@/.test(key)) { + const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key) + const objval = objkey ? this.getval(objkey) : '' + if (objval) { + try { + const objedval = JSON.parse(objval) + val = objedval ? this.lodash_get(objedval, paths, '') : val + } catch (e) { + val = '' + } + } + } + return val + } + + setdata(val, key) { + let issuc = false + if (/^@/.test(key)) { + const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key) + const objdat = this.getval(objkey) + const objval = objkey ? (objdat === 'null' ? null : objdat || '{}') : '{}' + try { + const objedval = JSON.parse(objval) + this.lodash_set(objedval, paths, val) + issuc = this.setval(JSON.stringify(objedval), objkey) + console.log(`${objkey}: ${JSON.stringify(objedval)}`) + } catch { + const objedval = {} + this.lodash_set(objedval, paths, val) + issuc = this.setval(JSON.stringify(objedval), objkey) + console.log(`${objkey}: ${JSON.stringify(objedval)}`) + } + } else { + issuc = $.setval(val, key) + } + return issuc + } + + getval(key) { if (this.isSurge() || this.isLoon()) { return $persistentStore.read(key) } else if (this.isQuanX()) { @@ -78,7 +138,7 @@ function Env(name, opts) { } } - setdata(val, key) { + setval(val, key) { if (this.isSurge() || this.isLoon()) { return $persistentStore.write(val, key) } else if (this.isQuanX()) { diff --git a/Env.min.js b/Env.min.js index 54d892f9e..267d1d766 100644 --- a/Env.min.js +++ b/Env.min.js @@ -1 +1 @@ -function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),h=JSON.stringify(this.data);e?this.fs.writeFileSync(t,h):i?this.fs.writeFileSync(s,h):this.fs.writeFileSync(t,h)}}getdata(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setdata(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t))}}msg(s=t,e="",i="",h){this.isSurge()||this.isLoon()?$notification.post(s,e,i):this.isQuanX()&&$notify(s,e,i),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} \ No newline at end of file +function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}catch{const s={};this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}}else e=$.setval(t,s);return e}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}msg(s=t,e="",i="",o){this.isSurge()||this.isLoon()?$notification.post(s,e,i):this.isQuanX()&&$notify(s,e,i),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} \ No newline at end of file From 8f9de656f26a6d46b7d2070a6d4793b8528d5e76 Mon Sep 17 00:00:00 2001 From: Chavy Date: Fri, 26 Jun 2020 15:06:07 +0800 Subject: [PATCH 009/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=95=BF=E6=96=87=E6=9C=AC=E6=8E=A7=E4=BB=B6,=20setti?= =?UTF-8?q?ng=20&=20data=20key=E6=94=AF=E6=8C=81=E8=A1=A8=E8=BE=BE?= =?UTF-8?q?=E5=BC=8F:=20@foo.name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chavy.box.js | 78 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 33 deletions(-) diff --git a/chavy.box.js b/chavy.box.js index af946d9c4..98e059d1e 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -354,11 +354,14 @@ function wrapapps(apps) { // 获取持久化数据 app.datas = Array.isArray(app.datas) ? app.datas : [] app.keys.forEach((key) => { - app.datas.push({ key, val: $.getdata(key) }) + const valdat = $.getdata(key) + const val = [undefined, null, 'null', ''].includes(valdat) ? null : valdat + app.datas.push({ key, val }) }) Array.isArray(app.settings) && app.settings.forEach((setting) => { - const val = $.getdata(setting.id) + const valdat = $.getdata(setting.id) + const val = [undefined, null, 'null', ''].includes(valdat) ? null : valdat if (setting.type === 'boolean') { setting.val = val === null ? setting.val : val === 'true' } else if (setting.type === 'int') { @@ -785,10 +788,10 @@ function printHtml(data, curapp = null, curview = 'app') { @@ -988,27 +991,6 @@ function printHtml(data, curapp = null, curview = 'app') { - - - - 导入备份 - - 清空 - - - - - - - - 复制 - 粘粘 - - 取消 - 导入 - - - 个人资料 @@ -1043,6 +1025,30 @@ function printHtml(data, curapp = null, curview = 'app') { + + + + 导入备份 + + 清空 + + + + + + + + 复制 + 粘粘 + + 取消 + 导入 + + + + + + @@ -1092,6 +1098,7 @@ function printHtml(data, curapp = null, curview = 'app') { curapp: ${curapp}, curappTabs: { curtab: 'sessions' }, curappSessions: null, + overlay: { show: false }, editProfileDialog: { show: false, bak: '' }, impGlobalBakDialog: { show: false, bak: '' }, reloadConfirmDialog: { show: false, title: '操作成功', message: '是否马上刷新页面?' }, @@ -1138,12 +1145,12 @@ function printHtml(data, curapp = null, curview = 'app') { dat[KEY_sysApps] = this.box.sysapps this.box.sysapps.forEach((app, appIdx) => { app.datas.forEach((data, dataIdx) => { - if (![undefined, null, 'null'].includes(data.val) && !/^@/.test(data.key)) { + if (![undefined, null, 'null'].includes(data.val)) { dat[data.key] = data.val } }) app.settings && app.settings.forEach((setting, settingIdx) => { - if (![undefined, null, 'null'].includes(setting.val) && !/^@/.test(setting.id)) { + if (![undefined, null, 'null'].includes(setting.val)) { dat[setting.id] = setting.val } }) @@ -1151,12 +1158,12 @@ function printHtml(data, curapp = null, curview = 'app') { this.box.appsubs.forEach((sub, subIdx) => { sub.apps.forEach((app, appIdx) => { app.datas.forEach((data, dataIdx) => { - if (![undefined, null, 'null'].includes(data.val) && !/^@/.test(data.key)) { + if (![undefined, null, 'null'].includes(data.val)) { dat[data.key] = data.val } }) app.settings && app.settings.forEach((setting, settingIdx) => { - if (![undefined, null, 'null'].includes(setting.val) && !/^@/.test(setting.id)) { + if (![undefined, null, 'null'].includes(setting.val)) { dat[setting.id] = setting.val } }) @@ -1271,6 +1278,7 @@ function printHtml(data, curapp = null, curview = 'app') { onClearCurAppSessionData(app, datas, data) { data.val = '' axios.post('/api', JSON.stringify({ cmd: 'saveCurAppSession', val: app })) + this.onReload() }, onSaveSession() { const session = { @@ -1280,7 +1288,7 @@ function printHtml(data, curapp = null, curview = 'app') { appName: this.ui.curapp.name, enable: true, createTime: moment().format('YYYY-MM-DD HH:mm:ss'), - datas: this.ui.curapp.datas + datas: JSON.parse(JSON.stringify(this.ui.curapp.datas)) } this.box.sessions.push(session) this.ui.curappSessions.push(session) @@ -1288,6 +1296,7 @@ function printHtml(data, curapp = null, curview = 'app') { }, onSaveSettings() { axios.post('/api', JSON.stringify({ cmd: 'saveSettings', val: this.ui.curapp.settings })) + this.onReload() }, onImpSessionPaste() { navigator.clipboard.readText().then((text) => { @@ -1341,6 +1350,7 @@ function printHtml(data, curapp = null, curview = 'app') { this.ui.reloadConfirmDialog.show = true }, onReload() { + this.ui.overlay.show = true window.location.reload() }, onDelSession(session) { @@ -1353,6 +1363,7 @@ function printHtml(data, curapp = null, curview = 'app') { onUseSession(session) { axios.post('/api', JSON.stringify({ cmd: 'useSession', val: session })) this.ui.curapp.datas = JSON.parse(JSON.stringify(session.datas)) + this.onReload() }, onImpGlobalBak() { const env = this.box.syscfgs.env @@ -1371,6 +1382,7 @@ function printHtml(data, curapp = null, curview = 'app') { this.box.globalbaks.push(bakobj) this.ui.impGlobalBakDialog.show = false axios.post('/api', JSON.stringify({ cmd: 'globalBak', val: bakobj })) + this.onReload() }, onGlobalBak() { const env = this.box.syscfgs.env @@ -1427,4 +1439,4 @@ function printJson() { } // prettier-ignore -function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),h=JSON.stringify(this.data);e?this.fs.writeFileSync(t,h):i?this.fs.writeFileSync(s,h):this.fs.writeFileSync(t,h)}}getdata(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setdata(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t))}}msg(s=t,e="",i="",h){this.isSurge()||this.isLoon()?$notification.post(s,e,i):this.isQuanX()&&$notify(s,e,i),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} +function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}catch{const s={};this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}}else e=$.setval(t,s);return e}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}msg(s=t,e="",i="",o){this.isSurge()||this.isLoon()?$notification.post(s,e,i):this.isQuanX()&&$notify(s,e,i),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} From 8f519e5d991cd7658bb2689ea1d73b209ab278d8 Mon Sep 17 00:00:00 2001 From: Chavy Date: Sat, 27 Jun 2020 00:25:07 +0800 Subject: [PATCH 010/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=BA=94=E7=94=A8=E8=AE=A2=E9=98=85=20icon&author=20?= =?UTF-8?q?=E7=BC=BA=E5=A4=B1=E9=BB=98=E8=AE=A4=E5=80=BC=E9=97=AE=E9=A2=98?= =?UTF-8?q?;=20=E4=BF=AE=E5=A4=8D=20appId=20=E7=89=B9=E6=AE=8A=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E8=BD=AC=E4=B9=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chavy.box.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/chavy.box.js b/chavy.box.js index 98e059d1e..647f912df 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -1,7 +1,7 @@ const $ = new Env('BoxJs') $.domain = '8.8.8.8' -$.version = '0.1.2' +$.version = '0.1.3' $.versionType = 'beta' $.KEY_sessions = 'chavy_boxjs_sessions' $.KEY_userCfgs = 'chavy_boxjs_userCfgs' @@ -11,6 +11,7 @@ $.json = $.name $.html = $.name !(async () => { + // $.setdata('', 'github') const path = getPath($request.url) // 处理主页请求 => /home if (/^\/home/.test(path)) { @@ -22,7 +23,8 @@ $.html = $.name } // 处理 App 请求 => /app else if (/^\/app/.test(path)) { - await handleApp(path.split('/app/')[1]) + const [, appId] = path.split('/app/') + await handleApp(decodeURIComponent(decodeURIComponent(appId))) } // 处理 Api 请求 => /api else if (/^\/api/.test(path)) { @@ -369,6 +371,11 @@ function wrapapps(apps) { } else { setting.val = val || setting.val } + if (!Array.isArray(app.icons)) { + app.icons = ['https://raw.githubusercontent.com/Orz-3/mini/master/appstore.png', 'https://raw.githubusercontent.com/Orz-3/task/master/appstore.png'] + } + app.author = app.author ? app.author : '@anonymous' + app.repo = app.repo ? app.repo : '作者很神秘, 没有留下任何线索!' }) // 判断是否收藏应用 const usercfgs = getUserCfgs() From 0fd26a89ab6e813325adaca4165ff6e6fdd501c9 Mon Sep 17 00:00:00 2001 From: Chavy Date: Sat, 27 Jun 2020 00:39:59 +0800 Subject: [PATCH 011/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[chavy.boxjs.json]:?= =?UTF-8?q?=20=E4=B8=AD=E5=9B=BD=E7=A7=BB=E5=8A=A8=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=81=B0=E7=81=B0=E5=A4=A7=E4=BD=AC=20author=20=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/chavy.boxjs.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/box/chavy.boxjs.json b/box/chavy.boxjs.json index 0648046f8..ec220b231 100644 --- a/box/chavy.boxjs.json +++ b/box/chavy.boxjs.json @@ -9,7 +9,7 @@ "id": "chavyleung.10086", "name": "10086", "keys": ["chavy_autologin_cmcc", "chavy_getfee_cmcc", "chavy_tokenurl_10086", "chavy_tokenheader_10086", "chavy_signurl_10086", "chavy_signheader_10086"], - "author": "@chavyleung", + "author": "@@wangfei021325, @chavyleung", "repo": "https://github.com/chavyleung/scripts/blob/master/10086/10086.js", "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/10086.png", "https://raw.githubusercontent.com/Orz-3/task/master/10086.png"] }, From 3d1bea24e53aca49d97e86de3dbf820f68e6d056 Mon Sep 17 00:00:00 2001 From: Chavy Date: Sat, 27 Jun 2020 02:56:17 +0800 Subject: [PATCH 012/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[=E4=B8=AD=E5=9B=BD?= =?UTF-8?q?=E7=94=B5=E4=BF=A1]:=20=E6=B2=A1=E9=94=99,=20=E7=94=B5=E4=BF=A1?= =?UTF-8?q?=E5=A4=8D=E6=B4=BB=E4=BA=86,=20=E6=84=9F=E8=B0=A2=20@wangfei021?= =?UTF-8?q?325?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 10000/10000.js | 180 +++++++++++++++++++++++-------------------- box/chavy.boxjs.json | 11 ++- 2 files changed, 106 insertions(+), 85 deletions(-) diff --git a/10000/10000.js b/10000/10000.js index 2451a0348..c694a9761 100644 --- a/10000/10000.js +++ b/10000/10000.js @@ -1,94 +1,106 @@ -const chavy = init() -const cookieName = '电信营业厅' -const KEY_signheader = 'chavy_signheader_10000' -const KEY_signbody = 'chavy_signbody_10000' -const KEY_mobile = 'chavy_mobile_10000' +// prettier-ignore +!function (t, r) { "object" == typeof exports ? module.exports = exports = r() : "function" == typeof define && define.amd ? define([], r) : t.CryptoJS = r() }(this, function () { + var t = t || function (t, r) { var e = Object.create || function () { function t() { } return function (r) { var e; return t.prototype = r, e = new t, t.prototype = null, e } }(), i = {}, n = i.lib = {}, o = n.Base = function () { return { extend: function (t) { var r = e(this); return t && r.mixIn(t), r.hasOwnProperty("init") && this.init !== r.init || (r.init = function () { r.$super.init.apply(this, arguments) }), r.init.prototype = r, r.$super = this, r }, create: function () { var t = this.extend(); return t.init.apply(t, arguments), t }, init: function () { }, mixIn: function (t) { for (var r in t) t.hasOwnProperty(r) && (this[r] = t[r]); t.hasOwnProperty("toString") && (this.toString = t.toString) }, clone: function () { return this.init.prototype.extend(this) } } }(), s = n.WordArray = o.extend({ init: function (t, e) { t = this.words = t || [], e != r ? this.sigBytes = e : this.sigBytes = 4 * t.length }, toString: function (t) { return (t || c).stringify(this) }, concat: function (t) { var r = this.words, e = t.words, i = this.sigBytes, n = t.sigBytes; if (this.clamp(), i % 4) for (var o = 0; o < n; o++) { var s = e[o >>> 2] >>> 24 - o % 4 * 8 & 255; r[i + o >>> 2] |= s << 24 - (i + o) % 4 * 8 } else for (var o = 0; o < n; o += 4)r[i + o >>> 2] = e[o >>> 2]; return this.sigBytes += n, this }, clamp: function () { var r = this.words, e = this.sigBytes; r[e >>> 2] &= 4294967295 << 32 - e % 4 * 8, r.length = t.ceil(e / 4) }, clone: function () { var t = o.clone.call(this); return t.words = this.words.slice(0), t }, random: function (r) { for (var e, i = [], n = function (r) { var r = r, e = 987654321, i = 4294967295; return function () { e = 36969 * (65535 & e) + (e >> 16) & i, r = 18e3 * (65535 & r) + (r >> 16) & i; var n = (e << 16) + r & i; return n /= 4294967296, n += .5, n * (t.random() > .5 ? 1 : -1) } }, o = 0; o < r; o += 4) { var a = n(4294967296 * (e || t.random())); e = 987654071 * a(), i.push(4294967296 * a() | 0) } return new s.init(i, r) } }), a = i.enc = {}, c = a.Hex = { stringify: function (t) { for (var r = t.words, e = t.sigBytes, i = [], n = 0; n < e; n++) { var o = r[n >>> 2] >>> 24 - n % 4 * 8 & 255; i.push((o >>> 4).toString(16)), i.push((15 & o).toString(16)) } return i.join("") }, parse: function (t) { for (var r = t.length, e = [], i = 0; i < r; i += 2)e[i >>> 3] |= parseInt(t.substr(i, 2), 16) << 24 - i % 8 * 4; return new s.init(e, r / 2) } }, h = a.Latin1 = { stringify: function (t) { for (var r = t.words, e = t.sigBytes, i = [], n = 0; n < e; n++) { var o = r[n >>> 2] >>> 24 - n % 4 * 8 & 255; i.push(String.fromCharCode(o)) } return i.join("") }, parse: function (t) { for (var r = t.length, e = [], i = 0; i < r; i++)e[i >>> 2] |= (255 & t.charCodeAt(i)) << 24 - i % 4 * 8; return new s.init(e, r) } }, l = a.Utf8 = { stringify: function (t) { try { return decodeURIComponent(escape(h.stringify(t))) } catch (t) { throw new Error("Malformed UTF-8 data") } }, parse: function (t) { return h.parse(unescape(encodeURIComponent(t))) } }, f = n.BufferedBlockAlgorithm = o.extend({ reset: function () { this._data = new s.init, this._nDataBytes = 0 }, _append: function (t) { "string" == typeof t && (t = l.parse(t)), this._data.concat(t), this._nDataBytes += t.sigBytes }, _process: function (r) { var e = this._data, i = e.words, n = e.sigBytes, o = this.blockSize, a = 4 * o, c = n / a; c = r ? t.ceil(c) : t.max((0 | c) - this._minBufferSize, 0); var h = c * o, l = t.min(4 * h, n); if (h) { for (var f = 0; f < h; f += o)this._doProcessBlock(i, f); var u = i.splice(0, h); e.sigBytes -= l } return new s.init(u, l) }, clone: function () { var t = o.clone.call(this); return t._data = this._data.clone(), t }, _minBufferSize: 0 }), u = (n.Hasher = f.extend({ cfg: o.extend(), init: function (t) { this.cfg = this.cfg.extend(t), this.reset() }, reset: function () { f.reset.call(this), this._doReset() }, update: function (t) { return this._append(t), this._process(), this }, finalize: function (t) { t && this._append(t); var r = this._doFinalize(); return r }, blockSize: 16, _createHelper: function (t) { return function (r, e) { return new t.init(e).finalize(r) } }, _createHmacHelper: function (t) { return function (r, e) { return new u.HMAC.init(t, e).finalize(r) } } }), i.algo = {}); return i }(Math); return function () { function r(t, r, e) { for (var i = [], o = 0, s = 0; s < r; s++)if (s % 4) { var a = e[t.charCodeAt(s - 1)] << s % 4 * 2, c = e[t.charCodeAt(s)] >>> 6 - s % 4 * 2; i[o >>> 2] |= (a | c) << 24 - o % 4 * 8, o++ } return n.create(i, o) } var e = t, i = e.lib, n = i.WordArray, o = e.enc; o.Base64 = { stringify: function (t) { var r = t.words, e = t.sigBytes, i = this._map; t.clamp(); for (var n = [], o = 0; o < e; o += 3)for (var s = r[o >>> 2] >>> 24 - o % 4 * 8 & 255, a = r[o + 1 >>> 2] >>> 24 - (o + 1) % 4 * 8 & 255, c = r[o + 2 >>> 2] >>> 24 - (o + 2) % 4 * 8 & 255, h = s << 16 | a << 8 | c, l = 0; l < 4 && o + .75 * l < e; l++)n.push(i.charAt(h >>> 6 * (3 - l) & 63)); var f = i.charAt(64); if (f) for (; n.length % 4;)n.push(f); return n.join("") }, parse: function (t) { var e = t.length, i = this._map, n = this._reverseMap; if (!n) { n = this._reverseMap = []; for (var o = 0; o < i.length; o++)n[i.charCodeAt(o)] = o } var s = i.charAt(64); if (s) { var a = t.indexOf(s); a !== -1 && (e = a) } return r(t, e, n) }, _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" } }(), function (r) { function e(t, r, e, i, n, o, s) { var a = t + (r & e | ~r & i) + n + s; return (a << o | a >>> 32 - o) + r } function i(t, r, e, i, n, o, s) { var a = t + (r & i | e & ~i) + n + s; return (a << o | a >>> 32 - o) + r } function n(t, r, e, i, n, o, s) { var a = t + (r ^ e ^ i) + n + s; return (a << o | a >>> 32 - o) + r } function o(t, r, e, i, n, o, s) { var a = t + (e ^ (r | ~i)) + n + s; return (a << o | a >>> 32 - o) + r } var s = t, a = s.lib, c = a.WordArray, h = a.Hasher, l = s.algo, f = []; !function () { for (var t = 0; t < 64; t++)f[t] = 4294967296 * r.abs(r.sin(t + 1)) | 0 }(); var u = l.MD5 = h.extend({ _doReset: function () { this._hash = new c.init([1732584193, 4023233417, 2562383102, 271733878]) }, _doProcessBlock: function (t, r) { for (var s = 0; s < 16; s++) { var a = r + s, c = t[a]; t[a] = 16711935 & (c << 8 | c >>> 24) | 4278255360 & (c << 24 | c >>> 8) } var h = this._hash.words, l = t[r + 0], u = t[r + 1], d = t[r + 2], v = t[r + 3], p = t[r + 4], _ = t[r + 5], y = t[r + 6], g = t[r + 7], B = t[r + 8], w = t[r + 9], k = t[r + 10], S = t[r + 11], m = t[r + 12], x = t[r + 13], b = t[r + 14], H = t[r + 15], z = h[0], A = h[1], C = h[2], D = h[3]; z = e(z, A, C, D, l, 7, f[0]), D = e(D, z, A, C, u, 12, f[1]), C = e(C, D, z, A, d, 17, f[2]), A = e(A, C, D, z, v, 22, f[3]), z = e(z, A, C, D, p, 7, f[4]), D = e(D, z, A, C, _, 12, f[5]), C = e(C, D, z, A, y, 17, f[6]), A = e(A, C, D, z, g, 22, f[7]), z = e(z, A, C, D, B, 7, f[8]), D = e(D, z, A, C, w, 12, f[9]), C = e(C, D, z, A, k, 17, f[10]), A = e(A, C, D, z, S, 22, f[11]), z = e(z, A, C, D, m, 7, f[12]), D = e(D, z, A, C, x, 12, f[13]), C = e(C, D, z, A, b, 17, f[14]), A = e(A, C, D, z, H, 22, f[15]), z = i(z, A, C, D, u, 5, f[16]), D = i(D, z, A, C, y, 9, f[17]), C = i(C, D, z, A, S, 14, f[18]), A = i(A, C, D, z, l, 20, f[19]), z = i(z, A, C, D, _, 5, f[20]), D = i(D, z, A, C, k, 9, f[21]), C = i(C, D, z, A, H, 14, f[22]), A = i(A, C, D, z, p, 20, f[23]), z = i(z, A, C, D, w, 5, f[24]), D = i(D, z, A, C, b, 9, f[25]), C = i(C, D, z, A, v, 14, f[26]), A = i(A, C, D, z, B, 20, f[27]), z = i(z, A, C, D, x, 5, f[28]), D = i(D, z, A, C, d, 9, f[29]), C = i(C, D, z, A, g, 14, f[30]), A = i(A, C, D, z, m, 20, f[31]), z = n(z, A, C, D, _, 4, f[32]), D = n(D, z, A, C, B, 11, f[33]), C = n(C, D, z, A, S, 16, f[34]), A = n(A, C, D, z, b, 23, f[35]), z = n(z, A, C, D, u, 4, f[36]), D = n(D, z, A, C, p, 11, f[37]), C = n(C, D, z, A, g, 16, f[38]), A = n(A, C, D, z, k, 23, f[39]), z = n(z, A, C, D, x, 4, f[40]), D = n(D, z, A, C, l, 11, f[41]), C = n(C, D, z, A, v, 16, f[42]), A = n(A, C, D, z, y, 23, f[43]), z = n(z, A, C, D, w, 4, f[44]), D = n(D, z, A, C, m, 11, f[45]), C = n(C, D, z, A, H, 16, f[46]), A = n(A, C, D, z, d, 23, f[47]), z = o(z, A, C, D, l, 6, f[48]), D = o(D, z, A, C, g, 10, f[49]), C = o(C, D, z, A, b, 15, f[50]), A = o(A, C, D, z, _, 21, f[51]), z = o(z, A, C, D, m, 6, f[52]), D = o(D, z, A, C, v, 10, f[53]), C = o(C, D, z, A, k, 15, f[54]), A = o(A, C, D, z, u, 21, f[55]), z = o(z, A, C, D, B, 6, f[56]), D = o(D, z, A, C, H, 10, f[57]), C = o(C, D, z, A, y, 15, f[58]), A = o(A, C, D, z, x, 21, f[59]), z = o(z, A, C, D, p, 6, f[60]), D = o(D, z, A, C, S, 10, f[61]), C = o(C, D, z, A, d, 15, f[62]), A = o(A, C, D, z, w, 21, f[63]), h[0] = h[0] + z | 0, h[1] = h[1] + A | 0, h[2] = h[2] + C | 0, h[3] = h[3] + D | 0 }, _doFinalize: function () { var t = this._data, e = t.words, i = 8 * this._nDataBytes, n = 8 * t.sigBytes; e[n >>> 5] |= 128 << 24 - n % 32; var o = r.floor(i / 4294967296), s = i; e[(n + 64 >>> 9 << 4) + 15] = 16711935 & (o << 8 | o >>> 24) | 4278255360 & (o << 24 | o >>> 8), e[(n + 64 >>> 9 << 4) + 14] = 16711935 & (s << 8 | s >>> 24) | 4278255360 & (s << 24 | s >>> 8), t.sigBytes = 4 * (e.length + 1), this._process(); for (var a = this._hash, c = a.words, h = 0; h < 4; h++) { var l = c[h]; c[h] = 16711935 & (l << 8 | l >>> 24) | 4278255360 & (l << 24 | l >>> 8) } return a }, clone: function () { var t = h.clone.call(this); return t._hash = this._hash.clone(), t } }); s.MD5 = h._createHelper(u), s.HmacMD5 = h._createHmacHelper(u) }(Math), function () { var r = t, e = r.lib, i = e.WordArray, n = e.Hasher, o = r.algo, s = [], a = o.SHA1 = n.extend({ _doReset: function () { this._hash = new i.init([1732584193, 4023233417, 2562383102, 271733878, 3285377520]) }, _doProcessBlock: function (t, r) { for (var e = this._hash.words, i = e[0], n = e[1], o = e[2], a = e[3], c = e[4], h = 0; h < 80; h++) { if (h < 16) s[h] = 0 | t[r + h]; else { var l = s[h - 3] ^ s[h - 8] ^ s[h - 14] ^ s[h - 16]; s[h] = l << 1 | l >>> 31 } var f = (i << 5 | i >>> 27) + c + s[h]; f += h < 20 ? (n & o | ~n & a) + 1518500249 : h < 40 ? (n ^ o ^ a) + 1859775393 : h < 60 ? (n & o | n & a | o & a) - 1894007588 : (n ^ o ^ a) - 899497514, c = a, a = o, o = n << 30 | n >>> 2, n = i, i = f } e[0] = e[0] + i | 0, e[1] = e[1] + n | 0, e[2] = e[2] + o | 0, e[3] = e[3] + a | 0, e[4] = e[4] + c | 0 }, _doFinalize: function () { var t = this._data, r = t.words, e = 8 * this._nDataBytes, i = 8 * t.sigBytes; return r[i >>> 5] |= 128 << 24 - i % 32, r[(i + 64 >>> 9 << 4) + 14] = Math.floor(e / 4294967296), r[(i + 64 >>> 9 << 4) + 15] = e, t.sigBytes = 4 * r.length, this._process(), this._hash }, clone: function () { var t = n.clone.call(this); return t._hash = this._hash.clone(), t } }); r.SHA1 = n._createHelper(a), r.HmacSHA1 = n._createHmacHelper(a) }(), function (r) { var e = t, i = e.lib, n = i.WordArray, o = i.Hasher, s = e.algo, a = [], c = []; !function () { function t(t) { for (var e = r.sqrt(t), i = 2; i <= e; i++)if (!(t % i)) return !1; return !0 } function e(t) { return 4294967296 * (t - (0 | t)) | 0 } for (var i = 2, n = 0; n < 64;)t(i) && (n < 8 && (a[n] = e(r.pow(i, .5))), c[n] = e(r.pow(i, 1 / 3)), n++), i++ }(); var h = [], l = s.SHA256 = o.extend({ _doReset: function () { this._hash = new n.init(a.slice(0)) }, _doProcessBlock: function (t, r) { for (var e = this._hash.words, i = e[0], n = e[1], o = e[2], s = e[3], a = e[4], l = e[5], f = e[6], u = e[7], d = 0; d < 64; d++) { if (d < 16) h[d] = 0 | t[r + d]; else { var v = h[d - 15], p = (v << 25 | v >>> 7) ^ (v << 14 | v >>> 18) ^ v >>> 3, _ = h[d - 2], y = (_ << 15 | _ >>> 17) ^ (_ << 13 | _ >>> 19) ^ _ >>> 10; h[d] = p + h[d - 7] + y + h[d - 16] } var g = a & l ^ ~a & f, B = i & n ^ i & o ^ n & o, w = (i << 30 | i >>> 2) ^ (i << 19 | i >>> 13) ^ (i << 10 | i >>> 22), k = (a << 26 | a >>> 6) ^ (a << 21 | a >>> 11) ^ (a << 7 | a >>> 25), S = u + k + g + c[d] + h[d], m = w + B; u = f, f = l, l = a, a = s + S | 0, s = o, o = n, n = i, i = S + m | 0 } e[0] = e[0] + i | 0, e[1] = e[1] + n | 0, e[2] = e[2] + o | 0, e[3] = e[3] + s | 0, e[4] = e[4] + a | 0, e[5] = e[5] + l | 0, e[6] = e[6] + f | 0, e[7] = e[7] + u | 0 }, _doFinalize: function () { var t = this._data, e = t.words, i = 8 * this._nDataBytes, n = 8 * t.sigBytes; return e[n >>> 5] |= 128 << 24 - n % 32, e[(n + 64 >>> 9 << 4) + 14] = r.floor(i / 4294967296), e[(n + 64 >>> 9 << 4) + 15] = i, t.sigBytes = 4 * e.length, this._process(), this._hash }, clone: function () { var t = o.clone.call(this); return t._hash = this._hash.clone(), t } }); e.SHA256 = o._createHelper(l), e.HmacSHA256 = o._createHmacHelper(l) }(Math), function () { function r(t) { return t << 8 & 4278255360 | t >>> 8 & 16711935 } var e = t, i = e.lib, n = i.WordArray, o = e.enc; o.Utf16 = o.Utf16BE = { stringify: function (t) { for (var r = t.words, e = t.sigBytes, i = [], n = 0; n < e; n += 2) { var o = r[n >>> 2] >>> 16 - n % 4 * 8 & 65535; i.push(String.fromCharCode(o)) } return i.join("") }, parse: function (t) { for (var r = t.length, e = [], i = 0; i < r; i++)e[i >>> 1] |= t.charCodeAt(i) << 16 - i % 2 * 16; return n.create(e, 2 * r) } }; o.Utf16LE = { stringify: function (t) { for (var e = t.words, i = t.sigBytes, n = [], o = 0; o < i; o += 2) { var s = r(e[o >>> 2] >>> 16 - o % 4 * 8 & 65535); n.push(String.fromCharCode(s)) } return n.join("") }, parse: function (t) { for (var e = t.length, i = [], o = 0; o < e; o++)i[o >>> 1] |= r(t.charCodeAt(o) << 16 - o % 2 * 16); return n.create(i, 2 * e) } } }(), function () { if ("function" == typeof ArrayBuffer) { var r = t, e = r.lib, i = e.WordArray, n = i.init, o = i.init = function (t) { if (t instanceof ArrayBuffer && (t = new Uint8Array(t)), (t instanceof Int8Array || "undefined" != typeof Uint8ClampedArray && t instanceof Uint8ClampedArray || t instanceof Int16Array || t instanceof Uint16Array || t instanceof Int32Array || t instanceof Uint32Array || t instanceof Float32Array || t instanceof Float64Array) && (t = new Uint8Array(t.buffer, t.byteOffset, t.byteLength)), t instanceof Uint8Array) { for (var r = t.byteLength, e = [], i = 0; i < r; i++)e[i >>> 2] |= t[i] << 24 - i % 4 * 8; n.call(this, e, r) } else n.apply(this, arguments) }; o.prototype = i } }(), function (r) { function e(t, r, e) { return t ^ r ^ e } function i(t, r, e) { return t & r | ~t & e } function n(t, r, e) { return (t | ~r) ^ e } function o(t, r, e) { return t & e | r & ~e } function s(t, r, e) { return t ^ (r | ~e) } function a(t, r) { return t << r | t >>> 32 - r } var c = t, h = c.lib, l = h.WordArray, f = h.Hasher, u = c.algo, d = l.create([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]), v = l.create([5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]), p = l.create([11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6]), _ = l.create([8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11]), y = l.create([0, 1518500249, 1859775393, 2400959708, 2840853838]), g = l.create([1352829926, 1548603684, 1836072691, 2053994217, 0]), B = u.RIPEMD160 = f.extend({ _doReset: function () { this._hash = l.create([1732584193, 4023233417, 2562383102, 271733878, 3285377520]) }, _doProcessBlock: function (t, r) { for (var c = 0; c < 16; c++) { var h = r + c, l = t[h]; t[h] = 16711935 & (l << 8 | l >>> 24) | 4278255360 & (l << 24 | l >>> 8) } var f, u, B, w, k, S, m, x, b, H, z = this._hash.words, A = y.words, C = g.words, D = d.words, R = v.words, E = p.words, M = _.words; S = f = z[0], m = u = z[1], x = B = z[2], b = w = z[3], H = k = z[4]; for (var F, c = 0; c < 80; c += 1)F = f + t[r + D[c]] | 0, F += c < 16 ? e(u, B, w) + A[0] : c < 32 ? i(u, B, w) + A[1] : c < 48 ? n(u, B, w) + A[2] : c < 64 ? o(u, B, w) + A[3] : s(u, B, w) + A[4], F |= 0, F = a(F, E[c]), F = F + k | 0, f = k, k = w, w = a(B, 10), B = u, u = F, F = S + t[r + R[c]] | 0, F += c < 16 ? s(m, x, b) + C[0] : c < 32 ? o(m, x, b) + C[1] : c < 48 ? n(m, x, b) + C[2] : c < 64 ? i(m, x, b) + C[3] : e(m, x, b) + C[4], F |= 0, F = a(F, M[c]), F = F + H | 0, S = H, H = b, b = a(x, 10), x = m, m = F; F = z[1] + B + b | 0, z[1] = z[2] + w + H | 0, z[2] = z[3] + k + S | 0, z[3] = z[4] + f + m | 0, z[4] = z[0] + u + x | 0, z[0] = F }, _doFinalize: function () { var t = this._data, r = t.words, e = 8 * this._nDataBytes, i = 8 * t.sigBytes; r[i >>> 5] |= 128 << 24 - i % 32, r[(i + 64 >>> 9 << 4) + 14] = 16711935 & (e << 8 | e >>> 24) | 4278255360 & (e << 24 | e >>> 8), t.sigBytes = 4 * (r.length + 1), this._process(); for (var n = this._hash, o = n.words, s = 0; s < 5; s++) { var a = o[s]; o[s] = 16711935 & (a << 8 | a >>> 24) | 4278255360 & (a << 24 | a >>> 8) } return n }, clone: function () { var t = f.clone.call(this); return t._hash = this._hash.clone(), t } }); c.RIPEMD160 = f._createHelper(B), c.HmacRIPEMD160 = f._createHmacHelper(B) }(Math), function () { var r = t, e = r.lib, i = e.Base, n = r.enc, o = n.Utf8, s = r.algo; s.HMAC = i.extend({ init: function (t, r) { t = this._hasher = new t.init, "string" == typeof r && (r = o.parse(r)); var e = t.blockSize, i = 4 * e; r.sigBytes > i && (r = t.finalize(r)), r.clamp(); for (var n = this._oKey = r.clone(), s = this._iKey = r.clone(), a = n.words, c = s.words, h = 0; h < e; h++)a[h] ^= 1549556828, c[h] ^= 909522486; n.sigBytes = s.sigBytes = i, this.reset() }, reset: function () { var t = this._hasher; t.reset(), t.update(this._iKey) }, update: function (t) { return this._hasher.update(t), this }, finalize: function (t) { var r = this._hasher, e = r.finalize(t); r.reset(); var i = r.finalize(this._oKey.clone().concat(e)); return i } }) }(), function () { var r = t, e = r.lib, i = e.Base, n = e.WordArray, o = r.algo, s = o.SHA1, a = o.HMAC, c = o.PBKDF2 = i.extend({ cfg: i.extend({ keySize: 4, hasher: s, iterations: 1 }), init: function (t) { this.cfg = this.cfg.extend(t) }, compute: function (t, r) { for (var e = this.cfg, i = a.create(e.hasher, t), o = n.create(), s = n.create([1]), c = o.words, h = s.words, l = e.keySize, f = e.iterations; c.length < l;) { var u = i.update(r).finalize(s); i.reset(); for (var d = u.words, v = d.length, p = u, _ = 1; _ < f; _++) { p = i.finalize(p), i.reset(); for (var y = p.words, g = 0; g < v; g++)d[g] ^= y[g] } o.concat(u), h[0]++ } return o.sigBytes = 4 * l, o } }); r.PBKDF2 = function (t, r, e) { return c.create(e).compute(t, r) } }(), function () { var r = t, e = r.lib, i = e.Base, n = e.WordArray, o = r.algo, s = o.MD5, a = o.EvpKDF = i.extend({ cfg: i.extend({ keySize: 4, hasher: s, iterations: 1 }), init: function (t) { this.cfg = this.cfg.extend(t) }, compute: function (t, r) { for (var e = this.cfg, i = e.hasher.create(), o = n.create(), s = o.words, a = e.keySize, c = e.iterations; s.length < a;) { h && i.update(h); var h = i.update(t).finalize(r); i.reset(); for (var l = 1; l < c; l++)h = i.finalize(h), i.reset(); o.concat(h) } return o.sigBytes = 4 * a, o } }); r.EvpKDF = function (t, r, e) { return a.create(e).compute(t, r) } }(), function () { var r = t, e = r.lib, i = e.WordArray, n = r.algo, o = n.SHA256, s = n.SHA224 = o.extend({ _doReset: function () { this._hash = new i.init([3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, 1694076839, 3204075428]) }, _doFinalize: function () { var t = o._doFinalize.call(this); return t.sigBytes -= 4, t } }); r.SHA224 = o._createHelper(s), r.HmacSHA224 = o._createHmacHelper(s) }(), function (r) { var e = t, i = e.lib, n = i.Base, o = i.WordArray, s = e.x64 = {}; s.Word = n.extend({ init: function (t, r) { this.high = t, this.low = r } }), s.WordArray = n.extend({ init: function (t, e) { t = this.words = t || [], e != r ? this.sigBytes = e : this.sigBytes = 8 * t.length }, toX32: function () { for (var t = this.words, r = t.length, e = [], i = 0; i < r; i++) { var n = t[i]; e.push(n.high), e.push(n.low) } return o.create(e, this.sigBytes) }, clone: function () { for (var t = n.clone.call(this), r = t.words = this.words.slice(0), e = r.length, i = 0; i < e; i++)r[i] = r[i].clone(); return t } }) }(), function (r) { var e = t, i = e.lib, n = i.WordArray, o = i.Hasher, s = e.x64, a = s.Word, c = e.algo, h = [], l = [], f = []; !function () { for (var t = 1, r = 0, e = 0; e < 24; e++) { h[t + 5 * r] = (e + 1) * (e + 2) / 2 % 64; var i = r % 5, n = (2 * t + 3 * r) % 5; t = i, r = n } for (var t = 0; t < 5; t++)for (var r = 0; r < 5; r++)l[t + 5 * r] = r + (2 * t + 3 * r) % 5 * 5; for (var o = 1, s = 0; s < 24; s++) { for (var c = 0, u = 0, d = 0; d < 7; d++) { if (1 & o) { var v = (1 << d) - 1; v < 32 ? u ^= 1 << v : c ^= 1 << v - 32 } 128 & o ? o = o << 1 ^ 113 : o <<= 1 } f[s] = a.create(c, u) } }(); var u = []; !function () { for (var t = 0; t < 25; t++)u[t] = a.create() }(); var d = c.SHA3 = o.extend({ cfg: o.cfg.extend({ outputLength: 512 }), _doReset: function () { for (var t = this._state = [], r = 0; r < 25; r++)t[r] = new a.init; this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32 }, _doProcessBlock: function (t, r) { for (var e = this._state, i = this.blockSize / 2, n = 0; n < i; n++) { var o = t[r + 2 * n], s = t[r + 2 * n + 1]; o = 16711935 & (o << 8 | o >>> 24) | 4278255360 & (o << 24 | o >>> 8), s = 16711935 & (s << 8 | s >>> 24) | 4278255360 & (s << 24 | s >>> 8); var a = e[n]; a.high ^= s, a.low ^= o } for (var c = 0; c < 24; c++) { for (var d = 0; d < 5; d++) { for (var v = 0, p = 0, _ = 0; _ < 5; _++) { var a = e[d + 5 * _]; v ^= a.high, p ^= a.low } var y = u[d]; y.high = v, y.low = p } for (var d = 0; d < 5; d++)for (var g = u[(d + 4) % 5], B = u[(d + 1) % 5], w = B.high, k = B.low, v = g.high ^ (w << 1 | k >>> 31), p = g.low ^ (k << 1 | w >>> 31), _ = 0; _ < 5; _++) { var a = e[d + 5 * _]; a.high ^= v, a.low ^= p } for (var S = 1; S < 25; S++) { var a = e[S], m = a.high, x = a.low, b = h[S]; if (b < 32) var v = m << b | x >>> 32 - b, p = x << b | m >>> 32 - b; else var v = x << b - 32 | m >>> 64 - b, p = m << b - 32 | x >>> 64 - b; var H = u[l[S]]; H.high = v, H.low = p } var z = u[0], A = e[0]; z.high = A.high, z.low = A.low; for (var d = 0; d < 5; d++)for (var _ = 0; _ < 5; _++) { var S = d + 5 * _, a = e[S], C = u[S], D = u[(d + 1) % 5 + 5 * _], R = u[(d + 2) % 5 + 5 * _]; a.high = C.high ^ ~D.high & R.high, a.low = C.low ^ ~D.low & R.low } var a = e[0], E = f[c]; a.high ^= E.high, a.low ^= E.low } }, _doFinalize: function () { var t = this._data, e = t.words, i = (8 * this._nDataBytes, 8 * t.sigBytes), o = 32 * this.blockSize; e[i >>> 5] |= 1 << 24 - i % 32, e[(r.ceil((i + 1) / o) * o >>> 5) - 1] |= 128, t.sigBytes = 4 * e.length, this._process(); for (var s = this._state, a = this.cfg.outputLength / 8, c = a / 8, h = [], l = 0; l < c; l++) { var f = s[l], u = f.high, d = f.low; u = 16711935 & (u << 8 | u >>> 24) | 4278255360 & (u << 24 | u >>> 8), d = 16711935 & (d << 8 | d >>> 24) | 4278255360 & (d << 24 | d >>> 8), h.push(d), h.push(u) } return new n.init(h, a) }, clone: function () { for (var t = o.clone.call(this), r = t._state = this._state.slice(0), e = 0; e < 25; e++)r[e] = r[e].clone(); return t } }); e.SHA3 = o._createHelper(d), e.HmacSHA3 = o._createHmacHelper(d) }(Math), function () { function r() { return s.create.apply(s, arguments) } var e = t, i = e.lib, n = i.Hasher, o = e.x64, s = o.Word, a = o.WordArray, c = e.algo, h = [r(1116352408, 3609767458), r(1899447441, 602891725), r(3049323471, 3964484399), r(3921009573, 2173295548), r(961987163, 4081628472), r(1508970993, 3053834265), r(2453635748, 2937671579), r(2870763221, 3664609560), r(3624381080, 2734883394), r(310598401, 1164996542), r(607225278, 1323610764), r(1426881987, 3590304994), r(1925078388, 4068182383), r(2162078206, 991336113), r(2614888103, 633803317), r(3248222580, 3479774868), r(3835390401, 2666613458), r(4022224774, 944711139), r(264347078, 2341262773), r(604807628, 2007800933), r(770255983, 1495990901), r(1249150122, 1856431235), r(1555081692, 3175218132), r(1996064986, 2198950837), r(2554220882, 3999719339), r(2821834349, 766784016), r(2952996808, 2566594879), r(3210313671, 3203337956), r(3336571891, 1034457026), r(3584528711, 2466948901), r(113926993, 3758326383), r(338241895, 168717936), r(666307205, 1188179964), r(773529912, 1546045734), r(1294757372, 1522805485), r(1396182291, 2643833823), r(1695183700, 2343527390), r(1986661051, 1014477480), r(2177026350, 1206759142), r(2456956037, 344077627), r(2730485921, 1290863460), r(2820302411, 3158454273), r(3259730800, 3505952657), r(3345764771, 106217008), r(3516065817, 3606008344), r(3600352804, 1432725776), r(4094571909, 1467031594), r(275423344, 851169720), r(430227734, 3100823752), r(506948616, 1363258195), r(659060556, 3750685593), r(883997877, 3785050280), r(958139571, 3318307427), r(1322822218, 3812723403), r(1537002063, 2003034995), r(1747873779, 3602036899), r(1955562222, 1575990012), r(2024104815, 1125592928), r(2227730452, 2716904306), r(2361852424, 442776044), r(2428436474, 593698344), r(2756734187, 3733110249), r(3204031479, 2999351573), r(3329325298, 3815920427), r(3391569614, 3928383900), r(3515267271, 566280711), r(3940187606, 3454069534), r(4118630271, 4000239992), r(116418474, 1914138554), r(174292421, 2731055270), r(289380356, 3203993006), r(460393269, 320620315), r(685471733, 587496836), r(852142971, 1086792851), r(1017036298, 365543100), r(1126000580, 2618297676), r(1288033470, 3409855158), r(1501505948, 4234509866), r(1607167915, 987167468), r(1816402316, 1246189591)], l = []; !function () { for (var t = 0; t < 80; t++)l[t] = r() }(); var f = c.SHA512 = n.extend({ _doReset: function () { this._hash = new a.init([new s.init(1779033703, 4089235720), new s.init(3144134277, 2227873595), new s.init(1013904242, 4271175723), new s.init(2773480762, 1595750129), new s.init(1359893119, 2917565137), new s.init(2600822924, 725511199), new s.init(528734635, 4215389547), new s.init(1541459225, 327033209)]) }, _doProcessBlock: function (t, r) { for (var e = this._hash.words, i = e[0], n = e[1], o = e[2], s = e[3], a = e[4], c = e[5], f = e[6], u = e[7], d = i.high, v = i.low, p = n.high, _ = n.low, y = o.high, g = o.low, B = s.high, w = s.low, k = a.high, S = a.low, m = c.high, x = c.low, b = f.high, H = f.low, z = u.high, A = u.low, C = d, D = v, R = p, E = _, M = y, F = g, P = B, W = w, O = k, U = S, I = m, K = x, X = b, L = H, j = z, N = A, T = 0; T < 80; T++) { var Z = l[T]; if (T < 16) var q = Z.high = 0 | t[r + 2 * T], G = Z.low = 0 | t[r + 2 * T + 1]; else { var J = l[T - 15], $ = J.high, Q = J.low, V = ($ >>> 1 | Q << 31) ^ ($ >>> 8 | Q << 24) ^ $ >>> 7, Y = (Q >>> 1 | $ << 31) ^ (Q >>> 8 | $ << 24) ^ (Q >>> 7 | $ << 25), tt = l[T - 2], rt = tt.high, et = tt.low, it = (rt >>> 19 | et << 13) ^ (rt << 3 | et >>> 29) ^ rt >>> 6, nt = (et >>> 19 | rt << 13) ^ (et << 3 | rt >>> 29) ^ (et >>> 6 | rt << 26), ot = l[T - 7], st = ot.high, at = ot.low, ct = l[T - 16], ht = ct.high, lt = ct.low, G = Y + at, q = V + st + (G >>> 0 < Y >>> 0 ? 1 : 0), G = G + nt, q = q + it + (G >>> 0 < nt >>> 0 ? 1 : 0), G = G + lt, q = q + ht + (G >>> 0 < lt >>> 0 ? 1 : 0); Z.high = q, Z.low = G } var ft = O & I ^ ~O & X, ut = U & K ^ ~U & L, dt = C & R ^ C & M ^ R & M, vt = D & E ^ D & F ^ E & F, pt = (C >>> 28 | D << 4) ^ (C << 30 | D >>> 2) ^ (C << 25 | D >>> 7), _t = (D >>> 28 | C << 4) ^ (D << 30 | C >>> 2) ^ (D << 25 | C >>> 7), yt = (O >>> 14 | U << 18) ^ (O >>> 18 | U << 14) ^ (O << 23 | U >>> 9), gt = (U >>> 14 | O << 18) ^ (U >>> 18 | O << 14) ^ (U << 23 | O >>> 9), Bt = h[T], wt = Bt.high, kt = Bt.low, St = N + gt, mt = j + yt + (St >>> 0 < N >>> 0 ? 1 : 0), St = St + ut, mt = mt + ft + (St >>> 0 < ut >>> 0 ? 1 : 0), St = St + kt, mt = mt + wt + (St >>> 0 < kt >>> 0 ? 1 : 0), St = St + G, mt = mt + q + (St >>> 0 < G >>> 0 ? 1 : 0), xt = _t + vt, bt = pt + dt + (xt >>> 0 < _t >>> 0 ? 1 : 0); j = X, N = L, X = I, L = K, I = O, K = U, U = W + St | 0, O = P + mt + (U >>> 0 < W >>> 0 ? 1 : 0) | 0, P = M, W = F, M = R, F = E, R = C, E = D, D = St + xt | 0, C = mt + bt + (D >>> 0 < St >>> 0 ? 1 : 0) | 0 } v = i.low = v + D, i.high = d + C + (v >>> 0 < D >>> 0 ? 1 : 0), _ = n.low = _ + E, n.high = p + R + (_ >>> 0 < E >>> 0 ? 1 : 0), g = o.low = g + F, o.high = y + M + (g >>> 0 < F >>> 0 ? 1 : 0), w = s.low = w + W, s.high = B + P + (w >>> 0 < W >>> 0 ? 1 : 0), S = a.low = S + U, a.high = k + O + (S >>> 0 < U >>> 0 ? 1 : 0), x = c.low = x + K, c.high = m + I + (x >>> 0 < K >>> 0 ? 1 : 0), H = f.low = H + L, f.high = b + X + (H >>> 0 < L >>> 0 ? 1 : 0), A = u.low = A + N, u.high = z + j + (A >>> 0 < N >>> 0 ? 1 : 0) }, _doFinalize: function () { var t = this._data, r = t.words, e = 8 * this._nDataBytes, i = 8 * t.sigBytes; r[i >>> 5] |= 128 << 24 - i % 32, r[(i + 128 >>> 10 << 5) + 30] = Math.floor(e / 4294967296), r[(i + 128 >>> 10 << 5) + 31] = e, t.sigBytes = 4 * r.length, this._process(); var n = this._hash.toX32(); return n }, clone: function () { var t = n.clone.call(this); return t._hash = this._hash.clone(), t }, blockSize: 32 }); e.SHA512 = n._createHelper(f), e.HmacSHA512 = n._createHmacHelper(f) }(), function () { var r = t, e = r.x64, i = e.Word, n = e.WordArray, o = r.algo, s = o.SHA512, a = o.SHA384 = s.extend({ _doReset: function () { this._hash = new n.init([new i.init(3418070365, 3238371032), new i.init(1654270250, 914150663), new i.init(2438529370, 812702999), new i.init(355462360, 4144912697), new i.init(1731405415, 4290775857), new i.init(2394180231, 1750603025), new i.init(3675008525, 1694076839), new i.init(1203062813, 3204075428)]) }, _doFinalize: function () { var t = s._doFinalize.call(this); return t.sigBytes -= 16, t } }); r.SHA384 = s._createHelper(a), r.HmacSHA384 = s._createHmacHelper(a) }(), t.lib.Cipher || function (r) { var e = t, i = e.lib, n = i.Base, o = i.WordArray, s = i.BufferedBlockAlgorithm, a = e.enc, c = (a.Utf8, a.Base64), h = e.algo, l = h.EvpKDF, f = i.Cipher = s.extend({ cfg: n.extend(), createEncryptor: function (t, r) { return this.create(this._ENC_XFORM_MODE, t, r) }, createDecryptor: function (t, r) { return this.create(this._DEC_XFORM_MODE, t, r) }, init: function (t, r, e) { this.cfg = this.cfg.extend(e), this._xformMode = t, this._key = r, this.reset() }, reset: function () { s.reset.call(this), this._doReset() }, process: function (t) { return this._append(t), this._process() }, finalize: function (t) { t && this._append(t); var r = this._doFinalize(); return r }, keySize: 4, ivSize: 4, _ENC_XFORM_MODE: 1, _DEC_XFORM_MODE: 2, _createHelper: function () { function t(t) { return "string" == typeof t ? m : w } return function (r) { return { encrypt: function (e, i, n) { return t(i).encrypt(r, e, i, n) }, decrypt: function (e, i, n) { return t(i).decrypt(r, e, i, n) } } } }() }), u = (i.StreamCipher = f.extend({ _doFinalize: function () { var t = this._process(!0); return t }, blockSize: 1 }), e.mode = {}), d = i.BlockCipherMode = n.extend({ createEncryptor: function (t, r) { return this.Encryptor.create(t, r) }, createDecryptor: function (t, r) { return this.Decryptor.create(t, r) }, init: function (t, r) { this._cipher = t, this._iv = r } }), v = u.CBC = function () { function t(t, e, i) { var n = this._iv; if (n) { var o = n; this._iv = r } else var o = this._prevBlock; for (var s = 0; s < i; s++)t[e + s] ^= o[s] } var e = d.extend(); return e.Encryptor = e.extend({ processBlock: function (r, e) { var i = this._cipher, n = i.blockSize; t.call(this, r, e, n), i.encryptBlock(r, e), this._prevBlock = r.slice(e, e + n) } }), e.Decryptor = e.extend({ processBlock: function (r, e) { var i = this._cipher, n = i.blockSize, o = r.slice(e, e + n); i.decryptBlock(r, e), t.call(this, r, e, n), this._prevBlock = o } }), e }(), p = e.pad = {}, _ = p.Pkcs7 = { pad: function (t, r) { for (var e = 4 * r, i = e - t.sigBytes % e, n = i << 24 | i << 16 | i << 8 | i, s = [], a = 0; a < i; a += 4)s.push(n); var c = o.create(s, i); t.concat(c) }, unpad: function (t) { var r = 255 & t.words[t.sigBytes - 1 >>> 2]; t.sigBytes -= r } }, y = (i.BlockCipher = f.extend({ cfg: f.cfg.extend({ mode: v, padding: _ }), reset: function () { f.reset.call(this); var t = this.cfg, r = t.iv, e = t.mode; if (this._xformMode == this._ENC_XFORM_MODE) var i = e.createEncryptor; else { var i = e.createDecryptor; this._minBufferSize = 1 } this._mode && this._mode.__creator == i ? this._mode.init(this, r && r.words) : (this._mode = i.call(e, this, r && r.words), this._mode.__creator = i) }, _doProcessBlock: function (t, r) { this._mode.processBlock(t, r) }, _doFinalize: function () { var t = this.cfg.padding; if (this._xformMode == this._ENC_XFORM_MODE) { t.pad(this._data, this.blockSize); var r = this._process(!0) } else { var r = this._process(!0); t.unpad(r) } return r }, blockSize: 4 }), i.CipherParams = n.extend({ init: function (t) { this.mixIn(t) }, toString: function (t) { return (t || this.formatter).stringify(this) } })), g = e.format = {}, B = g.OpenSSL = { stringify: function (t) { var r = t.ciphertext, e = t.salt; if (e) var i = o.create([1398893684, 1701076831]).concat(e).concat(r); else var i = r; return i.toString(c) }, parse: function (t) { var r = c.parse(t), e = r.words; if (1398893684 == e[0] && 1701076831 == e[1]) { var i = o.create(e.slice(2, 4)); e.splice(0, 4), r.sigBytes -= 16 } return y.create({ ciphertext: r, salt: i }) } }, w = i.SerializableCipher = n.extend({ cfg: n.extend({ format: B }), encrypt: function (t, r, e, i) { i = this.cfg.extend(i); var n = t.createEncryptor(e, i), o = n.finalize(r), s = n.cfg; return y.create({ ciphertext: o, key: e, iv: s.iv, algorithm: t, mode: s.mode, padding: s.padding, blockSize: t.blockSize, formatter: i.format }) }, decrypt: function (t, r, e, i) { i = this.cfg.extend(i), r = this._parse(r, i.format); var n = t.createDecryptor(e, i).finalize(r.ciphertext); return n }, _parse: function (t, r) { return "string" == typeof t ? r.parse(t, this) : t } }), k = e.kdf = {}, S = k.OpenSSL = { execute: function (t, r, e, i) { i || (i = o.random(8)); var n = l.create({ keySize: r + e }).compute(t, i), s = o.create(n.words.slice(r), 4 * e); return n.sigBytes = 4 * r, y.create({ key: n, iv: s, salt: i }) } }, m = i.PasswordBasedCipher = w.extend({ cfg: w.cfg.extend({ kdf: S }), encrypt: function (t, r, e, i) { i = this.cfg.extend(i); var n = i.kdf.execute(e, t.keySize, t.ivSize); i.iv = n.iv; var o = w.encrypt.call(this, t, r, n.key, i); return o.mixIn(n), o }, decrypt: function (t, r, e, i) { i = this.cfg.extend(i), r = this._parse(r, i.format); var n = i.kdf.execute(e, t.keySize, t.ivSize, r.salt); i.iv = n.iv; var o = w.decrypt.call(this, t, r, n.key, i); return o } }) }(), t.mode.CFB = function () { function r(t, r, e, i) { var n = this._iv; if (n) { var o = n.slice(0); this._iv = void 0 } else var o = this._prevBlock; i.encryptBlock(o, 0); for (var s = 0; s < e; s++)t[r + s] ^= o[s] } var e = t.lib.BlockCipherMode.extend(); return e.Encryptor = e.extend({ processBlock: function (t, e) { var i = this._cipher, n = i.blockSize; r.call(this, t, e, n, i), this._prevBlock = t.slice(e, e + n) } }), e.Decryptor = e.extend({ processBlock: function (t, e) { var i = this._cipher, n = i.blockSize, o = t.slice(e, e + n); r.call(this, t, e, n, i), this._prevBlock = o } }), e }(), t.mode.ECB = function () { var r = t.lib.BlockCipherMode.extend(); return r.Encryptor = r.extend({ processBlock: function (t, r) { this._cipher.encryptBlock(t, r) } }), r.Decryptor = r.extend({ processBlock: function (t, r) { this._cipher.decryptBlock(t, r) } }), r }(), t.pad.AnsiX923 = { pad: function (t, r) { var e = t.sigBytes, i = 4 * r, n = i - e % i, o = e + n - 1; t.clamp(), t.words[o >>> 2] |= n << 24 - o % 4 * 8, t.sigBytes += n }, unpad: function (t) { var r = 255 & t.words[t.sigBytes - 1 >>> 2]; t.sigBytes -= r } }, t.pad.Iso10126 = { pad: function (r, e) { var i = 4 * e, n = i - r.sigBytes % i; r.concat(t.lib.WordArray.random(n - 1)).concat(t.lib.WordArray.create([n << 24], 1)) }, unpad: function (t) { var r = 255 & t.words[t.sigBytes - 1 >>> 2]; t.sigBytes -= r } }, t.pad.Iso97971 = { pad: function (r, e) { r.concat(t.lib.WordArray.create([2147483648], 1)), t.pad.ZeroPadding.pad(r, e) }, unpad: function (r) { t.pad.ZeroPadding.unpad(r), r.sigBytes-- } }, t.mode.OFB = function () { var r = t.lib.BlockCipherMode.extend(), e = r.Encryptor = r.extend({ processBlock: function (t, r) { var e = this._cipher, i = e.blockSize, n = this._iv, o = this._keystream; n && (o = this._keystream = n.slice(0), this._iv = void 0), e.encryptBlock(o, 0); for (var s = 0; s < i; s++)t[r + s] ^= o[s] } }); return r.Decryptor = e, r }(), t.pad.NoPadding = { pad: function () { }, unpad: function () { } }, function (r) { var e = t, i = e.lib, n = i.CipherParams, o = e.enc, s = o.Hex, a = e.format; a.Hex = { stringify: function (t) { return t.ciphertext.toString(s) }, parse: function (t) { var r = s.parse(t); return n.create({ ciphertext: r }) } } }(), function () { var r = t, e = r.lib, i = e.BlockCipher, n = r.algo, o = [], s = [], a = [], c = [], h = [], l = [], f = [], u = [], d = [], v = []; !function () { for (var t = [], r = 0; r < 256; r++)r < 128 ? t[r] = r << 1 : t[r] = r << 1 ^ 283; for (var e = 0, i = 0, r = 0; r < 256; r++) { var n = i ^ i << 1 ^ i << 2 ^ i << 3 ^ i << 4; n = n >>> 8 ^ 255 & n ^ 99, o[e] = n, s[n] = e; var p = t[e], _ = t[p], y = t[_], g = 257 * t[n] ^ 16843008 * n; a[e] = g << 24 | g >>> 8, c[e] = g << 16 | g >>> 16, h[e] = g << 8 | g >>> 24, l[e] = g; var g = 16843009 * y ^ 65537 * _ ^ 257 * p ^ 16843008 * e; f[n] = g << 24 | g >>> 8, u[n] = g << 16 | g >>> 16, d[n] = g << 8 | g >>> 24, v[n] = g, e ? (e = p ^ t[t[t[y ^ p]]], i ^= t[t[i]]) : e = i = 1 } }(); var p = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], _ = n.AES = i.extend({ _doReset: function () { if (!this._nRounds || this._keyPriorReset !== this._key) { for (var t = this._keyPriorReset = this._key, r = t.words, e = t.sigBytes / 4, i = this._nRounds = e + 6, n = 4 * (i + 1), s = this._keySchedule = [], a = 0; a < n; a++)if (a < e) s[a] = r[a]; else { var c = s[a - 1]; a % e ? e > 6 && a % e == 4 && (c = o[c >>> 24] << 24 | o[c >>> 16 & 255] << 16 | o[c >>> 8 & 255] << 8 | o[255 & c]) : (c = c << 8 | c >>> 24, c = o[c >>> 24] << 24 | o[c >>> 16 & 255] << 16 | o[c >>> 8 & 255] << 8 | o[255 & c], c ^= p[a / e | 0] << 24), s[a] = s[a - e] ^ c } for (var h = this._invKeySchedule = [], l = 0; l < n; l++) { var a = n - l; if (l % 4) var c = s[a]; else var c = s[a - 4]; l < 4 || a <= 4 ? h[l] = c : h[l] = f[o[c >>> 24]] ^ u[o[c >>> 16 & 255]] ^ d[o[c >>> 8 & 255]] ^ v[o[255 & c]] } } }, encryptBlock: function (t, r) { this._doCryptBlock(t, r, this._keySchedule, a, c, h, l, o) }, decryptBlock: function (t, r) { var e = t[r + 1]; t[r + 1] = t[r + 3], t[r + 3] = e, this._doCryptBlock(t, r, this._invKeySchedule, f, u, d, v, s); var e = t[r + 1]; t[r + 1] = t[r + 3], t[r + 3] = e }, _doCryptBlock: function (t, r, e, i, n, o, s, a) { for (var c = this._nRounds, h = t[r] ^ e[0], l = t[r + 1] ^ e[1], f = t[r + 2] ^ e[2], u = t[r + 3] ^ e[3], d = 4, v = 1; v < c; v++) { var p = i[h >>> 24] ^ n[l >>> 16 & 255] ^ o[f >>> 8 & 255] ^ s[255 & u] ^ e[d++], _ = i[l >>> 24] ^ n[f >>> 16 & 255] ^ o[u >>> 8 & 255] ^ s[255 & h] ^ e[d++], y = i[f >>> 24] ^ n[u >>> 16 & 255] ^ o[h >>> 8 & 255] ^ s[255 & l] ^ e[d++], g = i[u >>> 24] ^ n[h >>> 16 & 255] ^ o[l >>> 8 & 255] ^ s[255 & f] ^ e[d++]; h = p, l = _, f = y, u = g } var p = (a[h >>> 24] << 24 | a[l >>> 16 & 255] << 16 | a[f >>> 8 & 255] << 8 | a[255 & u]) ^ e[d++], _ = (a[l >>> 24] << 24 | a[f >>> 16 & 255] << 16 | a[u >>> 8 & 255] << 8 | a[255 & h]) ^ e[d++], y = (a[f >>> 24] << 24 | a[u >>> 16 & 255] << 16 | a[h >>> 8 & 255] << 8 | a[255 & l]) ^ e[d++], g = (a[u >>> 24] << 24 | a[h >>> 16 & 255] << 16 | a[l >>> 8 & 255] << 8 | a[255 & f]) ^ e[d++]; t[r] = p, t[r + 1] = _, t[r + 2] = y, t[r + 3] = g }, keySize: 8 }); r.AES = i._createHelper(_) }(), function () { + function r(t, r) { var e = (this._lBlock >>> t ^ this._rBlock) & r; this._rBlock ^= e, this._lBlock ^= e << t } function e(t, r) { + var e = (this._rBlock >>> t ^ this._lBlock) & r; this._lBlock ^= e, this._rBlock ^= e << t; + } var i = t, n = i.lib, o = n.WordArray, s = n.BlockCipher, a = i.algo, c = [57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4], h = [14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32], l = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28], f = [{ 0: 8421888, 268435456: 32768, 536870912: 8421378, 805306368: 2, 1073741824: 512, 1342177280: 8421890, 1610612736: 8389122, 1879048192: 8388608, 2147483648: 514, 2415919104: 8389120, 2684354560: 33280, 2952790016: 8421376, 3221225472: 32770, 3489660928: 8388610, 3758096384: 0, 4026531840: 33282, 134217728: 0, 402653184: 8421890, 671088640: 33282, 939524096: 32768, 1207959552: 8421888, 1476395008: 512, 1744830464: 8421378, 2013265920: 2, 2281701376: 8389120, 2550136832: 33280, 2818572288: 8421376, 3087007744: 8389122, 3355443200: 8388610, 3623878656: 32770, 3892314112: 514, 4160749568: 8388608, 1: 32768, 268435457: 2, 536870913: 8421888, 805306369: 8388608, 1073741825: 8421378, 1342177281: 33280, 1610612737: 512, 1879048193: 8389122, 2147483649: 8421890, 2415919105: 8421376, 2684354561: 8388610, 2952790017: 33282, 3221225473: 514, 3489660929: 8389120, 3758096385: 32770, 4026531841: 0, 134217729: 8421890, 402653185: 8421376, 671088641: 8388608, 939524097: 512, 1207959553: 32768, 1476395009: 8388610, 1744830465: 2, 2013265921: 33282, 2281701377: 32770, 2550136833: 8389122, 2818572289: 514, 3087007745: 8421888, 3355443201: 8389120, 3623878657: 0, 3892314113: 33280, 4160749569: 8421378 }, { 0: 1074282512, 16777216: 16384, 33554432: 524288, 50331648: 1074266128, 67108864: 1073741840, 83886080: 1074282496, 100663296: 1073758208, 117440512: 16, 134217728: 540672, 150994944: 1073758224, 167772160: 1073741824, 184549376: 540688, 201326592: 524304, 218103808: 0, 234881024: 16400, 251658240: 1074266112, 8388608: 1073758208, 25165824: 540688, 41943040: 16, 58720256: 1073758224, 75497472: 1074282512, 92274688: 1073741824, 109051904: 524288, 125829120: 1074266128, 142606336: 524304, 159383552: 0, 176160768: 16384, 192937984: 1074266112, 209715200: 1073741840, 226492416: 540672, 243269632: 1074282496, 260046848: 16400, 268435456: 0, 285212672: 1074266128, 301989888: 1073758224, 318767104: 1074282496, 335544320: 1074266112, 352321536: 16, 369098752: 540688, 385875968: 16384, 402653184: 16400, 419430400: 524288, 436207616: 524304, 452984832: 1073741840, 469762048: 540672, 486539264: 1073758208, 503316480: 1073741824, 520093696: 1074282512, 276824064: 540688, 293601280: 524288, 310378496: 1074266112, 327155712: 16384, 343932928: 1073758208, 360710144: 1074282512, 377487360: 16, 394264576: 1073741824, 411041792: 1074282496, 427819008: 1073741840, 444596224: 1073758224, 461373440: 524304, 478150656: 0, 494927872: 16400, 511705088: 1074266128, 528482304: 540672 }, { 0: 260, 1048576: 0, 2097152: 67109120, 3145728: 65796, 4194304: 65540, 5242880: 67108868, 6291456: 67174660, 7340032: 67174400, 8388608: 67108864, 9437184: 67174656, 10485760: 65792, 11534336: 67174404, 12582912: 67109124, 13631488: 65536, 14680064: 4, 15728640: 256, 524288: 67174656, 1572864: 67174404, 2621440: 0, 3670016: 67109120, 4718592: 67108868, 5767168: 65536, 6815744: 65540, 7864320: 260, 8912896: 4, 9961472: 256, 11010048: 67174400, 12058624: 65796, 13107200: 65792, 14155776: 67109124, 15204352: 67174660, 16252928: 67108864, 16777216: 67174656, 17825792: 65540, 18874368: 65536, 19922944: 67109120, 20971520: 256, 22020096: 67174660, 23068672: 67108868, 24117248: 0, 25165824: 67109124, 26214400: 67108864, 27262976: 4, 28311552: 65792, 29360128: 67174400, 30408704: 260, 31457280: 65796, 32505856: 67174404, 17301504: 67108864, 18350080: 260, 19398656: 67174656, 20447232: 0, 21495808: 65540, 22544384: 67109120, 23592960: 256, 24641536: 67174404, 25690112: 65536, 26738688: 67174660, 27787264: 65796, 28835840: 67108868, 29884416: 67109124, 30932992: 67174400, 31981568: 4, 33030144: 65792 }, { 0: 2151682048, 65536: 2147487808, 131072: 4198464, 196608: 2151677952, 262144: 0, 327680: 4198400, 393216: 2147483712, 458752: 4194368, 524288: 2147483648, 589824: 4194304, 655360: 64, 720896: 2147487744, 786432: 2151678016, 851968: 4160, 917504: 4096, 983040: 2151682112, 32768: 2147487808, 98304: 64, 163840: 2151678016, 229376: 2147487744, 294912: 4198400, 360448: 2151682112, 425984: 0, 491520: 2151677952, 557056: 4096, 622592: 2151682048, 688128: 4194304, 753664: 4160, 819200: 2147483648, 884736: 4194368, 950272: 4198464, 1015808: 2147483712, 1048576: 4194368, 1114112: 4198400, 1179648: 2147483712, 1245184: 0, 1310720: 4160, 1376256: 2151678016, 1441792: 2151682048, 1507328: 2147487808, 1572864: 2151682112, 1638400: 2147483648, 1703936: 2151677952, 1769472: 4198464, 1835008: 2147487744, 1900544: 4194304, 1966080: 64, 2031616: 4096, 1081344: 2151677952, 1146880: 2151682112, 1212416: 0, 1277952: 4198400, 1343488: 4194368, 1409024: 2147483648, 1474560: 2147487808, 1540096: 64, 1605632: 2147483712, 1671168: 4096, 1736704: 2147487744, 1802240: 2151678016, 1867776: 4160, 1933312: 2151682048, 1998848: 4194304, 2064384: 4198464 }, { 0: 128, 4096: 17039360, 8192: 262144, 12288: 536870912, 16384: 537133184, 20480: 16777344, 24576: 553648256, 28672: 262272, 32768: 16777216, 36864: 537133056, 40960: 536871040, 45056: 553910400, 49152: 553910272, 53248: 0, 57344: 17039488, 61440: 553648128, 2048: 17039488, 6144: 553648256, 10240: 128, 14336: 17039360, 18432: 262144, 22528: 537133184, 26624: 553910272, 30720: 536870912, 34816: 537133056, 38912: 0, 43008: 553910400, 47104: 16777344, 51200: 536871040, 55296: 553648128, 59392: 16777216, 63488: 262272, 65536: 262144, 69632: 128, 73728: 536870912, 77824: 553648256, 81920: 16777344, 86016: 553910272, 90112: 537133184, 94208: 16777216, 98304: 553910400, 102400: 553648128, 106496: 17039360, 110592: 537133056, 114688: 262272, 118784: 536871040, 122880: 0, 126976: 17039488, 67584: 553648256, 71680: 16777216, 75776: 17039360, 79872: 537133184, 83968: 536870912, 88064: 17039488, 92160: 128, 96256: 553910272, 100352: 262272, 104448: 553910400, 108544: 0, 112640: 553648128, 116736: 16777344, 120832: 262144, 124928: 537133056, 129024: 536871040 }, { 0: 268435464, 256: 8192, 512: 270532608, 768: 270540808, 1024: 268443648, 1280: 2097152, 1536: 2097160, 1792: 268435456, 2048: 0, 2304: 268443656, 2560: 2105344, 2816: 8, 3072: 270532616, 3328: 2105352, 3584: 8200, 3840: 270540800, 128: 270532608, 384: 270540808, 640: 8, 896: 2097152, 1152: 2105352, 1408: 268435464, 1664: 268443648, 1920: 8200, 2176: 2097160, 2432: 8192, 2688: 268443656, 2944: 270532616, 3200: 0, 3456: 270540800, 3712: 2105344, 3968: 268435456, 4096: 268443648, 4352: 270532616, 4608: 270540808, 4864: 8200, 5120: 2097152, 5376: 268435456, 5632: 268435464, 5888: 2105344, 6144: 2105352, 6400: 0, 6656: 8, 6912: 270532608, 7168: 8192, 7424: 268443656, 7680: 270540800, 7936: 2097160, 4224: 8, 4480: 2105344, 4736: 2097152, 4992: 268435464, 5248: 268443648, 5504: 8200, 5760: 270540808, 6016: 270532608, 6272: 270540800, 6528: 270532616, 6784: 8192, 7040: 2105352, 7296: 2097160, 7552: 0, 7808: 268435456, 8064: 268443656 }, { 0: 1048576, 16: 33555457, 32: 1024, 48: 1049601, 64: 34604033, 80: 0, 96: 1, 112: 34603009, 128: 33555456, 144: 1048577, 160: 33554433, 176: 34604032, 192: 34603008, 208: 1025, 224: 1049600, 240: 33554432, 8: 34603009, 24: 0, 40: 33555457, 56: 34604032, 72: 1048576, 88: 33554433, 104: 33554432, 120: 1025, 136: 1049601, 152: 33555456, 168: 34603008, 184: 1048577, 200: 1024, 216: 34604033, 232: 1, 248: 1049600, 256: 33554432, 272: 1048576, 288: 33555457, 304: 34603009, 320: 1048577, 336: 33555456, 352: 34604032, 368: 1049601, 384: 1025, 400: 34604033, 416: 1049600, 432: 1, 448: 0, 464: 34603008, 480: 33554433, 496: 1024, 264: 1049600, 280: 33555457, 296: 34603009, 312: 1, 328: 33554432, 344: 1048576, 360: 1025, 376: 34604032, 392: 33554433, 408: 34603008, 424: 0, 440: 34604033, 456: 1049601, 472: 1024, 488: 33555456, 504: 1048577 }, { 0: 134219808, 1: 131072, 2: 134217728, 3: 32, 4: 131104, 5: 134350880, 6: 134350848, 7: 2048, 8: 134348800, 9: 134219776, 10: 133120, 11: 134348832, 12: 2080, 13: 0, 14: 134217760, 15: 133152, 2147483648: 2048, 2147483649: 134350880, 2147483650: 134219808, 2147483651: 134217728, 2147483652: 134348800, 2147483653: 133120, 2147483654: 133152, 2147483655: 32, 2147483656: 134217760, 2147483657: 2080, 2147483658: 131104, 2147483659: 134350848, 2147483660: 0, 2147483661: 134348832, 2147483662: 134219776, 2147483663: 131072, 16: 133152, 17: 134350848, 18: 32, 19: 2048, 20: 134219776, 21: 134217760, 22: 134348832, 23: 131072, 24: 0, 25: 131104, 26: 134348800, 27: 134219808, 28: 134350880, 29: 133120, 30: 2080, 31: 134217728, 2147483664: 131072, 2147483665: 2048, 2147483666: 134348832, 2147483667: 133152, 2147483668: 32, 2147483669: 134348800, 2147483670: 134217728, 2147483671: 134219808, 2147483672: 134350880, 2147483673: 134217760, 2147483674: 134219776, 2147483675: 0, 2147483676: 133120, 2147483677: 2080, 2147483678: 131104, 2147483679: 134350848 }], u = [4160749569, 528482304, 33030144, 2064384, 129024, 8064, 504, 2147483679], d = a.DES = s.extend({ _doReset: function () { for (var t = this._key, r = t.words, e = [], i = 0; i < 56; i++) { var n = c[i] - 1; e[i] = r[n >>> 5] >>> 31 - n % 32 & 1 } for (var o = this._subKeys = [], s = 0; s < 16; s++) { for (var a = o[s] = [], f = l[s], i = 0; i < 24; i++)a[i / 6 | 0] |= e[(h[i] - 1 + f) % 28] << 31 - i % 6, a[4 + (i / 6 | 0)] |= e[28 + (h[i + 24] - 1 + f) % 28] << 31 - i % 6; a[0] = a[0] << 1 | a[0] >>> 31; for (var i = 1; i < 7; i++)a[i] = a[i] >>> 4 * (i - 1) + 3; a[7] = a[7] << 5 | a[7] >>> 27 } for (var u = this._invSubKeys = [], i = 0; i < 16; i++)u[i] = o[15 - i] }, encryptBlock: function (t, r) { this._doCryptBlock(t, r, this._subKeys) }, decryptBlock: function (t, r) { this._doCryptBlock(t, r, this._invSubKeys) }, _doCryptBlock: function (t, i, n) { this._lBlock = t[i], this._rBlock = t[i + 1], r.call(this, 4, 252645135), r.call(this, 16, 65535), e.call(this, 2, 858993459), e.call(this, 8, 16711935), r.call(this, 1, 1431655765); for (var o = 0; o < 16; o++) { for (var s = n[o], a = this._lBlock, c = this._rBlock, h = 0, l = 0; l < 8; l++)h |= f[l][((c ^ s[l]) & u[l]) >>> 0]; this._lBlock = c, this._rBlock = a ^ h } var d = this._lBlock; this._lBlock = this._rBlock, this._rBlock = d, r.call(this, 1, 1431655765), e.call(this, 8, 16711935), e.call(this, 2, 858993459), r.call(this, 16, 65535), r.call(this, 4, 252645135), t[i] = this._lBlock, t[i + 1] = this._rBlock }, keySize: 2, ivSize: 2, blockSize: 2 }); i.DES = s._createHelper(d); var v = a.TripleDES = s.extend({ _doReset: function () { var t = this._key, r = t.words; this._des1 = d.createEncryptor(o.create(r.slice(0, 2))), this._des2 = d.createEncryptor(o.create(r.slice(2, 4))), this._des3 = d.createEncryptor(o.create(r.slice(4, 6))) }, encryptBlock: function (t, r) { this._des1.encryptBlock(t, r), this._des2.decryptBlock(t, r), this._des3.encryptBlock(t, r) }, decryptBlock: function (t, r) { this._des3.decryptBlock(t, r), this._des2.encryptBlock(t, r), this._des1.decryptBlock(t, r) }, keySize: 6, ivSize: 2, blockSize: 2 }); i.TripleDES = s._createHelper(v) + }(), function () { function r() { for (var t = this._S, r = this._i, e = this._j, i = 0, n = 0; n < 4; n++) { r = (r + 1) % 256, e = (e + t[r]) % 256; var o = t[r]; t[r] = t[e], t[e] = o, i |= t[(t[r] + t[e]) % 256] << 24 - 8 * n } return this._i = r, this._j = e, i } var e = t, i = e.lib, n = i.StreamCipher, o = e.algo, s = o.RC4 = n.extend({ _doReset: function () { for (var t = this._key, r = t.words, e = t.sigBytes, i = this._S = [], n = 0; n < 256; n++)i[n] = n; for (var n = 0, o = 0; n < 256; n++) { var s = n % e, a = r[s >>> 2] >>> 24 - s % 4 * 8 & 255; o = (o + i[n] + a) % 256; var c = i[n]; i[n] = i[o], i[o] = c } this._i = this._j = 0 }, _doProcessBlock: function (t, e) { t[e] ^= r.call(this) }, keySize: 8, ivSize: 0 }); e.RC4 = n._createHelper(s); var a = o.RC4Drop = s.extend({ cfg: s.cfg.extend({ drop: 192 }), _doReset: function () { s._doReset.call(this); for (var t = this.cfg.drop; t > 0; t--)r.call(this) } }); e.RC4Drop = n._createHelper(a) }(), t.mode.CTRGladman = function () { function r(t) { if (255 === (t >> 24 & 255)) { var r = t >> 16 & 255, e = t >> 8 & 255, i = 255 & t; 255 === r ? (r = 0, 255 === e ? (e = 0, 255 === i ? i = 0 : ++i) : ++e) : ++r, t = 0, t += r << 16, t += e << 8, t += i } else t += 1 << 24; return t } function e(t) { return 0 === (t[0] = r(t[0])) && (t[1] = r(t[1])), t } var i = t.lib.BlockCipherMode.extend(), n = i.Encryptor = i.extend({ processBlock: function (t, r) { var i = this._cipher, n = i.blockSize, o = this._iv, s = this._counter; o && (s = this._counter = o.slice(0), this._iv = void 0), e(s); var a = s.slice(0); i.encryptBlock(a, 0); for (var c = 0; c < n; c++)t[r + c] ^= a[c] } }); return i.Decryptor = n, i }(), function () { function r() { for (var t = this._X, r = this._C, e = 0; e < 8; e++)a[e] = r[e]; r[0] = r[0] + 1295307597 + this._b | 0, r[1] = r[1] + 3545052371 + (r[0] >>> 0 < a[0] >>> 0 ? 1 : 0) | 0, r[2] = r[2] + 886263092 + (r[1] >>> 0 < a[1] >>> 0 ? 1 : 0) | 0, r[3] = r[3] + 1295307597 + (r[2] >>> 0 < a[2] >>> 0 ? 1 : 0) | 0, r[4] = r[4] + 3545052371 + (r[3] >>> 0 < a[3] >>> 0 ? 1 : 0) | 0, r[5] = r[5] + 886263092 + (r[4] >>> 0 < a[4] >>> 0 ? 1 : 0) | 0, r[6] = r[6] + 1295307597 + (r[5] >>> 0 < a[5] >>> 0 ? 1 : 0) | 0, r[7] = r[7] + 3545052371 + (r[6] >>> 0 < a[6] >>> 0 ? 1 : 0) | 0, this._b = r[7] >>> 0 < a[7] >>> 0 ? 1 : 0; for (var e = 0; e < 8; e++) { var i = t[e] + r[e], n = 65535 & i, o = i >>> 16, s = ((n * n >>> 17) + n * o >>> 15) + o * o, h = ((4294901760 & i) * i | 0) + ((65535 & i) * i | 0); c[e] = s ^ h } t[0] = c[0] + (c[7] << 16 | c[7] >>> 16) + (c[6] << 16 | c[6] >>> 16) | 0, t[1] = c[1] + (c[0] << 8 | c[0] >>> 24) + c[7] | 0, t[2] = c[2] + (c[1] << 16 | c[1] >>> 16) + (c[0] << 16 | c[0] >>> 16) | 0, t[3] = c[3] + (c[2] << 8 | c[2] >>> 24) + c[1] | 0, t[4] = c[4] + (c[3] << 16 | c[3] >>> 16) + (c[2] << 16 | c[2] >>> 16) | 0, t[5] = c[5] + (c[4] << 8 | c[4] >>> 24) + c[3] | 0, t[6] = c[6] + (c[5] << 16 | c[5] >>> 16) + (c[4] << 16 | c[4] >>> 16) | 0, t[7] = c[7] + (c[6] << 8 | c[6] >>> 24) + c[5] | 0 } var e = t, i = e.lib, n = i.StreamCipher, o = e.algo, s = [], a = [], c = [], h = o.Rabbit = n.extend({ _doReset: function () { for (var t = this._key.words, e = this.cfg.iv, i = 0; i < 4; i++)t[i] = 16711935 & (t[i] << 8 | t[i] >>> 24) | 4278255360 & (t[i] << 24 | t[i] >>> 8); var n = this._X = [t[0], t[3] << 16 | t[2] >>> 16, t[1], t[0] << 16 | t[3] >>> 16, t[2], t[1] << 16 | t[0] >>> 16, t[3], t[2] << 16 | t[1] >>> 16], o = this._C = [t[2] << 16 | t[2] >>> 16, 4294901760 & t[0] | 65535 & t[1], t[3] << 16 | t[3] >>> 16, 4294901760 & t[1] | 65535 & t[2], t[0] << 16 | t[0] >>> 16, 4294901760 & t[2] | 65535 & t[3], t[1] << 16 | t[1] >>> 16, 4294901760 & t[3] | 65535 & t[0]]; this._b = 0; for (var i = 0; i < 4; i++)r.call(this); for (var i = 0; i < 8; i++)o[i] ^= n[i + 4 & 7]; if (e) { var s = e.words, a = s[0], c = s[1], h = 16711935 & (a << 8 | a >>> 24) | 4278255360 & (a << 24 | a >>> 8), l = 16711935 & (c << 8 | c >>> 24) | 4278255360 & (c << 24 | c >>> 8), f = h >>> 16 | 4294901760 & l, u = l << 16 | 65535 & h; o[0] ^= h, o[1] ^= f, o[2] ^= l, o[3] ^= u, o[4] ^= h, o[5] ^= f, o[6] ^= l, o[7] ^= u; for (var i = 0; i < 4; i++)r.call(this) } }, _doProcessBlock: function (t, e) { var i = this._X; r.call(this), s[0] = i[0] ^ i[5] >>> 16 ^ i[3] << 16, s[1] = i[2] ^ i[7] >>> 16 ^ i[5] << 16, s[2] = i[4] ^ i[1] >>> 16 ^ i[7] << 16, s[3] = i[6] ^ i[3] >>> 16 ^ i[1] << 16; for (var n = 0; n < 4; n++)s[n] = 16711935 & (s[n] << 8 | s[n] >>> 24) | 4278255360 & (s[n] << 24 | s[n] >>> 8), t[e + n] ^= s[n] }, blockSize: 4, ivSize: 2 }); e.Rabbit = n._createHelper(h) }(), t.mode.CTR = function () { var r = t.lib.BlockCipherMode.extend(), e = r.Encryptor = r.extend({ processBlock: function (t, r) { var e = this._cipher, i = e.blockSize, n = this._iv, o = this._counter; n && (o = this._counter = n.slice(0), this._iv = void 0); var s = o.slice(0); e.encryptBlock(s, 0), o[i - 1] = o[i - 1] + 1 | 0; for (var a = 0; a < i; a++)t[r + a] ^= s[a] } }); return r.Decryptor = e, r }(), function () { function r() { for (var t = this._X, r = this._C, e = 0; e < 8; e++)a[e] = r[e]; r[0] = r[0] + 1295307597 + this._b | 0, r[1] = r[1] + 3545052371 + (r[0] >>> 0 < a[0] >>> 0 ? 1 : 0) | 0, r[2] = r[2] + 886263092 + (r[1] >>> 0 < a[1] >>> 0 ? 1 : 0) | 0, r[3] = r[3] + 1295307597 + (r[2] >>> 0 < a[2] >>> 0 ? 1 : 0) | 0, r[4] = r[4] + 3545052371 + (r[3] >>> 0 < a[3] >>> 0 ? 1 : 0) | 0, r[5] = r[5] + 886263092 + (r[4] >>> 0 < a[4] >>> 0 ? 1 : 0) | 0, r[6] = r[6] + 1295307597 + (r[5] >>> 0 < a[5] >>> 0 ? 1 : 0) | 0, r[7] = r[7] + 3545052371 + (r[6] >>> 0 < a[6] >>> 0 ? 1 : 0) | 0, this._b = r[7] >>> 0 < a[7] >>> 0 ? 1 : 0; for (var e = 0; e < 8; e++) { var i = t[e] + r[e], n = 65535 & i, o = i >>> 16, s = ((n * n >>> 17) + n * o >>> 15) + o * o, h = ((4294901760 & i) * i | 0) + ((65535 & i) * i | 0); c[e] = s ^ h } t[0] = c[0] + (c[7] << 16 | c[7] >>> 16) + (c[6] << 16 | c[6] >>> 16) | 0, t[1] = c[1] + (c[0] << 8 | c[0] >>> 24) + c[7] | 0, t[2] = c[2] + (c[1] << 16 | c[1] >>> 16) + (c[0] << 16 | c[0] >>> 16) | 0, t[3] = c[3] + (c[2] << 8 | c[2] >>> 24) + c[1] | 0, t[4] = c[4] + (c[3] << 16 | c[3] >>> 16) + (c[2] << 16 | c[2] >>> 16) | 0, t[5] = c[5] + (c[4] << 8 | c[4] >>> 24) + c[3] | 0, t[6] = c[6] + (c[5] << 16 | c[5] >>> 16) + (c[4] << 16 | c[4] >>> 16) | 0, t[7] = c[7] + (c[6] << 8 | c[6] >>> 24) + c[5] | 0 } var e = t, i = e.lib, n = i.StreamCipher, o = e.algo, s = [], a = [], c = [], h = o.RabbitLegacy = n.extend({ _doReset: function () { var t = this._key.words, e = this.cfg.iv, i = this._X = [t[0], t[3] << 16 | t[2] >>> 16, t[1], t[0] << 16 | t[3] >>> 16, t[2], t[1] << 16 | t[0] >>> 16, t[3], t[2] << 16 | t[1] >>> 16], n = this._C = [t[2] << 16 | t[2] >>> 16, 4294901760 & t[0] | 65535 & t[1], t[3] << 16 | t[3] >>> 16, 4294901760 & t[1] | 65535 & t[2], t[0] << 16 | t[0] >>> 16, 4294901760 & t[2] | 65535 & t[3], t[1] << 16 | t[1] >>> 16, 4294901760 & t[3] | 65535 & t[0]]; this._b = 0; for (var o = 0; o < 4; o++)r.call(this); for (var o = 0; o < 8; o++)n[o] ^= i[o + 4 & 7]; if (e) { var s = e.words, a = s[0], c = s[1], h = 16711935 & (a << 8 | a >>> 24) | 4278255360 & (a << 24 | a >>> 8), l = 16711935 & (c << 8 | c >>> 24) | 4278255360 & (c << 24 | c >>> 8), f = h >>> 16 | 4294901760 & l, u = l << 16 | 65535 & h; n[0] ^= h, n[1] ^= f, n[2] ^= l, n[3] ^= u, n[4] ^= h, n[5] ^= f, n[6] ^= l, n[7] ^= u; for (var o = 0; o < 4; o++)r.call(this) } }, _doProcessBlock: function (t, e) { var i = this._X; r.call(this), s[0] = i[0] ^ i[5] >>> 16 ^ i[3] << 16, s[1] = i[2] ^ i[7] >>> 16 ^ i[5] << 16, s[2] = i[4] ^ i[1] >>> 16 ^ i[7] << 16, s[3] = i[6] ^ i[3] >>> 16 ^ i[1] << 16; for (var n = 0; n < 4; n++)s[n] = 16711935 & (s[n] << 8 | s[n] >>> 24) | 4278255360 & (s[n] << 24 | s[n] >>> 8), t[e + n] ^= s[n] }, blockSize: 4, ivSize: 2 }); e.RabbitLegacy = n._createHelper(h) }(), t.pad.ZeroPadding = { pad: function (t, r) { var e = 4 * r; t.clamp(), t.sigBytes += e - (t.sigBytes % e || e) }, unpad: function (t) { for (var r = t.words, e = t.sigBytes - 1; !(r[e >>> 2] >>> 24 - e % 4 * 8 & 255);)e--; t.sigBytes = e + 1 } }, t +}); -const signinfo = {} -const VAL_signheader = chavy.getdata(KEY_signheader) -const VAL_signbody = chavy.getdata(KEY_signbody) -const VAL_mobileVal = chavy.getdata(KEY_mobile) +const $ = new Env('中国电信') +$.KEY_mobile = 'chavy_mobile_10000' -;(sign = async () => { - chavy.log(`🔔 ${cookieName}`) +!(async () => { + $.CryptoJS = $.isNode() ? require('crypto-js') : CryptoJS await signapp() - showmsg() - chavy.done() -})().catch((e) => chavy.log(`❌ ${cookieName} 签到失败: ${e}`), chavy.done()) + await showmsg() +})() + .catch((e) => $.logErr(e)) + .finally(() => $.done()) -function signapp() { - return new Promise((resolve, reject) => { - let url = { url: `https://wapside.189.cn:9001/api/home/sign`, body: VAL_signbody, headers: JSON.parse(VAL_signheader) } - chavy.post(url, (error, response, data) => { - try { - signinfo.signapp = JSON.parse(data) - resolve() - } catch (e) { - chavy.msg(cookieName, `签到结果: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} signapp - 签到失败: ${e}`) - chavy.log(`❌ ${cookieName} signapp - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) +async function signapp() { + const phonedat = $.getdata($.KEY_mobile) + const phones = [undefined, null, 'null', ''].includes(phonedat) ? [] : phonedat.replace(/\n/, '').split(',') + const signacts = [] + $.info = { + allcnt: 0, + succnt: 0, + repeatcnt: 0, + failcnt: 0, + signs: [] + } + for (let phoneIdx = 0; phoneIdx < phones.length; phoneIdx++) { + signacts.push( + await new Promise((resolve) => { + const phone = phones[phoneIdx].trim() + const bodystr = `{"phone":"${phone}","date":${new Date().getTime()},"signSource":"smlprgrm"}` + const body = JSON.stringify({ encode: encrypt(bodystr) }) + const url = { url: 'https://wapside.189.cn:9001/api/home/sign', body, headers: {} } + url.headers['Content-Type'] = 'application/json;charset=UTF-8' + $.post(url, (err, resp, data) => { + try { + const _data = JSON.parse(data) + const _code = $.lodash_get(_data, 'data.code') + const _msg = $.lodash_get(_data, 'data.msg') + const sign = {} + sign._raw = _data + sign.idx = phoneIdx + 1 + sign.phone = phone + sign.isSuc = _code === 1 + sign.isRepeat = _code === 0 && /已签到/.test(_msg) + sign.msg = _msg + $.info.signs.push(sign) + $.info.allcnt += 1 + if (sign.isSuc) $.info.succnt += 1 + else if (sign.isRepeat) $.info.repeatcnt += 1 + else $.info.failcnt += 1 + } catch (e) { + const sign = {} + sign._raw = data + sign.idx = phoneIdx + 1 + sign.phone = phone + sign.isSuc = false + sign.msg = e + $.info.signs.push(sign) + $.info.failcnt += 1 + $.logErr(e, resp) + } finally { + resolve() + } + }) + }) + ) + } + return await Promise.all(signacts) } function showmsg() { - let subTitle = `` - let detail = `` - if (signinfo.signapp.data.code == 1) { - subTitle = `签到结果: 成功` - detail = `获得金币${signinfo.signapp.data.coin}, 金豆${signinfo.signapp.data.flow}` - } else if (signinfo.signapp.data.code == 0) { - subTitle = `签到结果: 重复` - detail = `说明: ${signinfo.signapp.data.msg}` - } else { - subTitle = `签到结果: 失败` - detail = `说明: ${signinfo.signapp.data.msg}` - } - chavy.msg(cookieName, subTitle, detail) + return new Promise((resolve) => { + if ($.info.signs.length === 0) { + $.subt = '请在 BoxJs 填写手机号码!' + $.desc = '' + } else { + $.subt = `共签: ${$.info.succnt + $.info.repeatcnt}/${$.info.allcnt}, 本次成功: ${$.info.succnt}, 本次失败: ${$.info.failcnt}` + $.desc = [] + $.desc.push('点击查看详情') + for (let signIdx = 0; signIdx < $.info.signs.length; signIdx++) { + const sign = $.info.signs[signIdx] + $.desc.push('', `${sign.idx}. ${sign.phone}`) + $.desc.push(` ${sign.msg}`) + } + $.desc = $.desc.join('\n') + } + $.msg($.name, $.subt, $.desc) + resolve() + }) } -function init() { - isSurge = () => { - return undefined === this.$httpClient ? false : true - } - isQuanX = () => { - return undefined === this.$task ? false : true - } - getdata = (key) => { - if (isSurge()) return $persistentStore.read(key) - if (isQuanX()) return $prefs.valueForKey(key) - } - setdata = (key, val) => { - if (isSurge()) return $persistentStore.write(key, val) - if (isQuanX()) return $prefs.setValueForKey(key, val) - } - msg = (title, subtitle, body) => { - if (isSurge()) $notification.post(title, subtitle, body) - if (isQuanX()) $notify(title, subtitle, body) - } - log = (message) => console.log(message) - get = (url, cb) => { - if (isSurge()) { - $httpClient.get(url, cb) - } - if (isQuanX()) { - url.method = 'GET' - $task.fetch(url).then((resp) => cb(null, resp, resp.body)) - } - } - post = (url, cb) => { - if (isSurge()) { - $httpClient.post(url, cb) - } - if (isQuanX()) { - url.method = 'POST' - $task.fetch(url).then((resp) => cb(null, resp, resp.body)) - } - } - done = (value = {}) => { - $done(value) - } - return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done } +function encrypt(word) { + const srcs = $.CryptoJS.enc.Utf8.parse(word) + const key = $.CryptoJS.enc.Utf8.parse('34d7cb0bcdf07523') + const encrypted = $.CryptoJS.AES.encrypt(srcs, key, { mode: $.CryptoJS.mode.ECB, padding: $.CryptoJS.pad.Pkcs7 }) + return $.CryptoJS.enc.Hex.stringify($.CryptoJS.enc.Base64.parse(encrypted.toString())) } + +// prettier-ignore +function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}catch{const s={};this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}}else e=$.setval(t,s);return e}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}msg(s=t,e="",i="",o){this.isSurge()||this.isLoon()?$notification.post(s,e,i):this.isQuanX()&&$notify(s,e,i),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} diff --git a/box/chavy.boxjs.json b/box/chavy.boxjs.json index ec220b231..c7c1180c6 100644 --- a/box/chavy.boxjs.json +++ b/box/chavy.boxjs.json @@ -5,11 +5,20 @@ "icon": "https://avatars3.githubusercontent.com/u/29748519?s=460&u=392a19e85465abbcb1791c9b8b32184a16e6795e&v=4", "repo": "https://github.com/chavyleung/scripts", "apps": [ + { + "id": "10000", + "name": "10000", + "keys": [], + "settings": [{ "id": "chavy_mobile_10000", "name": "手机号码", "val": "", "type": "textarea", "placeholder": "18918920000,\n18918920000", "autoGrow": true, "rows": 5, "desc": "以英文逗号分隔多个号码, 可加回车" }], + "author": "@wangfei021325, @chavyleung", + "repo": "https://github.com/chavyleung/scripts/blob/master/10000/10000.js", + "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/10000.png", "https://raw.githubusercontent.com/Orz-3/task/master/10000.png"] + }, { "id": "chavyleung.10086", "name": "10086", "keys": ["chavy_autologin_cmcc", "chavy_getfee_cmcc", "chavy_tokenurl_10086", "chavy_tokenheader_10086", "chavy_signurl_10086", "chavy_signheader_10086"], - "author": "@@wangfei021325, @chavyleung", + "author": "@wangfei021325, @chavyleung", "repo": "https://github.com/chavyleung/scripts/blob/master/10086/10086.js", "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/10086.png", "https://raw.githubusercontent.com/Orz-3/task/master/10086.png"] }, From 5807d72a514bcf11e34de84313a005fdf840f441 Mon Sep 17 00:00:00 2001 From: Chavy Date: Sat, 27 Jun 2020 11:46:46 +0800 Subject: [PATCH 013/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=88=B7=E6=96=B0=E4=BF=AE=E6=94=B9=E4=B8=BA=E6=89=8B?= =?UTF-8?q?=E5=8A=A8=E5=88=B7=E6=96=B0=EF=BC=8C=E5=BA=94=E8=AF=A5=E8=83=BD?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=BF=9D=E5=AD=98=E8=AE=BE=E7=BD=AE=E4=B8=8D?= =?UTF-8?q?=E7=94=9F=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chavy.box.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/chavy.box.js b/chavy.box.js index 647f912df..ab51f8988 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -861,7 +861,7 @@ function printHtml(data, curapp = null, curview = 'app') { 应用 - + 当前脚本没有自建会话! @@ -1028,7 +1028,7 @@ function printHtml(data, curapp = null, curview = 'app') { 稍候 - 马上刷新 + 马上刷新 @@ -1354,12 +1354,14 @@ function printHtml(data, curapp = null, curview = 'app') { } axios.post('/api', JSON.stringify({ cmd: 'addAppSub', val: sub })) this.ui.addAppSubDialog.show = false - this.ui.reloadConfirmDialog.show = true + this.onReload() }, - onReload() { - this.ui.overlay.show = true + reload() { window.location.reload() }, + onReload() { + this.ui.reloadConfirmDialog.show = true + }, onDelSession(session) { axios.post('/api', JSON.stringify({ cmd: 'delSession', val: session })) const sessionIdx = this.box.sessions.findIndex((s) => session.id === s.id) @@ -1416,7 +1418,7 @@ function printHtml(data, curapp = null, curview = 'app') { }, onRevertGlobalBak(id) { axios.post('/api', JSON.stringify({ cmd: 'revertGlobalBak', val: id })) - this.ui.reloadConfirmDialog.show = true + this.onReload() }, onCopy(e) { this.ui.snackbar.show = true From 5032b7153840909df45b51dd0cf70262dc449550 Mon Sep 17 00:00:00 2001 From: Chavy Date: Sat, 27 Jun 2020 20:37:38 +0800 Subject: [PATCH 014/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E7=89=88=E6=9C=AC=E6=9B=B4=E6=96=B0=E6=8F=90=E7=A4=BA?= =?UTF-8?q?,=20=E5=A2=9E=E5=8A=A0=20BoxJs=20=E5=8D=87=E7=BA=A7=E6=95=99?= =?UTF-8?q?=E7=A8=8B=20(=E6=82=AC=E6=B5=AE=E6=8C=89=E9=92=AE=E7=82=B9?= =?UTF-8?q?=E5=B8=AE=E5=8A=A9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/release/box.release.json | 19 ++++- chavy.box.js | 138 +++++++++++++++++++++++++++++++++-- 2 files changed, 149 insertions(+), 8 deletions(-) diff --git a/box/release/box.release.json b/box/release/box.release.json index 0dc9e4feb..601467203 100644 --- a/box/release/box.release.json +++ b/box/release/box.release.json @@ -1,15 +1,28 @@ { "releases": [ { - "version": "1.0.0", + "version": "0.2.0", "tags": ["beta"], "author": "@chavyleung", "icon": "https://avatars3.githubusercontent.com/u/29748519", "repo": "https://github.com/chavyleung", - "note": [ + "notes": [ { "name": "新增", - "list": ["增加版本时间线"] + "descs": ["版本更新提醒", "BoxJs升级教程"] + } + ] + }, + { + "version": "0.1.3", + "tags": ["beta"], + "author": "@chavyleung", + "icon": "https://avatars3.githubusercontent.com/u/29748519", + "repo": "https://github.com/chavyleung", + "notes": [ + { + "name": "新增", + "descs": ["长文本控件", "读写表达式"] } ] } diff --git a/chavy.box.js b/chavy.box.js index ab51f8988..be445871d 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -1,9 +1,10 @@ const $ = new Env('BoxJs') $.domain = '8.8.8.8' -$.version = '0.1.3' +$.version = '0.2.0' $.versionType = 'beta' $.KEY_sessions = 'chavy_boxjs_sessions' +$.KEY_versions = 'chavy_boxjs_versions' $.KEY_userCfgs = 'chavy_boxjs_userCfgs' $.KEY_globalBaks = 'chavy_boxjs_globalBaks' @@ -392,6 +393,24 @@ function getSessions() { return Array.isArray(sessions) ? sessions : [] } +async function getVersions() { + let vers = [] + await new Promise((resolve) => { + const verurl = 'https://github.com/chavyleung/scripts/raw/master/box/release/box.release.json' + $.get({ url: verurl }, (err, resp, data) => { + try { + const _data = JSON.parse(data) + vers = Array.isArray(_data.releases) ? _data.releases : vers + } catch (e) { + $.logErr(e, resp) + } finally { + resolve() + } + }) + }) + return vers +} + function getSystemThemes() { return [ { id: '', name: '默认' }, @@ -544,6 +563,7 @@ function handleApi() { async function getBoxData() { return { sessions: getSessions(), + versions: await getVersions(), sysapps: getSystemApps(), userapps: getUserApps(), appsubs: await getAppSubs(), @@ -637,7 +657,7 @@ function printHtml(data, curapp = null, curview = 'app') { mdi-chevron-left - + @@ -653,8 +673,8 @@ function printHtml(data, curapp = null, curview = 'app') { - - mdi-eye-off + + mdi-help mdi-database-import @@ -973,7 +993,7 @@ function printHtml(data, curapp = null, curview = 'app') { {{ bak.name }} {{ bak.createTime}} - {{ tag }} + {{ tag }} @@ -1084,6 +1104,103 @@ function printHtml(data, curapp = null, curview = 'app') { + + + + + 升级教程 + + 朕, 知道了! + + + + +
+

v{{ ver.version }} (当前)

+

v{{ ver.version }}

+ +
+
+
+
+
+ + + + + + + + + {{ env.id }} + + + + + 朕, 知道了! + + + +

【安装模块】

+

+ 首页 > 模块 > 安装新模块 + https://github.com/chavyleung/scripts/raw/master/surge.box.sgmodule +

+

最后重启 Surge 代理 (首页右上角的开关)

+
+ + +

【更新模块】

+

首页 > Surge图标 (左上角) > 外部资源 > 全部更新

+

最后重启 Surge 代理 (首页右上角的开关)

+
+
+ + QuanX TF 或 商店 (购买超 90 天) + +

【远程订阅】

+

+ 风车 > 重写 > 引用 > 添加 (右上角) + https://github.com/chavyleung/scripts/raw/master/QuantumultX.box.remote.conf +

+

【订阅更新】

+

长按风车 > 刷新 (左下角) > 重启代理 (主界面右上角的开关)

+

注意: 不是能只更新订阅链接, 必须长按风车全部更新!

+
+ + QuanX 商店 (购买少于 90 天) + +

【本地更新】

+

下载最新脚本 > 重启代理 (主界面右上角的开关)

+
+
+ + +

【远程订阅】

+

+ 配置 (底栏) > Rewrite > 订阅Rewrite > 添加 (右上角图标) + https://github.com/chavyleung/scripts/raw/master/loon.box.conf +

+

最后重启 Loon 代理 (首页右上角的开关)

+
+ + +

【订阅更新】

+

配置 (底栏) > Rewrite > 订阅Rewrite > 刷新 (右上角图标)

+

最后重启 Loon 代理 (首页右上角的开关)

+
+
+
+
@@ -1111,6 +1228,8 @@ function printHtml(data, curapp = null, curview = 'app') { reloadConfirmDialog: { show: false, title: '操作成功', message: '是否马上刷新页面?' }, impSessionDialog: { show: false, impval: '' }, addAppSubDialog: { show: false, url: '' }, + versheet: { show: false }, + updatesheet: { show: false }, snackbar: { show: false, text: '已复制!', timeout: 2000 }, appbar: { color: '' }, box: { show: false }, @@ -1434,6 +1553,15 @@ function printHtml(data, curapp = null, curview = 'app') { setTimeout(() => { this.ui.box.show = true }, 500) + + const curver = this.box.syscfgs.version + const vers = this.box.versions + if (curver && Array.isArray(vers)) { + const lastestVer = vers[0].version + if (curver < lastestVer) { + this.ui.versheet.show = true + } + } } }) From 5f83475042c99e6884d8035cb419d5bfe75506fa Mon Sep 17 00:00:00 2001 From: Chavy Date: Sat, 27 Jun 2020 22:06:35 +0800 Subject: [PATCH 015/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E8=AE=BE=E7=BD=AE=E6=82=AC=E6=B5=AE=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E7=9A=84=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/release/box.release.json | 13 +++++++++++++ chavy.box.js | 8 ++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/box/release/box.release.json b/box/release/box.release.json index 601467203..78dc84769 100644 --- a/box/release/box.release.json +++ b/box/release/box.release.json @@ -1,5 +1,18 @@ { "releases": [ + { + "version": "0.2.1", + "tags": ["beta"], + "author": "@chavyleung", + "icon": "https://avatars3.githubusercontent.com/u/29748519", + "repo": "https://github.com/chavyleung", + "notes": [ + { + "name": "新增", + "descs": ["可以设置悬浮按钮的位置"] + } + ] + }, { "version": "0.2.0", "tags": ["beta"], diff --git a/chavy.box.js b/chavy.box.js index be445871d..a886fae9f 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -1,7 +1,7 @@ const $ = new Env('BoxJs') $.domain = '8.8.8.8' -$.version = '0.2.0' +$.version = '0.2.1' $.versionType = 'beta' $.KEY_sessions = 'chavy_boxjs_sessions' $.KEY_versions = 'chavy_boxjs_versions' @@ -665,7 +665,7 @@ function printHtml(data, curapp = null, curview = 'app') { - + - + mdi-help @@ -686,7 +687,7 @@ function printHtml(data, curapp = null, curview = 'app') { mdi-export-variant - + mdi-refresh @@ -723,6 +724,16 @@ function printHtml(data, curapp = null, curview = 'app') { + + + + + + + mdi-help + + + @@ -1108,28 +1119,28 @@ function printHtml(data, curapp = null, curview = 'app') { - - - - - 升级教程 - - 朕, 知道了! - - - - -
-

v{{ ver.version }} (当前)

-

v{{ ver.version }}

- -
-
-
-
+ + + + 升级教程 + + 朕, 知道了! + + + + +
+

v{{ ver.version }} (当前)

+

v{{ ver.version }}

+ +
+
+
+
+
From 6a22549dc679e25fc936d3e3c0e0e5245b4a94b4 Mon Sep 17 00:00:00 2001 From: Chavy Date: Sun, 28 Jun 2020 00:39:55 +0800 Subject: [PATCH 017/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[box.switcher.js]:=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E6=83=85=E5=86=B5=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E4=BC=9A=E8=AF=9D=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= =?UTF-8?q?,=20=E4=BC=98=E5=8C=96=E7=B3=BB=E7=BB=9F=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/switcher/box.switcher.js | 63 ++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 36 deletions(-) diff --git a/box/switcher/box.switcher.js b/box/switcher/box.switcher.js index fc11eddae..c8fc50e95 100644 --- a/box/switcher/box.switcher.js +++ b/box/switcher/box.switcher.js @@ -1,84 +1,75 @@ const $ = new Env('会话切换') $.KEY_sessions = 'chavy_boxjs_sessions' +$.KEY_curSessions = 'chavy_boxjs_cur_sessions' $.CFG_isSilent = $.getdata('CFG_BoxSwitcher_isSilent') !(async () => { - $.log('', `🔔 ${$.name}, 开始!`, '') await execSwitch() await showmsg() })() - .catch((e) => { - $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '') - }) - .finally(() => { - $.log('', `🔔 ${$.name}, 结束!`, ''), $.done() - }) + .catch((e) => $.logErr(e)) + .finally(() => $.done()) function execSwitch() { + $.subt = '' + $.desc = [] return new Promise((resove) => { - // 会话排序: `创建时间`升序 const sessions = getSessions() + const curSessions = getCurSessions() + // 会话排序: `创建时间`升序 sessions.sort((a, b) => a.createTime.replace(/-|:| /g, '') - b.createTime.replace(/-|:| /g, '')) const apps = {} sessions.forEach((session) => { const appId = session.appId const appName = session.appName - apps[appId] = apps[appId] ? apps[appId] : { id: appId, name: appName, sessions: [], skipedSessions: [] } + apps[appId] = apps[appId] ? apps[appId] : { id: appId, name: appName, sessions: [] } const app = apps[appId] - session.datas.sort((a, b) => a.key.localeCompare(b.key)) - const appDatas = [] - session.datas.forEach((data) => appDatas.push({ key: data.key, val: $.getdata(data.key) })) - // 会话列表自重复 - const duplicateSession = app.sessions.find((_session) => JSON.stringify(_session.datas) === JSON.stringify(session.datas)) - if (duplicateSession) { - $.log(`⚠️ ${$.name}, ${appName}: ${session.name} 与 ${duplicateSession.name} 重复, 建议删除!`) - app.skipedSessions.push(session) - return true - } - // 会话为当前会话 - else if (JSON.stringify(session.datas) === JSON.stringify(appDatas)) { - app.sessions.push(session) - app.curSessionId = session.id - return true - } - // 继续添加会话 - else { - app.sessions.push(session) - } + app.sessions.push(session) }) Object.keys(apps).forEach((appId) => { const app = apps[appId] if (app.sessions.length <= 1) { - $.log(`⚠️ ${$.name}, ${app.name}: 跳过!`) + $.desc.push(`${app.name}: 跳过! 原因: 只有 1 个会话?`) return true } - const curSessionIdx = app.sessions.findIndex((session) => session.id === app.curSessionId) + let curSessionIdx = app.sessions.findIndex((session) => session.id === curSessions[appId]) + if (curSessionIdx === -1) { + curSessionIdx = app.sessions.length - 1 + } const curSession = app.sessions[curSessionIdx] const isNewRound = curSessionIdx + 1 === app.sessions.length const nextSessionIdx = isNewRound ? 0 : curSessionIdx + 1 const nextSession = app.sessions[nextSessionIdx] nextSession.datas.forEach((_data) => $.setdata(_data.val, _data.key) || true) - $.log(`❕ ${$.name}, ${curSession.appName}: ${curSession.name} => ${nextSession.name} ${isNewRound ? '(新一轮)' : ''}`) + curSessions[appId] = nextSession.id + $.desc.push(`${curSession.appName}: ${curSession.name} => #${nextSessionIdx + 1} ${nextSession.name} ${isNewRound ? '(新一轮)' : ''}`) }) - + $.setdata(JSON.stringify(curSessions), $.KEY_curSessions) resove() }) } function getSessions() { const sessionstr = $.getdata($.KEY_sessions) - const sessions = sessionstr ? JSON.parse(sessionstr) : [] + const sessions = ![undefined, null, 'null', ''].includes(sessionstr) ? JSON.parse(sessionstr) : [] return Array.isArray(sessions) ? sessions : [] } +function getCurSessions() { + const sessionstr = $.getdata($.KEY_curSessions) + return ![undefined, null, 'null', ''].includes(sessionstr) ? JSON.parse(sessionstr) : {} +} + function showmsg() { return new Promise((resove) => { if (!$.CFG_isSilent || $.CFG_isSilent === 'false') { - $.msg($.name, $.subt, $.desc) + $.msg($.name, $.subt, $.desc.join('\n')) + } else { + $.log('', ...$.desc) } resove() }) } // prettier-ignore -function Env(t){this.name=t,this.logs=[],this.isSurge=(()=>"undefined"!=typeof $httpClient),this.isQuanX=(()=>"undefined"!=typeof $task),this.log=((...t)=>{this.logs=[...this.logs,...t],t?console.log(t.join("\n")):console.log(this.logs.join("\n"))}),this.msg=((t=this.name,s="",i="")=>{this.isSurge()&&$notification.post(t,s,i),this.isQuanX()&&$notify(t,s,i),this.log("==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),t&&this.log(t),s&&this.log(s),i&&this.log(i)}),this.getdata=(t=>this.isSurge()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):void 0),this.setdata=((t,s)=>this.isSurge()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):void 0),this.get=((t,s)=>this.send(t,"GET",s)),this.wait=((t,s=t)=>i=>setTimeout(()=>i(),Math.floor(Math.random()*(s-t+1)+t))),this.post=((t,s)=>this.send(t,"POST",s)),this.send=((t,s,i)=>{if(this.isSurge()){const e="POST"==s?$httpClient.post:$httpClient.get;e(t,(t,s,e)=>{s.body=e,s.statusCode=s.status,i(t,s,e)})}this.isQuanX()&&(t.method=s,$task.fetch(t).then(t=>{t.status=t.statusCode,i(null,t,t.body)},t=>i(t.error,t,t)))}),this.done=((t={})=>$done(t))} +function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}catch{const s={};this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}}else e=$.setval(t,s);return e}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}msg(s=t,e="",i="",o){this.isSurge()||this.isLoon()?$notification.post(s,e,i):this.isQuanX()&&$notify(s,e,i),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} From 3b37da76145b265fa46d665e4538bd563e764416 Mon Sep 17 00:00:00 2001 From: Chavy Date: Sun, 28 Jun 2020 00:50:11 +0800 Subject: [PATCH 018/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=B8=AE=E5=8A=A9=E9=A1=B5=E9=9D=A2=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/release/box.release.json | 13 +++++++++++++ chavy.box.js | 6 ++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/box/release/box.release.json b/box/release/box.release.json index 92769e083..e8e8288eb 100644 --- a/box/release/box.release.json +++ b/box/release/box.release.json @@ -1,5 +1,18 @@ { "releases": [ + { + "version": "0.2.3", + "tags": ["beta"], + "author": "@chavyleung", + "icon": "https://avatars3.githubusercontent.com/u/29748519", + "repo": "https://github.com/chavyleung", + "notes": [ + { + "name": "优化", + "descs": ["帮助页面样式"] + } + ] + }, { "version": "0.2.2", "tags": ["beta"], diff --git a/chavy.box.js b/chavy.box.js index cc417dc4c..a07994fdc 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -1,7 +1,7 @@ const $ = new Env('BoxJs') $.domain = '8.8.8.8' -$.version = '0.2.2' +$.version = '0.2.3' $.versionType = 'beta' $.KEY_sessions = 'chavy_boxjs_sessions' $.KEY_versions = 'chavy_boxjs_versions' @@ -1121,9 +1121,11 @@ function printHtml(data, curapp = null, curview = 'app') { - + 升级教程 + 新版本 + 朕, 知道了! From 5618283a2be720c9ea01cb5854dc73411f2897c8 Mon Sep 17 00:00:00 2001 From: GideonSenku Date: Sun, 28 Jun 2020 15:37:16 +0800 Subject: [PATCH 019/626] =?UTF-8?q?=E6=B7=BB=E5=8A=A0[=E4=B8=87=E8=BE=BE?= =?UTF-8?q?=E5=BD=B1=E5=9F=8E]=E7=AD=BE=E5=88=B0=E8=84=9A=E6=9C=ACbeta?= =?UTF-8?q?=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wanda/wanda.cookie.js | 41 ++++++++++++ wanda/wanda.js | 148 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 189 insertions(+) create mode 100644 wanda/wanda.cookie.js create mode 100644 wanda/wanda.js diff --git a/wanda/wanda.cookie.js b/wanda/wanda.cookie.js new file mode 100644 index 000000000..5e076c3f5 --- /dev/null +++ b/wanda/wanda.cookie.js @@ -0,0 +1,41 @@ +/** + * + * hostname = user-api-prd-mx.wandafilm.com + * + * # Surge + * Rewrite: wanda = type=http-request,pattern=^https:\/\/user-api-prd-mx\.wandafilm\.com\/user\/islogin\.api,script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wanda/wanda.cookie.js,debug=true + * Tasks: wanda-签到 = type=cron,cronexp=10 0 * * *,script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wanda/wanda.js,wake-system=true + * + * # QuanX + * ^https:\/\/user-api-prd-mx\.wandafilm\.com\/user\/islogin\.api url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/wanda/wanda.cookie.js + * 10 0 * * * https://raw.githubusercontent.com/chavyleung/scripts/master/wanda/wanda.js, tag=wanda-签到 + * + * # Loon + * http-response ^https:\/\/user-api-prd-mx\.wandafilm\.com\/user\/islogin\.api script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wanda/wanda.cookie.js + * cron "10 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wanda/wanda.cookie.js + * + */ + +const $ = new Env('万达影城') +$._mi_ = 'senku_wanda_mi_' + +!(async () => { + const session = {} + session.url = $request.url + session.headers = JSON.parse($request.headers['MX-API'])['_mi_'] + let key = '' + if (/islogin.api/.test(session.url)) { + key = $._mi_ + } + if ($.setdata(session.headers, key)) { + $.subt = `获取会话: 成功! (${key})` + } else { + $.subt = `获取会话: 失败! (${key})` + } + $.msg($.name, $.subt, $.desc) +})() + .catch((e) => $.logErr(e)) + .finally(() => $.done()) + +// prettier-ignore +function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),h=JSON.stringify(this.data);e?this.fs.writeFileSync(t,h):i?this.fs.writeFileSync(s,h):this.fs.writeFileSync(t,h)}}getdata(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setdata(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t)):this.isNode()&&(this.got=this.got?this.got:require("got"),this.got(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t));else if(this.isNode()){this.got=this.got?this.got:require("got");const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t))}}msg(s=t,e="",i="",h){this.isSurge()||this.isLoon()?$notification.post(s,e,i):this.isQuanX()&&$notify(s,e,i),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} diff --git a/wanda/wanda.js b/wanda/wanda.js new file mode 100644 index 000000000..2b6dda5a7 --- /dev/null +++ b/wanda/wanda.js @@ -0,0 +1,148 @@ +const $ = new Env('万达影城') +$._mi_ = 'senku_wanda_mi_' +const ts = new Date().getTime() +const date = tTime(ts) +const key = 'Wanda1_3B3AA12B0145E1982F282BEDD8A3305B89A9811280C0B8CC3A6A60D81022E4903'+ts + +const mx_api = { + "ver":"v1.0.0", + "sCode":"Wanda", + "_mi_":`${$.getdata($._mi_)}`, + "width":1280, + "json":true, + "cCode":"1_3", + "check":'', + "ts":ts, + "heigth":720, + "appId":"3" +} + +!(async () => { + await check() + // await question() + // await answer() + // await drawprize() + await showmsg() + })() + .catch((e) => $.logErr(e)) + .finally(() => $.done()) + + + +function check() { + return new Promise((resolve) => { + const siginVal = key+'/activityWholeSign/wholeSignUp.apiactivityCode=12786638&signDate='+date + mx_api['check'] = hex_md5(siginVal) + const url = { + url:'https://activity-api-mx.wandafilm.com/activityWholeSign/wholeSignUp.api', + headers:{ + 'MX-API':JSON.stringify(mx_api), + }, + body : 'activityCode=12786638&signDate=' + date + } + $.post(url, (err, resp, data) => { + try { + $.check = JSON.parse(data) + } catch (e) { + $.logErr(e, resp) + } finally { + resolve() + } + }) + }) +} + +// 获取题目答案 +function question() { + return new Promise((resolve) => { + const questionVal = key+'/question/question_list.apiactivityCode=15884027' + mx_api['check'] = hex_md5(questionVal) + const url = { + url:'https://activity-api-mx.wandafilm.com/question/question_list.api', + headers:{ + 'MX-API':JSON.stringify(mx_api), + }, + body : 'activityCode=15884027' + } + $.post(url, (err, resp, data) => { + try { + const res = JSON.parse(data) + $.answer = res.data.questionList[0].movie.nameCN + $.log(data) + } catch (e) { + $.logErr(e, resp) + } finally { + resolve() + } + }) + }) +} + +// 答题 +function answer() { + return new Promise((resolve) => { + const answerVal = key + '/question/qustion/answer.apiactivityCode=15884027&answer={"1":"'+$.answer+'"}' + console.log(answerVal) + mx_api['check'] = hex_md5(answerVal) + const url = { + url:'https://activity-api-mx.wandafilm.com/question/qustion/answer.api', + headers:{ + 'MX-API':JSON.stringify(mx_api), + }, + body : 'activityCode=15884027&answer={"1":"'+$.answer+'"}' + } + $.post(url, (err, resp, data) => { + try { + $.log(data) + } catch (e) { + $.logErr(e, resp) + } finally { + resolve() + } + }) + }) +} + +// 答题后抽奖 +function drawprize() { + return new Promise((resolve) => { + const drawprizeVal = key+'/question/prize/lottery.apiactivityCode=15884027' + mx_api['check'] = hex_md5(drawprizeVal) + const url = { + url:'https://activity-api-mx.wandafilm.com/question/prize/lottery.api', + headers:{ + 'MX-API':JSON.stringify(mx_api), + }, + body : 'activityCode=15884027' + } + $.post(url, (err, resp, data) => { + try { + console.log(data) + $.log(data) + } catch (e) { + $.logErr(e, resp) + } finally { + resolve() + } + }) + }) +} + +function showmsg() { + return new Promise((resolve) => { + $.subt = `签到结果:${$.check.code == 1 ? `签到成功` : $.check.msg}` + $.desc = [] + $.msg($.name, $.subt, $.desc.join('\n')) + resolve() + }) +} +function tTime(timestamp) { + const date = new Date(timestamp) + const Y = date.getFullYear() + '-' + const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-' + const D = (date.getDate() + 1 < 10 ? '0' + date.getDate() : date.getDate()) + return Y + M + D +} +function hex_md5(r){return rstr2hex(rstr_md5(str2rstr_utf8(r)))}function b64_md5(r){return rstr2b64(rstr_md5(str2rstr_utf8(r)))}function any_md5(r,t){return rstr2any(rstr_md5(str2rstr_utf8(r)),t)}function hex_hmac_md5(r,t){return rstr2hex(rstr_hmac_md5(str2rstr_utf8(r),str2rstr_utf8(t)))}function b64_hmac_md5(r,t){return rstr2b64(rstr_hmac_md5(str2rstr_utf8(r),str2rstr_utf8(t)))}function any_hmac_md5(r,t,d){return rstr2any(rstr_hmac_md5(str2rstr_utf8(r),str2rstr_utf8(t)),d)}function md5_vm_test(){return"900150983cd24fb0d6963f7d28e17f72"==hex_md5("abc").toLowerCase()}function rstr_md5(r){return binl2rstr(binl_md5(rstr2binl(r),8*r.length))}function rstr_hmac_md5(r,t){var d=rstr2binl(r);d.length>16&&(d=binl_md5(d,8*r.length));for(var n=Array(16),_=Array(16),m=0;m<16;m++)n[m]=909522486^d[m],_[m]=1549556828^d[m];var f=binl_md5(n.concat(rstr2binl(t)),512+8*t.length);return binl2rstr(binl_md5(_.concat(f),640))}function rstr2hex(r){for(var t,d=hexcase?"0123456789ABCDEF":"0123456789abcdef",n="",_=0;_>>4&15)+d.charAt(15&t);return n}function rstr2b64(r){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d="",n=r.length,_=0;_8*r.length?d+=b64pad:d+=t.charAt(m>>>6*(3-f)&63);return d}function rstr2any(r,t){var d,n,_,m,f,h=t.length,e=Array(Math.ceil(r.length/2));for(d=0;d0||_>0)&&(f[f.length]=_);i[n]=m,e=f}var o="";for(d=i.length-1;d>=0;d--)o+=t.charAt(i[d]);return o}function str2rstr_utf8(r){for(var t,d,n="",_=-1;++_>>6&31,128|63&t):t<=65535?n+=String.fromCharCode(224|t>>>12&15,128|t>>>6&63,128|63&t):t<=2097151&&(n+=String.fromCharCode(240|t>>>18&7,128|t>>>12&63,128|t>>>6&63,128|63&t));return n}function str2rstr_utf16le(r){for(var t="",d=0;d>>8&255);return t}function str2rstr_utf16be(r){for(var t="",d=0;d>>8&255,255&r.charCodeAt(d));return t}function rstr2binl(r){for(var t=Array(r.length>>2),d=0;d>5]|=(255&r.charCodeAt(d/8))<>5]>>>d%32&255);return t}function binl_md5(r,t){r[t>>5]|=128<>>9<<4)]=t;for(var d=1732584193,n=-271733879,_=-1732584194,m=271733878,f=0;f>16)+(t>>16)+(d>>16);return n<<16|65535&d}function bit_rol(r,t){return r<>>32-t}var hexcase=0,b64pad=""; +// prettier-ignore +function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}catch{const s={};this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}}else e=$.setval(t,s);return e}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}msg(s=t,e="",i="",o){this.isSurge()||this.isLoon()?$notification.post(s,e,i):this.isQuanX()&&$notify(s,e,i),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} From 9cb15548ebe44242746ec18b69e9dd929bbd3231 Mon Sep 17 00:00:00 2001 From: Chavy Date: Sun, 28 Jun 2020 15:51:31 +0800 Subject: [PATCH 020/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[box.switcher.js]:=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E6=83=85=E5=86=B5=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E4=BC=9A=E8=AF=9D=E4=B8=8D=E6=88=90=E5=8A=9F=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/switcher/box.switcher.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/box/switcher/box.switcher.js b/box/switcher/box.switcher.js index c8fc50e95..7e10e3012 100644 --- a/box/switcher/box.switcher.js +++ b/box/switcher/box.switcher.js @@ -40,7 +40,7 @@ function execSwitch() { const isNewRound = curSessionIdx + 1 === app.sessions.length const nextSessionIdx = isNewRound ? 0 : curSessionIdx + 1 const nextSession = app.sessions[nextSessionIdx] - nextSession.datas.forEach((_data) => $.setdata(_data.val, _data.key) || true) + nextSession.datas.forEach((_data) => $.setdata([undefined, null, 'undefined', 'null', ''].includes(_data.val) ? '' : _data.val, _data.key)) curSessions[appId] = nextSession.id $.desc.push(`${curSession.appName}: ${curSession.name} => #${nextSessionIdx + 1} ${nextSession.name} ${isNewRound ? '(新一轮)' : ''}`) }) From f7e2dad76c11466dfc6da623c790a75788c528be Mon Sep 17 00:00:00 2001 From: Chavy Date: Sun, 28 Jun 2020 15:52:38 +0800 Subject: [PATCH 021/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E8=AE=A2=E9=98=85=E9=93=BE=E6=8E=A5=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E7=A9=BA=E6=A0=BC&=E6=8D=A2=E8=A1=8C=E7=AD=89=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/release/box.release.json | 4 ++-- chavy.box.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/box/release/box.release.json b/box/release/box.release.json index e8e8288eb..3090f4a9a 100644 --- a/box/release/box.release.json +++ b/box/release/box.release.json @@ -1,7 +1,7 @@ { "releases": [ { - "version": "0.2.3", + "version": "0.2.4", "tags": ["beta"], "author": "@chavyleung", "icon": "https://avatars3.githubusercontent.com/u/29748519", @@ -9,7 +9,7 @@ "notes": [ { "name": "优化", - "descs": ["帮助页面样式"] + "descs": ["帮助页面样式", "订阅链接多余空格&换行等字符"] } ] }, diff --git a/chavy.box.js b/chavy.box.js index a07994fdc..496fa25a6 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -1,7 +1,7 @@ const $ = new Env('BoxJs') $.domain = '8.8.8.8' -$.version = '0.2.3' +$.version = '0.2.4' $.versionType = 'beta' $.KEY_sessions = 'chavy_boxjs_sessions' $.KEY_versions = 'chavy_boxjs_versions' @@ -323,7 +323,7 @@ async function getAppSubs() { const sub = usercfgs.appsubs[subIdx] subActs.push( new Promise((resolve) => { - $.get({ url: sub.url }, (err, resp, data) => { + $.get({ url: sub.url.replace(/[ ]|[\r\n]/g, '') }, (err, resp, data) => { try { const respsub = JSON.parse(data) if (Array.isArray(respsub.apps)) { From f5cdac07afbb995c83f0069f3e7df89adfe3f418 Mon Sep 17 00:00:00 2001 From: GideonSenku Date: Sun, 28 Jun 2020 16:52:03 +0800 Subject: [PATCH 022/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[=E4=B8=87=E8=BE=BE?= =?UTF-8?q?=E7=94=B5=E5=BD=B1],=E6=B7=BB=E5=8A=A0=E7=AD=94=E9=A2=98?= =?UTF-8?q?=E6=8A=BD=E5=A5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wanda/wanda.cookie.js | 2 +- wanda/wanda.js | 70 ++++++++++++++++++++++++++++++------------- 2 files changed, 51 insertions(+), 21 deletions(-) diff --git a/wanda/wanda.cookie.js b/wanda/wanda.cookie.js index 5e076c3f5..aca16a7eb 100644 --- a/wanda/wanda.cookie.js +++ b/wanda/wanda.cookie.js @@ -16,7 +16,7 @@ * */ -const $ = new Env('万达影城') +const $ = new Env('万达电影') $._mi_ = 'senku_wanda_mi_' !(async () => { diff --git a/wanda/wanda.js b/wanda/wanda.js index 2b6dda5a7..bbea651be 100644 --- a/wanda/wanda.js +++ b/wanda/wanda.js @@ -1,9 +1,9 @@ -const $ = new Env('万达影城') +const $ = new Env('万达电影') $._mi_ = 'senku_wanda_mi_' +$.desc = [] const ts = new Date().getTime() const date = tTime(ts) const key = 'Wanda1_3B3AA12B0145E1982F282BEDD8A3305B89A9811280C0B8CC3A6A60D81022E4903'+ts - const mx_api = { "ver":"v1.0.0", "sCode":"Wanda", @@ -18,10 +18,12 @@ const mx_api = { } !(async () => { - await check() - // await question() - // await answer() - // await drawprize() + await sign() + await signRecord() + await question() + await answer() + await drawprize_ans() + await drawprize_ans() await showmsg() })() .catch((e) => $.logErr(e)) @@ -29,10 +31,10 @@ const mx_api = { -function check() { +function sign() { return new Promise((resolve) => { - const siginVal = key+'/activityWholeSign/wholeSignUp.apiactivityCode=12786638&signDate='+date - mx_api['check'] = hex_md5(siginVal) + const signVal = key+'/activityWholeSign/wholeSignUp.apiactivityCode=12786638&signDate='+date + mx_api['check'] = hex_md5(signVal) const url = { url:'https://activity-api-mx.wandafilm.com/activityWholeSign/wholeSignUp.api', headers:{ @@ -42,7 +44,30 @@ function check() { } $.post(url, (err, resp, data) => { try { - $.check = JSON.parse(data) + $.sign = JSON.parse(data) + } catch (e) { + $.logErr(e, resp) + } finally { + resolve() + } + }) + }) +} + +function signRecord() { + return new Promise((resolve) => { + const signRecordVal = key+'/activityWholeSign/getSignRecord.apiactivityCode=12786638' + mx_api['check'] = hex_md5(signRecordVal) + const url = { + url:'https://activity-api-mx.wandafilm.com/activityWholeSign/getSignRecord.api', + headers:{ + 'MX-API':JSON.stringify(mx_api), + }, + body : 'activityCode=12786638' + } + $.post(url, (err, resp, data) => { + try { + $.signRecord = JSON.parse(data) } catch (e) { $.logErr(e, resp) } finally { @@ -68,7 +93,6 @@ function question() { try { const res = JSON.parse(data) $.answer = res.data.questionList[0].movie.nameCN - $.log(data) } catch (e) { $.logErr(e, resp) } finally { @@ -81,19 +105,18 @@ function question() { // 答题 function answer() { return new Promise((resolve) => { - const answerVal = key + '/question/qustion/answer.apiactivityCode=15884027&answer={"1":"'+$.answer+'"}' - console.log(answerVal) + const answerVal = key + '/question/qustion/answer.apiactivityCode=15884027&answer=%7b%221%22%3a%22'+escape(`${$.answer}`).toLowerCase()+'%22%7d' mx_api['check'] = hex_md5(answerVal) const url = { url:'https://activity-api-mx.wandafilm.com/question/qustion/answer.api', headers:{ 'MX-API':JSON.stringify(mx_api), }, - body : 'activityCode=15884027&answer={"1":"'+$.answer+'"}' + body : 'activityCode=15884027&answer=%7B%221%22%3A%22'+encodeURI(`${$.answer}`) + '%22%7D' } $.post(url, (err, resp, data) => { try { - $.log(data) + $.answer = JSON.parse(data) } catch (e) { $.logErr(e, resp) } finally { @@ -104,7 +127,7 @@ function answer() { } // 答题后抽奖 -function drawprize() { +function drawprize_ans() { return new Promise((resolve) => { const drawprizeVal = key+'/question/prize/lottery.apiactivityCode=15884027' mx_api['check'] = hex_md5(drawprizeVal) @@ -117,8 +140,8 @@ function drawprize() { } $.post(url, (err, resp, data) => { try { - console.log(data) - $.log(data) + const res = JSON.parse(data) + $.desc.push(`答题抽奖:${res.data.prize.prizeName}`) } catch (e) { $.logErr(e, resp) } finally { @@ -130,12 +153,19 @@ function drawprize() { function showmsg() { return new Promise((resolve) => { - $.subt = `签到结果:${$.check.code == 1 ? `签到成功` : $.check.msg}` - $.desc = [] + $.subt = `签到:${$.sign.code == 1 ? `成功` : $.sign.msg}` + + if ($.signRecord.code == 1) { + const totalMedal = $.signRecord.data.totalMedal + const remainMedal = $.signRecord.data.remainMedal + $.desc.push(`本次获得${totalMedal}能量,剩余可用${remainMedal}能量`) + } + $.subt += ` 答题详情:${$.answer.code == 1 ? `答案:${$.answer.data.answer},获得:${$.answer.data.remainChance}次抽奖`:$.answer.msg}` $.msg($.name, $.subt, $.desc.join('\n')) resolve() }) } + function tTime(timestamp) { const date = new Date(timestamp) const Y = date.getFullYear() + '-' From 6faf82be96f29c16d667539d605decbe6d0cc778 Mon Sep 17 00:00:00 2001 From: Chavy Date: Sun, 28 Jun 2020 20:00:08 +0800 Subject: [PATCH 023/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E6=9B=B4?= =?UTF-8?q?=E6=AD=A3=20box.release.json=20=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chavy.box.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/chavy.box.js b/chavy.box.js index 496fa25a6..c10426938 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -396,8 +396,7 @@ function getSessions() { async function getVersions() { let vers = [] await new Promise((resolve) => { - // const verurl = 'https://github.com/chavyleung/scripts/raw/master/box/release/box.release.json' - const verurl = 'https://gist.github.com/chavyleung/e1f1021391143c961d925bcdc21dca24/raw/4185a281c1861ceadd870ca55a497077ae6fefc2/box.release.json' + const verurl = 'https://github.com/chavyleung/scripts/raw/master/box/release/box.release.json' $.get({ url: verurl }, (err, resp, data) => { try { const _data = JSON.parse(data) From 4045809e5a7c0cb784478c6adf41b5400b0adb53 Mon Sep 17 00:00:00 2001 From: Chavy Date: Sun, 28 Jun 2020 22:55:22 +0800 Subject: [PATCH 024/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[=E5=A8=81=E9=94=8B?= =?UTF-8?q?=E7=BD=91]:=20emm,=20=E5=8F=88=E5=A4=8D=E6=B4=BB=E4=BA=86,=20?= =?UTF-8?q?=E4=B8=8D=E4=BC=9A=E5=8F=96=20ck,=20=E5=9C=A8=20BoxJs=20?= =?UTF-8?q?=E9=87=8C=E6=89=8B=E6=92=95=E8=B4=A6=E5=8F=B7=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/chavy.boxjs.json | 9 ++ feng/feng.js | 244 ++++++++++++++++++------------------------- 2 files changed, 112 insertions(+), 141 deletions(-) diff --git a/box/chavy.boxjs.json b/box/chavy.boxjs.json index c7c1180c6..171a1db9e 100644 --- a/box/chavy.boxjs.json +++ b/box/chavy.boxjs.json @@ -61,6 +61,15 @@ "author": "@chavyleung", "repo": "https://github.com/chavyleung/scripts/tree/master/gdoil", "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/gdoil.png", "https://raw.githubusercontent.com/Orz-3/task/master/gdoil.png"] + }, + { + "id": "feng", + "name": "威锋网", + "settings": [{ "id": "chavy_accounts_feng", "name": "威锋账号", "val": "", "type": "textarea", "placeholder": "账号,密码 (回车) 账号,密码", "autoGrow": true, "rows": 5, "desc": "以英文逗号分隔账号与密码, 回车添加多个账号" }], + "keys": [], + "author": "@chavyleung", + "repo": "https://github.com/chavyleung/scripts/tree/master/feng", + "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/feng.png", "https://raw.githubusercontent.com/Orz-3/task/master/feng.png"] } ] } diff --git a/feng/feng.js b/feng/feng.js index f1f587b01..7309a5f91 100644 --- a/feng/feng.js +++ b/feng/feng.js @@ -7,157 +7,119 @@ }(), function () { function r() { for (var t = this._S, r = this._i, e = this._j, i = 0, n = 0; n < 4; n++) { r = (r + 1) % 256, e = (e + t[r]) % 256; var o = t[r]; t[r] = t[e], t[e] = o, i |= t[(t[r] + t[e]) % 256] << 24 - 8 * n } return this._i = r, this._j = e, i } var e = t, i = e.lib, n = i.StreamCipher, o = e.algo, s = o.RC4 = n.extend({ _doReset: function () { for (var t = this._key, r = t.words, e = t.sigBytes, i = this._S = [], n = 0; n < 256; n++)i[n] = n; for (var n = 0, o = 0; n < 256; n++) { var s = n % e, a = r[s >>> 2] >>> 24 - s % 4 * 8 & 255; o = (o + i[n] + a) % 256; var c = i[n]; i[n] = i[o], i[o] = c } this._i = this._j = 0 }, _doProcessBlock: function (t, e) { t[e] ^= r.call(this) }, keySize: 8, ivSize: 0 }); e.RC4 = n._createHelper(s); var a = o.RC4Drop = s.extend({ cfg: s.cfg.extend({ drop: 192 }), _doReset: function () { s._doReset.call(this); for (var t = this.cfg.drop; t > 0; t--)r.call(this) } }); e.RC4Drop = n._createHelper(a) }(), t.mode.CTRGladman = function () { function r(t) { if (255 === (t >> 24 & 255)) { var r = t >> 16 & 255, e = t >> 8 & 255, i = 255 & t; 255 === r ? (r = 0, 255 === e ? (e = 0, 255 === i ? i = 0 : ++i) : ++e) : ++r, t = 0, t += r << 16, t += e << 8, t += i } else t += 1 << 24; return t } function e(t) { return 0 === (t[0] = r(t[0])) && (t[1] = r(t[1])), t } var i = t.lib.BlockCipherMode.extend(), n = i.Encryptor = i.extend({ processBlock: function (t, r) { var i = this._cipher, n = i.blockSize, o = this._iv, s = this._counter; o && (s = this._counter = o.slice(0), this._iv = void 0), e(s); var a = s.slice(0); i.encryptBlock(a, 0); for (var c = 0; c < n; c++)t[r + c] ^= a[c] } }); return i.Decryptor = n, i }(), function () { function r() { for (var t = this._X, r = this._C, e = 0; e < 8; e++)a[e] = r[e]; r[0] = r[0] + 1295307597 + this._b | 0, r[1] = r[1] + 3545052371 + (r[0] >>> 0 < a[0] >>> 0 ? 1 : 0) | 0, r[2] = r[2] + 886263092 + (r[1] >>> 0 < a[1] >>> 0 ? 1 : 0) | 0, r[3] = r[3] + 1295307597 + (r[2] >>> 0 < a[2] >>> 0 ? 1 : 0) | 0, r[4] = r[4] + 3545052371 + (r[3] >>> 0 < a[3] >>> 0 ? 1 : 0) | 0, r[5] = r[5] + 886263092 + (r[4] >>> 0 < a[4] >>> 0 ? 1 : 0) | 0, r[6] = r[6] + 1295307597 + (r[5] >>> 0 < a[5] >>> 0 ? 1 : 0) | 0, r[7] = r[7] + 3545052371 + (r[6] >>> 0 < a[6] >>> 0 ? 1 : 0) | 0, this._b = r[7] >>> 0 < a[7] >>> 0 ? 1 : 0; for (var e = 0; e < 8; e++) { var i = t[e] + r[e], n = 65535 & i, o = i >>> 16, s = ((n * n >>> 17) + n * o >>> 15) + o * o, h = ((4294901760 & i) * i | 0) + ((65535 & i) * i | 0); c[e] = s ^ h } t[0] = c[0] + (c[7] << 16 | c[7] >>> 16) + (c[6] << 16 | c[6] >>> 16) | 0, t[1] = c[1] + (c[0] << 8 | c[0] >>> 24) + c[7] | 0, t[2] = c[2] + (c[1] << 16 | c[1] >>> 16) + (c[0] << 16 | c[0] >>> 16) | 0, t[3] = c[3] + (c[2] << 8 | c[2] >>> 24) + c[1] | 0, t[4] = c[4] + (c[3] << 16 | c[3] >>> 16) + (c[2] << 16 | c[2] >>> 16) | 0, t[5] = c[5] + (c[4] << 8 | c[4] >>> 24) + c[3] | 0, t[6] = c[6] + (c[5] << 16 | c[5] >>> 16) + (c[4] << 16 | c[4] >>> 16) | 0, t[7] = c[7] + (c[6] << 8 | c[6] >>> 24) + c[5] | 0 } var e = t, i = e.lib, n = i.StreamCipher, o = e.algo, s = [], a = [], c = [], h = o.Rabbit = n.extend({ _doReset: function () { for (var t = this._key.words, e = this.cfg.iv, i = 0; i < 4; i++)t[i] = 16711935 & (t[i] << 8 | t[i] >>> 24) | 4278255360 & (t[i] << 24 | t[i] >>> 8); var n = this._X = [t[0], t[3] << 16 | t[2] >>> 16, t[1], t[0] << 16 | t[3] >>> 16, t[2], t[1] << 16 | t[0] >>> 16, t[3], t[2] << 16 | t[1] >>> 16], o = this._C = [t[2] << 16 | t[2] >>> 16, 4294901760 & t[0] | 65535 & t[1], t[3] << 16 | t[3] >>> 16, 4294901760 & t[1] | 65535 & t[2], t[0] << 16 | t[0] >>> 16, 4294901760 & t[2] | 65535 & t[3], t[1] << 16 | t[1] >>> 16, 4294901760 & t[3] | 65535 & t[0]]; this._b = 0; for (var i = 0; i < 4; i++)r.call(this); for (var i = 0; i < 8; i++)o[i] ^= n[i + 4 & 7]; if (e) { var s = e.words, a = s[0], c = s[1], h = 16711935 & (a << 8 | a >>> 24) | 4278255360 & (a << 24 | a >>> 8), l = 16711935 & (c << 8 | c >>> 24) | 4278255360 & (c << 24 | c >>> 8), f = h >>> 16 | 4294901760 & l, u = l << 16 | 65535 & h; o[0] ^= h, o[1] ^= f, o[2] ^= l, o[3] ^= u, o[4] ^= h, o[5] ^= f, o[6] ^= l, o[7] ^= u; for (var i = 0; i < 4; i++)r.call(this) } }, _doProcessBlock: function (t, e) { var i = this._X; r.call(this), s[0] = i[0] ^ i[5] >>> 16 ^ i[3] << 16, s[1] = i[2] ^ i[7] >>> 16 ^ i[5] << 16, s[2] = i[4] ^ i[1] >>> 16 ^ i[7] << 16, s[3] = i[6] ^ i[3] >>> 16 ^ i[1] << 16; for (var n = 0; n < 4; n++)s[n] = 16711935 & (s[n] << 8 | s[n] >>> 24) | 4278255360 & (s[n] << 24 | s[n] >>> 8), t[e + n] ^= s[n] }, blockSize: 4, ivSize: 2 }); e.Rabbit = n._createHelper(h) }(), t.mode.CTR = function () { var r = t.lib.BlockCipherMode.extend(), e = r.Encryptor = r.extend({ processBlock: function (t, r) { var e = this._cipher, i = e.blockSize, n = this._iv, o = this._counter; n && (o = this._counter = n.slice(0), this._iv = void 0); var s = o.slice(0); e.encryptBlock(s, 0), o[i - 1] = o[i - 1] + 1 | 0; for (var a = 0; a < i; a++)t[r + a] ^= s[a] } }); return r.Decryptor = e, r }(), function () { function r() { for (var t = this._X, r = this._C, e = 0; e < 8; e++)a[e] = r[e]; r[0] = r[0] + 1295307597 + this._b | 0, r[1] = r[1] + 3545052371 + (r[0] >>> 0 < a[0] >>> 0 ? 1 : 0) | 0, r[2] = r[2] + 886263092 + (r[1] >>> 0 < a[1] >>> 0 ? 1 : 0) | 0, r[3] = r[3] + 1295307597 + (r[2] >>> 0 < a[2] >>> 0 ? 1 : 0) | 0, r[4] = r[4] + 3545052371 + (r[3] >>> 0 < a[3] >>> 0 ? 1 : 0) | 0, r[5] = r[5] + 886263092 + (r[4] >>> 0 < a[4] >>> 0 ? 1 : 0) | 0, r[6] = r[6] + 1295307597 + (r[5] >>> 0 < a[5] >>> 0 ? 1 : 0) | 0, r[7] = r[7] + 3545052371 + (r[6] >>> 0 < a[6] >>> 0 ? 1 : 0) | 0, this._b = r[7] >>> 0 < a[7] >>> 0 ? 1 : 0; for (var e = 0; e < 8; e++) { var i = t[e] + r[e], n = 65535 & i, o = i >>> 16, s = ((n * n >>> 17) + n * o >>> 15) + o * o, h = ((4294901760 & i) * i | 0) + ((65535 & i) * i | 0); c[e] = s ^ h } t[0] = c[0] + (c[7] << 16 | c[7] >>> 16) + (c[6] << 16 | c[6] >>> 16) | 0, t[1] = c[1] + (c[0] << 8 | c[0] >>> 24) + c[7] | 0, t[2] = c[2] + (c[1] << 16 | c[1] >>> 16) + (c[0] << 16 | c[0] >>> 16) | 0, t[3] = c[3] + (c[2] << 8 | c[2] >>> 24) + c[1] | 0, t[4] = c[4] + (c[3] << 16 | c[3] >>> 16) + (c[2] << 16 | c[2] >>> 16) | 0, t[5] = c[5] + (c[4] << 8 | c[4] >>> 24) + c[3] | 0, t[6] = c[6] + (c[5] << 16 | c[5] >>> 16) + (c[4] << 16 | c[4] >>> 16) | 0, t[7] = c[7] + (c[6] << 8 | c[6] >>> 24) + c[5] | 0 } var e = t, i = e.lib, n = i.StreamCipher, o = e.algo, s = [], a = [], c = [], h = o.RabbitLegacy = n.extend({ _doReset: function () { var t = this._key.words, e = this.cfg.iv, i = this._X = [t[0], t[3] << 16 | t[2] >>> 16, t[1], t[0] << 16 | t[3] >>> 16, t[2], t[1] << 16 | t[0] >>> 16, t[3], t[2] << 16 | t[1] >>> 16], n = this._C = [t[2] << 16 | t[2] >>> 16, 4294901760 & t[0] | 65535 & t[1], t[3] << 16 | t[3] >>> 16, 4294901760 & t[1] | 65535 & t[2], t[0] << 16 | t[0] >>> 16, 4294901760 & t[2] | 65535 & t[3], t[1] << 16 | t[1] >>> 16, 4294901760 & t[3] | 65535 & t[0]]; this._b = 0; for (var o = 0; o < 4; o++)r.call(this); for (var o = 0; o < 8; o++)n[o] ^= i[o + 4 & 7]; if (e) { var s = e.words, a = s[0], c = s[1], h = 16711935 & (a << 8 | a >>> 24) | 4278255360 & (a << 24 | a >>> 8), l = 16711935 & (c << 8 | c >>> 24) | 4278255360 & (c << 24 | c >>> 8), f = h >>> 16 | 4294901760 & l, u = l << 16 | 65535 & h; n[0] ^= h, n[1] ^= f, n[2] ^= l, n[3] ^= u, n[4] ^= h, n[5] ^= f, n[6] ^= l, n[7] ^= u; for (var o = 0; o < 4; o++)r.call(this) } }, _doProcessBlock: function (t, e) { var i = this._X; r.call(this), s[0] = i[0] ^ i[5] >>> 16 ^ i[3] << 16, s[1] = i[2] ^ i[7] >>> 16 ^ i[5] << 16, s[2] = i[4] ^ i[1] >>> 16 ^ i[7] << 16, s[3] = i[6] ^ i[3] >>> 16 ^ i[1] << 16; for (var n = 0; n < 4; n++)s[n] = 16711935 & (s[n] << 8 | s[n] >>> 24) | 4278255360 & (s[n] << 24 | s[n] >>> 8), t[e + n] ^= s[n] }, blockSize: 4, ivSize: 2 }); e.RabbitLegacy = n._createHelper(h) }(), t.pad.ZeroPadding = { pad: function (t, r) { var e = 4 * r; t.clamp(), t.sigBytes += e - (t.sigBytes % e || e) }, unpad: function (t) { for (var r = t.words, e = t.sigBytes - 1; !(r[e >>> 2] >>> 24 - e % 4 * 8 & 255);)e--; t.sigBytes = e + 1 } }, t }); -const cookieName = '威锋网' -const cookieKey = 'chavy_cookie_feng' -const chavy = init() -const cookieVal = chavy.getdata(cookieKey) +const $ = new Env('威锋网') +$.CFG_accounts = $.getdata('chavy_accounts_feng') -sign() +!(async () => { + $.CryptoJS = $.isNode() ? require('crypto-js') : CryptoJS + await signin() +})() + .catch((e) => $.logErr(e)) + .finally(() => $.done()) -function encrypt(str) { - const key = `abf82c19da4b098b` - const iv = CryptoJS.enc.Utf8.parse(key) - return CryptoJS.AES.encrypt(CryptoJS.enc.Utf8.parse(str), iv, { - iv: iv, - mode: CryptoJS.mode.CBC, - padding: CryptoJS.pad.Pkcs7 - }).toString() -} - -function sign() { - // abf82c19da4b098b - // url=/v1/attendance/userSignIn$time=1581313242043000000 - // PnzCEAiMjJaYWoBNqwXwssbnYHoJM81RvTrfrwyUsxUtRmMiiGKnyCVJrcqxb9+vKdljjPAZ3cf9lQUJdyNPdQ== - const timestamp = Date.parse(new Date()) - const signurl = `url=/v1/attendance/userSignIn$time=${timestamp}` - const url = { url: `https://beta-api.feng.com/v1/attendance/userSignIn?time=${timestamp}`, headers: {}, body: {} } - url.headers['Host'] = 'beta-api.feng.com' - url.headers['Origin'] = 'https://www.feng.com' - url.headers['Referer'] = 'https://www.feng.com/' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8' - url.headers['Accept'] = 'application/json, text/plain, */*' - url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15' - url.headers['X-Access-Token'] = getToken() - url.headers['X-Request-Id'] = encrypt(signurl) - chavy.post(url, (error, response, data) => { - chavy.log(`${cookieName}, signdata: ${data}`) - if (data) { - let result = JSON.parse(data) - let title = `${cookieName}` - // 签到成功 || 签到重复 - if (result.status && (result.status.code == 0 || result.status.code == 1021)) { - if (chavy.isQuanX()) getexp(result) - if (chavy.isSurge()) showSurgeMsg(result) - } - // 签到失败 - else { - let subTitle = `签到结果: 失败` - let detail = `说明: ${result.status.message}` - chavy.msg(title, subTitle, detail) - chavy.log(`${cookieName}, cookieKey: ${cookieVal}`) - chavy.log(`${cookieName}, token: ${getToken()}`) +async function signin() { + $.subt = '' + $.accounts = [] + $.CFG_accounts && + $.CFG_accounts.split('\n').forEach((account) => { + let [acc, pwd] = account.split(',') + acc = acc ? acc.trim() : acc + pwd = pwd ? pwd.trim() : pwd + if (acc && pwd) { + $.accounts.push({ acc, pwd }) } - } else { - chavy.msg(cookieName, `签到结果: 失败`, `说明: 威锋加了校验, 偶尔能签, 选择性弃坑吧!`) + }) + if ($.accounts.length === 0) { + $.subt = '请在 BoxJs 填写手机号码!' + $.desc = [] + } else { + $.desc = ['点击查看详情'] + let succnt = 0 + let repeatcnt = 0 + let failcnt = 0 + for (let accIdx = 0; accIdx < $.accounts.length; accIdx++) { + const account = $.accounts[accIdx] + await login(account) + $.wait(1000) + await sign(account) + if (account.issuc) succnt += 1 + else if (account.isrepeat) repeatcnt += 1 + else failcnt += 1 + $.desc.push('', `${account.acc}: ${account.msg}`) } - }) - chavy.done() + $.subt = `共签: ${succnt + repeatcnt}/${$.accounts.length}, 本次成功: ${succnt}, 本次失败: ${failcnt}` + } + $.msg($.name, $.subt, $.desc.join('\n')) } -function getexp(signResult) { - const timestamp = Date.parse(new Date()) - const signurl = `url=/v1/user/experience$time=${timestamp}` - const url = { url: `https://beta-api.feng.com/v1/user/experience?time=${timestamp}`, headers: {}, body: {} } - url.headers['Host'] = 'beta-api.feng.com' - url.headers['Origin'] = 'https://www.feng.com' - url.headers['Referer'] = 'https://www.feng.com/' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8' - url.headers['Accept'] = 'application/json, text/plain, */*' - url.headers['Accept-Encoding'] = 'gzip, deflate, br' - url.headers['Accept-Language'] = 'zh-cn' - url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15' - url.headers['X-Access-Token'] = getToken() - url.headers['X-Request-Id'] = encrypt(signurl) - chavy.get(url, (error, response, data) => { - chavy.log(`${cookieName}, getexpdata: ${data}`) - let result = JSON.parse(data) - let title = `${cookieName}` - let subTitle = '' - let detail = `累计: ${result.data.signInCount}次, 等级: ${result.data.level} (${result.data.levelTitle}), 经验: ${result.data.currentExperience}/${result.data.creditsLower}` - chavy.log(signResult.status.code + ', ' + signResult.status.code == 0) - // 签到成功 - if (signResult.status.code == 0) { - subTitle = `签到结果: 成功` - chavy.msg(title, subTitle, detail) - } - // 签到重复 - else if (signResult.status.code == 1021) { - subTitle = `签到结果: 成功 (重复签到)` - chavy.msg(title, subTitle, detail) - } +function login(account) { + const { acc, pwd } = account + return new Promise((resove) => { + const signstr = encrypt('url=/v1/auth/signin$time='.concat(Date.now(), '000000')) + const url = { url: 'https://api.wfdata.club/v1/auth/signin', headers: {} } + url.body = `account=${acc}&password=${pwd}` + url.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8' + url.headers['Origin'] = 'https://www.feng.com' + url.headers['Referer'] = 'https://www.feng.com/' + url.headers['Host'] = 'api.wfdata.club' + url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15' + url.headers['X-Request-Id'] = signstr + $.post(url, (err, resp, data) => { + try { + const _data = JSON.parse(data) + account.token = $.lodash_get(_data, 'data.accessToken') + } catch (e) { + $.token = null + $.logErr(e, resp) + } finally { + resove() + } + }) }) } - -function showSurgeMsg(signResult) { - let title = `${cookieName}` - let detail = `` - // 签到成功 - if (signResult.status.code == 0) { - subTitle = `签到结果: 成功` - chavy.msg(title, subTitle, detail) - } - // 签到重复 - else if (signResult.status.code == 1021) { - subTitle = `签到结果: 成功 (重复签到)` - chavy.msg(title, subTitle, detail) +function sign(account) { + if (!account.token) { + account.issuc = false + account.msg = '登录失败' + return } + return new Promise((resove) => { + const signstr = encrypt('url=/v1/attendance/userSignIn$time='.concat(Date.now(), '000000')) + const url = { url: 'https://api.wfdata.club/v1/attendance/userSignIn', headers: {} } + url.body = 'account=chavyleung&password=Chavy1enny2018' + url.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8' + url.headers['Origin'] = 'https://www.feng.com' + url.headers['Referer'] = 'https://www.feng.com/' + url.headers['Host'] = 'api.wfdata.club' + url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15' + url.headers['X-Access-Token'] = account.token + url.headers['X-Request-Id'] = signstr + $.post(url, (err, resp, data) => { + try { + const _data = JSON.parse(data) + account.issuc = $.lodash_get(_data, 'status.code') === '0' + account.isrepeat = $.lodash_get(_data, 'status.code') === 1021 + account.msg = account.issuc ? '成功' : $.lodash_get(_data, 'status.message') + } catch (e) { + account.issuc = false + account.msg = e + $.logErr(e, resp) + } finally { + resove() + } + }) + }) } -function getToken() { - const userInfo = decodeURIComponent(decodeURIComponent(cookieVal.match(/userInfo=(\{[^;]*)/)[1])) - return JSON.parse(userInfo).accessToken +function encrypt(str) { + const key = `2b7e151628aed2a6` + const iv = $.CryptoJS.enc.Utf8.parse(key) + return $.CryptoJS.AES.encrypt($.CryptoJS.enc.Utf8.parse(str), iv, { + iv: iv, + mode: $.CryptoJS.mode.CBC, + padding: $.CryptoJS.pad.Pkcs7 + }).toString() } -function init() { - isSurge = () => { - return undefined === this.$httpClient ? false : true - } - isQuanX = () => { - return undefined === this.$task ? false : true - } - getdata = (key) => { - if (isSurge()) return $persistentStore.read(key) - if (isQuanX()) return $prefs.valueForKey(key) - } - setdata = (key, val) => { - if (isSurge()) return $persistentStore.write(key, val) - if (isQuanX()) return $prefs.setValueForKey(key, val) - } - msg = (title, subtitle, body) => { - if (isSurge()) $notification.post(title, subtitle, body) - if (isQuanX()) $notify(title, subtitle, body) - } - log = (message) => console.log(message) - get = (url, cb) => { - if (isSurge()) { - $httpClient.get(url, cb) - } - if (isQuanX()) { - url.method = 'GET' - $task.fetch(url).then((resp) => cb(null, {}, resp.body)) - } - } - post = (url, cb) => { - if (isSurge()) { - $httpClient.post(url, cb) - } - if (isQuanX()) { - url.method = 'POST' - $task.fetch(url).then((resp) => cb(null, {}, resp.body)) - } - } - done = (value = {}) => { - $done(value) - } - return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done } -} +// prettier-ignore +function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}catch{const s={};this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}}else e=$.setval(t,s);return e}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}msg(s=t,e="",i="",o){this.isSurge()||this.isLoon()?$notification.post(s,e,i):this.isQuanX()&&$notify(s,e,i),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} From 2f43fd5aaba65ec43a26f08557e771783338f7ec Mon Sep 17 00:00:00 2001 From: Chavy Date: Mon, 29 Jun 2020 00:42:56 +0800 Subject: [PATCH 025/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E5=85=A8=E5=B1=80=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/release/box.release.json | 13 +++++++++++++ chavy.box.js | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/box/release/box.release.json b/box/release/box.release.json index 3090f4a9a..3f795e444 100644 --- a/box/release/box.release.json +++ b/box/release/box.release.json @@ -1,5 +1,18 @@ { "releases": [ + { + "version": "0.3.0", + "tags": ["beta"], + "author": "@chavyleung", + "icon": "https://avatars3.githubusercontent.com/u/29748519", + "repo": "https://github.com/chavyleung", + "notes": [ + { + "name": "新增", + "descs": ["全局搜索"] + } + ] + }, { "version": "0.2.4", "tags": ["beta"], diff --git a/chavy.box.js b/chavy.box.js index c10426938..0d0ed8b0c 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -1,7 +1,7 @@ const $ = new Env('BoxJs') $.domain = '8.8.8.8' -$.version = '0.2.4' +$.version = '0.3.0' $.versionType = 'beta' $.KEY_sessions = 'chavy_boxjs_sessions' $.KEY_versions = 'chavy_boxjs_versions' @@ -657,7 +657,24 @@ function printHtml(data, curapp = null, curview = 'app') { mdi-chevron-left - + + + @@ -1239,6 +1256,7 @@ function printHtml(data, curapp = null, curview = 'app') { curappTabs: { curtab: 'sessions' }, curappSessions: null, overlay: { show: false }, + autocomplete: { curapp: null }, editProfileDialog: { show: false, bak: '' }, impGlobalBakDialog: { show: false, bak: '' }, reloadConfirmDialog: { show: false, title: '操作成功', message: '是否马上刷新页面?' }, @@ -1256,6 +1274,13 @@ function printHtml(data, curapp = null, curview = 'app') { } }, computed: { + apps: function () { + const apps = [] + apps.push(...this.box.sysapps) + this.box.appsubs.forEach((sub, subIdx) => apps.push(...sub.apps)) + apps.sort((a, b) => a.id.localeCompare(b.id)) + return apps + }, appcnt: function () { let cnt = 0 cnt += Array.isArray(this.box.sysapps) ? this.box.sysapps.length : 0 @@ -1369,6 +1394,9 @@ function printHtml(data, curapp = null, curview = 'app') { } }, methods: { + appfilter(item, queryText, itemText) { + return item.id.includes(queryText) || item.name.includes(queryText) + }, onLink(link) { window.open(link) }, From d74f41203172e73183b824f868d7b0071e26b9e7 Mon Sep 17 00:00:00 2001 From: GideonSenku Date: Mon, 29 Jun 2020 20:57:10 +0800 Subject: [PATCH 026/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[=E4=B8=87=E8=BE=BE?= =?UTF-8?q?=E7=94=B5=E5=BD=B1],=E6=B7=BB=E5=8A=A0=E7=AD=BE=E5=88=B0?= =?UTF-8?q?=E6=8A=BD=E5=A5=96,=E5=B0=9D=E8=AF=95=E6=80=A7=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E7=AD=94=E9=A2=98=E6=9C=AA=E6=8A=A5=E5=90=8D=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wanda/wanda.cookie.js | 4 +-- wanda/wanda.js | 83 +++++++++++++++++++++++++++++++++++++------ 2 files changed, 75 insertions(+), 12 deletions(-) diff --git a/wanda/wanda.cookie.js b/wanda/wanda.cookie.js index aca16a7eb..5f5c9ff6f 100644 --- a/wanda/wanda.cookie.js +++ b/wanda/wanda.cookie.js @@ -12,7 +12,7 @@ * * # Loon * http-response ^https:\/\/user-api-prd-mx\.wandafilm\.com\/user\/islogin\.api script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wanda/wanda.cookie.js - * cron "10 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wanda/wanda.cookie.js + * cron "10 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wanda/wanda.js * */ @@ -24,7 +24,7 @@ $._mi_ = 'senku_wanda_mi_' session.url = $request.url session.headers = JSON.parse($request.headers['MX-API'])['_mi_'] let key = '' - if (/islogin.api/.test(session.url)) { + if (/user_info.api/.test(session.url)) { key = $._mi_ } if ($.setdata(session.headers, key)) { diff --git a/wanda/wanda.js b/wanda/wanda.js index bbea651be..5aaf01601 100644 --- a/wanda/wanda.js +++ b/wanda/wanda.js @@ -1,9 +1,13 @@ const $ = new Env('万达电影') $._mi_ = 'senku_wanda_mi_' $.desc = [] -const ts = new Date().getTime() -const date = tTime(ts) -const key = 'Wanda1_3B3AA12B0145E1982F282BEDD8A3305B89A9811280C0B8CC3A6A60D81022E4903'+ts +const date = tTime(new Date().getTime()) + +function getKey(){ + const ts = new Date().getTime() + const key = 'Wanda1_3B3AA12B0145E1982F282BEDD8A3305B89A9811280C0B8CC3A6A60D81022E4903'+ts + return {'key':key,'ts':ts} +} const mx_api = { "ver":"v1.0.0", "sCode":"Wanda", @@ -12,7 +16,7 @@ const mx_api = { "json":true, "cCode":"1_3", "check":'', - "ts":ts, + "ts":0, "heigth":720, "appId":"3" } @@ -20,10 +24,14 @@ const mx_api = { !(async () => { await sign() await signRecord() + await question_() await question() await answer() await drawprize_ans() await drawprize_ans() + if ($.signRecord.data.remainMedal >= 50 ) { + await lottery() + } await showmsg() })() .catch((e) => $.logErr(e)) @@ -33,7 +41,8 @@ const mx_api = { function sign() { return new Promise((resolve) => { - const signVal = key+'/activityWholeSign/wholeSignUp.apiactivityCode=12786638&signDate='+date + const signVal = getKey()['key'] + '/activityWholeSign/wholeSignUp.apiactivityCode=12786638&signDate='+date + mx_api['ts'] = getKey()['ts'] mx_api['check'] = hex_md5(signVal) const url = { url:'https://activity-api-mx.wandafilm.com/activityWholeSign/wholeSignUp.api', @@ -56,7 +65,8 @@ function sign() { function signRecord() { return new Promise((resolve) => { - const signRecordVal = key+'/activityWholeSign/getSignRecord.apiactivityCode=12786638' + const signRecordVal = getKey()['key']+'/activityWholeSign/getSignRecord.apiactivityCode=12786638' + mx_api['ts'] = getKey()['ts'] mx_api['check'] = hex_md5(signRecordVal) const url = { url:'https://activity-api-mx.wandafilm.com/activityWholeSign/getSignRecord.api', @@ -77,10 +87,60 @@ function signRecord() { }) } +function lottery() { + return new Promise((resolve) => { + const signVal = getKey()['key'] + '/activityWholeSign/prize/lottery.apiactivityCode=12786638&vcode=&requestId=' + mx_api['ts'] = getKey()['ts'] + mx_api['check'] = hex_md5(signVal) + const url = { + url:'https://activity-api-mx.wandafilm.com/activityWholeSign/prize/lottery.api', + headers:{ + 'MX-API':JSON.stringify(mx_api), + }, + body : 'activityCode=12786638&vcode=&requestId=' + } + $.post(url, (err, resp, data) => { + try { + $.lottery = JSON.parse(data) + console.log(data) + } catch (e) { + $.logErr(e, resp) + } finally { + resolve() + } + }) + }) +} + +function question_() { + return new Promise((resolve) => { + const questionVal = getKey()['key']+'/question/qustion/strength.apiactivityCode=15884027' + mx_api['ts'] = getKey()['ts'] + mx_api['check'] = hex_md5(questionVal) + const url = { + url:'https://activity-api-mx.wandafilm.com/question/qustion/strength.api', + headers:{ + 'MX-API':JSON.stringify(mx_api), + }, + body : 'activityCode=15884027' + } + $.post(url, (err, resp, data) => { + try { + $.log(`尝试性报名答题`) + } catch (e) { + $.logErr(e, resp) + } finally { + resolve() + } + }) + }) +} + // 获取题目答案 function question() { return new Promise((resolve) => { - const questionVal = key+'/question/question_list.apiactivityCode=15884027' + const questionVal = getKey()['key']+'/question/question_list.apiactivityCode=15884027' + mx_api['ts'] = getKey()['ts'] mx_api['check'] = hex_md5(questionVal) const url = { url:'https://activity-api-mx.wandafilm.com/question/question_list.api', @@ -105,7 +165,8 @@ function question() { // 答题 function answer() { return new Promise((resolve) => { - const answerVal = key + '/question/qustion/answer.apiactivityCode=15884027&answer=%7b%221%22%3a%22'+escape(`${$.answer}`).toLowerCase()+'%22%7d' + const answerVal = getKey()['key'] + '/question/qustion/answer.apiactivityCode=15884027&answer=%7b%221%22%3a%22'+escape(`${$.answer}`).toLowerCase()+'%22%7d' + mx_api['ts'] = getKey()['ts'] mx_api['check'] = hex_md5(answerVal) const url = { url:'https://activity-api-mx.wandafilm.com/question/qustion/answer.api', @@ -129,7 +190,8 @@ function answer() { // 答题后抽奖 function drawprize_ans() { return new Promise((resolve) => { - const drawprizeVal = key+'/question/prize/lottery.apiactivityCode=15884027' + const drawprizeVal = getKey()['key']+'/question/prize/lottery.apiactivityCode=15884027' + mx_api['ts'] = getKey()['ts'] mx_api['check'] = hex_md5(drawprizeVal) const url = { url:'https://activity-api-mx.wandafilm.com/question/prize/lottery.api', @@ -158,9 +220,10 @@ function showmsg() { if ($.signRecord.code == 1) { const totalMedal = $.signRecord.data.totalMedal const remainMedal = $.signRecord.data.remainMedal - $.desc.push(`本次获得${totalMedal}能量,剩余可用${remainMedal}能量`) + $.desc.push(`总计获得${totalMedal}能量,剩余可用${remainMedal}能量`) } $.subt += ` 答题详情:${$.answer.code == 1 ? `答案:${$.answer.data.answer},获得:${$.answer.data.remainChance}次抽奖`:$.answer.msg}` + $.lottery ? $.desc.push(`签到抽奖:${$.lottery.data.prize.prizeName}`) : `` $.msg($.name, $.subt, $.desc.join('\n')) resolve() }) From 3aa9e1e0f7b794b4d257d02780b039f7e1cb81b2 Mon Sep 17 00:00:00 2001 From: Chavy Date: Mon, 29 Jun 2020 23:53:07 +0800 Subject: [PATCH 027/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=89=8B=E5=8A=A8=E5=88=87=E6=8D=A2=E4=BC=9A=E8=AF=9D?= =?UTF-8?q?=E4=BC=9A=E5=AF=BC=E8=87=B4=E8=87=AA=E5=8A=A8=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/release/box.release.json | 13 +++++++++++++ chavy.box.js | 7 ++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/box/release/box.release.json b/box/release/box.release.json index 3f795e444..b2539637a 100644 --- a/box/release/box.release.json +++ b/box/release/box.release.json @@ -1,5 +1,18 @@ { "releases": [ + { + "version": "0.3.1", + "tags": ["beta"], + "author": "@chavyleung", + "icon": "https://avatars3.githubusercontent.com/u/29748519", + "repo": "https://github.com/chavyleung", + "notes": [ + { + "name": "修复", + "descs": ["手动切换会话会导致自动切换顺序错误问题"] + } + ] + }, { "version": "0.3.0", "tags": ["beta"], diff --git a/chavy.box.js b/chavy.box.js index 0d0ed8b0c..a0dc69fd4 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -1,12 +1,13 @@ const $ = new Env('BoxJs') $.domain = '8.8.8.8' -$.version = '0.3.0' +$.version = '0.3.1' $.versionType = 'beta' $.KEY_sessions = 'chavy_boxjs_sessions' $.KEY_versions = 'chavy_boxjs_versions' $.KEY_userCfgs = 'chavy_boxjs_userCfgs' $.KEY_globalBaks = 'chavy_boxjs_globalBaks' +$.KEY_curSessions = 'chavy_boxjs_cur_sessions' $.json = $.name $.html = $.name @@ -471,6 +472,8 @@ function handleApi() { // 应用会话 else if (data.cmd === 'useSession') { $.log(`❕ ${$.name}, 应用会话!`) + const curSessionsstr = $.getdata($.KEY_curSessions) + const curSessions = ![undefined, null, 'null', ''].includes(curSessionsstr) ? JSON.parse(curSessionsstr) : {} const session = data.val const sessions = getSessions() const sessionIdx = sessions.findIndex((s) => session.id === s.id) @@ -481,6 +484,8 @@ function handleApi() { const usesuc = $.setdata(`${newval}`, data.key) $.log(`❕ ${$.name}, 替换数据: ${data.key} ${usesuc ? '成功' : '失败'}!`, `旧值: ${oldval}`, `新值: ${newval}`) }) + curSessions[session.appId] = session.id + $.setdata(JSON.stringify(curSessions), $.KEY_curSessions) $.subt = `应用会话: 成功 (${session.appName})` $.desc = [] $.desc.push(`会话名称: ${session.name}`, `应用名称: ${session.appName}`, `会话编号: ${session.id}`, `应用编号: ${session.appId}`, `数据: ${JSON.stringify(session)}`) From 6fc8078cbfec472d8bfa7fe2d4bf9cb50f53c014 Mon Sep 17 00:00:00 2001 From: Chavy Date: Tue, 30 Jun 2020 00:57:08 +0800 Subject: [PATCH 028/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[=E5=A8=81=E9=94=8B?= =?UTF-8?q?=E7=BD=91]:=20=E4=BF=AE=E5=A4=8D=E6=88=90=E5=8A=9F=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E4=B8=BA=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- feng/feng.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/feng/feng.js b/feng/feng.js index 7309a5f91..dc4e20378 100644 --- a/feng/feng.js +++ b/feng/feng.js @@ -30,7 +30,7 @@ async function signin() { } }) if ($.accounts.length === 0) { - $.subt = '请在 BoxJs 填写手机号码!' + $.subt = '请在 BoxJs 填写账号密码!' $.desc = [] } else { $.desc = ['点击查看详情'] @@ -97,7 +97,7 @@ function sign(account) { $.post(url, (err, resp, data) => { try { const _data = JSON.parse(data) - account.issuc = $.lodash_get(_data, 'status.code') === '0' + account.issuc = $.lodash_get(_data, 'status.code') === 0 account.isrepeat = $.lodash_get(_data, 'status.code') === 1021 account.msg = account.issuc ? '成功' : $.lodash_get(_data, 'status.message') } catch (e) { From ff47528b03a66abfc80628c66655d83ae563e787 Mon Sep 17 00:00:00 2001 From: Chavy Date: Tue, 30 Jun 2020 01:27:56 +0800 Subject: [PATCH 029/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[EnvJs]:=20=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E9=80=9A=E7=9F=A5=E6=8E=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=20opts=20=E5=8F=82=E6=95=B0=20(=E7=82=B9=E5=87=BB=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E8=B7=B3=E8=BD=AC)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Env.js | 4 ++-- Env.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Env.js b/Env.js index 2a946115b..7c4f78048 100644 --- a/Env.js +++ b/Env.js @@ -255,9 +255,9 @@ function Env(name, opts) { */ msg(title = name, subt = '', desc = '', opts) { if (this.isSurge() || this.isLoon()) { - $notification.post(title, subt, desc) + $notification.post(title, subt, desc, opts) } else if (this.isQuanX()) { - $notify(title, subt, desc) + $notify(title, subt, desc, opts) } this.logs.push('', '==============📣系统通知📣==============') this.logs.push(title) diff --git a/Env.min.js b/Env.min.js index 267d1d766..5826fb95c 100644 --- a/Env.min.js +++ b/Env.min.js @@ -1 +1 @@ -function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}catch{const s={};this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}}else e=$.setval(t,s);return e}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}msg(s=t,e="",i="",o){this.isSurge()||this.isLoon()?$notification.post(s,e,i):this.isQuanX()&&$notify(s,e,i),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} \ No newline at end of file +function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}catch{const s={};this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}}else e=$.setval(t,s);return e}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}msg(s=t,e="",i="",o){this.isSurge()||this.isLoon()?$notification.post(s,e,i,o):this.isQuanX()&&$notify(s,e,i,o),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} \ No newline at end of file From 937b6906a22044da767bade41712aa0f43a4affa Mon Sep 17 00:00:00 2001 From: GideonSenku Date: Tue, 30 Jun 2020 23:55:17 +0800 Subject: [PATCH 030/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[=E4=B8=87=E8=BE=BE?= =?UTF-8?q?=E7=94=B5=E5=BD=B1],=E4=BF=AE=E6=94=B9=E5=AF=86=E9=92=A5?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=96=B9=E5=BC=8F=E5=8F=8A=E6=AD=A3=E5=88=99?= =?UTF-8?q?,=E6=B7=BB=E5=8A=A0=E5=88=B0Box=E8=AE=A2=E9=98=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/chavy.boxjs.json | 8 ++++++++ wanda/wanda.cookie.js | 19 ++++++++----------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/box/chavy.boxjs.json b/box/chavy.boxjs.json index 171a1db9e..b0b78aa7a 100644 --- a/box/chavy.boxjs.json +++ b/box/chavy.boxjs.json @@ -70,6 +70,14 @@ "author": "@chavyleung", "repo": "https://github.com/chavyleung/scripts/tree/master/feng", "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/feng.png", "https://raw.githubusercontent.com/Orz-3/task/master/feng.png"] + }, + { + "id": "wanda", + "name": "万达电影", + "keys": ["senku_wanda_mi_"], + "author": "@GideonSenku", + "repo": "https://github.com/chavyleung/scripts/tree/master/wanda", + "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/wanda.png", "https://raw.githubusercontent.com/Orz-3/task/master/wanda.png"] } ] } diff --git a/wanda/wanda.cookie.js b/wanda/wanda.cookie.js index 5f5c9ff6f..379aaeb9d 100644 --- a/wanda/wanda.cookie.js +++ b/wanda/wanda.cookie.js @@ -3,34 +3,31 @@ * hostname = user-api-prd-mx.wandafilm.com * * # Surge - * Rewrite: wanda = type=http-request,pattern=^https:\/\/user-api-prd-mx\.wandafilm\.com\/user\/islogin\.api,script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wanda/wanda.cookie.js,debug=true + * Rewrite: wanda = type=http-request,pattern=^https:\/\/user-api-prd-mx\.wandafilm\.com,script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wanda/wanda.cookie.js,debug=true * Tasks: wanda-签到 = type=cron,cronexp=10 0 * * *,script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wanda/wanda.js,wake-system=true * * # QuanX - * ^https:\/\/user-api-prd-mx\.wandafilm\.com\/user\/islogin\.api url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/wanda/wanda.cookie.js + * ^https:\/\/user-api-prd-mx\.wandafilm\.com url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/wanda/wanda.cookie.js * 10 0 * * * https://raw.githubusercontent.com/chavyleung/scripts/master/wanda/wanda.js, tag=wanda-签到 * * # Loon - * http-response ^https:\/\/user-api-prd-mx\.wandafilm\.com\/user\/islogin\.api script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wanda/wanda.cookie.js + * http-response ^https:\/\/user-api-prd-mx\.wandafilm\.com script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wanda/wanda.cookie.js * cron "10 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wanda/wanda.js * + * # 获取方式:进入签到页面获取,网页端:https://act-m.wandacinemas.com/2005/17621a8caacc4d190dadd/ */ -const $ = new Env('万达电影') +const $ = new Env('万达影城') $._mi_ = 'senku_wanda_mi_' !(async () => { const session = {} session.url = $request.url session.headers = JSON.parse($request.headers['MX-API'])['_mi_'] - let key = '' - if (/user_info.api/.test(session.url)) { - key = $._mi_ - } - if ($.setdata(session.headers, key)) { - $.subt = `获取会话: 成功! (${key})` + if (session.headers&&$.setdata(session.headers, $._mi_)) { + $.subt = `获取会话: 成功! (${$._mi_})` } else { - $.subt = `获取会话: 失败! (${key})` + $.subt = `获取会话: 失败! (${$._mi_})` } $.msg($.name, $.subt, $.desc) })() From 9391fb202a3bb2ed7bf3816647f32029d465423d Mon Sep 17 00:00:00 2001 From: GideonSenku Date: Wed, 1 Jul 2020 23:49:32 +0800 Subject: [PATCH 031/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[=E4=B8=87=E8=BE=BE?= =?UTF-8?q?=E7=94=B5=E5=BD=B1],=E6=B4=BB=E5=8A=A8ID=E6=9B=B4=E6=8D=A2,?= =?UTF-8?q?=E5=86=85=E7=BD=AE=E8=AE=A2=E9=98=85=E7=A7=BB=E9=99=A4=E9=83=A8?= =?UTF-8?q?=E5=88=86=E8=87=B3=E8=AE=A2=E9=98=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/chavy.boxjs.json | 56 ++++++++++++++++++++++++++++++++++++++++++++ chavy.box.js | 56 -------------------------------------------- wanda/wanda.js | 30 +++++++++++++----------- 3 files changed, 72 insertions(+), 70 deletions(-) diff --git a/box/chavy.boxjs.json b/box/chavy.boxjs.json index b0b78aa7a..7bf11d63b 100644 --- a/box/chavy.boxjs.json +++ b/box/chavy.boxjs.json @@ -78,6 +78,62 @@ "author": "@GideonSenku", "repo": "https://github.com/chavyleung/scripts/tree/master/wanda", "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/wanda.png", "https://raw.githubusercontent.com/Orz-3/task/master/wanda.png"] + }, + { + "id": "qtt", + "name": "趣头条", + "keys": ["senku_signKey_qtt", "senku_signXTK_qtt", "senku_readKey_qtt", "senku_navCoinKey_qtt"], + "author": "@GideonSenku", + "repo": "https://github.com/chavyleung/scripts/tree/master/qtt", + "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/qtt.png", "https://raw.githubusercontent.com/Orz-3/task/master/qtt.png"] + }, + { + "id": "qmkg", + "name": "全民K歌", + "keys": ["senku_signurl_qmkg", "senku_signheader_qmkg", "senku_signbody_qmkg"], + "author": "@GideonSenku", + "repo": "https://github.com/chavyleung/scripts/tree/master/qmkg", + "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/qmkg.png", "https://raw.githubusercontent.com/Orz-3/task/master/qmkg.png"] + }, + { + "id": "bcz", + "name": "百词斩", + "keys": ["senku_cookie_bcz", "senku_key_bcz"], + "author": "@GideonSenku", + "repo": "https://github.com/chavyleung/scripts/tree/master/bcz", + "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/bcz.png", "https://raw.githubusercontent.com/Orz-3/task/master/bcz.png"] + }, + { + "id": "zxhc", + "name": "智行火车票", + "keys": ["senku_signurl_zxhc", "senku_signheader_zxhc", "senku_signbody_zxhc"], + "author": "@GideonSenku", + "repo": "https://github.com/chavyleung/scripts/tree/master/zxhc", + "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/zxhc.png", "https://raw.githubusercontent.com/Orz-3/task/master/zxhc.png"] + }, + { + "id": "fenqile", + "name": "分期乐", + "keys": ["senku_signurl_fenqile", "senku_signheader_fenqile", "senku_signbody_fenqile", "senku_signDailyKey_fenqile", "senku_signDailyUrlKey_fenqile"], + "author": "@GideonSenku", + "repo": "https://github.com/chavyleung/scripts/tree/master/fenqile", + "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/fenqile.png", "https://raw.githubusercontent.com/Orz-3/task/master/fenqile.png"] + }, + { + "id": "fandeng", + "name": "樊登读书", + "keys": ["senku_signurl_pandeng", "senku_signheader_pandeng", "senku_signbody_pandeng"], + "author": "@GideonSenku", + "repo": "https://github.com/chavyleung/scripts/tree/master/fandeng", + "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/fandeng.png", "https://raw.githubusercontent.com/Orz-3/task/master/fandeng.png"] + }, + { + "id": "dbsj", + "name": "豆瓣时间", + "keys": ["senku_signurl_dbsj", "senku_signheader_dbsj", "senku_signbody_dbsj"], + "author": "@GideonSenku", + "repo": "https://github.com/chavyleung/scripts/tree/master/dbsj", + "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/dbsj.png", "https://raw.githubusercontent.com/Orz-3/task/master/dbsj.png"] } ] } diff --git a/chavy.box.js b/chavy.box.js index a0dc69fd4..340afef74 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -218,62 +218,6 @@ function getSystemApps() { tasks: [{ cron: '3 0 * * *', script: 'noteyoudao.js' }], rewrites: [{ type: 'request', pattern: '^https://note.youdao.com/yws/mapi/user?method=checkin', script: 'noteyoudao.cookie.js', body: true }] }, - { - id: 'QTT', - name: '趣头条', - keys: ['senku_signKey_qtt', 'senku_signXTK_qtt', 'senku_readKey_qtt', 'senku_navCoinKey_qtt'], - author: '@GideonSenku', - repo: 'https://github.com/chavyleung/scripts/tree/master/qtt', - icons: ['https://raw.githubusercontent.com/Orz-3/mini/master/qtt.png', 'https://raw.githubusercontent.com/Orz-3/task/master/qtt.png'] - }, - { - id: 'qmkg', - name: '全民K歌', - keys: ['senku_signurl_qmkg', 'senku_signheader_qmkg', 'senku_signbody_qmkg'], - author: '@GideonSenku', - repo: 'https://github.com/chavyleung/scripts/tree/master/qmkg', - icons: ['https://raw.githubusercontent.com/Orz-3/mini/master/qmkg.png', 'https://raw.githubusercontent.com/Orz-3/task/master/qmkg.png'] - }, - { - id: 'bcz', - name: '百词斩', - keys: ['senku_cookie_bcz', 'senku_key_bcz'], - author: '@GideonSenku', - repo: 'https://github.com/chavyleung/scripts/tree/master/bcz', - icons: ['https://raw.githubusercontent.com/Orz-3/mini/master/bcz.png', 'https://raw.githubusercontent.com/Orz-3/task/master/bcz.png'] - }, - { - id: 'zxhc', - name: '智行火车票', - keys: ['senku_signurl_zxhc', 'senku_signheader_zxhc', 'senku_signbody_zxhc'], - author: '@GideonSenku', - repo: 'https://github.com/chavyleung/scripts/tree/master/zxhc', - icons: ['https://raw.githubusercontent.com/Orz-3/mini/master/zxhc.png', 'https://raw.githubusercontent.com/Orz-3/task/master/zxhc.png'] - }, - { - id: 'fenqile', - name: '分期乐', - keys: ['senku_signurl_fenqile', 'senku_signheader_fenqile', 'senku_signbody_fenqile', 'senku_signDailyKey_fenqile', 'senku_signDailyUrlKey_fenqile'], - author: '@GideonSenku', - repo: 'https://github.com/chavyleung/scripts/tree/master/fenqile', - icons: ['https://raw.githubusercontent.com/Orz-3/mini/master/fenqile.png', 'https://raw.githubusercontent.com/Orz-3/task/master/fenqile.png'] - }, - { - id: 'fandeng', - name: '樊登读书', - keys: ['senku_signurl_pandeng', 'senku_signheader_pandeng', 'senku_signbody_pandeng'], - author: '@GideonSenku', - repo: 'https://github.com/chavyleung/scripts/tree/master/fandeng', - icons: ['https://raw.githubusercontent.com/Orz-3/mini/master/fandeng.png', 'https://raw.githubusercontent.com/Orz-3/task/master/fandeng.png'] - }, - { - id: 'dbsj', - name: '豆瓣时间', - keys: ['senku_signurl_dbsj', 'senku_signheader_dbsj', 'senku_signbody_dbsj'], - author: '@GideonSenku', - repo: 'https://github.com/chavyleung/scripts/tree/master/dbsj', - icons: ['https://raw.githubusercontent.com/Orz-3/mini/master/dbsj.png', 'https://raw.githubusercontent.com/Orz-3/task/master/dbsj.png'] - }, { id: 'txnews', name: '腾讯新闻', diff --git a/wanda/wanda.js b/wanda/wanda.js index 5aaf01601..7d2e51c13 100644 --- a/wanda/wanda.js +++ b/wanda/wanda.js @@ -1,6 +1,8 @@ const $ = new Env('万达电影') $._mi_ = 'senku_wanda_mi_' $.desc = [] +$.signCode = '17787285' +$.questionCode = '15884027' const date = tTime(new Date().getTime()) function getKey(){ @@ -41,7 +43,7 @@ const mx_api = { function sign() { return new Promise((resolve) => { - const signVal = getKey()['key'] + '/activityWholeSign/wholeSignUp.apiactivityCode=12786638&signDate='+date + const signVal = getKey()['key'] + '/activityWholeSign/wholeSignUp.apiactivityCode='+$.signCode+'&signDate='+date mx_api['ts'] = getKey()['ts'] mx_api['check'] = hex_md5(signVal) const url = { @@ -49,7 +51,7 @@ function sign() { headers:{ 'MX-API':JSON.stringify(mx_api), }, - body : 'activityCode=12786638&signDate=' + date + body : 'activityCode='+$.signCode+'&signDate=' + date } $.post(url, (err, resp, data) => { try { @@ -65,7 +67,7 @@ function sign() { function signRecord() { return new Promise((resolve) => { - const signRecordVal = getKey()['key']+'/activityWholeSign/getSignRecord.apiactivityCode=12786638' + const signRecordVal = getKey()['key']+'/activityWholeSign/getSignRecord.apiactivityCode='+$.signCode mx_api['ts'] = getKey()['ts'] mx_api['check'] = hex_md5(signRecordVal) const url = { @@ -73,7 +75,7 @@ function signRecord() { headers:{ 'MX-API':JSON.stringify(mx_api), }, - body : 'activityCode=12786638' + body : 'activityCode='+$.signCode } $.post(url, (err, resp, data) => { try { @@ -89,7 +91,7 @@ function signRecord() { function lottery() { return new Promise((resolve) => { - const signVal = getKey()['key'] + '/activityWholeSign/prize/lottery.apiactivityCode=12786638&vcode=&requestId=' + const signVal = getKey()['key'] + '/activityWholeSign/prize/lottery.apiactivityCode='+$.signCode+'&vcode=&requestId=' mx_api['ts'] = getKey()['ts'] mx_api['check'] = hex_md5(signVal) const url = { @@ -97,7 +99,7 @@ function lottery() { headers:{ 'MX-API':JSON.stringify(mx_api), }, - body : 'activityCode=12786638&vcode=&requestId=' + body : 'activityCode='+$.signCode+'&vcode=&requestId=' } $.post(url, (err, resp, data) => { try { @@ -114,7 +116,7 @@ function lottery() { function question_() { return new Promise((resolve) => { - const questionVal = getKey()['key']+'/question/qustion/strength.apiactivityCode=15884027' + const questionVal = getKey()['key']+'/question/qustion/strength.apiactivityCode='+$.questionCode mx_api['ts'] = getKey()['ts'] mx_api['check'] = hex_md5(questionVal) const url = { @@ -122,7 +124,7 @@ function question_() { headers:{ 'MX-API':JSON.stringify(mx_api), }, - body : 'activityCode=15884027' + body : 'activityCode='+$.questionCode } $.post(url, (err, resp, data) => { try { @@ -139,7 +141,7 @@ function question_() { // 获取题目答案 function question() { return new Promise((resolve) => { - const questionVal = getKey()['key']+'/question/question_list.apiactivityCode=15884027' + const questionVal = getKey()['key']+'/question/question_list.apiactivityCode='+$.questionCode mx_api['ts'] = getKey()['ts'] mx_api['check'] = hex_md5(questionVal) const url = { @@ -147,7 +149,7 @@ function question() { headers:{ 'MX-API':JSON.stringify(mx_api), }, - body : 'activityCode=15884027' + body : 'activityCode='+$.questionCode } $.post(url, (err, resp, data) => { try { @@ -165,7 +167,7 @@ function question() { // 答题 function answer() { return new Promise((resolve) => { - const answerVal = getKey()['key'] + '/question/qustion/answer.apiactivityCode=15884027&answer=%7b%221%22%3a%22'+escape(`${$.answer}`).toLowerCase()+'%22%7d' + const answerVal = getKey()['key'] + '/question/qustion/answer.apiactivityCode='+$.questionCode+'&answer=%7b%221%22%3a%22'+escape(`${$.answer}`).toLowerCase()+'%22%7d' mx_api['ts'] = getKey()['ts'] mx_api['check'] = hex_md5(answerVal) const url = { @@ -173,7 +175,7 @@ function answer() { headers:{ 'MX-API':JSON.stringify(mx_api), }, - body : 'activityCode=15884027&answer=%7B%221%22%3A%22'+encodeURI(`${$.answer}`) + '%22%7D' + body : 'activityCode='+$.questionCode+'&answer=%7B%221%22%3A%22'+encodeURI(`${$.answer}`) + '%22%7D' } $.post(url, (err, resp, data) => { try { @@ -190,7 +192,7 @@ function answer() { // 答题后抽奖 function drawprize_ans() { return new Promise((resolve) => { - const drawprizeVal = getKey()['key']+'/question/prize/lottery.apiactivityCode=15884027' + const drawprizeVal = getKey()['key']+'/question/prize/lottery.apiactivityCode='+$.questionCode mx_api['ts'] = getKey()['ts'] mx_api['check'] = hex_md5(drawprizeVal) const url = { @@ -198,7 +200,7 @@ function drawprize_ans() { headers:{ 'MX-API':JSON.stringify(mx_api), }, - body : 'activityCode=15884027' + body : 'activityCode='+$.questionCode } $.post(url, (err, resp, data) => { try { From 380e86781382acb514ee85c8396ea844581ecbe4 Mon Sep 17 00:00:00 2001 From: Chavy Date: Fri, 3 Jul 2020 00:06:11 +0800 Subject: [PATCH 032/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E8=AE=A2=E9=98=85=E5=90=AF=E7=94=A8=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E6=9C=BA=E5=88=B6=20(=E9=9C=80=E8=A6=81=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E6=9B=B4=E6=96=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chavy.box.js | 99 ++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 68 insertions(+), 31 deletions(-) diff --git a/chavy.box.js b/chavy.box.js index 340afef74..5f1aae5c1 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -1,7 +1,7 @@ const $ = new Env('BoxJs') $.domain = '8.8.8.8' -$.version = '0.3.1' +$.version = '0.3.2' $.versionType = 'beta' $.KEY_sessions = 'chavy_boxjs_sessions' $.KEY_versions = 'chavy_boxjs_versions' @@ -31,7 +31,7 @@ $.html = $.name // 处理 Api 请求 => /api else if (/^\/api/.test(path)) { $.isapi = true - handleApi() + await handleApi() } // 处理 Api 请求 => /my else if (/^\/my/.test(path)) { @@ -250,7 +250,7 @@ function getSystemApps() { } function getUserCfgs() { - const defcfgs = { favapps: [], appsubs: [] } + const defcfgs = { favapps: [], appsubs: [], appsubCaches: {} } const userCfgsStr = $.getdata($.KEY_userCfgs) return userCfgsStr ? Object.assign(defcfgs, JSON.parse(userCfgsStr)) : defcfgs } @@ -260,36 +260,56 @@ function getGlobalBaks() { return globalBaksStr ? JSON.parse(globalBaksStr) : [] } -async function getAppSubs() { +async function refreshAppSubs() { const usercfgs = getUserCfgs() - const appsubs = [] - const subActs = [] for (let subIdx = 0; subIdx < usercfgs.appsubs.length; subIdx++) { const sub = usercfgs.appsubs[subIdx] - subActs.push( - new Promise((resolve) => { - $.get({ url: sub.url.replace(/[ ]|[\r\n]/g, '') }, (err, resp, data) => { - try { - const respsub = JSON.parse(data) - if (Array.isArray(respsub.apps)) { - respsub._raw = sub - wrapapps(respsub.apps) - appsubs.push(respsub) - } - } catch (e) { - $.logErr(e, resp) - sub.isErr = true - sub.apps = [] - sub._raw = JSON.parse(JSON.stringify(sub)) - appsubs.push(sub) - } finally { - resolve() + const suburl = sub.url.replace(/[ ]|[\r\n]/g, '') + await new Promise((resolve) => { + $.get({ url: suburl }, (err, resp, data) => { + try { + const respsub = JSON.parse(data) + if (Array.isArray(respsub.apps)) { + respsub._raw = sub + respsub.updateTime = new Date() + wrapapps(respsub.apps) + usercfgs.appsubCaches[suburl] = respsub + console.log(`更新订阅, 成功! ${suburl}`) } - }) + } catch (e) { + $.logErr(e, resp) + sub.isErr = true + sub.apps = [] + sub._raw = JSON.parse(JSON.stringify(sub)) + sub.updateTime = new Date() + usercfgs.appsubCaches[suburl] = sub + console.log(`更新订阅, 失败! ${suburl}`) + } finally { + resolve() + } }) - ) + }) + } + $.setdata(JSON.stringify(usercfgs), $.KEY_userCfgs) + console.log(`全部订阅, 完成!`) +} + +function getAppSubs() { + const usercfgs = getUserCfgs() + const appsubs = [] + for (let subIdx = 0; subIdx < usercfgs.appsubs.length; subIdx++) { + const sub = usercfgs.appsubs[subIdx] + const suburl = sub.url.replace(/[ ]|[\r\n]/g, '') + const cachedsub = usercfgs.appsubCaches[suburl] + if (cachedsub) { + appsubs.push(cachedsub) + } else { + sub.isErr = true + sub.apps = [] + sub._raw = JSON.parse(JSON.stringify(sub)) + appsubs.push(sub) + } } - await Promise.all(subActs) return appsubs } @@ -341,7 +361,8 @@ function getSessions() { async function getVersions() { let vers = [] await new Promise((resolve) => { - const verurl = 'https://github.com/chavyleung/scripts/raw/master/box/release/box.release.json' + setTimeout(resolve, 1000) + const verurl = 'https://raw.githubusercontent.com/chavyleung/scripts/master/box/release/box.release.json' $.get({ url: verurl }, (err, resp, data) => { try { const _data = JSON.parse(data) @@ -349,6 +370,7 @@ async function getVersions() { } catch (e) { $.logErr(e, resp) } finally { + console.log(`resolve`) resolve() } }) @@ -370,7 +392,7 @@ function getSystemThemes() { ] } -function handleApi() { +async function handleApi() { const data = JSON.parse($request.body) // 保存会话 if (data.cmd === 'saveSession') { @@ -507,6 +529,10 @@ function handleApi() { $.msg($.name, $.subt, $.desc) } } + // 刷新应用订阅 + else if (data.cmd === 'refreshAppSubs') { + await refreshAppSubs() + } } async function getBoxData() { @@ -515,7 +541,7 @@ async function getBoxData() { versions: await getVersions(), sysapps: getSystemApps(), userapps: getUserApps(), - appsubs: await getAppSubs(), + appsubs: getAppSubs(), syscfgs: getSystemCfgs(), usercfgs: getUserCfgs(), globalbaks: getGlobalBaks(), @@ -892,9 +918,10 @@ function printHtml(data, curapp = null, curview = 'app') { 应用订阅 ({{ appsubs.length }}) + mdi-refresh-circle mdi-plus-circle - + mdi-account @@ -904,6 +931,7 @@ function printHtml(data, curapp = null, curview = 'app') { {{ sub.repo ? sub.repo : sub._raw.url }} {{ sub.author ? sub.author : '@anonymous' }} + 更新于: {{ moment(sub.updateTime) }} @@ -1189,6 +1217,7 @@ function printHtml(data, curapp = null, curview = 'app') { + @@ -1586,20 +1554,26 @@ function printHtml(data, curapp = null, curview = 'app') { }, onClearCurAppSessionData(app, datas, data) { data.val = '' - axios.post('/api', JSON.stringify({ cmd: 'saveCurAppSession', val: app })) - this.onReload() + this.ui.overlay.show = true + axios.post('/api', JSON.stringify({ cmd: 'saveCurAppSession', val: app })).finally(() => { + this.onReload() + }) }, onSaveSessionTo(session) { const val = { fromapp: this.ui.curapp, toSession: session } - axios.post('/api', JSON.stringify({ cmd: 'saveSessionTo', val })) - this.onReload() + this.ui.overlay.show = true + axios.post('/api', JSON.stringify({ cmd: 'saveSessionTo', val })).finally(() => { + this.onReload() + }) }, onModSession () { - axios.post('/api', JSON.stringify({ cmd: 'onModSession', val: this.ui.modSessionDialog.session })) - this.onReload() + this.ui.overlay.show = true + axios.post('/api', JSON.stringify({ cmd: 'onModSession', val: this.ui.modSessionDialog.session })).finally(() => { + this.onReload() + }) }, onSaveSession() { const session = { @@ -1616,8 +1590,10 @@ function printHtml(data, curapp = null, curview = 'app') { axios.post('/api', JSON.stringify({ cmd: 'saveSession', val: session })) }, onSaveSettings() { - axios.post('/api', JSON.stringify({ cmd: 'saveSettings', val: this.ui.curapp.settings })) - this.onReload() + this.ui.overlay.show = true + axios.post('/api', JSON.stringify({ cmd: 'saveSettings', val: this.ui.curapp.settings })).finally(() => { + this.onReload() + }) }, onImpSessionPaste() { navigator.clipboard.readText().then((text) => { @@ -1654,8 +1630,10 @@ function printHtml(data, curapp = null, curview = 'app') { } this.box.sessions.push(session) this.ui.curappSessions.push(session) - axios.post('/api', JSON.stringify({ cmd: 'saveSession', val: session })) - this.ui.impSessionDialog.show = false + this.ui.overlay.show = true + axios.post('/api', JSON.stringify({ cmd: 'saveSession', val: session })).finally(() => { + this.ui.impSessionDialog.show = false + }) } else { alert('导入失败! 原因: appId 为空?') } @@ -1666,44 +1644,48 @@ function printHtml(data, curapp = null, curview = 'app') { url: this.ui.addAppSubDialog.url, enable: true } - axios.post('/api', JSON.stringify({ cmd: 'addAppSub', val: sub })) - this.ui.addAppSubDialog.show = false - this.onReload() + this.ui.overlay.show = true + axios.post('/api', JSON.stringify({ cmd: 'addAppSub', val: sub })).finally(() => { + this.ui.addAppSubDialog.show = false + this.onReload() + }) }, onRefreshAppSubs(){ - if (['true', true].includes(this.box.usercfgs.isFixVPN)) { - axios.post('/api', JSON.stringify({ cmd: 'refreshAppSubs', val: null })) + this.ui.overlay.show = true + axios.post('/api', JSON.stringify({ cmd: 'refreshAppSubs', val: null })).finally(() => { this.box.usercfgs.refreshsecs = 3 - } + }) this.onReload() }, reload() { window.location.reload() }, onReload() { - if (!['true', true].includes(this.box.usercfgs.isFixVPN)) { - axios.post('/api', JSON.stringify({ cmd: 'refreshAppSubs', val: null })) - } const refreshsecs = this.box.usercfgs.refreshsecs const sec = [undefined, null, 'null', 'undefined', ''].includes(refreshsecs) ? 3 : refreshsecs * 1 if (sec === 0) { this.reload() } else { + this.ui.overlay.show = false this.ui.reloadConfirmDialog.show = true this.ui.reloadConfirmDialog.sec = sec } }, onDelSession(session) { - axios.post('/api', JSON.stringify({ cmd: 'delSession', val: session })) - const sessionIdx = this.box.sessions.findIndex((s) => session.id === s.id) - if (this.box.sessions.splice(sessionIdx, 1) !== -1) { - this.ui.curappSessions = this.box.sessions.filter((s) => s.appId === this.ui.curapp.id) - } + this.ui.overlay.show = true + axios.post('/api', JSON.stringify({ cmd: 'delSession', val: session })).finally(() => { + const sessionIdx = this.box.sessions.findIndex((s) => session.id === s.id) + if (this.box.sessions.splice(sessionIdx, 1) !== -1) { + this.ui.curappSessions = this.box.sessions.filter((s) => s.appId === this.ui.curapp.id) + } + }) }, onUseSession(session) { - axios.post('/api', JSON.stringify({ cmd: 'useSession', val: session })) - this.ui.curapp.datas = JSON.parse(JSON.stringify(session.datas)) - this.onReload() + this.ui.overlay.show = true + axios.post('/api', JSON.stringify({ cmd: 'useSession', val: session })).finally(() => { + this.ui.curapp.datas = JSON.parse(JSON.stringify(session.datas)) + this.onReload() + }) }, onImpGlobalBak() { const env = this.box.syscfgs.env @@ -1721,8 +1703,10 @@ function printHtml(data, curapp = null, curview = 'app') { bakobj.tags = [env, version, versionType] this.box.globalbaks.push(bakobj) this.ui.impGlobalBakDialog.show = false - axios.post('/api', JSON.stringify({ cmd: 'globalBak', val: bakobj })) - this.onReload() + this.ui.overlay.show = true + axios.post('/api', JSON.stringify({ cmd: 'globalBak', val: bakobj })).finally(() => { + this.onReload() + }) }, onGlobalBak() { const env = this.box.syscfgs.env @@ -1748,8 +1732,10 @@ function printHtml(data, curapp = null, curview = 'app') { axios.post('/api', JSON.stringify({ cmd: 'delGlobalBak', val: id })) }, onRevertGlobalBak(id) { - axios.post('/api', JSON.stringify({ cmd: 'revertGlobalBak', val: id })) - this.onReload() + this.ui.overlay.show = true + axios.post('/api', JSON.stringify({ cmd: 'revertGlobalBak', val: id })).finally(() => { + this.onReload() + }) }, onCopy(e) { this.ui.snackbar.show = true diff --git a/loon.box.conf b/loon.box.conf index a5b604662..5b74f8567 100644 --- a/loon.box.conf +++ b/loon.box.conf @@ -1,4 +1,4 @@ hostname = 8.8.8.8 http-request ^https://8.8.8.8/api script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/chavy.box.js, requires-body=true -http-response ^https://8.8.8.8/(home|sub|my|app|log\/) script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/chavy.box.js, requires-body=true \ No newline at end of file +http-response ^https://8.8.8.8/(home|sub|my|app|log)($|\/) script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/chavy.box.js, requires-body=true \ No newline at end of file diff --git a/surge.box.sgmodule b/surge.box.sgmodule index 2063a6ab7..45a8ed526 100644 --- a/surge.box.sgmodule +++ b/surge.box.sgmodule @@ -3,7 +3,7 @@ [Script] Rewrite: Scripts Manager = type=http-request,pattern=^https://8.8.8.8/api,script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/chavy.box.js,requires-body=true,max-size=0 -Rewrite: Scripts Manager = type=http-response,pattern=^https://8.8.8.8/(home|sub|my|app|log\/),script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/chavy.box.js,requires-body=true,max-size=0 +Rewrite: Scripts Manager = type=http-response,pattern=^https://8.8.8.8/(home|sub|my|app|log)($|\/),script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/chavy.box.js,requires-body=true,max-size=0 [MITM] hostname = %INSERT%, 8.8.8.8 \ No newline at end of file From 4153ac963b00bd7c8dbbec49ea67cdb8a73a2c97 Mon Sep 17 00:00:00 2001 From: Chavy Date: Sun, 12 Jul 2020 01:38:23 +0800 Subject: [PATCH 052/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=88=A0=E9=99=A4&=E5=AF=BC=E5=85=A5=E4=BC=9A?= =?UTF-8?q?=E8=AF=9D=E6=97=B6=20Loading=20=E5=8A=A8=E7=94=BB=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E8=87=AA=E5=8A=A8=E6=B6=88=E5=A4=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/release/box.release.json | 13 +++++++++++++ chavy.box.js | 9 ++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/box/release/box.release.json b/box/release/box.release.json index 108ca6d2f..3b6b33ff5 100644 --- a/box/release/box.release.json +++ b/box/release/box.release.json @@ -1,5 +1,18 @@ { "releases": [ + { + "version": "0.4.3", + "tags": ["beta"], + "author": "@chavyleung", + "icon": "https://avatars3.githubusercontent.com/u/29748519", + "repo": "https://github.com/chavyleung", + "notes": [ + { + "name": "修复", + "descs": ["删除&导入会话时 Loading 动画不能自动消失问题"] + } + ] + }, { "version": "0.4.2", "tags": ["beta"], diff --git a/chavy.box.js b/chavy.box.js index e3abbd1f3..ced9dd801 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -1,7 +1,7 @@ const $ = new Env('BoxJs') $.domain = '8.8.8.8' -$.version = '0.4.2' +$.version = '0.4.3' $.versionType = 'beta' $.KEY_sessions = 'chavy_boxjs_sessions' $.KEY_versions = 'chavy_boxjs_versions' @@ -1611,6 +1611,7 @@ function printHtml(data, curapp = null, curview = 'app') { }) }, onImpSession() { + this.ui.overlay.show = true const impjson = this.ui.impSessionDialog.impval const impSession = impjson && JSON.parse(impjson) if (impSession && impSession.id && impSession.id === this.ui.curapp.id) { @@ -1630,11 +1631,12 @@ function printHtml(data, curapp = null, curview = 'app') { } this.box.sessions.push(session) this.ui.curappSessions.push(session) - this.ui.overlay.show = true axios.post('/api', JSON.stringify({ cmd: 'saveSession', val: session })).finally(() => { this.ui.impSessionDialog.show = false + this.ui.overlay.show = false }) } else { + this.ui.overlay.show = false alert('导入失败! 原因: appId 为空?') } }, @@ -1678,6 +1680,7 @@ function printHtml(data, curapp = null, curview = 'app') { if (this.box.sessions.splice(sessionIdx, 1) !== -1) { this.ui.curappSessions = this.box.sessions.filter((s) => s.appId === this.ui.curapp.id) } + this.ui.overlay.show = false }) }, onUseSession(session) { @@ -1688,6 +1691,7 @@ function printHtml(data, curapp = null, curview = 'app') { }) }, onImpGlobalBak() { + this.ui.overlay.show = true const env = this.box.syscfgs.env const version = this.box.syscfgs.version const versionType = this.box.syscfgs.versionType @@ -1703,7 +1707,6 @@ function printHtml(data, curapp = null, curview = 'app') { bakobj.tags = [env, version, versionType] this.box.globalbaks.push(bakobj) this.ui.impGlobalBakDialog.show = false - this.ui.overlay.show = true axios.post('/api', JSON.stringify({ cmd: 'globalBak', val: bakobj })).finally(() => { this.onReload() }) From 8157e60645544440aa80bfdff28f0bf2e79c3f75 Mon Sep 17 00:00:00 2001 From: Chavy Date: Sun, 12 Jul 2020 01:40:01 +0800 Subject: [PATCH 053/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[box.switcher.js]:=20?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E5=9C=A8=E5=90=8C=E4=B8=80=E6=89=B9=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E4=BC=9A=E8=AF=9D=E4=B8=AD=EF=BC=8C=E5=AF=B9=E5=90=8C?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E5=B1=9E=E6=80=A7=E8=AE=BE=E7=BD=AE=E4=B8=8D?= =?UTF-8?q?=E5=90=8C=E5=80=BC=E6=97=B6=EF=BC=8C=E4=BC=9A=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/switcher/box.switcher.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/box/switcher/box.switcher.js b/box/switcher/box.switcher.js index 7e10e3012..00626854f 100644 --- a/box/switcher/box.switcher.js +++ b/box/switcher/box.switcher.js @@ -26,6 +26,7 @@ function execSwitch() { const app = apps[appId] app.sessions.push(session) }) + const switchkeys = {} Object.keys(apps).forEach((appId) => { const app = apps[appId] if (app.sessions.length <= 1) { @@ -40,9 +41,27 @@ function execSwitch() { const isNewRound = curSessionIdx + 1 === app.sessions.length const nextSessionIdx = isNewRound ? 0 : curSessionIdx + 1 const nextSession = app.sessions[nextSessionIdx] - nextSession.datas.forEach((_data) => $.setdata([undefined, null, 'undefined', 'null', ''].includes(_data.val) ? '' : _data.val, _data.key)) + nextSession.datas.forEach((_data) => { + const key = _data.key + const val = [undefined, null, 'undefined', 'null', ''].includes(_data.val) ? '' : _data.val + if (switchkeys[key]) { + const swData = switchkeys[key] + const isClash = swData.val !== val ? true : false + if (isClash) { + nextSession.isClash = true + $.log('', `⚠️【${key}】冲突: `, ` ${nextSession.appName}.${nextSession.name} => ${swData.session.appName}.${swData.session.name}`) + } + } else { + switchkeys[key] = {} + const swData = switchkeys[key] + swData.val = val + swData.session = nextSession + } + $.setdata(val, key) + }) curSessions[appId] = nextSession.id - $.desc.push(`${curSession.appName}: ${curSession.name} => #${nextSessionIdx + 1} ${nextSession.name} ${isNewRound ? '(新一轮)' : ''}`) + const clashstr = nextSession.isClash === true ? ' (冲突)' : '' + $.desc.push(`${curSession.appName}: ${curSession.name} => #${nextSessionIdx + 1} ${nextSession.name}${clashstr} ${isNewRound ? '(新一轮)' : ''}`) }) $.setdata(JSON.stringify(curSessions), $.KEY_curSessions) resove() From 69976bc30775d1d2d94ca984bc078d63831f15f7 Mon Sep 17 00:00:00 2001 From: Chavy Date: Sun, 12 Jul 2020 19:53:48 +0800 Subject: [PATCH 054/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[=E4=BB=80=E4=B9=88?= =?UTF-8?q?=E5=80=BC=E5=BE=97=E4=B9=B0]:=20=E4=BF=AE=E5=A4=8D=20App=20?= =?UTF-8?q?=E7=AB=AF=E7=AD=BE=E5=88=B0=E9=97=AE=E9=A2=98=20(=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=BB=A4=E7=89=8C=E7=BC=93=E5=AD=98)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/chavy.boxjs.json | 5 ++++- smzdm/smzdm.js | 19 +++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/box/chavy.boxjs.json b/box/chavy.boxjs.json index af70eb478..c89c6712a 100644 --- a/box/chavy.boxjs.json +++ b/box/chavy.boxjs.json @@ -147,7 +147,10 @@ "id": "smzdm", "name": "什么值得买", "keys": ["chavy_cookie_smzdm"], - "settings": [{ "id": "chavy_accounts_smzdm", "name": "大妈账号", "val": "", "type": "textarea", "placeholder": "账号,密码 (回车) 账号,密码", "autoGrow": true, "rows": 5, "desc": "以英文逗号分隔账号与密码, 回车添加多个账号" }], + "settings": [ + { "id": "chavy_accounts_smzdm", "name": "大妈账号", "val": "", "type": "textarea", "placeholder": "账号,密码 (回车) 账号,密码", "autoGrow": true, "rows": 5, "desc": "以英文逗号分隔账号与密码, 回车添加多个账号" }, + { "id": "chavy_tokens_smzdm", "name": "令牌缓存 (自动生成, 无须手填)", "val": "", "type": "textarea", "placeholder": "正常情况下, 你无须修本字段的内容", "autoGrow": true, "rows": 5, "desc": "本字段的值由脚本自动生成, 无须手动编辑, 如需清除令牌缓存, 可直接删除本字段的值。" } + ], "author": "@wangfei021325, @chavyleung", "repo": "https://github.com/chavyleung/scripts/tree/master/smzdm", "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/smzdm.png", "https://raw.githubusercontent.com/Orz-3/task/master/smzdm.png"] diff --git a/smzdm/smzdm.js b/smzdm/smzdm.js index 60ed426f7..f70726101 100644 --- a/smzdm/smzdm.js +++ b/smzdm/smzdm.js @@ -1,6 +1,7 @@ const $ = new Env('什么值得买') $.VAL_cookies = $.getdata('chavy_cookie_smzdm') $.VAl_accounts = $.getdata('chavy_accounts_smzdm') +$.CFG_tokens = 'chavy_tokens_smzdm' !(async () => { await signweb() @@ -34,20 +35,29 @@ async function signapp() { for (let accIdx = 0; accIdx < accounts.length; accIdx++) { const account = accounts[accIdx] await loginapp(account) - await $.wait(1000) + await $.wait(account.isCached ? 0 : 3000) await signinapp(account) - await $.wait(1000) + await $.wait(accIdx + 1 === accounts.length ? 0 : 3000) } $.accounts = accounts } function loginapp(account) { + const tokens = getTokens() + if (tokens[account.acc]) { + account.isCached = true + account.token = tokens[account.acc] + return + } return new Promise((resove) => { const url = { url: 'https://api.smzdm.com/v1/user/login', headers: {} } url.body = `user_login=${account.acc}&user_pass=${account.pwd}&f=win` $.post(url, (err, resp, data) => { try { account.token = $.lodash_get(JSON.parse(data), 'data.token') + const tokens = getTokens() + tokens[account.acc] = account.token + $.setdata(JSON.stringify(tokens), $.CFG_tokens) } catch (e) { $.logErr(e, resp) } finally { @@ -91,6 +101,11 @@ function getAccounts() { return accounts } +function getTokens() { + const tokendat = $.getdata($.CFG_tokens) + return [undefined, null, 'null', 'undefined', ''].includes(tokendat) ? {} : JSON.parse(tokendat) +} + function showmsg() { return new Promise((resolve) => { $.subt = '' From 67a2dff0c48ea4da8e04210045a6473446833028 Mon Sep 17 00:00:00 2001 From: Chavy Date: Sun, 12 Jul 2020 20:05:44 +0800 Subject: [PATCH 055/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[=E4=BB=80=E4=B9=88?= =?UTF-8?q?=E5=80=BC=E5=BE=97=E4=B9=B0]:=20=E4=BF=AE=E5=A4=8D=20App=20?= =?UTF-8?q?=E7=AB=AF=E7=AD=BE=E5=88=B0=E9=97=AE=E9=A2=98=20(=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=BB=A4=E7=89=8C=E7=BC=93=E5=AD=98)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- smzdm/quanx/smzdm.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/smzdm/quanx/smzdm.js b/smzdm/quanx/smzdm.js index 60ed426f7..f70726101 100644 --- a/smzdm/quanx/smzdm.js +++ b/smzdm/quanx/smzdm.js @@ -1,6 +1,7 @@ const $ = new Env('什么值得买') $.VAL_cookies = $.getdata('chavy_cookie_smzdm') $.VAl_accounts = $.getdata('chavy_accounts_smzdm') +$.CFG_tokens = 'chavy_tokens_smzdm' !(async () => { await signweb() @@ -34,20 +35,29 @@ async function signapp() { for (let accIdx = 0; accIdx < accounts.length; accIdx++) { const account = accounts[accIdx] await loginapp(account) - await $.wait(1000) + await $.wait(account.isCached ? 0 : 3000) await signinapp(account) - await $.wait(1000) + await $.wait(accIdx + 1 === accounts.length ? 0 : 3000) } $.accounts = accounts } function loginapp(account) { + const tokens = getTokens() + if (tokens[account.acc]) { + account.isCached = true + account.token = tokens[account.acc] + return + } return new Promise((resove) => { const url = { url: 'https://api.smzdm.com/v1/user/login', headers: {} } url.body = `user_login=${account.acc}&user_pass=${account.pwd}&f=win` $.post(url, (err, resp, data) => { try { account.token = $.lodash_get(JSON.parse(data), 'data.token') + const tokens = getTokens() + tokens[account.acc] = account.token + $.setdata(JSON.stringify(tokens), $.CFG_tokens) } catch (e) { $.logErr(e, resp) } finally { @@ -91,6 +101,11 @@ function getAccounts() { return accounts } +function getTokens() { + const tokendat = $.getdata($.CFG_tokens) + return [undefined, null, 'null', 'undefined', ''].includes(tokendat) ? {} : JSON.parse(tokendat) +} + function showmsg() { return new Promise((resolve) => { $.subt = '' From 0d9d01280027194ea517b4a2074e075e314af296 Mon Sep 17 00:00:00 2001 From: Chavy Date: Sun, 12 Jul 2020 21:52:04 +0800 Subject: [PATCH 056/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E5=88=86=E7=B1=BB=E5=8F=AF=E4=BB=A5=E6=94=B6=E7=BA=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/release/box.release.json | 13 +++ chavy.box.js | 166 +++++++++++++++++++++-------------- 2 files changed, 111 insertions(+), 68 deletions(-) diff --git a/box/release/box.release.json b/box/release/box.release.json index 3b6b33ff5..e92ef4b14 100644 --- a/box/release/box.release.json +++ b/box/release/box.release.json @@ -1,5 +1,18 @@ { "releases": [ + { + "version": "0.4.4", + "tags": ["beta"], + "author": "@chavyleung", + "icon": "https://avatars3.githubusercontent.com/u/29748519", + "repo": "https://github.com/chavyleung", + "notes": [ + { + "name": "优化", + "descs": ["应用分类可以收纳"] + } + ] + }, { "version": "0.4.3", "tags": ["beta"], diff --git a/chavy.box.js b/chavy.box.js index ced9dd801..643cd7e63 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -1,7 +1,7 @@ const $ = new Env('BoxJs') $.domain = '8.8.8.8' -$.version = '0.4.3' +$.version = '0.4.4' $.versionType = 'beta' $.KEY_sessions = 'chavy_boxjs_sessions' $.KEY_versions = 'chavy_boxjs_versions' @@ -805,74 +805,89 @@ function printHtml(data, curapp = null, curview = 'app') {
- - - 收藏应用 ({{ favapps.length }}) - - - - {{ app.name }} ({{ app.id }}) - {{ app.repo }} - {{ app.author }} - - - - - - - 上移 - - - 下移 - - - - 取消收藏 - - - - - - - - - - + + + + 收藏应用 ({{ favapps.length }}) + + + + + + + {{ app.name }} ({{ app.id }}) + {{ app.repo }} + {{ app.author }} + + + + + + + 上移 + + + 下移 + + + + 取消收藏 + + + + + + + + + + + + {{ sub.name ? sub.name : '匿名订阅' }} ({{ sub.apps.length }}) - - - - - {{ app.name }} ({{ app.id }}) - {{ app.repo }} - {{ app.author }} - - - mdi-star - mdi-star-outline - - - - - - - 内置应用 ({{ box.sysapps.length }}) - - - - {{ app.name }} ({{ app.id }}) - {{ app.repo }} - {{ app.author }} - - - mdi-star - mdi-star-outline - - - - + + + + + + + {{ app.name }} ({{ app.id }}) + {{ app.repo }} + {{ app.author }} + + + mdi-star + mdi-star-outline + + + + + + + + + + 内置应用 ({{ box.sysapps.length }}) + + + + + + + {{ app.name }} ({{ app.id }}) + {{ app.repo }} + {{ app.author }} + + + mdi-star + mdi-star-outline + + + + + @@ -1495,6 +1510,21 @@ function printHtml(data, curapp = null, curview = 'app') { this.reload() } } + }, + 'box.usercfgs.favapppanel': { + handler(newval, oldval) { + this.onUserCfgsChange() + } + }, + 'box.usercfgs.subapppanel': { + handler(newval, oldval) { + this.onUserCfgsChange() + } + }, + 'box.usercfgs.sysapppanel': { + handler(newval, oldval) { + this.onUserCfgsChange() + } } }, methods: { From fdaf3737c69ab8530241cca7212035e965bb81b1 Mon Sep 17 00:00:00 2001 From: Chavy Date: Sun, 12 Jul 2020 22:32:12 +0800 Subject: [PATCH 057/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E9=83=A8=E5=88=86=E6=83=85=E5=86=B5=E4=B8=8B=E5=86=85?= =?UTF-8?q?=E7=BD=AE=E5=BA=94=E7=94=A8=E4=B8=8D=E6=98=BE=E7=A4=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/release/box.release.json | 13 +++++++++++++ chavy.box.js | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/box/release/box.release.json b/box/release/box.release.json index e92ef4b14..4e0e6bef4 100644 --- a/box/release/box.release.json +++ b/box/release/box.release.json @@ -1,5 +1,18 @@ { "releases": [ + { + "version": "0.4.5", + "tags": ["beta"], + "author": "@chavyleung", + "icon": "https://avatars3.githubusercontent.com/u/29748519", + "repo": "https://github.com/chavyleung", + "notes": [ + { + "name": "修复", + "descs": ["部分情况下内置应用不显示问题"] + } + ] + }, { "version": "0.4.4", "tags": ["beta"], diff --git a/chavy.box.js b/chavy.box.js index 643cd7e63..d688ea63b 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -1,7 +1,7 @@ const $ = new Env('BoxJs') $.domain = '8.8.8.8' -$.version = '0.4.4' +$.version = '0.4.5' $.versionType = 'beta' $.KEY_sessions = 'chavy_boxjs_sessions' $.KEY_versions = 'chavy_boxjs_versions' @@ -866,7 +866,7 @@ function printHtml(data, curapp = null, curview = 'app') { - + 内置应用 ({{ box.sysapps.length }}) From bc7d06ee2987dcf0e1f40a64b7df415fb771ce7c Mon Sep 17 00:00:00 2001 From: Chavy Date: Sun, 12 Jul 2020 22:59:40 +0800 Subject: [PATCH 058/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E9=80=8F=E6=98=8E=E5=9B=BE=E6=A0=87=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/release/box.release.json | 13 +++++++++++++ chavy.box.js | 36 +++++++++++++++++++++++------------- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/box/release/box.release.json b/box/release/box.release.json index 4e0e6bef4..7ff977d9b 100644 --- a/box/release/box.release.json +++ b/box/release/box.release.json @@ -1,5 +1,18 @@ { "releases": [ + { + "version": "0.4.6", + "tags": ["beta"], + "author": "@chavyleung", + "icon": "https://avatars3.githubusercontent.com/u/29748519", + "repo": "https://github.com/chavyleung", + "notes": [ + { + "name": "优化", + "descs": ["透明图标处理"] + } + ] + }, { "version": "0.4.5", "tags": ["beta"], diff --git a/chavy.box.js b/chavy.box.js index d688ea63b..c821265e2 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -1,7 +1,7 @@ const $ = new Env('BoxJs') $.domain = '8.8.8.8' -$.version = '0.4.5' +$.version = '0.4.6' $.versionType = 'beta' $.KEY_sessions = 'chavy_boxjs_sessions' $.KEY_versions = 'chavy_boxjs_versions' @@ -64,9 +64,9 @@ function getSystemCfgs() { version: $.version, versionType: $.versionType, envs: [ - { id: 'Surge', icon: 'https://raw.githubusercontent.com/Orz-3/task/master/surge.png' }, - { id: 'QuanX', icon: 'https://raw.githubusercontent.com/Orz-3/task/master/quantumultx.png' }, - { id: 'Loon', icon: 'https://raw.githubusercontent.com/Orz-3/task/master/loon.png' } + { id: 'Surge', icons: ['https://raw.githubusercontent.com/Orz-3/mini/none/surge.png', 'https://raw.githubusercontent.com/Orz-3/task/master/surge.png'] }, + { id: 'QuanX', icons: ['https://raw.githubusercontent.com/Orz-3/mini/none/quanX.png', 'https://raw.githubusercontent.com/Orz-3/task/master/quantumultx.png'] }, + { id: 'Loon', icons: ['https://raw.githubusercontent.com/Orz-3/mini/none/loon.png', 'https://raw.githubusercontent.com/Orz-3/task/master/loon.png'] } ], chavy: { id: 'Chavy Scripts', @@ -82,6 +82,7 @@ function getSystemCfgs() { id: 'BoxJs', show: false, icon: 'https://raw.githubusercontent.com/Orz-3/task/master/box.png', + icons: ['https://raw.githubusercontent.com/Orz-3/mini/master/box.png', 'https://raw.githubusercontent.com/Orz-3/task/master/box.png'], repo: 'https://github.com/chavyleung/scripts' } } @@ -659,13 +660,13 @@ function printHtml(data, curapp = null, curview = 'app') { - + {{ env.id }} @@ -683,7 +684,10 @@ function printHtml(data, curapp = null, curview = 'app') { {{ item.author }} - mdi-star + + mdi-star + mdi-star + mdi-star-outline @@ -700,7 +704,7 @@ function printHtml(data, curapp = null, curview = 'app') { @@ -756,7 +760,7 @@ function printHtml(data, curapp = null, curview = 'app') { - + @@ -858,7 +862,10 @@ function printHtml(data, curapp = null, curview = 'app') { {{ app.author }} - mdi-star + + mdi-star + mdi-star + mdi-star-outline @@ -881,7 +888,10 @@ function printHtml(data, curapp = null, curview = 'app') { {{ app.author }} - mdi-star + + mdi-star + mdi-star + mdi-star-outline @@ -1270,13 +1280,13 @@ function printHtml(data, curapp = null, curview = 'app') { - + {{ env.id }} From 7faa7a40030d994105e3b45f258fb5242e5e7d42 Mon Sep 17 00:00:00 2001 From: Chavy Date: Tue, 14 Jul 2020 00:35:07 +0800 Subject: [PATCH 059/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E9=83=A8=E5=88=86=E6=83=85=E5=86=B5=E4=B8=8B=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=B8=85=E7=A9=BA=E4=BC=9A=E8=AF=9D=E6=95=B0=E5=80=BC?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(=E6=9B=B4=E6=96=B0=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E5=90=8E,=20=E9=9C=80=E8=A6=81=E6=89=8B=E5=8A=A8=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E4=B8=8B=E8=AE=A2=E9=98=85)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/release/box.release.json | 13 +++++++++++++ chavy.box.js | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/box/release/box.release.json b/box/release/box.release.json index 7ff977d9b..57d68bc61 100644 --- a/box/release/box.release.json +++ b/box/release/box.release.json @@ -1,5 +1,18 @@ { "releases": [ + { + "version": "0.4.7", + "tags": ["beta"], + "author": "@chavyleung", + "icon": "https://avatars3.githubusercontent.com/u/29748519", + "repo": "https://github.com/chavyleung", + "notes": [ + { + "name": "修复", + "descs": ["部分情况下无法清空会话数值问题 (更新脚本后, 需要手动刷新下订阅)"] + } + ] + }, { "version": "0.4.6", "tags": ["beta"], diff --git a/chavy.box.js b/chavy.box.js index c821265e2..2f05047b9 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -272,7 +272,7 @@ async function refreshAppSubs() { if (Array.isArray(respsub.apps)) { respsub._raw = sub respsub.updateTime = new Date() - wrapapps(respsub.apps) + // wrapapps(respsub.apps) usercfgs.appsubCaches[suburl] = respsub console.log(`更新订阅, 成功! ${suburl}`) } From 88c302d4e74bdfc4b1e476968b4aa0c509fa10dc Mon Sep 17 00:00:00 2001 From: Chavy Date: Tue, 14 Jul 2020 00:42:12 +0800 Subject: [PATCH 060/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E9=83=A8=E5=88=86=E6=83=85=E5=86=B5=E4=B8=8B=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=B8=85=E7=A9=BA=E4=BC=9A=E8=AF=9D=E6=95=B0=E5=80=BC?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(=E6=9B=B4=E6=96=B0=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E5=90=8E,=20=E9=9C=80=E8=A6=81=E6=89=8B=E5=8A=A8=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E4=B8=8B=E8=AE=A2=E9=98=85)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chavy.box.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chavy.box.js b/chavy.box.js index 2f05047b9..00217b60d 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -1,7 +1,7 @@ const $ = new Env('BoxJs') $.domain = '8.8.8.8' -$.version = '0.4.6' +$.version = '0.4.7' $.versionType = 'beta' $.KEY_sessions = 'chavy_boxjs_sessions' $.KEY_versions = 'chavy_boxjs_versions' From d63a8a4a47a119e87884e116d57a17f27da26c8f Mon Sep 17 00:00:00 2001 From: Chavy Date: Wed, 15 Jul 2020 14:55:45 +0800 Subject: [PATCH 061/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[EnvJs]:=20=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=8F=82=E6=95=B0=E6=A0=B9=E6=8D=AE=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=85=BC=E5=AE=B9=20(=E4=BC=A0=20QX=20?= =?UTF-8?q?=E5=92=8C=20Loon=20=E6=A0=BC=E5=BC=8F=E9=83=BD=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Env.js | 28 ++++++++++++++++++++++++++-- Env.min.js | 2 +- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/Env.js b/Env.js index 7c4f78048..20a660984 100644 --- a/Env.js +++ b/Env.js @@ -248,16 +248,40 @@ function Env(name, opts) { /** * 系统通知 * + * > 通知参数: 同时支持 QuanX 和 Loon 两种格式, EnvJs根据运行环境自动转换, Surge 环境不支持多媒体通知 + * + * 示例: + * $.msg(title, subt, desc, 'twitter://') + * $.msg(title, subt, desc, { 'open-url': 'twitter://', 'media-url': 'https://github.githubassets.com/images/modules/open_graph/github-mark.png' }) + * $.msg(title, subt, desc, { 'open-url': 'https://bing.com', 'media-url': 'https://github.githubassets.com/images/modules/open_graph/github-mark.png' }) + * * @param {*} title 标题 * @param {*} subt 副标题 * @param {*} desc 通知详情 * @param {*} opts 通知参数 + * */ msg(title = name, subt = '', desc = '', opts) { + const toEnvOpts = (rawopts) => { + if (!rawopts || (!this.isLoon() && this.isSurge())) return rawopts + if (typeof rawopts === 'string') { + this.logs.push('string') + if (this.isLoon()) return rawopts + else if (this.isQuanX()) return { 'open-url': rawopts } + else return undefined + } else if (typeof rawopts === 'object' && (rawopts['open-url'] || rawopts['media-url'])) { + this.logs.push('object') + if (this.isLoon()) return rawopts['open-url'] + else if (this.isQuanX()) return rawopts + else undefined + } else { + return undefined + } + } if (this.isSurge() || this.isLoon()) { - $notification.post(title, subt, desc, opts) + $notification.post(title, subt, desc, toEnvOpts(opts)) } else if (this.isQuanX()) { - $notify(title, subt, desc, opts) + $notify(title, subt, desc, toEnvOpts(opts)) } this.logs.push('', '==============📣系统通知📣==============') this.logs.push(title) diff --git a/Env.min.js b/Env.min.js index 5826fb95c..d3e37f67e 100644 --- a/Env.min.js +++ b/Env.min.js @@ -1 +1 @@ -function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}catch{const s={};this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}}else e=$.setval(t,s);return e}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}msg(s=t,e="",i="",o){this.isSurge()||this.isLoon()?$notification.post(s,e,i,o):this.isQuanX()&&$notify(s,e,i,o),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} \ No newline at end of file +function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}catch{const s={};this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}}else e=$.setval(t,s);return e}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?(this.logs.push("string"),this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0):"object"==typeof t&&(t["open-url"]||t["media-url"])?(this.logs.push("object"),this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0):void 0;this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o)),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} \ No newline at end of file From a6a8dede0398b8714fd5a77334c5370694478069 Mon Sep 17 00:00:00 2001 From: Chavy Date: Wed, 15 Jul 2020 15:13:50 +0800 Subject: [PATCH 062/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[EnvJs]:=20=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=A4=9A=E4=BD=99=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Env.js | 2 -- Env.min.js | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Env.js b/Env.js index 20a660984..92fec3eb8 100644 --- a/Env.js +++ b/Env.js @@ -265,12 +265,10 @@ function Env(name, opts) { const toEnvOpts = (rawopts) => { if (!rawopts || (!this.isLoon() && this.isSurge())) return rawopts if (typeof rawopts === 'string') { - this.logs.push('string') if (this.isLoon()) return rawopts else if (this.isQuanX()) return { 'open-url': rawopts } else return undefined } else if (typeof rawopts === 'object' && (rawopts['open-url'] || rawopts['media-url'])) { - this.logs.push('object') if (this.isLoon()) return rawopts['open-url'] else if (this.isQuanX()) return rawopts else undefined diff --git a/Env.min.js b/Env.min.js index d3e37f67e..2086d4d78 100644 --- a/Env.min.js +++ b/Env.min.js @@ -1 +1 @@ -function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}catch{const s={};this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}}else e=$.setval(t,s);return e}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?(this.logs.push("string"),this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0):"object"==typeof t&&(t["open-url"]||t["media-url"])?(this.logs.push("object"),this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0):void 0;this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o)),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} \ No newline at end of file +function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}catch{const s={};this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}}else e=$.setval(t,s);return e}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o)),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} \ No newline at end of file From d3719bc0dccaf165e3f509bb92f69f42d46b10b9 Mon Sep 17 00:00:00 2001 From: Chavy Date: Wed, 15 Jul 2020 18:00:55 +0800 Subject: [PATCH 063/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[=E4=BB=80=E4=B9=88?= =?UTF-8?q?=E5=80=BC=E5=BE=97=E4=B9=B0]:=20=E8=B0=83=E6=95=B4=E7=AD=BE?= =?UTF-8?q?=E5=88=B0=E9=A1=BA=E5=BA=8F=E5=B0=9D=E8=AF=95=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E4=B8=BB=E9=A1=B5=E5=90=9B=E8=BE=83=E5=BF=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- smzdm/quanx/smzdm.js | 4 ++-- smzdm/smzdm.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/smzdm/quanx/smzdm.js b/smzdm/quanx/smzdm.js index f70726101..8ba987997 100644 --- a/smzdm/quanx/smzdm.js +++ b/smzdm/quanx/smzdm.js @@ -4,8 +4,8 @@ $.VAl_accounts = $.getdata('chavy_accounts_smzdm') $.CFG_tokens = 'chavy_tokens_smzdm' !(async () => { - await signweb() await signapp() + await signweb() await showmsg() })() .catch((e) => $.logErr(e)) @@ -37,7 +37,7 @@ async function signapp() { await loginapp(account) await $.wait(account.isCached ? 0 : 3000) await signinapp(account) - await $.wait(accIdx + 1 === accounts.length ? 0 : 3000) + await $.wait(3000) } $.accounts = accounts } diff --git a/smzdm/smzdm.js b/smzdm/smzdm.js index f70726101..8ba987997 100644 --- a/smzdm/smzdm.js +++ b/smzdm/smzdm.js @@ -4,8 +4,8 @@ $.VAl_accounts = $.getdata('chavy_accounts_smzdm') $.CFG_tokens = 'chavy_tokens_smzdm' !(async () => { - await signweb() await signapp() + await signweb() await showmsg() })() .catch((e) => $.logErr(e)) @@ -37,7 +37,7 @@ async function signapp() { await loginapp(account) await $.wait(account.isCached ? 0 : 3000) await signinapp(account) - await $.wait(accIdx + 1 === accounts.length ? 0 : 3000) + await $.wait(3000) } $.accounts = accounts } From c4248ae0de5852f80e72ccc4ef348b4d41239e9a Mon Sep 17 00:00:00 2001 From: Chavy Date: Thu, 16 Jul 2020 19:25:46 +0800 Subject: [PATCH 064/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=9C=89=E6=97=B6=E5=88=B7=E6=96=B0=E4=B8=8D=E7=94=9F?= =?UTF-8?q?=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/release/box.release.json | 21 +++++++ chavy.box.js | 103 +++++++++++++++++++---------------- 2 files changed, 78 insertions(+), 46 deletions(-) diff --git a/box/release/box.release.json b/box/release/box.release.json index 57d68bc61..7ae15be47 100644 --- a/box/release/box.release.json +++ b/box/release/box.release.json @@ -1,5 +1,26 @@ { "releases": [ + { + "version": "0.4.8", + "tags": ["beta"], + "author": "@chavyleung", + "icon": "https://avatars3.githubusercontent.com/u/29748519", + "repo": "https://github.com/chavyleung", + "notes": [ + { + "name": "新增", + "descs": ["添加&刷新订阅的消息通知"] + }, + { + "name": "修复", + "descs": ["添加订阅时显示格式错误", "刷新订阅有时不生效"] + }, + { + "name": "移除", + "descs": ["刷新等待秒数"] + } + ] + }, { "version": "0.4.7", "tags": ["beta"], diff --git a/chavy.box.js b/chavy.box.js index 00217b60d..e73776498 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -1,7 +1,7 @@ const $ = new Env('BoxJs') $.domain = '8.8.8.8' -$.version = '0.4.7' +$.version = '0.4.8' $.versionType = 'beta' $.KEY_sessions = 'chavy_boxjs_sessions' $.KEY_versions = 'chavy_boxjs_versions' @@ -260,38 +260,44 @@ function getGlobalBaks() { return globalBaksStr ? JSON.parse(globalBaksStr) : [] } -async function refreshAppSubs() { +async function refreshAppSub(sub) { const usercfgs = getUserCfgs() - for (let subIdx = 0; subIdx < usercfgs.appsubs.length; subIdx++) { - const sub = usercfgs.appsubs[subIdx] - const suburl = sub.url.replace(/[ ]|[\r\n]/g, '') - await new Promise((resolve) => { - $.get({ url: suburl }, (err, resp, data) => { - try { - const respsub = JSON.parse(data) - if (Array.isArray(respsub.apps)) { - respsub._raw = sub - respsub.updateTime = new Date() - // wrapapps(respsub.apps) - usercfgs.appsubCaches[suburl] = respsub - console.log(`更新订阅, 成功! ${suburl}`) - } - } catch (e) { - $.logErr(e, resp) - sub.isErr = true - sub.apps = [] - sub._raw = JSON.parse(JSON.stringify(sub)) - sub.updateTime = new Date() - usercfgs.appsubCaches[suburl] = sub - console.log(`更新订阅, 失败! ${suburl}`) - } finally { - resolve() + const suburl = sub.url.replace(/[ ]|[\r\n]/g, '') + await new Promise((resolve) => { + $.get({ url: suburl }, (err, resp, data) => { + try { + const respsub = JSON.parse(data) + if (Array.isArray(respsub.apps)) { + respsub._raw = sub + respsub.updateTime = new Date() + usercfgs.appsubCaches[suburl] = respsub + console.log(`更新订阅, 成功! ${suburl}`) } - }) + } catch (e) { + $.logErr(e, resp) + sub.isErr = true + sub.apps = [] + sub._raw = JSON.parse(JSON.stringify(sub)) + sub.updateTime = new Date() + usercfgs.appsubCaches[suburl] = sub + console.log(`更新订阅, 失败! ${suburl}`) + } finally { + resolve() + } }) - } + }) $.setdata(JSON.stringify(usercfgs), $.KEY_userCfgs) - console.log(`全部订阅, 完成!`) +} + +async function refreshAppSubs() { + $.msg($.name, '更新订阅: 开始!') + const usercfgs = getUserCfgs() + for (let subIdx = 0; subIdx < usercfgs.appsubs.length; subIdx++) { + await refreshAppSub(usercfgs.appsubs[subIdx]) + } + const endTime = new Date().getTime() + const costTime = (endTime - $.startTime) / 1000 + $.msg($.name, `更新订阅: 完成! 🕛 ${costTime} 秒`) } function getAppSubs() { @@ -378,7 +384,6 @@ async function getVersions() { } catch (e) { $.logErr(e, resp) } finally { - console.log(`resolve`) resolve() } }) @@ -512,10 +517,15 @@ async function handleApi() { } // 添加应用订阅 else if (data.cmd === 'addAppSub') { + $.msg($.name, '添加订阅: 开始!') const sub = data.val const usercfgs = getUserCfgs() usercfgs.appsubs.push(sub) $.setdata(JSON.stringify(usercfgs), $.KEY_userCfgs) + await refreshAppSub(data.val) + const endTime = new Date().getTime() + const costTime = (endTime - $.startTime) / 1000 + $.msg($.name, `添加订阅: 完成! 🕛 ${costTime} 秒`) } // 删除应用订阅 else if (data.cmd === 'delAppSub') { @@ -738,7 +748,7 @@ function printHtml(data, curapp = null, curview = 'app') { - + @@ -1610,6 +1620,7 @@ function printHtml(data, curapp = null, curview = 'app') { }) }, onModSession () { + this.ui.modSessionDialog.show = false this.ui.overlay.show = true axios.post('/api', JSON.stringify({ cmd: 'onModSession', val: this.ui.modSessionDialog.session })).finally(() => { this.onReload() @@ -1671,8 +1682,8 @@ function printHtml(data, curapp = null, curview = 'app') { } this.box.sessions.push(session) this.ui.curappSessions.push(session) + this.ui.impSessionDialog.show = false axios.post('/api', JSON.stringify({ cmd: 'saveSession', val: session })).finally(() => { - this.ui.impSessionDialog.show = false this.ui.overlay.show = false }) } else { @@ -1681,37 +1692,37 @@ function printHtml(data, curapp = null, curview = 'app') { } }, onAddAppSub() { + this.ui.addAppSubDialog.show = false + this.ui.overlay.show = true const sub = { id: uuidv4(), url: this.ui.addAppSubDialog.url, enable: true } - this.ui.overlay.show = true axios.post('/api', JSON.stringify({ cmd: 'addAppSub', val: sub })).finally(() => { - this.ui.addAppSubDialog.show = false this.onReload() }) }, onRefreshAppSubs(){ this.ui.overlay.show = true axios.post('/api', JSON.stringify({ cmd: 'refreshAppSubs', val: null })).finally(() => { - this.box.usercfgs.refreshsecs = 3 + this.onReload() }) - this.onReload() }, reload() { window.location.reload() }, onReload() { - const refreshsecs = this.box.usercfgs.refreshsecs - const sec = [undefined, null, 'null', 'undefined', ''].includes(refreshsecs) ? 3 : refreshsecs * 1 - if (sec === 0) { - this.reload() - } else { - this.ui.overlay.show = false - this.ui.reloadConfirmDialog.show = true - this.ui.reloadConfirmDialog.sec = sec - } + window.location.reload() + // const refreshsecs = this.box.usercfgs.refreshsecs + // const sec = [undefined, null, 'null', 'undefined', ''].includes(refreshsecs) ? 3 : refreshsecs * 1 + // if (sec === 0) { + // this.reload() + // } else { + // this.ui.overlay.show = false + // this.ui.reloadConfirmDialog.show = true + // this.ui.reloadConfirmDialog.sec = sec + // } }, onDelSession(session) { this.ui.overlay.show = true @@ -1731,6 +1742,7 @@ function printHtml(data, curapp = null, curview = 'app') { }) }, onImpGlobalBak() { + this.ui.impGlobalBakDialog.show = false this.ui.overlay.show = true const env = this.box.syscfgs.env const version = this.box.syscfgs.version @@ -1746,7 +1758,6 @@ function printHtml(data, curapp = null, curview = 'app') { } bakobj.tags = [env, version, versionType] this.box.globalbaks.push(bakobj) - this.ui.impGlobalBakDialog.show = false axios.post('/api', JSON.stringify({ cmd: 'globalBak', val: bakobj })).finally(() => { this.onReload() }) From e6bd77d4262f88c8232cae0aae26d37a5401227c Mon Sep 17 00:00:00 2001 From: Chavy Date: Thu, 16 Jul 2020 22:34:59 +0800 Subject: [PATCH 065/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=8D=95=E9=80=89=E7=BB=84&=E5=A4=9A=E9=80=89?= =?UTF-8?q?=E7=BB=84=E6=8E=A7=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/release/box.release.json | 13 +++++++++++++ chavy.box.js | 25 +++++++++++++++++-------- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/box/release/box.release.json b/box/release/box.release.json index 7ae15be47..83426d393 100644 --- a/box/release/box.release.json +++ b/box/release/box.release.json @@ -1,5 +1,18 @@ { "releases": [ + { + "version": "0.4.9", + "tags": ["beta"], + "author": "@chavyleung", + "icon": "https://avatars3.githubusercontent.com/u/29748519", + "repo": "https://github.com/chavyleung", + "notes": [ + { + "name": "新增 (面向开发者)", + "descs": ["单选组控件", "多选组控件"] + } + ] + }, { "version": "0.4.8", "tags": ["beta"], diff --git a/chavy.box.js b/chavy.box.js index e73776498..3449f2b46 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -1,7 +1,7 @@ const $ = new Env('BoxJs') $.domain = '8.8.8.8' -$.version = '0.4.8' +$.version = '0.4.9' $.versionType = 'beta' $.KEY_sessions = 'chavy_boxjs_sessions' $.KEY_versions = 'chavy_boxjs_versions' @@ -343,6 +343,8 @@ function wrapapps(apps) { setting.val = val === null ? setting.val : val === 'true' } else if (setting.type === 'int') { setting.val = val * 1 || setting.val + } else if (setting.type === 'checkboxes') { + setting.val = val ? val.split(',') : null || setting.val } else { setting.val = val || setting.val } @@ -464,10 +466,10 @@ async function handleApi() { if (Array.isArray(settings)) { settings.forEach((setting) => { const oldval = $.getdata(setting.id) - const newval = setting.val - const usesuc = $.setdata(`${newval}`, setting.id) + const newval = `${setting.val}` + const usesuc = $.setdata(newval, setting.id) $.log(`❕ ${$.name}, 保存设置: ${setting.id} ${usesuc ? '成功' : '失败'}!`, `旧值: ${oldval}`, `新值: ${newval}`) - $.setdata(`${newval}`, setting.id) + $.setdata(newval, setting.id) }) $.subt = `保存设置: 成功! ` $.msg($.name, $.subt, '') @@ -917,10 +919,17 @@ function printHtml(data, curapp = null, curview = 'app') { From 473a999e4ab769719868d53513b7f1b8c60763bc Mon Sep 17 00:00:00 2001 From: Chavy Date: Thu, 16 Jul 2020 23:38:09 +0800 Subject: [PATCH 066/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E5=86=85=E7=BD=AE=E5=BA=94=E7=94=A8,=20=E4=BA=AC?= =?UTF-8?q?=E4=B8=9C=E8=AF=B7=E4=BD=BF=E7=94=A8=E9=87=8E=E6=AF=94=E5=A4=A7?= =?UTF-8?q?=E4=BD=AC=E7=9A=84=E8=AE=A2=E9=98=85:=20https://raw.githubuserc?= =?UTF-8?q?ontent.com/NobyDa/Script/master/NobyDa=5FBoxJs.json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/release/box.release.json | 13 +++++++++++++ chavy.box.js | 10 +--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/box/release/box.release.json b/box/release/box.release.json index 83426d393..176c20e19 100644 --- a/box/release/box.release.json +++ b/box/release/box.release.json @@ -1,5 +1,18 @@ { "releases": [ + { + "version": "0.4.10", + "tags": ["beta"], + "author": "@chavyleung", + "icon": "https://avatars3.githubusercontent.com/u/29748519", + "repo": "https://github.com/chavyleung", + "notes": [ + { + "name": "调整", + "descs": ["京东, 请使用野比大佬的订阅: https://raw.githubusercontent.com/NobyDa/Script/master/NobyDa_BoxJs.json"] + } + ] + }, { "version": "0.4.9", "tags": ["beta"], diff --git a/chavy.box.js b/chavy.box.js index 3449f2b46..fcdc683b2 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -1,7 +1,7 @@ const $ = new Env('BoxJs') $.domain = '8.8.8.8' -$.version = '0.4.9' +$.version = '0.4.10' $.versionType = 'beta' $.KEY_sessions = 'chavy_boxjs_sessions' $.KEY_versions = 'chavy_boxjs_versions' @@ -147,14 +147,6 @@ function getSystemApps() { repo: 'https://github.com/NobyDa/Script/blob/master/iQIYI-DailyBonus/iQIYI.js', icons: ['https://raw.githubusercontent.com/Orz-3/mini/master/iQIYI.png', 'https://raw.githubusercontent.com/Orz-3/task/master/iQIYI.png'] }, - { - id: 'JD', - name: '京东', - keys: ['CookieJD', 'CookieJD2'], - author: '@NobyDa', - repo: 'https://github.com/NobyDa/Script/blob/master/JD-DailyBonus/JD_DailyBonus.js', - icons: ['https://raw.githubusercontent.com/Orz-3/mini/master/jd.png', 'https://raw.githubusercontent.com/Orz-3/task/master/jd.png'] - }, { id: 'JD618', name: '京东618', From 7daeee19ac609fb0106ca1974604adcc50347b9f Mon Sep 17 00:00:00 2001 From: Chavy Date: Fri, 17 Jul 2020 01:38:17 +0800 Subject: [PATCH 067/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E9=83=A8=E5=88=86=E6=83=85=E5=86=B5=E4=B8=8B=E6=94=B6?= =?UTF-8?q?=E8=97=8F=E5=BA=94=E7=94=A8=E6=8E=92=E5=BA=8F=E5=A4=B1=E6=95=88?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/release/box.release.json | 13 +++++++++++++ chavy.box.js | 22 +++++++++------------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/box/release/box.release.json b/box/release/box.release.json index 176c20e19..c4013dcfb 100644 --- a/box/release/box.release.json +++ b/box/release/box.release.json @@ -1,5 +1,18 @@ { "releases": [ + { + "version": "0.4.11", + "tags": ["beta"], + "author": "@chavyleung", + "icon": "https://avatars3.githubusercontent.com/u/29748519", + "repo": "https://github.com/chavyleung", + "notes": [ + { + "name": "修复", + "descs": ["收藏应用排序异常问题"] + } + ] + }, { "version": "0.4.10", "tags": ["beta"], diff --git a/chavy.box.js b/chavy.box.js index fcdc683b2..b7fc6a17e 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -1,7 +1,7 @@ const $ = new Env('BoxJs') $.domain = '8.8.8.8' -$.version = '0.4.10' +$.version = '0.4.11' $.versionType = 'beta' $.KEY_sessions = 'chavy_boxjs_sessions' $.KEY_versions = 'chavy_boxjs_versions' @@ -575,7 +575,7 @@ async function handleApi() { } async function getBoxData() { - return { + const box = { sessions: getSessions(), versions: await getVersions(), sysapps: getSystemApps(), @@ -586,6 +586,11 @@ async function getBoxData() { globalbaks: getGlobalBaks(), colors: getSystemThemes() } + const apps = [] + apps.push(...box.sysapps) + box.appsubs.forEach((sub) => apps.push(...sub.apps)) + box.usercfgs.favapps = box.usercfgs.favapps.filter((favappId) => apps.find((app) => app.id === favappId)) + return box } async function handleHome() { @@ -915,11 +920,11 @@ function printHtml(data, curapp = null, curview = 'app') { - + @@ -1715,15 +1720,6 @@ function printHtml(data, curapp = null, curview = 'app') { }, onReload() { window.location.reload() - // const refreshsecs = this.box.usercfgs.refreshsecs - // const sec = [undefined, null, 'null', 'undefined', ''].includes(refreshsecs) ? 3 : refreshsecs * 1 - // if (sec === 0) { - // this.reload() - // } else { - // this.ui.overlay.show = false - // this.ui.reloadConfirmDialog.show = true - // this.ui.reloadConfirmDialog.sec = sec - // } }, onDelSession(session) { this.ui.overlay.show = true From c7be1da061e65bd5a7073dd26281fdbbe8dbcdac Mon Sep 17 00:00:00 2001 From: GideonSenku <39037656+GideonSenku@users.noreply.github.com> Date: Fri, 17 Jul 2020 15:43:34 +0800 Subject: [PATCH 068/626] Create LICENSE --- LICENSE | 674 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 674 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..d43a18cdc --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Scripts Copyright (C) 2019-present chavyleung + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. From 3c0ad919aa3b712f1222cf2a98e506e0e462e6fc Mon Sep 17 00:00:00 2001 From: AGentleWind2391 <2391961006@qq.com> Date: Fri, 17 Jul 2020 15:51:58 +0800 Subject: [PATCH 069/626] =?UTF-8?q?=E6=B7=BB=E5=8A=A0GPL=E5=BC=80=E6=BA=90?= =?UTF-8?q?=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a480d86a1..fe2935244 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ # Chavy Scripts -[脚本投票地址](https://t.me/chavyscripts) \ No newline at end of file +[脚本投票地址](https://t.me/chavyscripts) + +# LICENSE +Copyright © 2019-present chavyleung. This project is [GPL](https://github.com/chavyleung/scripts/blob/master/LICENSE) licensed. \ No newline at end of file From 2ed9bc92a77a52beb53a79f8fb5832774ad9261d Mon Sep 17 00:00:00 2001 From: Chavy Date: Fri, 17 Jul 2020 19:40:29 +0800 Subject: [PATCH 070/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E9=83=A8=E5=88=86=E6=83=85=E5=86=B5=E4=B8=8B=E5=88=B7?= =?UTF-8?q?=E6=96=B0&=E6=B7=BB=E5=8A=A0=E8=AE=A2=E9=98=85=E6=97=A0?= =?UTF-8?q?=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/release/box.release.json | 13 +++++++++++++ chavy.box.js | 17 +++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/box/release/box.release.json b/box/release/box.release.json index c4013dcfb..a80a42411 100644 --- a/box/release/box.release.json +++ b/box/release/box.release.json @@ -1,5 +1,18 @@ { "releases": [ + { + "version": "0.4.12", + "tags": ["beta"], + "author": "@chavyleung", + "icon": "https://avatars3.githubusercontent.com/u/29748519", + "repo": "https://github.com/chavyleung", + "notes": [ + { + "name": "修复", + "descs": ["部分情况下刷新&添加订阅无效问题"] + } + ] + }, { "version": "0.4.11", "tags": ["beta"], diff --git a/chavy.box.js b/chavy.box.js index b7fc6a17e..84728fd43 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -1,7 +1,7 @@ const $ = new Env('BoxJs') $.domain = '8.8.8.8' -$.version = '0.4.11' +$.version = '0.4.12' $.versionType = 'beta' $.KEY_sessions = 'chavy_boxjs_sessions' $.KEY_versions = 'chavy_boxjs_versions' @@ -252,10 +252,9 @@ function getGlobalBaks() { return globalBaksStr ? JSON.parse(globalBaksStr) : [] } -async function refreshAppSub(sub) { - const usercfgs = getUserCfgs() - const suburl = sub.url.replace(/[ ]|[\r\n]/g, '') - await new Promise((resolve) => { +function refreshAppSub(sub, usercfgs) { + return new Promise((resolve) => { + const suburl = sub.url.replace(/[ ]|[\r\n]/g, '') $.get({ url: suburl }, (err, resp, data) => { try { const respsub = JSON.parse(data) @@ -278,15 +277,17 @@ async function refreshAppSub(sub) { } }) }) - $.setdata(JSON.stringify(usercfgs), $.KEY_userCfgs) } async function refreshAppSubs() { $.msg($.name, '更新订阅: 开始!') const usercfgs = getUserCfgs() for (let subIdx = 0; subIdx < usercfgs.appsubs.length; subIdx++) { - await refreshAppSub(usercfgs.appsubs[subIdx]) + const sub = usercfgs.appsubs[subIdx] + await refreshAppSub(sub, usercfgs) } + $.setdata(JSON.stringify(usercfgs), $.KEY_userCfgs) + console.log(`全部订阅, 完成!`) const endTime = new Date().getTime() const costTime = (endTime - $.startTime) / 1000 $.msg($.name, `更新订阅: 完成! 🕛 ${costTime} 秒`) @@ -515,8 +516,8 @@ async function handleApi() { const sub = data.val const usercfgs = getUserCfgs() usercfgs.appsubs.push(sub) + await refreshAppSub(sub, usercfgs) $.setdata(JSON.stringify(usercfgs), $.KEY_userCfgs) - await refreshAppSub(data.val) const endTime = new Date().getTime() const costTime = (endTime - $.startTime) / 1000 $.msg($.name, `添加订阅: 完成! 🕛 ${costTime} 秒`) From 605fa096c41b1d8a20cf0a53fc4100aea5a0ac91 Mon Sep 17 00:00:00 2001 From: Chavy Date: Sat, 18 Jul 2020 10:58:21 +0800 Subject: [PATCH 071/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E8=AE=A2=E9=98=85=E5=88=B7=E6=96=B0=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/release/box.release.json | 13 +++++++++++++ chavy.box.js | 6 ++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/box/release/box.release.json b/box/release/box.release.json index a80a42411..2f30fb1ed 100644 --- a/box/release/box.release.json +++ b/box/release/box.release.json @@ -1,5 +1,18 @@ { "releases": [ + { + "version": "0.4.13", + "tags": ["beta"], + "author": "@chavyleung", + "icon": "https://avatars3.githubusercontent.com/u/29748519", + "repo": "https://github.com/chavyleung", + "notes": [ + { + "name": "性能", + "descs": ["优化订阅刷新性能 (并行)"] + } + ] + }, { "version": "0.4.12", "tags": ["beta"], diff --git a/chavy.box.js b/chavy.box.js index 84728fd43..3ad8ef1ac 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -282,10 +282,12 @@ function refreshAppSub(sub, usercfgs) { async function refreshAppSubs() { $.msg($.name, '更新订阅: 开始!') const usercfgs = getUserCfgs() + const refreshActs = [] for (let subIdx = 0; subIdx < usercfgs.appsubs.length; subIdx++) { const sub = usercfgs.appsubs[subIdx] - await refreshAppSub(sub, usercfgs) + refreshActs.push(refreshAppSub(sub, usercfgs)) } + await Promise.all(refreshActs) $.setdata(JSON.stringify(usercfgs), $.KEY_userCfgs) console.log(`全部订阅, 完成!`) const endTime = new Date().getTime() @@ -1839,4 +1841,4 @@ function printJson() { } // prettier-ignore -function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}catch{const s={};this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}}else e=$.setval(t,s);return e}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}msg(s=t,e="",i="",o){this.isSurge()||this.isLoon()?$notification.post(s,e,i):this.isQuanX()&&$notify(s,e,i),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} +function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}catch{const s={};this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}}else e=$.setval(t,s);return e}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o)),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} From caa96b9562778f3eee005d8e25305792923c21b5 Mon Sep 17 00:00:00 2001 From: Chavy Date: Sat, 18 Jul 2020 10:59:25 +0800 Subject: [PATCH 072/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[EnvJs]:=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E4=B8=80=E5=A4=84=E8=AF=AD=E6=B3=95=E9=94=99=E8=AF=AF?= =?UTF-8?q?=20(=E9=9D=9E=E5=BF=85=E8=A6=81=E6=80=A7=E6=9B=B4=E6=96=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Env.js | 4 ++-- Env.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Env.js b/Env.js index 92fec3eb8..610764ed3 100644 --- a/Env.js +++ b/Env.js @@ -28,7 +28,7 @@ function Env(name, opts) { } loaddata() { - if (this.isNode) { + if (this.isNode()) { this.fs = this.fs ? this.fs : require('fs') this.path = this.path ? this.path : require('path') const curDirDataFilePath = this.path.resolve(this.dataFile) @@ -47,7 +47,7 @@ function Env(name, opts) { } writedata() { - if (this.isNode) { + if (this.isNode()) { this.fs = this.fs ? this.fs : require('fs') this.path = this.path ? this.path : require('path') const curDirDataFilePath = this.path.resolve(this.dataFile) diff --git a/Env.min.js b/Env.min.js index 2086d4d78..1249e3de0 100644 --- a/Env.min.js +++ b/Env.min.js @@ -1 +1 @@ -function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}catch{const s={};this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}}else e=$.setval(t,s);return e}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o)),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} \ No newline at end of file +function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}catch{const s={};this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}}else e=$.setval(t,s);return e}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o)),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} \ No newline at end of file From d5f052a0a3949d9b9d5532ba403544a7ec57389d Mon Sep 17 00:00:00 2001 From: Chavy Date: Sat, 18 Jul 2020 11:08:06 +0800 Subject: [PATCH 073/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=95=B0=E5=AD=97=E6=8E=A7=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/release/box.release.json | 13 +++++++++++++ chavy.box.js | 9 +++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/box/release/box.release.json b/box/release/box.release.json index 2f30fb1ed..16b541559 100644 --- a/box/release/box.release.json +++ b/box/release/box.release.json @@ -1,5 +1,18 @@ { "releases": [ + { + "version": "0.4.14", + "tags": ["beta"], + "author": "@chavyleung", + "icon": "https://avatars3.githubusercontent.com/u/29748519", + "repo": "https://github.com/chavyleung", + "notes": [ + { + "name": "新增 (面向开发者)", + "descs": ["数字控件 (number)"] + } + ] + }, { "version": "0.4.13", "tags": ["beta"], diff --git a/chavy.box.js b/chavy.box.js index 3ad8ef1ac..9b383c0b0 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -1,7 +1,7 @@ const $ = new Env('BoxJs') $.domain = '8.8.8.8' -$.version = '0.4.12' +$.version = '0.4.14' $.versionType = 'beta' $.KEY_sessions = 'chavy_boxjs_sessions' $.KEY_versions = 'chavy_boxjs_versions' @@ -131,9 +131,9 @@ function getSystemApps() { keys: ['chavy_cookie_tieba'], settings: [ { id: 'CFG_tieba_isOrderBars', name: '按连签排序', val: false, type: 'boolean', desc: '默认按经验排序' }, - { id: 'CFG_tieba_maxShowBars', name: '每页显示数', val: 15, type: 'text', desc: '每页最显示多少个吧信息' }, - { id: 'CFG_tieba_maxSignBars', name: '每次并发', val: 5, type: 'text', desc: '每次并发签到多少个吧' }, - { id: 'CFG_tieba_signWaitTime', name: '并发间隔 (毫秒)', val: 2000, type: 'text', desc: '每次并发间隔时间' } + { id: 'CFG_tieba_maxShowBars', name: '每页显示数', val: 15, type: 'number', desc: '每页最显示多少个吧信息' }, + { id: 'CFG_tieba_maxSignBars', name: '每次并发', val: 5, type: 'number', desc: '每次并发签到多少个吧' }, + { id: 'CFG_tieba_signWaitTime', name: '并发间隔 (毫秒)', val: 2000, type: 'number', desc: '每次并发间隔时间' } ], author: '@chavyleung', repo: 'https://github.com/chavyleung/scripts/tree/master/tieba', @@ -929,6 +929,7 @@ function printHtml(data, curapp = null, curview = 'app') { + From cbec8ec8f19e4c5fef68c5ce2d6a1079069bd075 Mon Sep 17 00:00:00 2001 From: evilbutcher Date: Sat, 18 Jul 2020 14:45:15 +0800 Subject: [PATCH 074/626] Update Env.js --- Env.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Env.js b/Env.js index 610764ed3..d7d9398f5 100644 --- a/Env.js +++ b/Env.js @@ -39,7 +39,7 @@ function Env(name, opts) { const datPath = isCurDirDataFile ? curDirDataFilePath : rootDirDataFilePath try { return JSON.parse(this.fs.readFileSync(datPath)) - } catch { + } catch (e) { return {} } } else return {} @@ -113,7 +113,7 @@ function Env(name, opts) { this.lodash_set(objedval, paths, val) issuc = this.setval(JSON.stringify(objedval), objkey) console.log(`${objkey}: ${JSON.stringify(objedval)}`) - } catch { + } catch (e) { const objedval = {} this.lodash_set(objedval, paths, val) issuc = this.setval(JSON.stringify(objedval), objkey) From 42f306cb166c6a767a1d066c9581bc5da89048bc Mon Sep 17 00:00:00 2001 From: Chavy Date: Sat, 18 Jul 2020 17:52:44 +0800 Subject: [PATCH 075/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs]:=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=A4=9A=E9=80=89=E7=BB=84=E6=8E=A7=E4=BB=B6=E5=85=A8?= =?UTF-8?q?=E9=83=A8=E5=8F=96=E6=B6=88=E6=97=B6=E4=BC=9A=E6=81=A2=E5=A4=8D?= =?UTF-8?q?=E5=88=B0=E9=BB=98=E8=AE=A4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/release/box.release.json | 13 +++++++++++++ chavy.box.js | 7 +++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/box/release/box.release.json b/box/release/box.release.json index 16b541559..b0d95ddb8 100644 --- a/box/release/box.release.json +++ b/box/release/box.release.json @@ -1,5 +1,18 @@ { "releases": [ + { + "version": "0.4.15", + "tags": ["beta"], + "author": "@chavyleung", + "icon": "https://avatars3.githubusercontent.com/u/29748519", + "repo": "https://github.com/chavyleung", + "notes": [ + { + "name": "修复", + "descs": ["多选组控件全部取消时会恢复到默认问题"] + } + ] + }, { "version": "0.4.14", "tags": ["beta"], diff --git a/chavy.box.js b/chavy.box.js index 9b383c0b0..be94e345f 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -1,7 +1,7 @@ const $ = new Env('BoxJs') $.domain = '8.8.8.8' -$.version = '0.4.14' +$.version = '0.4.15' $.versionType = 'beta' $.KEY_sessions = 'chavy_boxjs_sessions' $.KEY_versions = 'chavy_boxjs_versions' @@ -339,7 +339,10 @@ function wrapapps(apps) { } else if (setting.type === 'int') { setting.val = val * 1 || setting.val } else if (setting.type === 'checkboxes') { - setting.val = val ? val.split(',') : null || setting.val + if (![null, undefined].includes(valdat)) { + setting.val = valdat ? valdat.split(',') : [] + } + console.log(setting.val) } else { setting.val = val || setting.val } From bc8909e441ab4890c848d400f1db1a82464d5cd5 Mon Sep 17 00:00:00 2001 From: Chavy Date: Sun, 19 Jul 2020 14:28:17 +0800 Subject: [PATCH 076/626] =?UTF-8?q?=E6=9B=B4=E6=96=B0[10086=E6=9F=A5?= =?UTF-8?q?=E8=AF=9D=E8=B4=B9]:=20=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=83=85=E5=86=B5=E4=B8=8B=E5=8F=96=E4=B8=8D=E5=88=B0Cookie?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 10086/10086.fee.cookie.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/10086/10086.fee.cookie.js b/10086/10086.fee.cookie.js index 04fa653ee..782f2d0bf 100644 --- a/10086/10086.fee.cookie.js +++ b/10086/10086.fee.cookie.js @@ -45,4 +45,4 @@ $.KEY_getfee = 'chavy_getfee_cmcc' .finally(() => $.done()) // prettier-ignore -function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),h=JSON.stringify(this.data);e?this.fs.writeFileSync(t,h):i?this.fs.writeFileSync(s,h):this.fs.writeFileSync(t,h)}}getdata(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setdata(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t)):this.isNode()&&(this.got=this.got?this.got:require("got"),this.got(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t));else if(this.isNode()){this.got=this.got?this.got:require("got");const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t))}}msg(s=t,e="",i="",h){this.isSurge()||this.isLoon()?$notification.post(s,e,i):this.isQuanX()&&$notify(s,e,i),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} +function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i),console.log(`${i}: ${JSON.stringify(s)}`)}catch(s){const h={};this.lodash_set(h,o,t),e=this.setval(JSON.stringify(h),i),console.log(`${i}: ${JSON.stringify(h)}`)}}else e=$.setval(t,s);return e}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o)),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} From 8a53617c9fdcab4922631c5ae298f2906fc14a48 Mon Sep 17 00:00:00 2001 From: chouchoui Date: Sun, 19 Jul 2020 14:46:16 +0800 Subject: [PATCH 077/626] =?UTF-8?q?iPhone=20X=20=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chavy.box.js | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/chavy.box.js b/chavy.box.js index be94e345f..4a950d2a6 100644 --- a/chavy.box.js +++ b/chavy.box.js @@ -665,6 +665,47 @@ function printHtml(data, curapp = null, curview = 'app') { [v-cloak]{ display: none } + + .v-bottom-navigation, + .v-bottom-sheet { + padding-bottom: constant(safe-area-inset-bottom); + padding-bottom: env(safe-area-inset-bottom); + } + + .v-bottom-navigation{ + box-sizing: content-box; + } + + .v-bottom-navigation button { + box-sizing: border-box; + } + + .v-main.safe { + margin-bottom: 56px; + margin-bottom: calc(56px + constant(safe-area-inset-bottom)); + margin-bottom: calc(56px + env(safe-area-inset-bottom)); + + } + + .v-main .v-main__wrap { + padding-bottom: 68px; + padding-bottom: calc(68px + constant(safe-area-inset-bottom)); + padding-bottom: calc(68px + env(safe-area-inset-bottom)); + } + + .v-main.safe .v-main__wrap { + padding-bottom: 68px; + } + + .v-speed-dial { + bottom: calc(12px + constant(safe-area-inset-bottom)); + bottom: calc(12px + env(safe-area-inset-bottom)); + } + + .v-speed-dial.has-nav { + bottom: calc(68px + constant(safe-area-inset-bottom)); + bottom: calc(68px + env(safe-area-inset-bottom)); + } @@ -715,7 +756,7 @@ function printHtml(data, curapp = null, curview = 'app') { - +