diff --git a/Scripts/SignIn/10000/10000.cookie.js b/Scripts/SignIn/10000/10000.cookie.js deleted file mode 100644 index 295fc4d..0000000 --- a/Scripts/SignIn/10000/10000.cookie.js +++ /dev/null @@ -1,58 +0,0 @@ -const cookieName = '电信营业厅' -const KEY_signheader = 'chavy_signheader_10000' -const KEY_signbody = 'chavy_signbody_10000' -const KEY_mobile = 'chavy_mobile_10000' -const chavy = init() -if (this.$request && this.$request.headers && this.$request.body) { - const VAL_signheader = JSON.stringify($request.headers) - const VAL_signbody = this.$request.body - if (VAL_signheader) chavy.setdata(VAL_signheader, KEY_signheader) - if (VAL_signbody) chavy.setdata(VAL_signbody, KEY_signbody) - chavy.msg(cookieName, `获取Cookie: 成功`, ``) -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/10000/10000.js b/Scripts/SignIn/10000/10000.js deleted file mode 100644 index f5c22d5..0000000 --- a/Scripts/SignIn/10000/10000.js +++ /dev/null @@ -1,1881 +0,0 @@ -// 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_mobile = 'chavy_mobile_10000' - -!(async () => { - $.CryptoJS = $.isNode() ? require('crypto-js') : CryptoJS - await signapp() - await showmsg() -})() - .catch((e) => $.logErr(e)) - .finally(() => $.done()) - -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() { - 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 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/Scripts/SignIn/10000/README.md b/Scripts/SignIn/10000/README.md deleted file mode 100644 index ea07d26..0000000 --- a/Scripts/SignIn/10000/README.md +++ /dev/null @@ -1,98 +0,0 @@ -# 电信营业厅 - -> 2020.5.6 更新签到脚本 (正则和 rewrite 类型都有变化, 需要重取 Cookie) - -## 配置 (Surge) - -```properties -[MITM] -wapside.189.cn:9001 - -[Script] -http-request ^https:\/\/wapside.189.cn:9001\/api\/home\/sign script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/10000/10000.cookie.js, requires-body=true -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/10000/10000.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -wapside.189.cn - -[rewrite_local] -# 190及以后版本 -^https:\/\/wapside.189.cn:9001\/api\/home\/sign url script-request-body 10000.cookie.js - -[task_local] -1 0 * * * 10000.js -``` - -## 说明 - -> 先在登录成功后, 再打开获取 Cookie 的脚本 - -1. 先配置`[MITM]` - - Surge: wapside.189.cn:9001 - - QuanX: wapside.189.cn -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`10000.cookie.js`和`10000.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP 手动签到一次: 访问下右下角 `我` > `签到` (头像下面) -4. 系统提示: `获取Cookie: 成功` -5. 最后就可以把第 1 条脚本注释掉了 - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) - -[@sazs34](https://github.com/sazs34/) diff --git a/Scripts/SignIn/10010/10010.cookie.js b/Scripts/SignIn/10010/10010.cookie.js deleted file mode 100644 index 2f3c89a..0000000 --- a/Scripts/SignIn/10010/10010.cookie.js +++ /dev/null @@ -1,82 +0,0 @@ -const cookieName = '中国联通' -const tokenurlKey = 'chavy_tokenurl_10010' -const tokenheaderKey = 'chavy_tokenheader_10010' -const signurlKey = 'chavy_signurl_10010' -const signheaderKey = 'chavy_signheader_10010' -const loginlotteryurlKey = 'chavy_loginlotteryurl_10010' -const loginlotteryheaderKey = 'chavy_loginlotteryheader_10010' -const findlotteryurlKey = 'chavy_findlotteryurl_10010' -const findlotteryheaderKey = 'chavy_findlotteryheader_10010' -const chavy = init() - -if ($request && $request.method != 'OPTIONS' && $request.url.indexOf('querySigninActivity.htm') >= 0) { - const tokenurlVal = $request.url - const tokenheaderVal = JSON.stringify($request.headers) - if (tokenurlVal) chavy.setdata(tokenurlVal, tokenurlKey) - if (tokenheaderVal) chavy.setdata(tokenheaderVal, tokenheaderKey) - chavy.msg(cookieName, `获取刷新链接: 成功`, ``) -} else if ($request && $request.method != 'OPTIONS' && $request.url.indexOf('daySign') >= 0) { - const signurlVal = $request.url - const signheaderVal = JSON.stringify($request.headers) - if (signurlVal) chavy.setdata(signurlVal, signurlKey) - if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey) - chavy.msg(cookieName, `获取Cookie: 成功 (每日签到)`, ``) -} else if ($request && $request.method != 'OPTIONS' && $request.url.indexOf('userLogin') >= 0) { - const loginlotteryurlVal = $request.url - const loginlotteryheaderVal = JSON.stringify($request.headers) - if (loginlotteryurlVal) chavy.setdata(loginlotteryurlVal, loginlotteryurlKey) - if (loginlotteryheaderVal) chavy.setdata(loginlotteryheaderVal, loginlotteryheaderKey) - chavy.msg(cookieName, `获取Cookie: 成功 (登录抽奖)`, ``) -} else if ($request && $request.method != 'OPTIONS' && $request.url.indexOf('findActivityInfo') >= 0) { - const findlotteryurlVal = $request.url - const findlotteryheaderVal = JSON.stringify($request.headers) - if (findlotteryurlVal) chavy.setdata(findlotteryurlVal, findlotteryurlKey) - if (findlotteryheaderVal) chavy.setdata(findlotteryheaderVal, findlotteryheaderKey) - chavy.msg(cookieName, `获取Cookie: 成功 (抽奖次数)`, ``) -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/10010/10010.js b/Scripts/SignIn/10010/10010.js deleted file mode 100644 index 74bedf7..0000000 --- a/Scripts/SignIn/10010/10010.js +++ /dev/null @@ -1,256 +0,0 @@ -const chavy = init() -const cookieName = '中国联通' -const KEY_loginurl = 'chavy_tokenurl_10010' -const KEY_loginheader = 'chavy_tokenheader_10010' -const KEY_signurl = 'chavy_signurl_10010' -const KEY_signheader = 'chavy_signheader_10010' -const KEY_loginlotteryurl = 'chavy_loginlotteryurl_10010' -const KEY_loginlotteryheader = 'chavy_loginlotteryheader_10010' -const KEY_findlotteryurl = 'chavy_findlotteryurl_10010' -const KEY_findlotteryheader = 'chavy_findlotteryheader_10010' - -const signinfo = {} -let VAL_loginurl = chavy.getdata(KEY_loginurl) -let VAL_loginheader = chavy.getdata(KEY_loginheader) -let VAL_signurl = chavy.getdata(KEY_signurl) -let VAL_signheader = chavy.getdata(KEY_signheader) -let VAL_loginlotteryurl = chavy.getdata(KEY_loginlotteryurl) -let VAL_loginlotteryheader = chavy.getdata(KEY_loginlotteryheader) -let VAL_findlotteryurl = chavy.getdata(KEY_findlotteryurl) -let VAL_findlotteryheader = chavy.getdata(KEY_findlotteryheader) - -;(sign = async () => { - chavy.log(`🔔 ${cookieName}`) - await loginapp() - await signapp() - if (VAL_loginlotteryurl && VAL_findlotteryurl) await loginlottery() - if (signinfo.encryptmobile) { - await findlottery() - if (signinfo.findlottery && signinfo.findlottery.acFrequency && signinfo.findlottery.acFrequency.usableAcFreq) { - for (let i = 0; i < signinfo.findlottery.acFrequency.usableAcFreq; i++) { - await lottery() - } - } - } - await getinfo() - showmsg() - chavy.done() -})().catch((e) => chavy.log(`❌ ${cookieName} 签到失败: ${e}`), chavy.done()) - -function loginapp() { - return new Promise((resolve, reject) => { - const url = {url: VAL_loginurl, headers: JSON.parse(VAL_loginheader)} - chavy.post(url, (error, response, data) => { - try { - resolve() - } catch (e) { - chavy.msg(cookieName, `登录结果: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} loginapp - 登录失败: ${e}`) - chavy.log(`❌ ${cookieName} loginapp - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function signapp() { - return new Promise((resolve, reject) => { - if (VAL_signurl.endsWith('.do')) VAL_signurl = VAL_signurl.replace('.do', '') - const url = {url: 'https://act.10010.com/SigninApp/signin/daySign', 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() - } - }) - }) -} - -function loginlottery() { - return new Promise((resolve, reject) => { - const url = {url: VAL_loginlotteryurl, headers: JSON.parse(VAL_loginlotteryheader)} - chavy.get(url, (error, response, data) => { - try { - const encryptmobileMatch = data.match(/encryptmobile=([^('|")]*)/) - if (encryptmobileMatch) { - signinfo.encryptmobile = encryptmobileMatch[1] - } else { - chavy.msg(cookieName, `获取抽奖令牌: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} loginlottery - 获取抽奖令牌失败: ${e}`) - chavy.log(`❌ ${cookieName} loginlottery - response: ${JSON.stringify(response)}`) - } - resolve() - } catch (e) { - chavy.msg(cookieName, `登录抽奖: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} loginlottery - 登录抽奖失败: ${e}`) - chavy.log(`❌ ${cookieName} loginlottery - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function findlottery() { - return new Promise((resolve, reject) => { - VAL_findlotteryurl = VAL_findlotteryurl.replace(/encryptmobile=[^(&|$)]*/, `encryptmobile=${signinfo.encryptmobile}`) - VAL_findlotteryurl = VAL_findlotteryurl.replace(/mobile=[^(&|$)]*/, `mobile=${signinfo.encryptmobile}`) - const url = {url: VAL_findlotteryurl, headers: JSON.parse(VAL_findlotteryheader)} - chavy.get(url, (error, response, data) => { - try { - signinfo.findlottery = JSON.parse(data) - resolve() - } catch (e) { - chavy.msg(cookieName, `获取抽奖次数: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} findlottery - 获取抽奖次数失败: ${e}`) - chavy.log(`❌ ${cookieName} findlottery - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function lottery() { - return new Promise((resolve, reject) => { - const url = { - url: `https://m.client.10010.com/dailylottery/static/doubleball/choujiang?usernumberofjsp=${signinfo.encryptmobile}`, - headers: JSON.parse(VAL_loginlotteryheader) - } - url.headers['Referer'] = `https://m.client.10010.com/dailylottery/static/doubleball/firstpage?encryptmobile=${signinfo.encryptmobile}` - chavy.post(url, (error, response, data) => { - try { - signinfo.lotterylist = signinfo.lotterylist ? signinfo.lotterylist : [] - signinfo.lotterylist.push(JSON.parse(data)) - resolve() - } catch (e) { - chavy.msg(cookieName, `抽奖结果: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} lottery - 抽奖失败: ${e}`) - chavy.log(`❌ ${cookieName} lottery - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function gettel() { - const reqheaders = JSON.parse(VAL_signheader) - const reqreferer = reqheaders.Referer - const reqCookie = reqheaders.Cookie - let tel = '' - if (reqreferer.indexOf(`desmobile=`) >= 0) tel = reqreferer.match(/desmobile=(.*?)(&|$)/)[1] - if (tel == '' && reqCookie.indexOf(`u_account=`) >= 0) tel = reqCookie.match(/u_account=(.*?);/)[1] - return tel -} - -function getinfo() { - return new Promise((resolve, reject) => { - const url = {url: `https://mina.10010.com/wxapplet/bind/getIndexData/alipay/alipaymini?user_id=${gettel()}`} - chavy.get(url, (error, response, data) => { - try { - signinfo.info = JSON.parse(data) - resolve() - } catch (e) { - chavy.msg(cookieName, `获取余量: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} getinfo - 获取余量失败: ${e}`) - chavy.log(`❌ ${cookieName} getinfo - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function showmsg() { - let subTitle = '' - let detail = '' - - // 签到结果 - if (signinfo.signapp.signinMedal) { - subTitle = `签到: 成功` - detail = `积分: +${signinfo.signapp.prizeCount}, 成长值: +${signinfo.signapp.growthV}, 鲜花: +${signinfo.signapp.flowerCount}` - } else if (JSON.stringify(signinfo.signapp) == '{}') { - subTitle = `签到: 重复` - } else { - subTitle = `签到: 失败` - chavy.log(`❌ ${cookieName} signapp - response: ${JSON.stringify(signinfo.signapp)}`) - } - - if (signinfo.info.code == '0000') { - // 基本信息 - detail = detail ? `${detail}\n` : `` - const free = signinfo.info.dataList[0] - const flow = signinfo.info.dataList[1] - const voice = signinfo.info.dataList[2] - detail = `话费: ${free.number}${free.unit}, 已用: ${flow.number}${flow.unit}, 剩余: ${voice.number}${voice.unit}` - } else { - chavy.log(`❌ ${cookieName} signapp - response: ${JSON.stringify(signinfo.info)}`) - } - - if (signinfo.findlottery && signinfo.findlottery.acFrequency && signinfo.lotterylist) { - subTitle += `; 抽奖: ${signinfo.findlottery.acFrequency.usableAcFreq}次` - detail += '\n查看详情\n' - - for (let i = 0; i < signinfo.findlottery.acFrequency.usableAcFreq; i++) { - detail += `\n抽奖 (${i + 1}): ${signinfo.lotterylist[i].RspMsg}` - } - } else { - chavy.log(`❌ ${cookieName} signapp - response: ${JSON.stringify(signinfo.findlottery)}`) - } - - chavy.msg(cookieName, subTitle, detail) -} - -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 (url['headers'] != undefined) { - delete url['headers']['Content-Length'] - console.log(url['headers']) - } - 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 (url['headers'] != undefined) { - delete url['headers']['Content-Length'] - console.log(url['headers']) - } - 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} -} diff --git a/Scripts/SignIn/10010/README.md b/Scripts/SignIn/10010/README.md deleted file mode 100644 index 8f2c650..0000000 --- a/Scripts/SignIn/10010/README.md +++ /dev/null @@ -1,107 +0,0 @@ -# 中国联通 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> 注意获取 Cookie 有两条脚本 - -> 如果你希望显示话费、语音、流量信息,请在支付宝中搜索小程序“中国联通”并授权登录一次 - -> 2020.3.12 增加每日抽奖 (需要进抽奖页面获取 Cookie) (进抽奖页会弹两个获取 Cookie 成功的消息) (签到 Cookie 不用重新获取) (增加了 rewrite 和 mitm), 注意看操作步骤说明 - -> 2020.5.6 修复签到报错问题 - -## 配置 (Surge) - -```properties -[MITM] -hostname = act.10010.com, m.client.10010.com - -[Script] -# 注意获取Cookie有两条脚本 -http-request ^https:\/\/act.10010.com\/SigninApp\/signin\/querySigninActivity.htm script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/10010/10010.cookie.js -http-request ^https:\/\/act.10010.com\/SigninApp(.*?)\/signin\/daySign script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/10010/10010.cookie.js -http-request ^https:\/\/m.client.10010.com\/dailylottery\/static\/(textdl\/userLogin|active\/findActivityInfo) script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/10010/10010.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/10010/10010.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -hostname = act.10010.com, m.client.10010.com - -[rewrite_local] -# 注意获取Cookie有两条脚本 -^https:\/\/act.10010.com\/SigninApp\/signin\/querySigninActivity.htm url script-request-header 10010.cookie.js -^https:\/\/act.10010.com\/SigninApp(.*?)\/signin\/daySign url script-request-header 10010.cookie.js -^https:\/\/m.client.10010.com\/dailylottery\/static\/(textdl\/userLogin|active\/findActivityInfo) url script-request-header 10010.cookie.js - -[task_local] -1 0 * * * 10010.js -``` - -## 说明 - -1. 先把`act.10010.com, m.client.10010.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`10010.cookie.js`和`10010.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP , 进入签到页面, 系统提示: `获取刷新链接: 成功` -4. 然后手动签到 1 次, 系统提示: `获取Cookie: 成功 (每日签到)` -5. 首页>天天抽奖, 系统提示 `2` 次: `获取Cookie: 成功 (登录抽奖)` 和 `获取Cookie: 成功 (抽奖次数)` -6. 把获取 Cookie 的脚本注释掉 -7. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/10086/10086.cookie.js b/Scripts/SignIn/10086/10086.cookie.js deleted file mode 100644 index 9e96a9b..0000000 --- a/Scripts/SignIn/10086/10086.cookie.js +++ /dev/null @@ -1,68 +0,0 @@ -const cookieName = '中国移动' -const tokenurlKey = 'chavy_tokenurl_10086' -const tokenheaderKey = 'chavy_tokenheader_10086' -const signurlKey = 'chavy_signurl_10086' -const signheaderKey = 'chavy_signheader_10086' -const chavy = init() - -const requrl = $request.url -const reqRef = $request.headers.Referer -if ($request && $request.method != 'OPTIONS' && requrl.indexOf('website/taskCenter/index') >= 0 && requrl.indexOf('mobile=') >= 0) { - const tokenurlVal = requrl - const tokenheaderVal = JSON.stringify($request.headers) - if (tokenurlVal) chavy.setdata(tokenurlVal, tokenurlKey) - if (tokenheaderVal) chavy.setdata(tokenheaderVal, tokenheaderKey) - title = chavy.msg(cookieName, `获取刷新链接: 成功`, ``) -} else if ($request && $request.method != 'OPTIONS' && requrl.indexOf('website/taskCenter/sign') >= 0) { - const signurlVal = requrl - const signheaderVal = JSON.stringify($request.headers) - if (signurlVal) chavy.setdata(signurlVal, signurlKey) - if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey) - title = chavy.msg(cookieName, `获取Cookie: 成功`, ``) -} - -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} -} - -chavy.done() \ No newline at end of file diff --git a/Scripts/SignIn/10086/10086.fee.cookie.js b/Scripts/SignIn/10086/10086.fee.cookie.js deleted file mode 100644 index aa7ac25..0000000 --- a/Scripts/SignIn/10086/10086.fee.cookie.js +++ /dev/null @@ -1,157 +0,0 @@ -/** - * - * 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) -} \ No newline at end of file diff --git a/Scripts/SignIn/10086/10086.fee.js b/Scripts/SignIn/10086/10086.fee.js deleted file mode 100644 index a77789f..0000000 --- a/Scripts/SignIn/10086/10086.fee.js +++ /dev/null @@ -1,1848 +0,0 @@ -// 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 querymeal() - 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 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), { - 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}` - 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() - }) -} - -// 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) -} \ No newline at end of file diff --git a/Scripts/SignIn/10086/10086.js b/Scripts/SignIn/10086/10086.js deleted file mode 100644 index 4873a85..0000000 --- a/Scripts/SignIn/10086/10086.js +++ /dev/null @@ -1,97 +0,0 @@ -const cookieName = '中国移动' -const tokenurlKey = 'chavy_tokenurl_10086' -const tokenheaderKey = 'chavy_tokenheader_10086' -const signurlKey = 'chavy_signurl_10086' -const signheaderKey = 'chavy_signheader_10086' -const chavy = init() -const tokenurlVal = chavy.getdata(tokenurlKey) -const tokenheaderVal = chavy.getdata(tokenheaderKey) -const signurlVal = chavy.getdata(signurlKey) -let signheaderVal = chavy.getdata(signheaderKey) -const signinfo = {} - -sign() - -function loginapp(cb) { - const url = {url: tokenurlVal, headers: JSON.parse(tokenheaderVal)} - chavy.get(url, (error, response, data) => { - const respcookie = response.headers['Set-Cookie'] - chavy.log(`${cookieName}, loginapp - respcookie: ${respcookie}`) - if (respcookie && respcookie.indexOf('d.sid=') >= 0) { - const signheaderObj = JSON.parse(signheaderVal) - let signcookie = signheaderObj['Cookie'] - signcookie = signcookie.replace(/d\.sid=([^;]*)/, respcookie.match(/d\.sid=([^;]*)/)[0]) - signheaderObj['Cookie'] = signcookie - signheaderVal = JSON.stringify(signheaderObj) - } - cb() - }) -} - -function sign() { - loginapp(() => { - const url = {url: signurlVal, headers: JSON.parse(signheaderVal)} - chavy.get(url, (error, response, data) => { - chavy.log(`${cookieName}, data: ${data}`) - const result = JSON.parse(data) - let subTitle = `` - let detail = `` - if (result.rtnCode == '0') { - subTitle = `签到结果: 成功` - detail = `连签: ${result.object.signDays}天` - } else if (result.rtnCode == '-9999' && result.object.status == '50001') { - subTitle = `签到结果: 成功 (重复签到)` - detail = `说明: ${result.object.message}` - } else { - subTitle = `签到结果: 失败` - detail = `说明: 详见日志` - } - chavy.msg(cookieName, subTitle, detail) - chavy.done() - }) - }) -} - -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} -} \ No newline at end of file diff --git a/Scripts/SignIn/10086/Readme.md b/Scripts/SignIn/10086/Readme.md deleted file mode 100644 index 763ea68..0000000 --- a/Scripts/SignIn/10086/Readme.md +++ /dev/null @@ -1,98 +0,0 @@ -# 中国移动 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> 注意: 中国移动是指名字为`10086`这款的 APP [点这里下载](https://apps.apple.com/cn/app/10086-%E4%B8%AD%E5%9B%BD%E7%A7%BB%E5%8A%A8%E5%87%BA%E5%93%81/id1004816017) - -## 配置 (Surge) - -```properties -[MITM] -wx.10086.cn - -[Script] -# 注意获取Cookie有两条脚本 -http-request ^http:\/\/wx.10086.cn\/website\/taskCenter\/index\? script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/10086/10086.cookie.js -http-request ^http:\/\/wx.10086.cn\/website\/taskCenter\/sign\? script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/10086/10086.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/10086/10086.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -wx.10086.cn - -[rewrite_local] -# 注意获取Cookie有两条脚本 -^http:\/\/wx.10086.cn\/website\/taskCenter\/index\? url script-request-header 10086.cookie.js -^http:\/\/wx.10086.cn\/website\/taskCenter\/sign\? url script-request-header 10086.cookie.js - -[task_local] -1 0 * * * 10086.js -``` - -## 说明 - -1. 先把`wx.10086.cn`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`10086.cookie.js`和`10086.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP , 进入签到页面, 系统提示: `获取刷新链接: 成功` -4. 然后手动签到 1 次, 系统提示: `获取Cookie: 成功` -5. 把获取 Cookie 的脚本注释掉 -6. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) \ No newline at end of file diff --git a/Scripts/SignIn/ACFun/Readme.md b/Scripts/SignIn/ACFun/Readme.md deleted file mode 100644 index c47ec6f..0000000 --- a/Scripts/SignIn/ACFun/Readme.md +++ /dev/null @@ -1,101 +0,0 @@ -# AcFun -# 此 Readme Copied From [@chavyleung](https://github.com/chavyleung/scripts/blob/master/wps/README.md) -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> 只支持 APP 端签到 (什么? 你想用 Mac 签? emm...看需求人数吧...) - -> 测试版有可能出现任何情况, 如虫子(bug)、cookie(有效期)等各种问题, 希望大家能抱着共同完善的心态来玩 - -> 2020.1.11 QuanX 在`190`版本开始, 获取 Cookie 方式需要从`script-response-body`改为`script-request-header` - -## 配置 (Surge) - -```properties -[MITM] -*.acfun.cn - -[Script] - -http-request ^https:\/\/api\-new\.app\.acfun\.cn\/rest\/app\/user\/personalInfo script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/acfun/acfun.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/acfun/acfun.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -*.acfun.cn - -[rewrite_local] -# 189及以前版本 -^https:\/\/api\-new\.app\.acfun\.cn\/rest\/app\/user\/personalInfo url script-response-body acfun.cookie.js -# 190及以后版本 -^https:\/\/api\-new\.app\.acfun\.cn\/rest\/app\/user\/personalInfo url script-request-header acfun.cookie.js - -[task_local] -1 0 * * * acfun.js -``` - -## 说明 - -1. 先把`*.acfun.cn`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`acfun.cookie.js`和`acfun.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP, 访问下`我的` -4. 系统提示: `获取Cookie: 成功` & `获取Token: 成功`(如果不提示获取成功, 尝试杀进程再进我的) -5. 最后就可以把第 1 条脚本注释掉了 - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) \ No newline at end of file diff --git a/Scripts/SignIn/ACFun/acfun.cookie.js b/Scripts/SignIn/ACFun/acfun.cookie.js deleted file mode 100644 index 9b7a387..0000000 --- a/Scripts/SignIn/ACFun/acfun.cookie.js +++ /dev/null @@ -1,62 +0,0 @@ -const cookieName = 'AcFun' -const cookieKey = 'chavy_cookie_acfun' -const tokenKey = 'chavy_token_acfun' -const chavy = init() -const cookieVal = $request.headers['Cookie'] -const tokenVal = $request.headers['access_token'] -if (cookieVal) { - if (chavy.setdata(cookieVal, cookieKey)) { - chavy.msg(`${cookieName}`, '获取Cookie: 成功', '') - chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`) - } - if (chavy.setdata(tokenVal, tokenKey)) { - chavy.msg(`${cookieName}`, '获取Token: 成功', '') - chavy.log(`[${cookieName}] 获取Token: 成功, token: ${tokenVal}`) - } -} - -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} -} - -chavy.done() \ No newline at end of file diff --git a/Scripts/SignIn/ACFun/acfun.js b/Scripts/SignIn/ACFun/acfun.js deleted file mode 100644 index be04357..0000000 --- a/Scripts/SignIn/ACFun/acfun.js +++ /dev/null @@ -1,97 +0,0 @@ -const cookieName = 'AcFun' -const cookieKey = 'chavy_cookie_acfun' -const tokenKey = 'chavy_token_acfun' -const chavy = init() -const cookieVal = chavy.getdata(cookieKey) -const tokenVal = chavy.getdata(tokenKey) - -sign() - -function sign() { - let url = {url: `https://api-new.acfunchina.com/rest/app/user/signIn`, headers: {Cookie: cookieVal}} - url.headers['access_token'] = `${tokenVal}` - url.headers['acPlatform'] = 'IPHONE' - url.headers['User-Agent'] = 'AcFun/6.14.2 (iPhone; iOS 13.3; Scale/2.00)' - url.body = `access_token=${cookieVal}` - chavy.post(url, (error, response, data) => { - const result = JSON.parse(data) - const title = `${cookieName}` - let subTitle = `` - let detail = `` - if (result.result == 0 || result.result == 122) { - getinfo(result) - } else { - subTitle = `签到结果: 失败` - detail = `编码: ${result.result}, 说明: ${result.error_msg}` - chavy.msg(title, subTitle, detail) - } - chavy.log(`${cookieName}, data: ${data}`) - }) - chavy.done() -} - -function getinfo(signresult) { - let url = {url: `https://api-new.acfunchina.com/rest/app/user/hasSignedIn`, headers: {Cookie: cookieVal}} - url.headers['access_token'] = `${tokenVal}` - url.headers['acPlatform'] = 'IPHONE' - url.headers['User-Agent'] = 'AcFun/6.14.2 (iPhone; iOS 13.3; Scale/2.00)' - url.body = `access_token=${cookieVal}` - chavy.post(url, (error, response, data) => { - const result = JSON.parse(data) - const title = `${cookieName}` - let subTitle = `` - let detail = `` - if (signresult.result == 0) { - subTitle = `签到结果: 成功` - } else if (signresult.result == 122) { - subTitle = `签到结果: 成功 (重复签到)` - } - detail = `共签: ${result.cumulativeDays}次, 连签: ${result.continuousDays}次, 说明: ${signresult.msg}` - chavy.msg(title, subTitle, detail) - chavy.log(`${cookieName}, data: ${data}`) - }) -} - -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} -} \ No newline at end of file diff --git a/Scripts/SignIn/ApkTw/README.md b/Scripts/SignIn/ApkTw/README.md deleted file mode 100644 index 8b9d55b..0000000 --- a/Scripts/SignIn/ApkTw/README.md +++ /dev/null @@ -1,87 +0,0 @@ -# APK.TW - -> 调整获取会话正则 (使用账号密码登录获取) - -## 配置 (Surge) - -```properties -[MITM] -apk.tw - -[Script] -http-request ^https://apk.tw\/member.php(.*?)action=login script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/apktw/apktw.cookie.js,requires-body=true -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/apktw/apktw.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -apk.tw - -[rewrite_local] -^https://apk.tw\/member.php(.*?)action=login url script-request-body apktw.cookie.js - -[task_local] -1 0 * * * apktw.js -``` - -## 说明 - -1. 访问: `https://apk.tw/` (如果你已经登录, 请先注销) -2. 使用账号密码登录 -3. 系统提示: `获取会话: 成功` (以登录成功后弹出的通知为准!) - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/ApkTw/apktw.cookie.js b/Scripts/SignIn/ApkTw/apktw.cookie.js deleted file mode 100644 index 0fc79f2..0000000 --- a/Scripts/SignIn/ApkTw/apktw.cookie.js +++ /dev/null @@ -1,46 +0,0 @@ -const $ = new Env('ApkTw') - -!(async () => { - $.log('', `🔔 ${$.name}, 获取会话: 开始!`, '') - const session = {} - session.url = $request.url - session.body = $request.body - session.headers = $request.headers - delete session.headers['Content-Length'] - delete session.headers['Cookie'] - $.log('', `url: ${session.url}`, `body: ${session.body}`, `headers: ${JSON.stringify(session.headers)}`) - if ($.setdata(JSON.stringify(session), 'chavy_cookie_apktw')) { - $.subt = '获取会话: 成功!' - } else { - $.subt = '获取会话: 失败!' - } -})() - .catch((e) => { - $.subt = '获取会话: 失败!' - $.desc = `原因: ${e}` - $.log(`❌ ${$.name}, 获取会话: 失败! 原因: ${e}!`) - }) - .finally(() => { - $.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 获取会话: 结束!`, ''), $.done() - }) - -// 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); - const e = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; - t && e.push(t), s && e.push(s), i && e.push(i), console.log(e.join("\n")) - }), 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 && (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)) -} diff --git a/Scripts/SignIn/ApkTw/apktw.js b/Scripts/SignIn/ApkTw/apktw.js deleted file mode 100644 index a9474cb..0000000 --- a/Scripts/SignIn/ApkTw/apktw.js +++ /dev/null @@ -1,114 +0,0 @@ -const $ = new Env('ApkTw') -$.VAL_login = $.getdata('chavy_cookie_apktw') - -!(async () => { - $.log('', `🔔 ${$.name}, 开始!`, '') - await login() - await getHash() - await sign() - await showmsg() -})() - .catch((e) => { - $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '') - }) - .finally(() => { - $.msg($.name, $.subt, ''), $.log('', `🔔 ${$.name}, 结束!`, ''), $.done() - }) - -// 登录 -function login() { - const url = JSON.parse($.VAL_login) - return new Promise((resove) => $.post(url, (error, response, data) => resove())) -} - -function getHash() { - return new Promise((resove) => { - const url = {url: 'https://apk.tw/', headers: {}} - url.headers['Host'] = 'apk.tw' - url.headers['Referer'] = 'https://apk.tw/forum.php' - url.headers['Accept'] = '*/*' - 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' - $.get(url, (error, response, data) => { - try { - if (error) throw new Error(error) - if (/\/source\/plugin\/dsu_amupper\/images\/wb\.gif/.test(data)) { - $.isSigned = true - $.isSignSuc = true - } else { - $.isSigned = false - const [hash] = /plugin.php\?id=dsu_amupper:pper([^('|")]*)/.exec(data) - if (hash) { - $.hash = hash - } else { - $.isSignSuc = false - } - } - } catch (e) { - $.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, '') - } finally { - resove() - } - }) - }) -} - -function sign() { - if ($.isSigned && !$.hash) return - return new Promise((resove) => { - const url = {url: `https://apk.tw/${$.hash}&inajax=1&ajaxtarget=my_amupper`, headers: {}} - $.log(`❕ ${url.url}!`) - url.headers['Host'] = 'apk.tw' - url.headers['Referer'] = 'https://apk.tw/forum.php' - url.headers['Accept'] = '*/*' - 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' - $.get(url, (error, response, data) => { - try { - if (error) throw new Error(error) - if (/\/source\/plugin\/dsu_amupper\/images\/wb\.gif/.test(data)) { - $.isSignSuc = true - } else { - $.isSignSuc = false - } - } catch (e) { - $.isSignSuc = false - $.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, '') - } finally { - resove() - } - }) - }) -} - -function showmsg() { - return new Promise((resove) => { - if ($.isSigned) { - $.subt = '签到: 重复' - } else if (!$.isSigned && $.isSignSuc) { - $.subt = '签到: 成功' - } else { - $.subt = '签到: 失败' - } - 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); - const e = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; - t && e.push(t), s && e.push(s), i && e.push(i), console.log(e.join("\n")) - }), 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 && (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)) -} diff --git a/Scripts/SignIn/Bcz/README.md b/Scripts/SignIn/Bcz/README.md deleted file mode 100644 index 86dc3bf..0000000 --- a/Scripts/SignIn/Bcz/README.md +++ /dev/null @@ -1,105 +0,0 @@ -# 百词斩 - -> 参考 chavy 签到脚本制作的百词斩领取铜板的脚本 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> 不需要手动编辑脚本 (获取 Cookie 和手机号码都由脚本自动完成) - -> 感谢 [@GideonSenku](https://github.com/GideonSenku) PR - -## 配置 (Surge) - -```properties -[MITM] -group.baicizhan.com - -[Script] -http-request ^https://group\.baicizhan\.com/group/rewards? script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/bcz/bcz.cookie.js - -cron "0 50 23 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/bcz/bcz.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -group.baicizhan.com - -[rewrite_local] -# 190及以后版本 -^https://group\.baicizhan\.com/group/rewards? url script-request-header bcz.cookie.js - -[task_local] -50 23 * * * bcz.js -``` - -## 说明 - -> 先在登录成功后, 再打开获取 Cookie 的脚本 - -1. 先配置`[MITM]` - - Surge&QuanX: group.baicizhan.com -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`bcz.cookie.js`和`bcz.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP 手动签到一次: 访问下右下角 `我` > `我的铜板` > `加入百词斩小班` > `去查看` > `我的小班进去 领铜板` -4. 系统提示: `获取Cookie: 成功` -5. 最后就可以把第 1 条脚本注释掉了 - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`23:50`执行一次. -7. 也可将脚本的cron语法自行更改,如我设置成 `0 */4 * * *` 则每4小时可提醒我背单词 - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) - -[@GideonSenku](https://github.com/GideonSenku) diff --git a/Scripts/SignIn/Bcz/bcz.cookie.js b/Scripts/SignIn/Bcz/bcz.cookie.js deleted file mode 100644 index aa85f2f..0000000 --- a/Scripts/SignIn/Bcz/bcz.cookie.js +++ /dev/null @@ -1,64 +0,0 @@ -const cookieName = '百词斩' -const cookieKey = 'senku_cookie_bcz' -const shareKey = 'senku_key_bcz' -const senku = init() - -if (this.$request && this.$request.headers) { - const cookieVal = $request.headers['Cookie'] - const url = $request.url - const index1 = url.indexOf('=') - const index2 = url.indexOf('&') - const shareVal = url.substring(index1 + 1, index2) - if (cookieVal && shareVal) { - if (senku.setdata(cookieVal, cookieKey) && senku.setdata(shareVal, shareKey)) { - senku.msg(`${cookieName}`, '获取Cookie: 成功', '') - senku.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`) - } - } -} - -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} -} - -senku.done() diff --git a/Scripts/SignIn/Bcz/bcz.js b/Scripts/SignIn/Bcz/bcz.js deleted file mode 100644 index 36c46aa..0000000 --- a/Scripts/SignIn/Bcz/bcz.js +++ /dev/null @@ -1,83 +0,0 @@ -const cookieName = '百词斩' -const cookieKey = 'senku_cookie_bcz' -const shareKey = 'senku_key_bcz' -const senku = init() -const cookieVal = senku.getdata(cookieKey) -const shareVal = senku.getdata(shareKey) - -let signinfo = {} -senku.log() -check() - -function check(cb) { - const url = {url: `https://group.baicizhan.com/group/apply_reward`, headers: {Cookie: cookieVal}} - url.headers['Content-Type'] = `text/plain;charset=utf-8` - url.headers['User-Agent'] = `Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.10(0x17000a21) NetType/4G Language/zh_CN` - const key = {share_key: shareVal} - url.body = JSON.stringify(key) - senku.log(url.body) - senku.post(url, (error, response, data) => { - signinfo = JSON.parse(data) - senku.log(JSON.stringify(signinfo)) - const title = `${cookieName}` - let subTitle = `` - let detail = '' - if (signinfo.code == 1) { - if (signinfo.data.is_new) { - subTitle += `成功` - detail = `获取铜板数${signinfo.data.reward[2]}` - } else { - subTitle += `今天的铜板已经领取,但是单词还是可以继续背的` - } - } else { - detail = `状态: 还玩手机?快去背单词` - subTitle += '失败' - } - senku.msg(title, subTitle, detail) - senku.done() - }) -} - -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} -} diff --git a/Scripts/SignIn/Bilibili/ExchangePoint.js b/Scripts/SignIn/Bilibili/ExchangePoint.js deleted file mode 100644 index 475ee51..0000000 --- a/Scripts/SignIn/Bilibili/ExchangePoint.js +++ /dev/null @@ -1,240 +0,0 @@ -/* -哔哩哔哩漫画, 积分商城自动抢购脚本 - -脚本兼容: Surge, QuantumultX, Loon - -************************* -【 抢购脚本注意事项 】: -************************* - -该脚本需要使用签到脚本获取Cookie后方可使用. -默认兑换积分商城中的"积分兑换", 兑换数量为用户积分可兑换的最大值 (可于BoxJs内修改) -默认执行时间为中午12:00:10、12:00:20、12:00:30 - -BoxJs订阅地址: https://raw.githubusercontent.com/NobyDa/Script/master/NobyDa_BoxJs.json - -************************* -【 Surge & Loon 脚本配置 】: -************************* - -[Script] -cron "10,20,30 0 12 * * *" script-path=https://raw.githubusercontent.com/NobyDa/Script/master/Bilibili-DailyBonus/ExchangePoints.js, wake-system=1, timeout=60 - -************************* -【 QX 1.0.10+ 脚本配置 】 : -************************* - -[task_local] -10,20,30 0 12 * * * https://raw.githubusercontent.com/NobyDa/Script/master/Bilibili-DailyBonus/ExchangePoints.js, tag=哔哩哔哩漫画抢券, enabled=true - -*/ - -// 新建一个实例对象, 把兼容函数定义到$中, 以便统一调用 -let $ = new nobyda(); - -// 读取兑换商品名, 默认兑换积分商城中的"积分兑换"; 该接口为BoxJs预留, 以便修改 -let productName = $.read('BM_ProductName') || '积分兑换'; - -// 读取兑换数量, 默认兑换最大值; 该接口为BoxJs预留, 以便修改 -let productNum = $.read('BM_ProductNum'); - -// 读取循环抢购次数, 默认100次; 该接口为BoxJs预留, 以便修改 -let exchangeNum = $.read('BM_ExchangeNum') || '100'; - -// 读取哔哩哔哩漫画签到脚本所使用的Cookie -let cookie = $.read('CookieBM'); - -// 预留的空对象, 便于函数之间读取数据 -let user = {}; - -(async function() { // 立即运行的匿名异步函数 - // 使用await关键字声明, 表示以同步方式执行异步函数, 可以简单理解为顺序执行 - await Promise.all([ //该方法用于将多个实例包装成一个新的实例, 可以简单理解为同时调用函数, 以进一步提高执行速度 - GetUserPoint(), //查询积分函数 - ListProduct() //查询商品函数 - ]); - await ExchangeProduct(); //上面的查询都完成后, 则执行抢购 - $.done(); //抢购完成后调用Surge、QX内部特有的函数, 用于退出脚本执行 -})(); - -function GetUserPoint() { - const pointUrl = { //查询积分接口 - url: 'https://manga.bilibili.com/twirp/pointshop.v1.Pointshop/GetUserPoint', - headers: { //请求头 - 'Cookie': cookie //用户鉴权Cookie - } - } - return new Promise((resolve) => { //主函数返回Promise实例对象, 以便后续调用时可以实现顺序执行异步函数 - $.post(pointUrl, (error, resp, data) => { //使用post请求查询, 再使用回调函数处理返回的结果 - try { //使用try方法捕获可能出现的代码异常 - if (error) { - throw new Error(error); //如果请求失败, 例如无法联网, 则抛出一个异常 - } else { - const body = JSON.parse(data); //解析响应体json并转化为对象 - if (body.code == 0 && body.data) { //如果响应体为预期格式 - user.point = parseInt(body.data.point); //把查询的积分赋值到全局变量user中 - console.log(`\n当前积分: ${body.data.point}`); //打印日志 - } else { //否则抛出一个异常 - throw new Error(body.msg || data); - } - } - } catch (e) { //接住try代码块中抛出的异常, 并打印日志 - console.log(`\n查询积分: 失败\n出现错误: ${e.message}`); - } finally { //finally语句在try和catch之后无论有无异常都会执行 - resolve(); //异步操作成功时调用, 将Promise对象的状态标记为"成功", 表示已完成查询积分 - } - }) - }) -} - -function ListProduct() { - const listUrl = { //查询商品接口 - url: 'https://manga.bilibili.com/twirp/pointshop.v1.Pointshop/ListProduct', - headers: {} - } - return new Promise((resolve) => { //主函数返回Promise实例对象, 以便后续调用时可以实现顺序执行异步函数 - $.post(listUrl, (error, resp, data) => { //使用post请求查询, 再使用回调函数处理返回的结果 - try { //使用try方法捕获可能出现的代码异常 - if (error) { - throw new Error(error); //如果请求失败, 例如无法联网, 则抛出一个异常 - } else { - const body = JSON.parse(data); //解析响应体json并转化为对象 - if (body.code == 0 && body.data.length >= 1) { //如果接口正常返回商品信息 - // 按全局变量所填写的商品名进行过滤, 并把商品信息赋值到全局变量user中 - user.list = body.data.filter(t => t.title == productName).pop(); - if (!user.list) { - throw new Error('请检查商品名'); //如果填错商品名则抛出一个异常 - } else { //否则打印日志 - console.log(`\n查询商品: ${productName}\n商品库存: ${user.list.remain_amount}`) - } - } else { //否则抛出一个异常 - throw new Error('无商品列表'); - } - } - } catch (e) { //接住try代码块中抛出的异常并打印日志 - console.log(`\n查询商品: ${productName}\n出现错误: ${e.message}`); - } finally { //finally语句在try和catch之后无论有无异常都会执行 - resolve(); //异步操作成功时调用, 将Promise对象的状态标记为"成功", 表示已完成查询商品 - } - }) - }) -} - -function ExchangeProduct() { - return new Promise(async (resolve) => { //主函数返回Promise实例对象, 以便后续调用时可以实现顺序执行异步函数, 该实例函数带有async关键字, 表示里面有异步操作, 例如可使用await得到异步结果 - if (user.list && user.list.remain_amount && user.point >= 100) { //如果商品有库存并且用户积分大于100则进行抢购 - //兑换商品数量(用户积分 除与 商品单价得到兑换数量), 并转成整数; 默认兑换最大数量 - const num = parseInt(productNum || (user.point / user.list.real_cost)); - const exchangeUrl = { - url: 'https://manga.bilibili.com/twirp/pointshop.v1.Pointshop/Exchange', //兑换商品接口 - headers: { //请求头 - 'Content-Type': 'application/json', //声明请求体数据格式 - 'Cookie': cookie //用户鉴权Cookie - }, - body: JSON.stringify({ //请求体转成字符串类型 - product_id: user.list.id, //兑换的商品id - product_num: num, //兑换的商品数量 - point: num * user.list.real_cost //消耗的积分总数 (兑换数量乘单价得到积分总数) - }) - }; - for (let i = 0; i < parseInt(exchangeNum); i++) { //根据全局变量定义的次数, 暴力循环抢购 - // 循环内调用另一个抢购函数, 并传入请求、第几次循环、兑换数量等参数, - // 使用await关键字声明, 表示需要等待每一次的执行结果 - const run = await startExchange(exchangeUrl, i, num); - if (run) { - break; //如果函数返回布尔值true, 则跳出循环, 脚本结束 - } - } - } else { //商品无库存或用户积分小于100等情况, 则不执行抢购, 脚本结束 - console.log(`\n抢购终止: 不具备兑换条件`); //打印日志 - } - resolve(); //将主函数的Promise对象状态标记为"成功", 表示已完成抢购任务 - }) -} - -function startExchange(url, item, amount) { - return new Promise((resolve) => { //主函数返回Promise实例对象, 以便后续调用时可以实现顺序执行异步函数 - $.post(url, (error, resp, data) => { //使用post请求查询, 再使用回调函数处理返回的结果 - try { //使用try方法捕获可能出现的代码异常 - if (error) { - throw new Error(error); //如果请求失败, 例如无法联网, 则抛出一个异常 - } else { - const body = JSON.parse(data); //解析响应体json并转化为对象 - if (body.code == 0) { //如果抢购成功, 则输出日志和通知 - console.log(`\n抢购成功: 第${item+1}次\n抢购数量: ${amount}\n消耗积分: ${amount * user.list.real_cost}`); - $.notify('哔哩哔哩漫画抢券', '', `"${productName}"抢购成功, 数量: ${amount}, 消耗积分: ${amount * user.list.real_cost}`); - resolve(true); //将Promise对象的状态标记为"成功", 然后返回一个布尔值true用于跳出循环 - } else { - throw new Error(body.msg || '未知'); //抢购失败则抛出异常 - } - } - } catch (e) { //接住try代码块中抛出的异常并打印日志 - console.log(`\n抢购失败: 第${item+1}次\n失败原因: ${e.message}`); - resolve(); //将Promise对象的状态标记为"成功", 但不返回任何值, 表示继续循环抢购 - } - }) - }) -} - -function nobyda() { - const isSurge = typeof $httpClient != "undefined"; - const isQuanX = typeof $task != "undefined"; - const isNode = typeof require == "function"; - const node = (() => { - if (isNode) { - const request = require('request'); - return { - request - } - } else { - return null; - } - })() - const adapterStatus = (response) => { - if (response) { - if (response.status) { - response["statusCode"] = response.status - } else if (response.statusCode) { - response["status"] = response.statusCode - } - } - return response - } - this.read = (key) => { - if (isQuanX) return $prefs.valueForKey(key) - if (isSurge) return $persistentStore.read(key) - } - this.notify = (title, subtitle, message) => { - if (isQuanX) $notify(title, subtitle, message) - if (isSurge) $notification.post(title, subtitle, message) - if (isNode) console.log(`${title}\n${subtitle}\n${message}`) - } - this.post = (options, callback) => { - options.headers['User-Agent'] = 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/609.3.5.0.2 (KHTML, like Gecko) Mobile/17G80 BiliApp/822 mobi_app/ios_comic channel/AppStore BiliComic/822' - if (isQuanX) { - if (typeof options == "string") options = { - url: options - } - options["method"] = "POST" - $task.fetch(options).then(response => { - callback(null, adapterStatus(response), response.body) - }, reason => callback(reason.error, null, null)) - } - if (isSurge) { - options.headers['X-Surge-Skip-Scripting'] = false - $httpClient.post(options, (error, response, body) => { - callback(error, adapterStatus(response), body) - }) - } - if (isNode) { - node.request.post(options, (error, response, body) => { - callback(error, adapterStatus(response), body) - }) - } - } - this.done = () => { - if (isQuanX || isSurge) { - $done() - } - } -}; \ No newline at end of file diff --git a/Scripts/SignIn/Bilibili/Manga.js b/Scripts/SignIn/Bilibili/Manga.js deleted file mode 100644 index b4ffaed..0000000 --- a/Scripts/SignIn/Bilibili/Manga.js +++ /dev/null @@ -1,107 +0,0 @@ -/* -哔哩哔哩漫画签到 - -脚本兼容: QuantumultX, Surge, Loon -电报频道:@NobyDa -问题反馈:@NobyDa_bot -如果转载,请注明出处 - -说明: -打开哔哩哔哩漫画后 (AppStore中国区),单击"我的", 如果通知获取cookie成功, 则可以使用此脚本. - -脚本将在每天上午9点执行。 您可以修改执行时间。 - -~~~~~~~~~~~~~~~~ -QX 1.0.10+ : - -[task_local] -0 9 * * * https://raw.githubusercontent.com/NobyDa/Script/master/Bilibili-DailyBonus/Manga.js, tag=Bili漫画签到 - -[rewrite_local] -#获取Bili漫画Cookie -^https:\/\/app\.bilibili\.com\/x\/v2\/account\/myinfo url script-request-header https://raw.githubusercontent.com/NobyDa/Script/master/Bilibili-DailyBonus/Manga.js - -[mitm] -hostname = app.bilibili.com -~~~~~~~~~~~~~~~~ -*/ - -const $ = new Env(`哔哩哔哩漫画`); - -const cookie = $.getdata("CookieBM") || ''; // 哔哩哔哩漫画Cookie - -const barkKey = ''; //Bark APP 通知推送Key - -if (typeof $request !== 'undefined') { - GetCookie() -} else { - checkin() -} - -function checkin() { - const bilibili = { - url: 'https://manga.bilibili.com/twirp/activity.v1.Activity/ClockIn', - headers: { - Cookie: cookie, - }, - body: "platform=ios" - }; - $.post(bilibili, async function(error, response, data) { - if (error && !data) { - $.msgBody = `请求失败!\n${error}`; - } else if (parseInt(response.status) == 200) { - $.msgBody = "签到成功!🎉"; - } else if (/duplicate/.test(data)) { - $.msgBody = "今日已签过 ⚠️"; - } else if (/uid must/.test(data)) { - $.msgBody = "Cookie失效 ‼️‼️"; - } else { - $.msgBody = `签到失败 ‼️\n${data}`; - } - if (barkKey) { - await BarkNotify($, barkKey, $.name, $.msgBody); - } - $.msg($.name, ``, $.msgBody); - $.done(); - }) -} - -function GetCookie() { - var CookieName = "B站漫画"; - var CookieKey = "CookieBM"; - var regex = /SESSDATA=.+?;/; - if ($request.headers) { - var header = Object.keys($request.headers).reduce((t, i) => (t[i.toLowerCase()] = $request.headers[i], t), {})['cookie'] || ''; - if (header.indexOf("SESSDATA=") != -1) { - var CookieValue = regex.exec(header)[0]; - if ($.getdata(CookieKey)) { - if ($.getdata(CookieKey) != CookieValue) { - var cookie = $.setdata(CookieValue, CookieKey); - if (!cookie) { - $.msg("更新" + CookieName + "Cookie失败‼️", "", ""); - } else { - $.msg("更新" + CookieName + "Cookie成功 🎉", "", ""); - } - } - } else { - var cookie = $.setdata(CookieValue, CookieKey); - if (!cookie) { - $.msg("首次写入" + CookieName + "Cookie失败‼️", "", ""); - } else { - $.msg("首次写入" + CookieName + "Cookie成功 🎉", "", ""); - } - } - } else { - $.msg("写入" + CookieName + "Cookie失败‼️", "", "Cookie关键值缺失"); - } - } else { - $.msg("写入" + CookieName + "Cookie失败‼️", "", "配置错误, 无法读取请求头,"); - } - $.done() -} - -//Bark APP notify -async function BarkNotify(c,k,t,b){for(let i=0;i<3;i++){console.log(`🔷Bark notify >> Start push (${i+1})`);const s=await new Promise((n)=>{c.post({url:'https://api.day.app/push',headers:{'Content-Type':'application/json'},body:JSON.stringify({title:t,body:b,device_key:k,ext_params:{group:t}})},(e,r,d)=>r&&r.status==200?n(1):n(d||e))});if(s===1){console.log('✅Push success!');break}else{console.log(`❌Push failed! >> ${s.message||s}`)}}}; - -// https://github.com/chavyleung/scripts/blob/master/Env.min.js -function Env(t,e){class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),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&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}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),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;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),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}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,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||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,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/Scripts/SignIn/Bilibili/README.md b/Scripts/SignIn/Bilibili/README.md deleted file mode 100644 index 5bb24ae..0000000 --- a/Scripts/SignIn/Bilibili/README.md +++ /dev/null @@ -1,107 +0,0 @@ -# bilibili - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> 目前可签 bilibili 直播 (直播!直播!直播!) + 银瓜子转硬币 - -> 2020.1.11 QuanX 在`190`版本开始, 获取 Cookie 方式需要从`script-response-body`改为`script-request-header` - -> 2020.3.16 添加银瓜子转硬币脚本 感谢[@lcandy2](https://github.com/lcandy2) PR - -## 配置 (Surge) - -```properties -[MITM] -*.bilibili.com - -[Script] -http-request ^https:\/\/(www|live)\.bilibili\.com\/?.? script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/bilibili/bilibili.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/bilibili/bilibili.js -# 如需银瓜子转硬币,添加以下内容 -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/bilibili/bilibili.silver2coin.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -*.bilibili.com - -[rewrite_local] -# 189及以前版本 -^https:\/\/(www|live)\.bilibili\.com\/?.? url script-response-body bilibili.cookie.js -# 190及以后版本 -^https:\/\/(www|live)\.bilibili\.com\/?.? url script-request-header bilibili.cookie.js - -[task_local] -1 0 * * * bilibili.js -# 如需银瓜子转硬币,添加以下内容 -1 0 * * * bilibili.silver2coin.js -``` - -## 说明 - -1. 先在浏览器登录 `(先登录! 先登录! 先登录!)` -2. 先把`*.bilibili.com`加到`[MITM]` -3. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`bilibili.cookie.js`和`bilibili.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -4. 打开浏览器访问: https://www.bilibili.com 或 https://live.bilibili.com -5. 系统提示: `获取Cookie: 成功` -6. 最后就可以把第 1 条脚本注释掉了 - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) - -[@lcandy2](https://github.com/lcandy2) diff --git a/Scripts/SignIn/Bilibili/bilibili.cookie.js b/Scripts/SignIn/Bilibili/bilibili.cookie.js deleted file mode 100644 index 0819eb0..0000000 --- a/Scripts/SignIn/Bilibili/bilibili.cookie.js +++ /dev/null @@ -1,56 +0,0 @@ -const cookieName = 'bilibili' -const cookieKey = 'chavy_cookie_bilibili' -const chavy = init() -const cookieVal = $request.headers['Cookie'] -if (cookieVal) { - if (chavy.setdata(cookieVal, cookieKey)) { - chavy.msg(`${cookieName}`, '获取Cookie: 成功', '') - chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`) - } -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/Bilibili/bilibili.js b/Scripts/SignIn/Bilibili/bilibili.js deleted file mode 100644 index acf166f..0000000 --- a/Scripts/SignIn/Bilibili/bilibili.js +++ /dev/null @@ -1,110 +0,0 @@ -const cookieName = 'bilibili' -const cookieKey = 'chavy_cookie_bilibili' -const chavy = init() -const cookieVal = chavy.getdata(cookieKey) - -sign() - -function sign() { - let url = { - url: `https://api.live.bilibili.com/sign/doSign`, - headers: { - Cookie: cookieVal - } - } - url.headers['Origin'] = 'api.live.bilibili.com' - url.headers['Referer'] = 'http://live.bilibili.com/' - url.headers['Accept'] = 'application/json, text/javascript, */*; q=0.01' - 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' - - chavy.get(url, (error, response, data) => { - let result = JSON.parse(data) - let title = `${cookieName}` - // 签到成功 - if (result && result.code == 0) { - let subTitle = `签到结果: 成功` - let detail = `本月累计: ${result.data.hadSignDays}/${result.data.allDays}次, 说明: ${result.data.text}` - chavy.msg(title, subTitle, detail) - } - // 签到重复 - else if (result && result.code == 1011040) { - getsigninfo() - } - // 签到失败 - else { - let subTitle = `签到结果: 失败` - let detail = `说明: ${result.message}` - chavy.msg(title, subTitle, detail) - } - chavy.log(`${cookieName}, data: ${data}`) - }) - - chavy.done() -} - -function getsigninfo() { - let url = { - url: `https://api.live.bilibili.com/sign/GetSignInfo`, - headers: { - Cookie: cookieVal - } - } - url.headers['Host'] = 'api.live.bilibili.com' - url.headers['Origin'] = 'http://live.bilibili.com' - url.headers['Referer'] = 'http://live.bilibili.com/' - url.headers['Accept'] = 'application/json, text/javascript, */*; q=0.01' - 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' - - chavy.get(url, (error, response, data) => { - let title = `${cookieName}` - let subTitle = `签到结果: 成功 (重复签到)` - let detail = `` - let result = JSON.parse(data) - if (result && result.code == 0) detail = `本月累计: ${result.data.hadSignDays}/${result.data.allDays}次, 说明: ${result.data.text}` - chavy.msg(title, subTitle, detail) - }) -} - -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} -} diff --git a/Scripts/SignIn/Bilibili/bilibili.silver2coin.js b/Scripts/SignIn/Bilibili/bilibili.silver2coin.js deleted file mode 100644 index 8993ecd..0000000 --- a/Scripts/SignIn/Bilibili/bilibili.silver2coin.js +++ /dev/null @@ -1,89 +0,0 @@ -const cookieName = 'bilibili' -const cookieKey = 'chavy_cookie_bilibili' -const chavy = init() -const cookieVal = chavy.getdata(cookieKey) - -sign() - -function sign() { - let url = { - url: `https://api.live.bilibili.com/pay/v1/Exchange/silver2coin`, - headers: { - Cookie: cookieVal - } - } - url.headers['Origin'] = 'api.live.bilibili.com' - url.headers['Referer'] = 'http://live.bilibili.com/' - url.headers['Accept'] = 'application/json, text/javascript, */*; q=0.01' - 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' - - chavy.get(url, (error, response, data) => { - let result = JSON.parse(data) - let title = `${cookieName} 银瓜子转硬币` - // 兑换成功 - if (result && result.code == 0) { - let subTitle = `${result.message}` - let detail = `成功兑换: ${result.data.coin} 个硬币\n当前银瓜子: ${result.data.silver} , 当前金瓜子: ${result.data.gold}` - chavy.msg(title, subTitle, detail) - } - // 兑换中止(重复兑换&银瓜子不足) - else if (result && result.code == 403) { - let subTitle = `未成功兑换` - let detail = `${result.message}` - chavy.msg(title, subTitle, detail) - } - // 兑换失败 - else { - let subTitle = `兑换失败` - let detail = `说明: ${result.message}` - chavy.msg(title, subTitle, detail) - } - chavy.log(`${cookieName}, data: ${data}`) - }) - - chavy.done() -} - -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} -} diff --git a/Scripts/SignIn/Box/chavy.boxjs.json b/Scripts/SignIn/Box/chavy.boxjs.json deleted file mode 100644 index 9531bd6..0000000 --- a/Scripts/SignIn/Box/chavy.boxjs.json +++ /dev/null @@ -1,275 +0,0 @@ -{ - "id": "chavyleung.app.sub", - "name": "chavyleung应用订阅", - "author": "@chavyleung", - "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", - "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" - ] - }, - { - "id": "chavyleung.suning", - "name": "苏宁易购", - "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/suning.png" - ] - }, - { - "id": "chavyleung.bilibili.live", - "name": "bilibili直播", - "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" - ] - }, - { - "id": "chavyleung.meituan", - "name": "美团", - "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" - ] - }, - { - "id": "chavyleung.mgtv", - "name": "芒果TV", - "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" - ] - }, - { - "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" - ] - }, - { - "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" - ] - }, - { - "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" - ] - }, - { - "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/Scripts/SignIn/Box/release/box.release.json b/Scripts/SignIn/Box/release/box.release.json deleted file mode 100644 index 694a566..0000000 --- a/Scripts/SignIn/Box/release/box.release.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "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" - ], - "author": "@chavyleung", - "icon": "https://avatars3.githubusercontent.com/u/29748519", - "repo": "https://github.com/chavyleung", - "notes": [ - { - "name": "新增", - "descs": [ - "全局搜索" - ] - } - ] - }, - { - "version": "0.2.4", - "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" - ], - "author": "@chavyleung", - "icon": "https://avatars3.githubusercontent.com/u/29748519", - "repo": "https://github.com/chavyleung", - "notes": [ - { - "name": "优化", - "descs": [ - "悬浮按钮刷新不用确认", - "侧栏可以隐藏帮助按钮" - ] - } - ] - }, - { - "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" - ], - "author": "@chavyleung", - "icon": "https://avatars3.githubusercontent.com/u/29748519", - "repo": "https://github.com/chavyleung", - "notes": [ - { - "name": "新增", - "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/Scripts/SignIn/Box/switcher/box.switcher.js b/Scripts/SignIn/Box/switcher/box.switcher.js deleted file mode 100644 index f12b515..0000000 --- a/Scripts/SignIn/Box/switcher/box.switcher.js +++ /dev/null @@ -1,236 +0,0 @@ -const $ = new Env('会话切换') -$.KEY_sessions = 'chavy_boxjs_sessions' -$.KEY_curSessions = 'chavy_boxjs_cur_sessions' -$.CFG_isSilent = $.getdata('CFG_BoxSwitcher_isSilent') - -!(async () => { - await execSwitch() - await showmsg() -})() - .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: []} - const app = apps[appId] - app.sessions.push(session) - }) - Object.keys(apps).forEach((appId) => { - const app = apps[appId] - if (app.sessions.length <= 1) { - $.desc.push(`${app.name}: 跳过! 原因: 只有 1 个会话?`) - return true - } - 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([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 ? '(新一轮)' : ''}`) - }) - $.setdata(JSON.stringify(curSessions), $.KEY_curSessions) - resove() - }) -} - -function getSessions() { - const sessionstr = $.getdata($.KEY_sessions) - 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.join('\n')) - } else { - $.log('', ...$.desc) - } - resove() - }) -} - -// 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/Scripts/SignIn/Bubei/README.md b/Scripts/SignIn/Bubei/README.md deleted file mode 100644 index 3e58d3e..0000000 --- a/Scripts/SignIn/Bubei/README.md +++ /dev/null @@ -1,104 +0,0 @@ -# 不背单词 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> 感谢[@danchaw](https://github.com/danchaw) PR -## 配置 (Surge) - -```properties -[MITM] -sapi.beingfine.cn - -[Script] -http-request ^https:\/\/sapi\.beingfine\.cn\/v3\/bb\/reward\/by-sign-in script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/bubei/bubei.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/bubei/bubei.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -sapi.beingfine.cn - -[rewrite_local] - -# [商店版] -^https:\/\/sapi\.beingfine\.cn\/v3\/bb\/reward\/by-sign-in url script-request-header bubei.js - -# [TestFlight] -^https:\/\/sapi\.beingfine\.cn\/v3\/bb\/reward\/by-sign-in url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/bubei/bubei.js - -[task_local] - -# [商店版] -1 0 * * * bubei.js - -# [TestFlight] -1 0 * * * https://raw.githubusercontent.com/chavyleung/scripts/master/bubei/bubei.js -``` - -## 说明 - -1. 先把`sapi.beingfine.cn`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`bubei.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP[不背单词](https://apps.apple.com/cn/app/%E4%B8%8D%E8%83%8C%E5%8D%95%E8%AF%8D-%E7%9C%9F%E5%AE%9E%E8%AF%AD%E5%A2%83%E5%AD%A6%E8%8B%B1%E8%AF%AD%E5%8D%95%E8%AF%8D/id698570469) 然后手动签到 1 次, 系统提示: `首次写入不背单词Url成功🎉`和`首次写入不背单词Cookie成功🎉` -4. 最后就可以把第 1 条脚本注释掉了 -5. 运行一次脚本, 如果提示说明:aceess_denied#30103, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) - -[@danchaw](https://github.com/danchaw) diff --git a/Scripts/SignIn/Bubei/bubei.js b/Scripts/SignIn/Bubei/bubei.js deleted file mode 100644 index ecc9942..0000000 --- a/Scripts/SignIn/Bubei/bubei.js +++ /dev/null @@ -1,142 +0,0 @@ -var appName = '不背单词' -var bubei = init() -var URL = bubei.getdata("UrlBB") -var KEY = bubei.getdata("CookieBB") - -let isGetCookie = typeof $request !== 'undefined' - -if (isGetCookie) { - getcookie() -} else { - sign() -} - -function getcookie() { - var url = $request.url; - if (url) { - var UrlKeyBB = "UrlBB"; - var UrlValueBB = url; - if (bubei.getdata(UrlKeyBB) != (undefined || null)) { - if (bubei.getdata(UrlKeyBB) != UrlValueBB) { - var url = bubei.setdata(UrlValueBB, UrlKeyBB); - if (!url) { - bubei.msg("更新" + appName + "Url失败‼️", "", ""); - } else { - bubei.msg("更新" + appName + "Url成功🎉", "", ""); - } - } else { - bubei.msg(appName + "Url未变化❗️", "", ""); - } - } else { - var url = bubei.setdata(UrlValueBB, UrlKeyBB); - if (!url) { - bubei.msg("首次写入" + appName + "Url失败‼️", "", ""); - } else { - bubei.msg("首次写入" + appName + "Url成功🎉", "", ""); - } - } - } else { - bubei.msg("写入" + appName + "Url失败‼️", "", "配置错误, 无法读取URL, "); - } - if ($request.headers) { - var CookieKeyBB = "CookieBB"; - var CookieValueBB = JSON.stringify($request.headers); - if (bubei.getdata(CookieKeyBB) != (undefined || null)) { - if (bubei.getdata(CookieKeyBB) != CookieValueBB) { - var cookie = bubei.setdata(CookieValueBB, CookieKeyBB); - if (!cookie) { - bubei.msg("更新" + appName + "Cookie失败‼️", "", ""); - } else { - bubei.msg("更新" + appName + "Cookie成功🎉", "", ""); - } - } else { - bubei.msg(appName + "Cookie未变化❗️", "", ""); - } - } else { - var cookie = bubei.setdata(CookieValueBB, CookieKeyBB); - if (!cookie) { - bubei.msg("首次写入" + appName + "Cookie失败‼️", "", ""); - } else { - bubei.msg("首次写入" + appName + "Cookie成功🎉", "", ""); - } - } - } else { - bubei.msg("写入" + appName + "Cookie失败‼️", "", "配置错误, 无法读取请求头, "); - } - bubei.done() -} - -function sign() { - var t1 = new Date().getTime() - var t2 = t1 + 1 - URL = URL.replace(/by-sign-in\/\d*/g, "by-sign-in/" + t1).replace(/timestamp=\d*/g, "timestamp=" + t2) - const url = {url: URL, headers: JSON.parse(KEY)} - bubei.get(url, (error, response, data) => { - bubei.log(`${appName}, data: ${data}`) - const title = `${appName}` - let subTitle = '' - let detail = '' - const result = JSON.parse(data) - if (result.result_code == 200) { - subTitle = `签到结果: 成功` - } else { - subTitle = `签到结果: 未知` - detail = `说明: ${result.error_body.user_msg}` - } - bubei.msg(title, subTitle, detail) - bubei.done() - }) -} - -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)) - } - } - put = (url, cb) => { - if (isSurge()) { - $httpClient.put(url, cb) - } - if (isQuanX()) { - url.method = 'PUT' - $task.fetch(url).then((resp) => cb(null, {}, resp.body)) - } - } - done = (value = {}) => { - $done(value) - } - return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done} -} \ No newline at end of file diff --git a/Scripts/SignIn/CSDN/README.md b/Scripts/SignIn/CSDN/README.md deleted file mode 100644 index 49ad001..0000000 --- a/Scripts/SignIn/CSDN/README.md +++ /dev/null @@ -1,102 +0,0 @@ -# CSDN - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> 2020.3.11 更新获取刷新链接正则 (更新后打开 App 即可获取刷新链接, 无需重新获取 Cookie) - -> 2020.3.12 增加自动抽奖 (如果有抽奖机会的话) (无需重新获取 Cookie) - -> 2020.3.12 如果发现无法签到 (后台日志报错), 注销一下 csdn 账号重新登录, 再重新获取下刷新链接 - -## 配置 (Surge) - -```properties -[MITM] -*.csdn.net - -[Script] -# 注意获取Cookie有两条脚本 -http-request ^https:\/\/passport.csdn.net\/v2\/api\/app\/login\/checkAndRefreshToken script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/csdn/csdn.cookie.js -http-request ^https:\/\/gw.csdn.net\/mini-app\/v2\/lucky_draw\/login\/sign_in\? script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/csdn/csdn.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/csdn/csdn.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -*.csdn.net - -[rewrite_local] -# 注意获取Cookie有两条脚本 -^https:\/\/passport.csdn.net\/v2\/api\/app\/login\/checkAndRefreshToken url script-request-header csdn.cookie.js -^https:\/\/gw.csdn.net\/mini-app\/v2\/lucky_draw\/login\/sign_in\? url script-request-header csdn.cookie.js - -[task_local] -1 0 * * * csdn.js -``` - -## 说明 - -1. 先把`*.csdn.net`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`csdn.cookie.js`和`csdn.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP , 系统提示: `获取刷新链接: 成功` -4. 然后手动签到 1 次, 系统提示: `获取Cookie: 成功` -5. 最后就可以把两条获取 Cookie 的脚本注释掉了 -6. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/CSDN/csdn.cookie.js b/Scripts/SignIn/CSDN/csdn.cookie.js deleted file mode 100644 index fba2d63..0000000 --- a/Scripts/SignIn/CSDN/csdn.cookie.js +++ /dev/null @@ -1,71 +0,0 @@ -const cookieName = 'CSDN' -const tokenurlKey = 'chavy_tokenurl_csdn' -const tokenheaderKey = 'chavy_tokenheader_csdn' -const signurlKey = 'chavy_signurl_csdn' -const signheaderKey = 'chavy_signheader_csdn' -const chavy = init() - -let title = `` -let detail = `` -if ($request && $request.method != 'OPTIONS' && $request.headers.Host == 'passport.csdn.net') { - const tokenurlVal = $request.url - const tokenheaderVal = JSON.stringify($request.headers) - if (tokenurlVal) chavy.setdata(tokenurlVal, tokenurlKey) - if (tokenheaderVal) chavy.setdata(tokenheaderVal, tokenheaderKey) - title = `获取刷新链接: 成功` - detail = `请进入 "我的>签到" 并手动签到1次` - chavy.msg(`${cookieName}`, title, detail) -} else if ($request && $request.method != 'OPTIONS' && $request.headers.Host == 'gw.csdn.net') { - const signurlVal = $request.url - const signheaderVal = JSON.stringify($request.headers) - if (signurlVal) chavy.setdata(signurlVal, signurlKey) - if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey) - title = `获取Cookie: 成功 (手动签到)` - chavy.msg(`${cookieName}`, title, detail) -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/CSDN/csdn.js b/Scripts/SignIn/CSDN/csdn.js deleted file mode 100644 index 001e2c9..0000000 --- a/Scripts/SignIn/CSDN/csdn.js +++ /dev/null @@ -1,206 +0,0 @@ -const chavy = init() -const cookieName = 'CSDN' -const KEY_loginurl = 'chavy_tokenurl_csdn' -const KEY_loginheader = 'chavy_tokenheader_csdn' -const KEY_signurl = 'chavy_signurl_csdn' -const KEY_signheader = 'chavy_signheader_csdn' - -const signinfo = {} -let VAL_loginurl = chavy.getdata(KEY_loginurl) -let VAL_loginheader = chavy.getdata(KEY_loginheader) -let VAL_signurl = chavy.getdata(KEY_signurl) -let VAL_signheader = chavy.getdata(KEY_signheader) - -;(sign = async () => { - chavy.log(`🔔 ${cookieName}`) - await loginapp() - await signapp() - await getlucky() - for (let i = 0; i < signinfo.lucky.data.drawTimes; i++) { - await luckyapp() - } - showmsg() - chavy.done() -})().catch((e) => chavy.log(`❌ ${cookieName} 签到失败: ${e}`), chavy.done()) - -function loginapp() { - return new Promise((resolve, reject) => { - const url = {url: VAL_loginurl, headers: JSON.parse(VAL_loginheader)} - chavy.get(url, (error, response, data) => { - try { - signinfo.loginapp = JSON.parse(data) - updateSignAppCookies() - resolve() - } catch (e) { - chavy.msg(cookieName, `登录结果: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} loginapp - 登录失败: ${e}`) - chavy.log(`❌ ${cookieName} loginapp - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function updateSignAppCookies() { - if (signinfo.loginapp) { - const signheaderObj = JSON.parse(VAL_signheader) - signheaderObj['JWT-TOKEN'] = signinfo.loginapp.data.token - signheaderObj['Cookie'] = signheaderObj['Cookie'].replace(/JWT-TOKEN=[^;]*/, `JWT-TOKEN=${signinfo.loginapp.data.token}`) - VAL_signheader = JSON.stringify(signheaderObj) - } else { - chavy.log(`⚠ ${cookieName} updateSignAppCookies: 请先获取 Cookies`) - } -} - -function signapp() { - return new Promise((resolve, reject) => { - const url = {url: VAL_signurl, body: '{}', 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() - } - }) - }) -} - -function getlucky() { - return new Promise((resolve, reject) => { - const VAL_getluckyurl = `https://gw.csdn.net/mini-app/v2/lucky_draw/login/sign_info?projectVersion=1.0.0` - const url = {url: VAL_getluckyurl, headers: JSON.parse(VAL_signheader)} - delete url.headers['Content-Length'] - url.headers['Connection'] = 'keep-alive' - url.headers['Accept-Encoding'] = 'gzip, deflate, br' - url.headers['X-OS'] = 'iOS' - url.headers['Content-Type'] = 'application/json' - url.headers['X-App-ID'] = 'CSDN-APP' - url.headers['Origin'] = 'https://webapp.csdn.net' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 CSDNApp/4.1.5(iOS) AnalysysAgent/Hybrid' - url.headers['Referer'] = 'https://webapp.csdn.net/' - url.headers['Host'] = 'gw.csdn.net' - url.headers['Accept-Language'] = 'zh-cn' - url.headers['Accept'] = '*/*' - - chavy.get(url, (error, response, data) => { - try { - signinfo.lucky = JSON.parse(data) - resolve() - } catch (e) { - chavy.msg(cookieName, `获取抽奖次数: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} getlucky - 获取抽奖次数失败: ${e}`) - chavy.log(`❌ ${cookieName} getlucky - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function luckyapp() { - return new Promise((resolve, reject) => { - const VAL_luckyappurl = `https://gw.csdn.net/mini-app/v2/lucky_draw/login/good_luck?projectVersion=1.0.0` - const url = {url: VAL_luckyappurl, body: '{}', headers: JSON.parse(VAL_signheader)} - url.headers['Connection'] = 'keep-alive' - url.headers['Accept-Encoding'] = 'gzip, deflate, br' - url.headers['X-OS'] = 'iOS' - url.headers['Content-Type'] = 'application/json' - url.headers['X-App-ID'] = 'CSDN-APP' - url.headers['Origin'] = 'https://webapp.csdn.net' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 CSDNApp/4.1.5(iOS) AnalysysAgent/Hybrid' - url.headers['Referer'] = 'https://webapp.csdn.net/' - url.headers['Host'] = 'gw.csdn.net' - url.headers['Accept-Language'] = 'zh-cn' - url.headers['Accept'] = '*/*' - chavy.post(url, (error, response, data) => { - try { - chavy.log(`❕ ${cookieName} luckyapp - response: ${JSON.stringify(response)}`) - signinfo.luckylist = signinfo.luckylist ? signinfo.luckylist : [] - signinfo.luckylist.push(JSON.parse(data)) - resolve() - } catch (e) { - chavy.msg(cookieName, `抽奖结果: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} luckyapp - 抽奖失败: ${e}`) - chavy.log(`❌ ${cookieName} luckyapp - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function showmsg() { - let subTitle = '' - let detail = '' - if (signinfo.signapp.code == 200) { - if (signinfo.signapp.data.isSigned === false) { - subTitle = `签到结果: 成功` - detail = `共签: ${signinfo.signapp.data.totalCount}天, 连签: ${signinfo.signapp.data.keepCount}天` - } else if (signinfo.signapp.data.isSigned === true) { - subTitle = `签到结果: 重复` - } else { - subTitle = `签到结果: 失败` - detail = `编码: ${signinfo.signapp.code}, 说明: ${signinfo.signapp.msg}` - } - } else { - subTitle = `签到结果: 失败` - detail = `说明: 详见日志` - } - - if (signinfo.lucky && signinfo.lucky.data && signinfo.lucky.data.drawTimes && signinfo.lucky.data.drawTimes > 0) { - subTitle += `; 抽奖次数: ${signinfo.lucky.data.drawTimes}` - detail += `\n查看抽奖详情\n` - for (let i = 0; i < signinfo.luckylist.length; i++) { - const can_draw = signinfo.luckylist[i].data.can_draw - if (can_draw) detail += `\n抽奖 ${i + 1}: ${signinfo.luckylist[i].data.title}` - else detail += `\n抽奖 ${i + 1}: ${signinfo.luckylist[i].data.msg}` - } - } - chavy.msg(cookieName, subTitle, detail) -} - -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} -} diff --git a/Scripts/SignIn/DBSJ/README.md b/Scripts/SignIn/DBSJ/README.md deleted file mode 100644 index 50a3ab0..0000000 --- a/Scripts/SignIn/DBSJ/README.md +++ /dev/null @@ -1,105 +0,0 @@ -# 豆瓣时间 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> QuanX 需要: v1.0.6-build195 及以后版本 (TestFlight) - -> 感谢 [@GideonSenku](https://github.com/GideonSenku) Commit - -> 实现过程[nocoding.xyz](http://nocoding.xyz/2020/03/28/build-check/) -## 配置 (Surge) - -```properties -[MITM] -frodo.douban.com - -[Script] -http-request ^https:\/\/frodo\.douban\.com\/api\/v2\/niffler\/check_in\/status script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/dbsj/dbsj.cookie.js - -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/dbsj/dbsj.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -frodo.douban.com - -[rewrite_local] - -# [商店版] QuanX v1.0.6-build194 及更早版本 -^https:\/\/frodo\.douban\.com\/api\/v2\/niffler\/check_in\/status url script-request-header dbsj.cookie.js - -# [TestFlight] QuanX v1.0.6-build195 及以后版本 -^https:\/\/frodo\.douban\.com\/api\/v2\/niffler\/check_in\/status url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/dbsj/dbsj.cookie.js - -[task_local] -1 0 * * * dbsj.js -``` - -## 说明 - -1. 先把`frodo.douban.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`dbsj.cookie.js`和`dbsj.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP 手动签到一次: `市集` > `豆瓣时间` > `签到` -4. 系统提示: `获取Cookie: 成功` -5. 把获取 Cookie 的脚本注释掉 -6. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) - -[@GideonSenku](https://github.com/GideonSenku) diff --git a/Scripts/SignIn/DBSJ/dbsj.cookie.js b/Scripts/SignIn/DBSJ/dbsj.cookie.js deleted file mode 100644 index c060398..0000000 --- a/Scripts/SignIn/DBSJ/dbsj.cookie.js +++ /dev/null @@ -1,61 +0,0 @@ -const cookieName = '豆瓣时间' -const signurlKey = 'senku_signurl_dbsj' -const signheaderKey = 'senku_signheader_dbsj' -const signbodyKey = 'senku_signbody_dbsj' -const senku = init() - -const requrl = $request.url -if ($request && $request.method != 'OPTIONS') { - const signurlVal = requrl - const signheaderVal = JSON.stringify($request.headers) - - if (signurlVal) senku.setdata(signurlVal, signurlKey) - if (signheaderVal) senku.setdata(signheaderVal, signheaderKey) - senku.msg(cookieName, `获取Cookie: 成功`, ``) -} - -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} -} - -senku.done() diff --git a/Scripts/SignIn/DBSJ/dbsj.js b/Scripts/SignIn/DBSJ/dbsj.js deleted file mode 100644 index 70e2b02..0000000 --- a/Scripts/SignIn/DBSJ/dbsj.js +++ /dev/null @@ -1,77 +0,0 @@ -const cookieName = '豆瓣时间' -const signurlKey = 'senku_signurl_dbsj' -const signheaderKey = 'senku_signheader_dbsj' -const signbodyKey = 'senku_signbody_dbsj' -const senku = init() -const signurlVal = senku.getdata(signurlKey) -const signheaderVal = senku.getdata(signheaderKey) - -sign() - -function sign() { - - const url = {url: signurlVal, headers: JSON.parse(signheaderVal)} - senku.get(url, (error, response, data) => { - const result = JSON.parse(data) - let subTitle = `` - let detail = `` - const has_checked = result.today_status.has_checked - const continuous_check_in_count = result.continuous_check_in_count - const status = result.auto_check.status - if (status == "success") { - subTitle = `签到结果: 成功` - detail = `连续签到天数${continuous_check_in_count}` - } else if (has_checked == false) { - subTitle = `签到结果: 重复` - } else if (has_checked == false) { - subTitle = `签到结果: 失败` - } - senku.msg(cookieName, subTitle, detail) - senku.done() - }) -} - - -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} -} diff --git a/Scripts/SignIn/Dongqiudi/README.md b/Scripts/SignIn/Dongqiudi/README.md deleted file mode 100644 index 82aac12..0000000 --- a/Scripts/SignIn/Dongqiudi/README.md +++ /dev/null @@ -1,94 +0,0 @@ -# 懂球帝 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -## 配置 (Surge) - -```properties -[MITM] -api.dongqiudi.com - -[Script] -http-request ^https:\/\/api\.dongqiudi\.com\/v2\/user\/is_login script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/dongqiudi/dongqiudi.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/dongqiudi/dongqiudi.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -api.dongqiudi.com - -[rewrite_local] -# 189及以前版本 -^https:\/\/api\.dongqiudi\.com\/v2\/user\/is_login url script-response-body dongqiudi.cookie.js -# 190及以后版本 -^https:\/\/api\.dongqiudi\.com\/v2\/user\/is_login url script-request-header dongqiudi.cookie.js - -[task_local] -1 0 * * * dongqiudi.js -``` - -## 说明 - -1. 先把`api.dongqiudi.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`dongqiudi.cookie.js`和`dongqiudi.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开懂球帝 (打开前先杀掉 APP) -4. 系统提示: `获取Cookie: 成功` (如果不提示获取成功, 尝试杀进程再进个人中心) -5. 最后就可以把第 1 条脚本注释掉了 - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/Dongqiudi/dongqiudi.cookie.js b/Scripts/SignIn/Dongqiudi/dongqiudi.cookie.js deleted file mode 100644 index a9a8feb..0000000 --- a/Scripts/SignIn/Dongqiudi/dongqiudi.cookie.js +++ /dev/null @@ -1,57 +0,0 @@ -const cookieName = '懂球帝' -const cookieKey = 'chavy_cookie_dongqiudi' -const chavy = init() -const cookieVal = JSON.stringify({ - UUID: $request.headers['UUID'], - Authorization: $request.headers['Authorization'] -}) -if (cookieVal && chavy.setdata(cookieVal, cookieKey)) { - chavy.msg(`${cookieName}`, '获取Cookie: 成功', '') - chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`) -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/Dongqiudi/dongqiudi.js b/Scripts/SignIn/Dongqiudi/dongqiudi.js deleted file mode 100644 index 146f6ee..0000000 --- a/Scripts/SignIn/Dongqiudi/dongqiudi.js +++ /dev/null @@ -1,82 +0,0 @@ -const cookieName = '懂球帝' -const cookieKey = 'chavy_cookie_dongqiudi' -const chavy = init() -const cookieVal = JSON.parse(chavy.getdata(cookieKey)) - -sign() - -function sign() { - let url = {url: `https://api.dongqiudi.com/v3/useract/sign/tasknew/index`, headers: {}} - url.headers['UUID'] = `${cookieVal.UUID}` - url.headers['Authorization'] = `${cookieVal.Authorization}` - url.headers['Accept-Encoding'] = `gzip, deflate, br` - url.headers['Origin'] = `https://n.dongqiudi.com` - url.headers['Connection'] = `keep-alive` - url.headers['Accept'] = `application/json, text/plain, */*` - url.headers['Referer'] = `https://n.dongqiudi.com/webapp/signIn.html` - url.headers['Host'] = `api.dongqiudi.com` - url.headers['User-Agent'] = `Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 NewsApp/7.3.3 NetType/NA Technology/Wifi (iPhone; iOS 13.3; Scale/2.00) dongqiudiClientApp (modelIdentifier/iPhone10,1 )` - url.headers['Accept-Language'] = `zh-cn` - - chavy.get(url, (error, response, data) => { - chavy.log(`${cookieName}, data: ${data}`) - let result = JSON.parse(data) - const title = `${cookieName}` - let subTitle = `` - let detail = `` - if (result.code == 0) { - if (result.data.sign_gold != 0) subTitle = '签到结果: 成功' - else subTitle = '签到结果: 成功 (重复签到)' - detail = `连签: ${result.data.continue_sign_days}天, 金币: ${result.data.gold_num} (+${result.data.sign_gold}), 价值: ${result.data.convertible_money}元` - } else { - subTitle = '签到结果: 失败' - detail = `编码: ${result.code}, 说明: ${result.message}` - } - chavy.msg(title, subTitle, detail) - }) - chavy.done() -} - -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} -} diff --git a/Scripts/SignIn/Duokan/README.md b/Scripts/SignIn/Duokan/README.md deleted file mode 100644 index 9cb8ba3..0000000 --- a/Scripts/SignIn/Duokan/README.md +++ /dev/null @@ -1,94 +0,0 @@ -# 多看阅读 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> QuanX 需要: v1.0.6-build195 及以后版本 (TestFlight) - -## 配置 (Surge) - -```properties -[MITM] -www.duokan.com - -[Script] -http-request ^https:\/\/www\.duokan\.com\/checkin\/v0\/status script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/duokan/duokan.cookie.js, requires-body=true - -cron "0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/duokan/duokan.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -www.duokan.com - -[rewrite_local] -# [商店版] QuanX v1.0.6-build194 及更早版本 -^https:\/\/www\.duokan\.com\/checkin\/v0\/status url script-request-body duokan.cookie.js - -# [TestFlight] QuanX v1.0.6-build195 及以后版本 -^https:\/\/www\.duokan\.com\/checkin\/v0\/status url script-request-body https://raw.githubusercontent.com/chavyleung/scripts/master/duokan/duokan.cookie.js - -[task_local] -0 0 * * * duokan.js -``` - -## 说明 -1. 先把 `www.duokan.com` 加到 `[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到 `[Script]` - - QuanX: 把 `duokan.cookie.js` 和 `duokan.js` 传到 `On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 获取 Cookie: `我的` > `签到任务` 等到提示获取 Cookie 成功即可 -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天 `00:00` 执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天 00:00:10 执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天 00:00:20 执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天 00:00:30 执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每 60 分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天 00:01 执行一次 - 2 0 * * * xxx.js # 每天 00:02 执行一次 - 3 0 * * * xxx.js # 每天 00:03 执行一次 - - */60 * * * * xxx.js # 每 60 分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) \ No newline at end of file diff --git a/Scripts/SignIn/Duokan/duokan.cookie.js b/Scripts/SignIn/Duokan/duokan.cookie.js deleted file mode 100644 index 36950b8..0000000 --- a/Scripts/SignIn/Duokan/duokan.cookie.js +++ /dev/null @@ -1,81 +0,0 @@ -const DUOKAN_COOKIE_KEY = 'duokan_cookie' -const DUOKAN_DEVICE_ID_KEY = 'duokan_device_id' - -let $util = init() - -if (typeof $request !== 'undefined') { - getCookie() -} -$util.done({}) - -function getCookie() { - let cookieVal = $request.headers['Cookie'] - $util.log(`cookie: ${cookieVal}`) - if (cookieVal.indexOf('token=') !== -1 && cookieVal.indexOf('device_id=') !== -1) { - let regexp = /device_id=(.*?);/g - let matched = regexp.exec(cookieVal) - if (matched) { - let deviceId = matched[1] - $util.log(`deviceId: ${deviceId}`) - if ($util.setdata(cookieVal, DUOKAN_COOKIE_KEY) && $util.setdata(deviceId, DUOKAN_DEVICE_ID_KEY)) { - $util.msg(`获取多看阅读 Cookie 成功 🎉`) - } - } - } -} - -function init() { - isSurge = () => { - return undefined !== this.$httpClient - } - isQuanX = () => { - return undefined !== this.$task - } - 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 = (msg) => { - console.log(`${msg}\n`) - } - get = (options, callback) => { - if (isQuanX()) { - if (typeof options == 'string') options = {url: options} - options['method'] = 'GET' - return $task.fetch(options).then( - (response) => { - response['status'] = response.statusCode - callback(null, response, response.body) - }, - (reason) => callback(reason.error, null, null) - ) - } - if (isSurge()) return $httpClient.get(options, callback) - } - post = (options, callback) => { - if (isQuanX()) { - if (typeof options == 'string') options = {url: options} - options['method'] = 'POST' - $task.fetch(options).then( - (response) => { - response['status'] = response.statusCode - callback(null, response, response.body) - }, - (reason) => callback(reason.error, null, null) - ) - } - if (isSurge()) $httpClient.post(options, callback) - } - done = (value = {}) => { - $done(value) - } - return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done} -} diff --git a/Scripts/SignIn/Duokan/duokan.js b/Scripts/SignIn/Duokan/duokan.js deleted file mode 100644 index 5bb3a72..0000000 --- a/Scripts/SignIn/Duokan/duokan.js +++ /dev/null @@ -1,123 +0,0 @@ -const DUOKAN_COOKIE_KEY = 'duokan_cookie' -const DUOKAN_DEVICE_ID_KEY = 'duokan_device_id' -const API_HOST = 'https://www.duokan.com' -const TASK_NAME = '多看阅读' - -let $util = init() - -;(async () => { - let cookieVal = $util.getdata(DUOKAN_COOKIE_KEY) - let deviceId = $util.getdata(DUOKAN_DEVICE_ID_KEY) - if (!cookieVal || !deviceId) { - $util.msg(TASK_NAME, '⚠️ 请先获取 Cookie') - $util.done({}) - return - } - await checkin(cookieVal, deviceId).then(() => { - $util.done({}) - }) -})() - -function checkin(cookieVal, deviceId) { - return new Promise((resolve, reject) => { - let options = { - url: `${API_HOST}/checkin/v0/checkin`, - headers: { - 'User-Agent': - 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148', - Cookie: cookieVal - }, - body: signature(deviceId) - } - $util.post(options, (error, response, data) => { - if (error) { - $util.log(`签到失败,error:${error}`) - $util.msg(TASK_NAME, '⚠️ 签到失败,详情请查看日志') - resolve() - return - } - let result = JSON.parse(data) - if (result && result.result === 0 && result.data) { - $util.log(`签到成功,response: ${data}`) - let subtitle = `签到成功,已连续签到 ${result.data.today} 天` - let body = '' - if (result.data.gift && Array.isArray(result.data.gift) && result.data.gift.length > 0) { - body = result.data.gift.reduce((prev, cur) => { - return (prev += `获得 ${cur.value} 个${cur.name} \n`) - }, '') - } - $util.msg(TASK_NAME, subtitle, body) - resolve() - } else { - $util.log(`签到失败,response: ${data}`) - $util.msg(TASK_NAME, `⚠️ 签到失败,${result.msg}`) - resolve() - } - }) - }) -} - -function signature(deviceId) { - let t = parseInt(new Date().getTime() / 1000) - let c = 0 - for (char of `${deviceId}&${t}`) { - c = (c * 131 + char.charCodeAt(0)) % 65536 - } - return `_t=${t}&_c=${c}` -} - -function init() { - isSurge = () => { - return undefined !== this.$httpClient - } - isQuanX = () => { - return undefined !== this.$task - } - 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 = (msg) => { - console.log(`${msg}\n`) - } - get = (options, callback) => { - if (isQuanX()) { - if (typeof options == 'string') options = {url: options} - options['method'] = 'GET' - return $task.fetch(options).then( - (response) => { - response['status'] = response.statusCode - callback(null, response, response.body) - }, - (reason) => callback(reason.error, null, null) - ) - } - if (isSurge()) return $httpClient.get(options, callback) - } - post = (options, callback) => { - if (isQuanX()) { - if (typeof options == 'string') options = {url: options} - options['method'] = 'POST' - $task.fetch(options).then( - (response) => { - response['status'] = response.statusCode - callback(null, response, response.body) - }, - (reason) => callback(reason.error, null, null) - ) - } - if (isSurge()) $httpClient.post(options, callback) - } - done = (value = {}) => { - $done(value) - } - return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done} -} diff --git a/Scripts/SignIn/EverPhoto/README.md b/Scripts/SignIn/EverPhoto/README.md deleted file mode 100644 index 04165b0..0000000 --- a/Scripts/SignIn/EverPhoto/README.md +++ /dev/null @@ -1,91 +0,0 @@ -# 时光相册 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -## 配置 (Surge) - -```properties -[MITM] -api.everphoto.cn - -[Script] -http-request ^https:\/\/api.everphoto.cn\/users\/self\/checkin\/v2 script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/everphoto/everphoto.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/everphoto/everphoto.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -api.everphoto.cn - -[rewrite_local] -^https:\/\/api.everphoto.cn\/users\/self\/checkin\/v2 url script-request-header everphoto.cookie.js - -[task_local] -1 0 * * * everphoto.js -``` - -## 说明 - -1. 先把`api.everphoto.cn`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`everphoto.cookie.js`和`everphoto.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP 然后手动签到 1 次, 系统提示: `获取Cookie: 成功` -4. 最后就可以把第 1 条脚本注释掉了 -5. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/EverPhoto/everphoto.cookie.js b/Scripts/SignIn/EverPhoto/everphoto.cookie.js deleted file mode 100644 index 5b64d25..0000000 --- a/Scripts/SignIn/EverPhoto/everphoto.cookie.js +++ /dev/null @@ -1,70 +0,0 @@ -const chavy = init() -const cookieName = '时光相册' -const KEY_signurl = 'chavy_sign_url_everphoto' -const KEY_signheader = 'chavy_sign_header_everphoto' - -if ($request && $request.method != 'OPTIONS') { - try { - chavy.log(`🔔 ${cookieName} 开始获取: Cookies`) - const VAL_signurl = $request.url - const VAL_signheader = JSON.stringify($request.headers) - if (VAL_signurl) { - chavy.setdata(VAL_signurl, KEY_signurl) - chavy.log(`❕ ${cookieName} VAL_signurl: ${VAL_signurl}`) - } - if (VAL_signheader) { - chavy.setdata(VAL_signheader, KEY_signheader) - chavy.log(`❕ ${cookieName} VAL_signheader: ${VAL_signheader}`) - } - chavy.msg(cookieName, `获取Cookie: 成功`, ``) - } catch (e) { - chavy.msg(cookieName, `获取Cookie: 失败`, e) - chavy.log(`❌ ${cookieName} 获取Cookie: 失败: ${e}`) - } -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/EverPhoto/everphoto.js b/Scripts/SignIn/EverPhoto/everphoto.js deleted file mode 100644 index 01abeb6..0000000 --- a/Scripts/SignIn/EverPhoto/everphoto.js +++ /dev/null @@ -1,97 +0,0 @@ -const chavy = init() -const cookieName = '时光相册' -const KEY_signurl = 'chavy_sign_url_everphoto' -const KEY_signheader = 'chavy_sign_header_everphoto' - -const signinfo = {} -let VAL_signurl = chavy.getdata(KEY_signurl) -let VAL_signheader = chavy.getdata(KEY_signheader) - -;(exec = async () => { - chavy.log(`🔔 ${cookieName} 开始签到`) - await signapp() - showmsg() - chavy.done() -})().catch((e) => chavy.log(`❌ ${cookieName} 签到失败: ${e}`), chavy.done()) - -function signapp() { - return new Promise((resolve, reject) => { - const url = {url: VAL_signurl, 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} sign - 签到失败: ${e}`) - chavy.log(`❌ ${cookieName} sign - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function showmsg() { - let subTitle, detail - if (signinfo.signapp.code == 0 && signinfo.signapp.data.checkin_result == true) { - const reward = signinfo.signapp.data.reward / 1024 / 1024 - const total_reward = signinfo.signapp.data.total_reward / 1024 / 1024 - const tomorrow_reward = signinfo.signapp.data.tomorrow_reward / 1024 / 1024 - subTitle = '签到结果: 成功' - detail = `总共获得: ${total_reward}MB (+${reward}MB), 明天获得: ${tomorrow_reward}MB` - } else if (signinfo.signapp.code == 0 && signinfo.signapp.data.checkin_result == false) { - const total_reward = signinfo.signapp.data.total_reward / 1024 / 1024 - const tomorrow_reward = signinfo.signapp.data.tomorrow_reward / 1024 / 1024 - subTitle = '签到结果: 成功 (重复签到)' - detail = `总共获得: ${total_reward}MB, 明天获得: ${tomorrow_reward}MB` - } else { - subTitle = '签到结果: 失败' - detail = `编码: ${signinfo.signapp.code}, 说明: 未知` - chavy.log(`❌ ${cookieName} showmsg - 签到失败: ${JSON.stringify(signinfo.signapp)}`) - } - chavy.msg(cookieName, subTitle, detail) -} - -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} -} diff --git a/Scripts/SignIn/Feng/README.md b/Scripts/SignIn/Feng/README.md deleted file mode 100644 index c10a3ef..0000000 --- a/Scripts/SignIn/Feng/README.md +++ /dev/null @@ -1,110 +0,0 @@ -# 威锋网 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> 注意了威锋网只能在一处登录, 如果你手机上登录了, 其他地方的登录会话会被踢掉 (重新登录需要重新获取 Cookie) - -> 2020.1.11 QuanX 在`190`版本开始, 获取 Cookie 方式需要从`script-response-body`改为`script-request-header` - -> 2020.2.6 威锋加了验证, 弃坑 - -> 2020.2.10 恢复签到: 增加参数签名 - -> 2020.2.11 威锋加了校验, 偶尔能签, 选择性弃坑吧! - -## 配置 (Surge) - -```properties -[MITM] -*.feng.com - -[Script] -http-request ^https:\/\/(www\.)?feng\.com\/?.? script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/feng/feng.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/feng/feng.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -*.feng.com - -[rewrite_local] -# 189及以前版本 -^https:\/\/(www\.)?feng\.com\/?.? url script-response-body feng.cookie.js -# 190及以后版本 -^https:\/\/(www\.)?feng\.com\/?.? url script-request-header feng.cookie.js - -[task_local] -1 0 * * * feng.js -``` - -## 说明 - -1. 先在浏览器登录 `(先登录! 先登录! 先登录!)` - - 如果你找不到登录的入口: 随便找个帖子做个“回帖”的动作, 会提示你登录的. - - 可以试试: https://www.feng.com/newthread -2. 先把`*.feng.com`加到`[MITM]` -3. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`feng.cookie.js`和`feng.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -4. 打开浏览器访问: https://www.feng.com -5. 系统提示: `获取Cookie: 成功` - - 如果一直取不到 Cookie, 请尝试一切你想到的姿势, 如: - - 访问: https://www.feng.com/newthread - - 然后刷新下 -6. 最后就可以把第 1 条脚本注释掉了 - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/Feng/feng.cookie.js b/Scripts/SignIn/Feng/feng.cookie.js deleted file mode 100644 index 05613e7..0000000 --- a/Scripts/SignIn/Feng/feng.cookie.js +++ /dev/null @@ -1,63 +0,0 @@ -const cookieName = '威锋网' -const cookieKey = 'chavy_cookie_feng' -const chavy = init() -const cookieVal = $request.headers['Cookie'] -if (cookieVal.indexOf('userInfo') >= 0) { - if (cookieVal) { - if (chavy.setdata(cookieVal, cookieKey)) { - chavy.msg(`${cookieName}`, '获取Cookie: 成功', '') - chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`) - } - } -} else { - let subTitle = '获取Cookie: 失败' - let detail = `请确保在已登录状态下获取Cookie` - chavy.msg(`${cookieName}`, subTitle, detail) - chavy.log(`[${cookieName}] ${subTitle}, cookie: ${cookieVal}`) -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/Feng/feng.js b/Scripts/SignIn/Feng/feng.js deleted file mode 100644 index 3762da2..0000000 --- a/Scripts/SignIn/Feng/feng.js +++ /dev/null @@ -1,1901 +0,0 @@ -// 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('威锋网') -$.CFG_accounts = $.getdata('chavy_accounts_feng') - -!(async () => { - $.CryptoJS = $.isNode() ? require('crypto-js') : CryptoJS - await signin() -})() - .catch((e) => $.logErr(e)) - .finally(() => $.done()) - -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}) - } - }) - 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}`) - } - $.subt = `共签: ${succnt + repeatcnt}/${$.accounts.length}, 本次成功: ${succnt}, 本次失败: ${failcnt}` - } - $.msg($.name, $.subt, $.desc.join('\n')) -} - -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 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 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() -} - -// 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/Scripts/SignIn/Fenqile/README.md b/Scripts/SignIn/Fenqile/README.md deleted file mode 100644 index e3eea04..0000000 --- a/Scripts/SignIn/Fenqile/README.md +++ /dev/null @@ -1,109 +0,0 @@ -# 分期乐 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> QuanX 需要: v1.0.6-build195 及以后版本 (TestFlight) - -> 感谢 [@GideonSenku](https://github.com/GideonSenku) Commit - -> 2020.03.18 添加超级乐星日/天天领乐星 -## 配置 (Surge) - -```properties -[MITM] -pm.m.fenqile.com - -[Script] -http-request ^https://pm\.m\.fenqile\.com/route0014/star/sign/sign.json script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/fenqile/fenqile.cookie.js, requires-body=true - -http-request ^https:\/\/pm\.m\.fenqile\.com/route0014\/app\/tab\/privilege\/convertTaskReward.json script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/fenqile/fenqile.cookie.js, requires-body=true - - -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/fenqile/fenqile.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -pm.m.fenqile.com - -[rewrite_local] - -# [商店版] QuanX v1.0.6-build194 及更早版本 -# 支持request-body 脚本可食用,换成本地 - -# [TestFlight] QuanX v1.0.6-build195 及以后版本 -^https://pm\.m\.fenqile\.com/route0014/star/sign/sign.json url script-request-body https://raw.githubusercontent.com/chavyleung/scripts/master/fenqile/fenqile.cookie.js -^https:\/\/pm\.m\.fenqile\.com/route0014\/app\/tab\/privilege\/convertTaskReward.json url script-request-body https://raw.githubusercontent.com/chavyleung/scripts/master/fenqile/fenqile.cookie.js - -[task_local] -1 0 * * * fenqile.js -``` - -## 说明 - -1. 先把`pm.m.fenqile.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`fenqile.cookie.js`和`fenqile.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP 手动签到一次: 访问下右下角 `我的` > `乐星` > `签到`,`我的` > `账单点击` > `超级乐星日/天天领乐星` -4. 系统提示: `获取Cookie: 成功` -5. 把获取 Cookie 的脚本注释掉 -6. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) - -[@GideonSenku](https://github.com/GideonSenku) diff --git a/Scripts/SignIn/Fenqile/fenqile.cookie.js b/Scripts/SignIn/Fenqile/fenqile.cookie.js deleted file mode 100644 index ad0347e..0000000 --- a/Scripts/SignIn/Fenqile/fenqile.cookie.js +++ /dev/null @@ -1,71 +0,0 @@ -const cookieName = '分期乐' -const signurlKey = 'senku_signurl_fenqile' -const signheaderKey = 'senku_signheader_fenqile' -const signbodyKey = 'senku_signbody_fenqile' -const signDailyKey = 'senku_signDailyKey_fenqile' -const signDailyUrlKey = 'senku_signDailyUrlKey_fenqile' -const senku = init() - -const requrl = $request.url -if ($request && $request.method != 'OPTIONS' && requrl.match(/\/route0014\/star\/sign\//)) { - const signurlVal = requrl - const signheaderVal = JSON.stringify($request.headers) - const signbodyVal = $request.body - if (signurlVal) senku.setdata(signurlVal, signurlKey) - if (signheaderVal) senku.setdata(signheaderVal, signheaderKey) - if (signbodyVal) senku.setdata(signbodyVal, signbodyKey) - senku.msg(cookieName, `获取Cookie: 成功`, `签到领乐星`) -} else { - const signDailyUrlVal = $request.url - const signDailyVal = $request.body; - if (signDailyUrlVal) senku.setdata(signDailyUrlVal, signDailyUrlKey) - if (signDailyVal) senku.setdata(signDailyVal, signDailyKey) - senku.msg(cookieName, `获取Cookie: 成功`, `天天领乐星`) - senku.log() -} - -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} -} - -senku.done() diff --git a/Scripts/SignIn/Fenqile/fenqile.js b/Scripts/SignIn/Fenqile/fenqile.js deleted file mode 100644 index 23d41b8..0000000 --- a/Scripts/SignIn/Fenqile/fenqile.js +++ /dev/null @@ -1,128 +0,0 @@ -const cookieName = '分期乐' -const signurlKey = 'senku_signurl_fenqile' -const signheaderKey = 'senku_signheader_fenqile' -const signbodyKey = 'senku_signbody_fenqile' -const signDailyKey = 'senku_signDailyKey_fenqile' -const signDailyUrlKey = 'senku_signDailyUrlKey_fenqile' -const senku = init() - -const signurlVal = senku.getdata(signurlKey) -const signheaderVal = senku.getdata(signheaderKey) -const signBodyVal = senku.getdata(signbodyKey) -const signDailyUrlVal = senku.getdata(signDailyUrlKey) -const signDailyVal = senku.getdata(signDailyKey) - -const signinfo = {} - - -check() - -function check() { - signDaily() - sign() - checkin() -} - -function sign() { - const url = {url: signurlVal, headers: JSON.parse(signheaderVal), body: signBodyVal} - senku.post(url, (error, response, data) => { - senku.log(`${cookieName}, 🔔sign--data: ${data}`) - signinfo.sign = JSON.parse(data) - }) -} - -function signDaily() { - const url = {url: signDailyUrlVal, headers: JSON.parse(signheaderVal), body: signDailyVal} - senku.post(url, (error, response, data) => { - senku.log(`${cookieName}, 🔔signDaily--data: ${data}`) - signinfo.signDaily = JSON.parse(data) - }) -} - - -function getinfo() { - const title = `${cookieName}` - let subTitle = `天天领乐星:` - let detail = `` - - //signDaily - if (signinfo.signDaily.data.result == 0) { - subTitle += `成功` - } else if (signinfo.signDaily.data.result == 11650011) { - subTitle += `重复签到` - } else { - subTitle += `失败` - detail += `编码: ${signinfo.signDaily.data.result}, 说明: ${signinfo.signDaily.data.res_info}` - } - - //sign - subTitle += ` 签到领乐星:` - if (signinfo.sign.data.result == 0) { - subTitle += `成功` - detail += `账户乐星总数: ${signinfo.sign.data.result_rows.postStar}` - } else if (signinfo.sign.data.result == 12130022) { - subTitle += `重复签到` - } else { - subTitle += `失败` - detail += `编码: ${signinfo.sign.data.result}, 说明: ${signinfo.sign.data.res_info}` - } - senku.msg(title, subTitle, detail) - senku.done() -} - -function checkin(checkms = 0) { - if (signinfo.sign && signinfo.signDaily) { - getinfo() - } else { - if (checkms > 5000) { - chavy.msg(`${cookieName}`, `签到失败: 超时退出`, ``) - chavy.done() - } else { - setTimeout(() => check(checkms + 100), 100) - } - } -} - -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} -} diff --git a/Scripts/SignIn/Flyertea/README.md b/Scripts/SignIn/Flyertea/README.md deleted file mode 100644 index ea9ec67..0000000 --- a/Scripts/SignIn/Flyertea/README.md +++ /dev/null @@ -1,96 +0,0 @@ -# 飞客茶馆 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> 2020.1.11 QuanX 在`190`版本开始, 获取 Cookie 方式需要从`script-response-body`改为`script-request-header` - -## 配置 (Surge) - -```properties -[MITM] -www.flyertea.com - -[Script] -http-request ^https:\/\/www\.flyertea\.com\/source\/plugin\/mobile\/mobile\.php\?module=getdata&.* script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/flyertea/flyertea.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/flyertea/flyertea.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -www.flyertea.com - -[rewrite_local] -# 189及以前版本 -^https:\/\/www\.flyertea\.com\/source\/plugin\/mobile\/mobile\.php\?module=getdata&.* url script-response-body flyertea.cookie.js -# 190及以后版本 -^https:\/\/www\.flyertea\.com\/source\/plugin\/mobile\/mobile\.php\?module=getdata&.* url script-request-header flyertea.cookie.js - -[task_local] -1 0 * * * flyertea.js -``` - -## 说明 - -1. 先把`www.flyertea.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`flyertea.cookie.js`和`flyertea.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP, 访问下`个人中心` -4. 系统提示: `获取Cookie: 成功` (如果不提示获取成功, 尝试杀进程再进个人中心) -5. 最后就可以把第 1 条脚本注释掉了 - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/Flyertea/flyertea.cookie.js b/Scripts/SignIn/Flyertea/flyertea.cookie.js deleted file mode 100644 index dd68960..0000000 --- a/Scripts/SignIn/Flyertea/flyertea.cookie.js +++ /dev/null @@ -1,70 +0,0 @@ -const cookieName = '飞客茶馆' -const cookieKey = 'chavy_cookie_flyertea' -const tokenKey = 'chavy_token_flyertea' -const chavy = init() -const cookieVal = $request.headers['Cookie'] -if (cookieVal) { - if (chavy.setdata(cookieVal, cookieKey)) { - chavy.msg(`${cookieName}`, '获取Cookie: 成功', '') - chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`) - } -} - -const queryparam = $request.url.split('?')[1] -if (queryparam) { - const params = {} - for (param of $request.url.split('?')[1].split('&')) { - params[param.split('=')[0]] = param.split('=')[1] - } - const token = JSON.stringify(params) - if (chavy.setdata(token, tokenKey)) { - chavy.msg(`${cookieName}`, '获取Token: 成功', '') - chavy.log(`[${cookieName}] 获取Token: 成功, token: ${token}`) - } -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/Flyertea/flyertea.js b/Scripts/SignIn/Flyertea/flyertea.js deleted file mode 100644 index 97a3a9f..0000000 --- a/Scripts/SignIn/Flyertea/flyertea.js +++ /dev/null @@ -1,88 +0,0 @@ -const cookieName = '飞客茶馆' -const cookieKey = 'chavy_cookie_flyertea' -const tokenKey = 'chavy_token_flyertea' -const chavy = init() -let cookieVal = chavy.getdata(cookieKey) -let tokenVal = chavy.getdata(tokenKey) - -sign() - -function sign() { - const token = JSON.parse(tokenVal) - let url = { - url: `https://www.flyertea.com/plugin.php?id=k_misign:sign&operation=qiandao&from=insign&version=${token.version}&appcan=appcan&appkey=${token.appkey}&appversion=${token.appversion}&formhash=${token.formhash}&token=${token.token}`, - headers: {Cookie: cookieVal} - } - url.headers['Accept'] = `*/*` - url.headers['Accept-Language'] = `zh-Hans-CN;q=1, en-US;q=0.9` - url.headers['Host'] = `www.flyertea.com` - url.headers['User-Agent'] = `FKForum/7.14.0 (iPhone10,1; iOS 13.3; Scale/2.00)` - url.headers['Referer'] = `https://www.flyertea.com/home.php` - url.headers['Accept-Encoding'] = `gzip, deflate, br` - url.headers['Connection'] = `keep-alive` - chavy.get(url, (error, response, data) => { - chavy.log(`${cookieName}, data: ${data}`) - const result = JSON.parse(data) - const title = `${cookieName}` - let subTitle = `` - let detail = `` - if (result.Variables && result.Variables.Message.messageval == 'success') { - subTitle = `签到结果: 成功` - detail = `说明: ${result.Variables.Message.messagestr}` - chavy.msg(title, subTitle, detail) - } else { - if (result.Message.messageval == 'error' && result.Message.messagestr.indexOf('只能签到一次') >= 0) { - subTitle = `签到结果: 成功 (重复签到)` - } else { - subTitle = `签到结果: 失败` - } - detail = `说明: ${result.Message.messagestr}` - chavy.msg(title, subTitle, detail) - } - }) - chavy.done() -} - -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} -} diff --git a/Scripts/SignIn/Gdoil/README.md b/Scripts/SignIn/Gdoil/README.md deleted file mode 100644 index 8fbafd9..0000000 --- a/Scripts/SignIn/Gdoil/README.md +++ /dev/null @@ -1,93 +0,0 @@ -# 加油广东 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> 2020.2.28 更新域名: gdws.nsenz.com > m.gdoil.cn - -## 配置 (Surge) - -```properties -[MITM] -m.gdoil.cn - -[Script] -http-request ^https:\/\/m.gdoil.cn\/webapi\/usersign\/addusersign script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/gdoil/gdoil.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/gdoil/gdoil.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -m.gdoil.cn - -[rewrite_local] -^https:\/\/m.gdoil.cn\/webapi\/usersign\/addusersign url script-request-header gdoil.cookie.js - -[task_local] -1 0 * * * gdoil.js -``` - -## 说明 - -1. 先把`m.gdoil.cn`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`gdoil.cookie.js`和`gdoil.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP 然后手动签到 1 次, 系统提示: `获取Cookie: 成功` -4. 最后就可以把第 1 条脚本注释掉了 -5. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/Gdoil/gdoil.cookie.js b/Scripts/SignIn/Gdoil/gdoil.cookie.js deleted file mode 100644 index e205753..0000000 --- a/Scripts/SignIn/Gdoil/gdoil.cookie.js +++ /dev/null @@ -1,58 +0,0 @@ -const cookieName = '加油广东' -const signurlKey = 'chavy_signurl_gdoil' -const signheaderKey = 'chavy_signheader_gdoil' -const chavy = init() - -if ($request && $request.method != 'OPTIONS') { - const signurlVal = $request.url - const signheaderVal = JSON.stringify($request.headers) - if (signurlVal) chavy.setdata(signurlVal, signurlKey) - if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey) - chavy.msg(cookieName, `获取Cookie: 成功`, ``) -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/Gdoil/gdoil.js b/Scripts/SignIn/Gdoil/gdoil.js deleted file mode 100644 index e44abb4..0000000 --- a/Scripts/SignIn/Gdoil/gdoil.js +++ /dev/null @@ -1,73 +0,0 @@ -const cookieName = '加油广东' -const signurlKey = 'chavy_signurl_gdoil' -const signheaderKey = 'chavy_signheader_gdoil' -const chavy = init() -const signurlVal = chavy.getdata(signurlKey) -const signheaderVal = chavy.getdata(signheaderKey) - -sign() - -function sign() { - const url = {url: signurlVal, headers: JSON.parse(signheaderVal)} - url.body = '{}' - chavy.post(url, (error, response, data) => { - chavy.log(`${cookieName}, data: ${data}`) - const result = JSON.parse(data) - const title = `${cookieName}` - let subTitle = '' - let detail = '' - if (result.result == true) { - subTitle = `签到结果: 成功` - } else { - if (result.msg.indexOf('已经签到') >= 0) subTitle = `签到结果: 成功 (重复签到)` - else subTitle = `签到结果: 失败` - detail = `说明: ${result.msg}` - } - chavy.msg(title, subTitle, detail) - chavy.done() - }) -} - -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} -} diff --git a/Scripts/SignIn/Haidilao/README.md b/Scripts/SignIn/Haidilao/README.md deleted file mode 100644 index 73430ba..0000000 --- a/Scripts/SignIn/Haidilao/README.md +++ /dev/null @@ -1,104 +0,0 @@ -# 海底捞 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> 感谢[@danchaw](https://github.com/danchaw) PR -## 配置 (Surge) - -```properties -[MITM] -activity-1.m.duiba.com.cn - -[Script] -http-request ^https:\/\/activity-1\.m\.duiba\.com\.cn\/signactivity\/doSign$ requires-body=1,max-size=0,script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/haidilao/hdl.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/haidilao/hdl.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -activity-1.m.duiba.com.cn - -[rewrite_local] - -# [商店版] -^https:\/\/activity-1\.m\.duiba\.com\.cn\/signactivity\/doSign$ url script-request-body hdl.js - -# [TestFlight] -^https:\/\/activity-1\.m\.duiba\.com\.cn\/signactivity\/doSign$ url script-request-body https://raw.githubusercontent.com/chavyleung/scripts/master/haidilao/hdl.js - -[task_local] - -# [商店版] -1 0 * * * hdl.js - -# [TestFlight] -1 0 * * * https://raw.githubusercontent.com/chavyleung/scripts/master/haidilao/hdl.js -``` - -## 说明 - -1. 先把`activity-1.m.duiba.com.cn`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`hdl.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP[海底捞](https://apps.apple.com/cn/app/%E6%B5%B7%E5%BA%95%E6%8D%9E/id553115181) 然后手动签到 1 次, 系统提示: `获取Cookie: 成功` -4. 最后就可以把第 1 条脚本注释掉了 -5. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) - -[@danchaw](https://github.com/danchaw) diff --git a/Scripts/SignIn/Haidilao/hdl.js b/Scripts/SignIn/Haidilao/hdl.js deleted file mode 100644 index 94755eb..0000000 --- a/Scripts/SignIn/Haidilao/hdl.js +++ /dev/null @@ -1,106 +0,0 @@ -const cookieName = '海底捞' -const signurlKey = 'signurl_hdl' -const signheaderKey = 'signheader_hdl' -const signbodyKey = 'signbody_hdl' -const hdl = init() - -let isGetCookie = typeof $request !== 'undefined' - -if (isGetCookie) { - getcookie() -} else { - sign() -} - -function getcookie() { - if ($request && $request.method == 'POST') { - const signurlVal = $request.url - const signheaderVal = JSON.stringify($request.headers) - const signbodyVal = $request.body - - if (signurlVal) hdl.setdata(signurlVal, signurlKey) - if (signheaderVal) hdl.setdata(signheaderVal, signheaderKey) - if (signbodyVal) hdl.setdata(signbodyVal, signbodyKey) - hdl.msg(cookieName, `获取Cookie: 成功, 请禁用该脚本`, ``) - } - hdl.done() -} - -function sign() { - const signurlVal = hdl.getdata(signurlKey) - const signheaderVal = hdl.getdata(signheaderKey) - const signbodyVal = hdl.getdata(signbodyKey) - const url = {url: signurlVal, headers: JSON.parse(signheaderVal), body: signbodyVal} - hdl.post(url, (error, response, data) => { - hdl.log(`${cookieName}, data: ${data}`) - const title = `${cookieName}` - let subTitle = '' - let detail = '' - const result = JSON.parse(data) - if (result.success == true && result.signInfoVO.todaySigned == true) { - subTitle = `签到结果: 成功` - detail = `签到奖励: ${result.customInfo.foodNum}火柴, 连签: ${result.signInfoVO.continueDay}天` - } else if (result.success == false && result.signInfoVO.todaySigned == true) { - subTitle = `签到结果: 成功 (重复签到)` - detail = `连签: ${result.signInfoVO.continueDay}天` - } else { - subTitle = `签到结果: 失败` - detail = `说明: ${result.message}, 请重新获取` - } - hdl.msg(title, subTitle, detail) - hdl.done() - }) -} - -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)) - } - } - put = (url, cb) => { - if (isSurge()) { - $httpClient.put(url, cb) - } - if (isQuanX()) { - url.method = 'PUT' - $task.fetch(url).then((resp) => cb(null, {}, resp.body)) - } - } - done = (value = {}) => { - $done(value) - } - return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done} -} \ No newline at end of file diff --git a/Scripts/SignIn/HelloBike/README.md b/Scripts/SignIn/HelloBike/README.md deleted file mode 100644 index 1786362..0000000 --- a/Scripts/SignIn/HelloBike/README.md +++ /dev/null @@ -1,102 +0,0 @@ -# 哈啰出行 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -## 配置 (Surge) - -```properties -[MITM] -gameapi.hellobike.com - -[Script] -http-request ^https:\/\/gameapi\.hellobike\.com\/api script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/hellobike/hellobike.js, requires-body=true -cron "5 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/hellobike/hellobike.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -gameapi.hellobike.com - -[rewrite_local] -# [商店版] -^https:\/\/gameapi\.hellobike\.com\/api url script-request-body hellobike/hellobike.js - -# [TestFlight] -^https:\/\/gameapi\.hellobike\.com\/api url script-request-body https://raw.githubusercontent.com/chavyleung/scripts/master/hellobike/hellobike.js - -[task_local] -# [商店版] -5 0 * * * hellobike/hellobike.js - -# [TestFlight] -5 0 * * * https://raw.githubusercontent.com/chavyleung/scripts/master/hellobike/hellobike.js -``` - -## 说明 - -1. 先把`gameapi.hellobike.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把远程脚本放到`[Script]` - - QuanX: 把`hellobike.js`传到`On My iPhone - Quantumult X - Scripts - hellobike` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP 进入签到页面: `我的` > `有哈有车` -4. 系统提示: `首次写入 哈啰出行 Token 成功 🎉` -5. 把获取 Cookie 的脚本注释掉 -6. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:05`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) - -[@GideonSenku](https://github.com/GideonSenku) diff --git a/Scripts/SignIn/HelloBike/hellobike.js b/Scripts/SignIn/HelloBike/hellobike.js deleted file mode 100644 index 7990a5b..0000000 --- a/Scripts/SignIn/HelloBike/hellobike.js +++ /dev/null @@ -1,303 +0,0 @@ -const HELLO_BIKE = init() -const TASK_NAME = '哈啰出行' -const TOKEN_KEY = 'hellobike' -const API_URL = 'https://gameapi.hellobike.com/api' -const UA = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148; app=easybike; version=5.35.0' - -if (typeof $request !== 'undefined') { - getToken() - HELLO_BIKE.done() -} else { - ;(async () => { - let token = HELLO_BIKE.getdata(TOKEN_KEY) - if (!token) { - HELLO_BIKE.msg(TASK_NAME, '请先获取 Token') - HELLO_BIKE.done() - return - } - - await checkin(token).then(data => { - if (data && data.isSuccess) { - HELLO_BIKE.msg(TASK_NAME, `签到成功,获取 ${data.energy}c 能量`) - } else if (data && !data.isSuccess) { - HELLO_BIKE.msg(TASK_NAME, `重复签到`) - } - }).catch(error => { - HELLO_BIKE.msg(TASK_NAME, error.reason) - if (error.isInvalidToken) { - token = null - } - }) - - await share(token).then(data => { - HELLO_BIKE.log(TASK_NAME, `分享成功, ${JSON.stringify(data)}`) - }).catch(error => { - HELLO_BIKE.msg(TASK_NAME, error.reason) - if (error.isInvalidToken) { - token = null - } - }) - - await getEnergyList(token).then( - data => { - HELLO_BIKE.log(TASK_NAME, `获取能量:${JSON.stringify(data)}`) - return mergePromise(data.map(energy => collectEnergy(token, energy.guid))) - }, - error => { - HELLO_BIKE.msg(TASK_NAME, error.reason) - if (error.isInvalidToken) { - token = null - } - }, - ).then( - data => { - if (Array.isArray(data) && data.length > 0) { - HELLO_BIKE.log(TASK_NAME, `收取能量: ${JSON.stringify(data)}`) - let collected = data.filter(energy => { - return energy != null - }).reduce((total, currentValue) => { - return total + currentValue.energy - }, 0) - HELLO_BIKE.msg(TASK_NAME, `收取能量成功,总共收取 ${collected}c 能量`) - } - HELLO_BIKE.done() - }, - error => { - HELLO_BIKE.msg(TASK_NAME, error.reason) - HELLO_BIKE.done() - }, - ) - })() -} - -function getToken() { - if ($request.body) { - let body = JSON.parse($request.body) - if (body && body.token) { - let token = HELLO_BIKE.getdata(TOKEN_KEY) - if (token != null) { - if (token !== body.token) { - if (!HELLO_BIKE.setdata(body.token, TOKEN_KEY)) { - HELLO_BIKE.msg(`更新 ${TASK_NAME} Token 失败‼️`) - } else { - HELLO_BIKE.msg(`更新 ${TASK_NAME} Token 成功 🎉`) - } - } - } else { - if (!HELLO_BIKE.setdata(body.token, TOKEN_KEY)) { - HELLO_BIKE.msg(`首次写入 ${TASK_NAME} Token 失败‼️`) - } else { - HELLO_BIKE.msg(`首次写入 ${TASK_NAME} Token 成功 🎉`) - } - } - } - } -} - -function checkin(token) { - if (!token) { - return Promise.resolve({}) - } - return new Promise((resolve, reject) => { - let action = 'happy.energy.dailyCheck.v2' - let options = { - url: API_URL, - headers: {'User-Agent': UA}, - body: JSON.stringify({ - action, - token, - ticket: '', - }), - } - HELLO_BIKE.post(options, (error, response, data) => { - if (error) { - HELLO_BIKE.log(TASK_NAME, `签到失败,error:${error}`) - reject(new RequestFailed(action, error)) - return - } - let result = JSON.parse(data) - if (result && result.code === 0 && result.data) { - resolve(result.data) - } else { - HELLO_BIKE.log(TASK_NAME, `签到失败,response:${data}`) - reject(new RequestFailed(action, result.msg, result.code === 103)) - } - }) - }) -} - -function share(token) { - if (!token) { - return Promise.resolve({}) - } - return new Promise((resolve, reject) => { - let action = 'happy.energy.dailyShare' - let options = { - url: API_URL, - headers: {'User-Agent': UA}, - body: JSON.stringify({ - token, - action, - ticket: '', - }), - } - HELLO_BIKE.post(options, (error, response, data) => { - if (error) { - HELLO_BIKE.log(TASK_NAME, `分享失败,error:${error}`) - reject(new RequestFailed(action, error)) - return - } - let result = JSON.parse(data) - if (result && result.code === 0) { - resolve(result) - } else { - HELLO_BIKE.log(TASK_NAME, `分享失败,response:${data}`) - reject(new RequestFailed(action, result.msg, result.code === 103)) - } - }) - }) -} - -function getEnergyList(token) { - if (!token) { - return Promise.resolve([]) - } - return new Promise((resolve, reject) => { - let action = 'happy.energy.getEnergyList' - let options = { - url: API_URL, - headers: {'User-Agent': UA}, - body: JSON.stringify({ - token, - action, - ticket: '', - limit: 6, - }), - } - HELLO_BIKE.post(options, (error, response, data) => { - if (error) { - HELLO_BIKE.log(TASK_NAME, `获取能量失败,error:${error}`) - reject(new RequestFailed(action, error)) - return - } - let result = JSON.parse(data) - if (result && result.code === 0 && result.data) { - resolve(result.data) - } else { - HELLO_BIKE.log(TASK_NAME, `获取能量失败,response:${data}`) - reject(new RequestFailed(action, result.msg, result.code === 103)) - } - }) - }) -} - -function collectEnergy(token, energyGuid) { - if (!token) { - return Promise.resolve({}) - } - return new Promise((resolve, reject) => { - let action = 'happy.energy.collectEnergy' - let options = { - url: API_URL, - headers: {'User-Agent': UA}, - body: JSON.stringify({ - token, - action, - ticket: '', - energyGuid, - }), - } - HELLO_BIKE.post(options, (error, response, data) => { - if (error) { - HELLO_BIKE.log(TASK_NAME, `收取能量失败,error:${error}`) - reject(new RequestFailed(action, error)) - return - } - let result = JSON.parse(data) - if (result && result.code === 0 && result.data) { - resolve(result.data) - } else { - HELLO_BIKE.log(TASK_NAME, `收取能量失败,response:${data}`) - reject(new RequestFailed(action, result.msg, result.code === 103)) - } - }) - }) -} - -function mergePromise(promises = []) { - let array = [] - let sequence = Promise.resolve([]) - promises.forEach(promise => { - sequence = sequence.then(() => promise).then(data => { - array.push(data) - return array - }) - }) - return sequence -} - -function init() { - isSurge = () => { - return undefined !== this.$httpClient - } - isQuanX = () => { - return undefined !== this.$task - } - 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 = (title, msg) => { - console.log(`${title}:\n${msg}\n`) - } - get = (options, callback) => { - if (isQuanX()) { - if (typeof options == 'string') options = {url: options} - options['method'] = 'GET' - return $task.fetch(options).then( - response => { - response['status'] = response.statusCode - callback(null, response, response.body) - }, - reason => callback(reason.error, null, null), - ) - } - if (isSurge()) return $httpClient.get(options, callback) - } - post = (options, callback) => { - if (isQuanX()) { - if (typeof options == 'string') options = {url: options} - options['method'] = 'POST' - $task.fetch(options).then( - response => { - response['status'] = response.statusCode - callback(null, response, response.body) - }, - reason => callback(reason.error, null, null), - ) - } - if (isSurge()) $httpClient.post(options, callback) - } - done = (value = {}) => { - $done(value) - } - return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done} -} - -function RequestFailed(action = '', reason = '', isInvalidToken = false) { - this.action = action - this.reason = reason - this.isInvalidToken = isInvalidToken -} - -RequestFailed.prototype = { - constructor: RequestFailed, -} diff --git a/Scripts/SignIn/Hycan/README.md b/Scripts/SignIn/Hycan/README.md deleted file mode 100644 index e0fd94c..0000000 --- a/Scripts/SignIn/Hycan/README.md +++ /dev/null @@ -1,103 +0,0 @@ -# HYCAN合创 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 -> 感谢 [@danchaw](https://github.com/danchaw) PR -## 配置 (Surge) - -```properties -[MITM] -wxprdapplet.gac-nio.com - -[Script] -http-request ^https:\/\/wxprdapplet\.gac-nio\.com\/community\/userSignIn\/simpleAuth\/front\/.*\/sign$ script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/hycan/hycan.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/hycan/hycan.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -wxprdapplet.gac-nio.com - -[rewrite_local] - -# [商店版] -^https:\/\/wxprdapplet\.gac-nio\.com\/community\/userSignIn\/simpleAuth\/front\/.*\/sign$ url script-request-header hycan.cookie.js - -# [TestFlight] -^https:\/\/wxprdapplet\.gac-nio\.com\/community\/userSignIn\/simpleAuth\/front\/.*\/sign$ url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/hycan/hycan.cookie.js - -[task_local] - -# [商店版] -1 0 * * * hycan.js - -# [TestFlight] -1 0 * * * https://raw.githubusercontent.com/chavyleung/scripts/master/hycan/hycan.js -``` - -## 说明 - -1. 先把`wxprdapplet.gac-nio.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`hycan.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP[HYCAN合创](https://apps.apple.com/cn/app/hycan%E5%90%88%E5%88%9B-%E5%B9%BF%E6%B1%BD%E8%94%9A%E6%9D%A5/id1464838502) 然后手动签到 1 次, 系统提示: `获取Cookie: 成功` -4. 最后就可以把第 1 条脚本注释掉了 -5. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) - -[@danchaw](https://github.com/danchaw) diff --git a/Scripts/SignIn/Hycan/hycan.cookie.js b/Scripts/SignIn/Hycan/hycan.cookie.js deleted file mode 100644 index 494fec5..0000000 --- a/Scripts/SignIn/Hycan/hycan.cookie.js +++ /dev/null @@ -1,68 +0,0 @@ -const cookieName = 'HYCAN合创' -const signurlKey = 'signurl_hycan' -const signheaderKey = 'signheader_hycan' -const hycan = init() - -if ($request && $request.method == 'POST') { - const signurlVal = $request.url - const signheaderVal = JSON.stringify($request.headers) - - if (signurlVal) hycan.setdata(signurlVal, signurlKey) - if (signheaderVal) hycan.setdata(signheaderVal, signheaderKey) - hycan.msg(cookieName, `获取Cookie: 成功`, ``) -} - -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)) - } - } - put = (url, cb) => { - if (isSurge()) { - $httpClient.put(url, cb) - } - if (isQuanX()) { - url.method = 'PUT' - $task.fetch(url).then((resp) => cb(null, {}, resp.body)) - } - } - done = (value = {}) => { - $done(value) - } - return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done} -} - -hycan.done() \ No newline at end of file diff --git a/Scripts/SignIn/Hycan/hycan.js b/Scripts/SignIn/Hycan/hycan.js deleted file mode 100644 index 11a1258..0000000 --- a/Scripts/SignIn/Hycan/hycan.js +++ /dev/null @@ -1,83 +0,0 @@ -const cookieName = 'HYCAN合创' -const signurlKey = 'signurl_hycan' -const signheaderKey = 'signheader_hycan' -const hycan = init() -const signurlVal = hycan.getdata(signurlKey) -const signheaderVal = hycan.getdata(signheaderKey) - -sign() - -function sign() { - const url = {url: signurlVal, headers: JSON.parse(signheaderVal)} - hycan.post(url, (error, response, data) => { - hycan.log(`${cookieName}, data: ${data}`) - const title = `${cookieName}` - let subTitle = '' - let detail = '' - const result = JSON.parse(data) - if (result.data.addScore == true) { - subTitle = `签到结果: 成功` - detail = `签到积分: ${result.data.score}, 签到详情: ${result.data.msg}` - } else if (result.data.addScore == false) { - subTitle = `签到结果: 成功 (重复签到)` - } else { - subTitle = `签到结果: 失败` - detail = `说明: token失效, ${result.msg}` - } - hycan.msg(title, subTitle, detail) - hycan.done() - }) -} - -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)) - } - } - put = (url, cb) => { - if (isSurge()) { - $httpClient.put(url, cb) - } - if (isQuanX()) { - url.method = 'PUT' - $task.fetch(url).then((resp) => cb(null, {}, resp.body)) - } - } - done = (value = {}) => { - $done(value) - } - return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done} -} diff --git a/Scripts/SignIn/JD/JD_Nobyda.js b/Scripts/SignIn/JD/JD_Nobyda.js deleted file mode 100644 index d1acb1d..0000000 --- a/Scripts/SignIn/JD/JD_Nobyda.js +++ /dev/null @@ -1,1990 +0,0 @@ -/************************* -京东多合一签到脚本 -更新时间: 2021.06.17 23:20 v2.0.5 -有效接口: 30+ -脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js -电报频道: @NobyDa -问题反馈: @NobyDa_bot -如果转载: 请注明出处 -************************* -【 JSbox, Node.js 说明 】 : -************************* -开启抓包app后, Safari浏览器登录 https://bean.m.jd.com/bean/signIndex.action 点击签到并且出现签到日历后, 返回抓包app搜索关键字 functionId=signBean 复制请求头Cookie填入以下Key处的单引号内即可 */ - -var Key = ''; //单引号内自行填写您抓取的Cookie - -var DualKey = ''; //如需双账号签到,此处单引号内填写抓取的"账号2"Cookie, 否则请勿填写 - -var OtherKey = ''; //第三账号或以上的Cookie json串数据, 以下样例为第三第四账号:var OtherKey = '[{"cookie":"pt_key=xxxxxx;pt_pin=yyyyyy"},{"cookie":"pt_key=xxxxxx;pt_pin=yyyyyy"}]' - -/* 注1: 以上选项仅针对于JsBox或Node.js, 如果使用QX,Surge,Loon, 请使用脚本获取Cookie. - 注2: 双账号用户抓取"账号1"Cookie后, 请勿点击退出账号(可能会导致Cookie失效), 需清除浏览器资料或更换浏览器登录"账号2"抓取. - 注3: 如果复制的Cookie开头为"Cookie: "请把它删除后填入. - 注4: 如果使用QX,Surge,Loon并获取Cookie后, 再重复填写以上选项, 则签到优先读取以上Cookie. - 注5: 如果使用Node.js, 需自行安装'request'模块. 例: npm install request -g - 注6: Node.js或JSbox环境下已配置数据持久化, 填写Cookie运行一次后, 后续更新脚本无需再次填写, 待Cookie失效后重新抓取填写即可. -************************* -【 QX, Surge, Loon 说明 】 : -************************* -初次使用时, app配置文件添加脚本配置,并启用Mitm后, Safari浏览器打开登录 https://bean.m.jd.com/bean/signIndex.action ,点击签到并且出现签到日历后, 如果通知获得cookie成功, 则可以使用此签到脚本。 注: 请勿在京东APP内获取!!! -由于cookie的有效性(经测试网页Cookie有效周期最长31天),如果脚本后续弹出cookie无效的通知,则需要重复上述步骤。 -签到脚本将在每天的凌晨0:05执行, 您可以修改执行时间。 因部分接口京豆限量领取, 建议调整为凌晨签到。 -BoxJs或QX Gallery订阅地址: https://raw.githubusercontent.com/NobyDa/Script/master/NobyDa_BoxJs.json -************************* -【 配置多京东账号签到说明 】 : -************************* -正确配置QX、Surge、Loon后, 并使用此脚本获取"账号1"Cookie成功后, 请勿点击退出账号(可能会导致Cookie失效), 需清除浏览器资料或更换浏览器登录"账号2"获取即可; 账号3或以上同理. -注: 如需清除所有Cookie, 您可开启脚本内"DeleteCookie"选项 (第96行) -************************* -【Surge 4.2+ 脚本配置】: -************************* -[Script] -京东多合一签到 = type=cron,cronexp=5 0 * * *,wake-system=1,timeout=60,script-path=https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js -获取京东Cookie = type=http-request,pattern=https:\/\/api\.m\.jd\.com\/client\.action.*functionId=signBean,script-path=https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js -[MITM] -hostname = api.m.jd.com -************************* -【Loon 2.1+ 脚本配置】: -************************* -[Script] -cron "5 0 * * *" tag=京东多合一签到, script-path=https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js -http-request https:\/\/api\.m\.jd\.com\/client\.action.*functionId=signBean tag=获取京东Cookie, script-path=https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js -[MITM] -hostname = api.m.jd.com -************************* -【 QX 1.0.10+ 脚本配置 】 : -************************* -[task_local] -# 京东多合一签到 -# 注意此为远程路径, 低版本用户请自行调整为本地路径. -5 0 * * * https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js, tag=京东多合一签到, img-url=https://raw.githubusercontent.com/NobyDa/mini/master/Color/jd.png,enabled=true -[rewrite_local] -# 获取京东Cookie. -# 注意此为远程路径, 低版本用户请自行调整为本地路径. -https:\/\/api\.m\.jd\.com\/client\.action.*functionId=signBean url script-request-header https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js -[mitm] -hostname = api.m.jd.com -*************************/ - -var LogDetails = false; //是否开启响应日志, true则开启 - -var stop = '0'; //自定义延迟签到, 单位毫秒. 默认分批并发无延迟; 该参数接受随机或指定延迟(例: '2000'则表示延迟2秒; '2000-5000'则表示延迟最小2秒,最大5秒内的随机延迟), 如填入延迟则切换顺序签到(耗时较长), Surge用户请注意在SurgeUI界面调整脚本超时; 注: 该参数Node.js或JSbox环境下已配置数据持久化, 留空(var stop = '')即可清除. - -var DeleteCookie = false; //是否清除所有Cookie, true则开启. - -var boxdis = true; //是否开启自动禁用, false则关闭. 脚本运行崩溃时(如VPN断连), 下次运行时将自动禁用相关崩溃接口(仅部分接口启用), 崩溃时可能会误禁用正常接口. (该选项仅适用于QX,Surge,Loon) - -var ReDis = false; //是否移除所有禁用列表, true则开启. 适用于触发自动禁用后, 需要再次启用接口的情况. (该选项仅适用于QX,Surge,Loon) - -var out = 0; //接口超时退出, 用于可能发生的网络不稳定, 0则关闭. 如QX日志出现大量"JS Context timeout"后脚本中断时, 建议填写6000 - -var $nobyda = nobyda(); - -async function all() { - merge = {}; - switch (stop) { - case 0: - await Promise.all([ - JingDongBean(stop), //京东京豆 - JingDongStore(stop), //京东超市 - JingRongSteel(stop), //金融钢镚 - JingDongTurn(stop), //京东转盘 - JDFlashSale(stop), //京东闪购 - JingDongCash(stop), //京东现金红包 - JDMagicCube(stop, 2), //京东小魔方 - JingDongSubsidy(stop), //京东金贴 - JingDongGetCash(stop), //京东领现金 - JingDongShake(stop), //京东摇一摇 - JDSecKilling(stop), //京东秒杀 - JingDongBuyCar(stop, '435c9611622e4135b436b9d73351be10'), //京东汽车 - // JingRongDoll(stop, 'JRDoll', '京东金融-签壹', '4D25A6F482'), - // JingRongDoll(stop, 'JRThreeDoll', '京东金融-签叁', '69F5EC743C'), - JingRongDoll(stop, 'JRFourDoll', '京东金融-签肆', '30C4F86264'), - // JingRongDoll(stop, 'JRFiveDoll', '京东金融-签伍', '1D06AA3B0F') - ]); - await Promise.all([ - JDUserSignPre(stop, 'JDUndies', '京东商城-内衣', '4PgpL1xqPSW1sVXCJ3xopDbB1f69'), //京东内衣馆 - JDUserSignPre(stop, 'JDCard', '京东商城-卡包', '7e5fRnma6RBATV9wNrGXJwihzcD'), //京东卡包 - // JDUserSignPre(stop, 'JDCustomized', '京东商城-定制', '2BJK5RBdvc3hdddZDS1Svd5Esj3R'), //京东定制 - JDUserSignPre(stop, 'JDaccompany', '京东商城-陪伴', 'kPM3Xedz1PBiGQjY4ZYGmeVvrts'), //京东陪伴 - JDUserSignPre(stop, 'JDShoes', '京东商城-鞋靴', '4RXyb1W4Y986LJW8ToqMK14BdTD'), //京东鞋靴 - JDUserSignPre(stop, 'JDChild', '京东商城-童装', '3Af6mZNcf5m795T8dtDVfDwWVNhJ'), //京东童装馆 - JDUserSignPre(stop, 'JDBaby', '京东商城-母婴', '3BbAVGQPDd6vTyHYjmAutXrKAos6'), //京东母婴馆 - JDUserSignPre(stop, 'JD3C', '京东商城-数码', '4SWjnZSCTHPYjE5T7j35rxxuMTb6'), //京东数码电器馆 - JDUserSignPre(stop, 'JDWomen', '京东商城-女装', 'DpSh7ma8JV7QAxSE2gJNro8Q2h9'), //京东女装馆 - JDUserSignPre(stop, 'JDBook', '京东商城-图书', '3SC6rw5iBg66qrXPGmZMqFDwcyXi'), //京东图书 - JingRongDoll(stop, 'JTDouble', '京东金贴-双签', '1DF13833F7'), //京东金融 金贴双签 - // JingRongDoll(stop, 'XJDouble', '金融现金-双签', 'F68B2C3E71', '', '', '', 'xianjin') //京东金融 现金双签 - ]); - await Promise.all([ - JDUserSignPre(stop, 'JDEsports', '京东商城-电竞', 'CHdHQhA5AYDXXQN9FLt3QUAPRsB'), //京东电竞 - JDUserSignPre(stop, 'JDClothing', '京东商城-服饰', '4RBT3H9jmgYg1k2kBnHF8NAHm7m8'), //京东服饰 - JDUserSignPre(stop, 'JDSuitcase', '京东商城-箱包', 'ZrH7gGAcEkY2gH8wXqyAPoQgk6t'), //京东箱包馆 - JDUserSignPre(stop, 'JDSchool', '京东商城-校园', '2QUxWHx5BSCNtnBDjtt5gZTq7zdZ'), //京东校园 - JDUserSignPre(stop, 'JDHealth', '京东商城-健康', 'w2oeK5yLdHqHvwef7SMMy4PL8LF'), //京东健康 - JDUserSignPre(stop, 'JDShand', '京东拍拍-二手', '3S28janPLYmtFxypu37AYAGgivfp'), //京东拍拍二手 - JDUserSignPre(stop, 'JDClean', '京东商城-清洁', '2Tjm6ay1ZbZ3v7UbriTj6kHy9dn6'), //京东清洁馆 - JDUserSignPre(stop, 'JDCare', '京东商城-个护', '2tZssTgnQsiUqhmg5ooLSHY9XSeN'), //京东个人护理馆 - // JDUserSignPre(stop, 'JDJewels', '京东商城-珠宝', 'zHUHpTHNTaztSRfNBFNVZscyFZU'), //京东珠宝馆 - // JDUserSignPre(stop, 'JDMakeup', '京东商城-美妆', '2smCxzLNuam5L14zNJHYu43ovbAP'), //京东美妆馆 - JDUserSignPre(stop, 'JDVege', '京东商城-菜场', 'Wcu2LVCFMkBP3HraRvb7pgSpt64'), //京东菜场 - // JDUserSignPre(stop, 'JDLive', '京东智能-生活', 'KcfFqWvhb5hHtaQkS4SD1UU6RcQ') //京东智能生活 - ]); - await JingRongDoll(stop, 'JDDouble', '金融京豆-双签', 'F68B2C3E71', '', '', '', 'jingdou'); //京东金融 京豆双签 - break; - default: - await JingDongBean(0); //京东京豆 - await JingDongStore(Wait(stop)); //京东超市 - await JingRongSteel(Wait(stop)); //金融钢镚 - await JingDongTurn(Wait(stop)); //京东转盘 - await JDFlashSale(Wait(stop)); //京东闪购 - await JingDongCash(Wait(stop)); //京东现金红包 - await JDMagicCube(Wait(stop), 2); //京东小魔方 - await JingDongGetCash(Wait(stop)); //京东领现金 - await JingDongSubsidy(Wait(stop)); //京东金贴 - await JingDongShake(Wait(stop)); //京东摇一摇 - await JDSecKilling(Wait(stop)); //京东秒杀 - await JingDongBuyCar(Wait(stop), '435c9611622e4135b436b9d73351be10'); //京东汽车 - // await JingRongDoll(Wait(stop), 'JRThreeDoll', '京东金融-签叁', '69F5EC743C'); - await JingRongDoll(Wait(stop), 'JRFourDoll', '京东金融-签肆', '30C4F86264'); - // await JingRongDoll(Wait(stop), 'JRFiveDoll', '京东金融-签伍', '1D06AA3B0F'); - // await JingRongDoll(Wait(stop), 'JRDoll', '京东金融-签壹', '4D25A6F482'); - // await JingRongDoll(Wait(stop), 'XJDouble', '金融现金-双签', 'F68B2C3E71', '', '', '', 'xianjin'); //京东金融 现金双签 - await JingRongDoll(Wait(stop), 'JTDouble', '京东金贴-双签', '1DF13833F7'); //京东金融 金贴双签 - await JDUserSignPre(Wait(stop), 'JDCard', '京东商城-卡包', '7e5fRnma6RBATV9wNrGXJwihzcD'); //京东卡包 - await JDUserSignPre(Wait(stop), 'JDUndies', '京东商城-内衣', '4PgpL1xqPSW1sVXCJ3xopDbB1f69'); //京东内衣馆 - await JDUserSignPre(Wait(stop), 'JDEsports', '京东商城-电竞', 'CHdHQhA5AYDXXQN9FLt3QUAPRsB'); //京东电竞 - // await JDUserSignPre(Wait(stop), 'JDCustomized', '京东商城-定制', '2BJK5RBdvc3hdddZDS1Svd5Esj3R'); //京东定制 - await JDUserSignPre(Wait(stop), 'JDSuitcase', '京东商城-箱包', 'ZrH7gGAcEkY2gH8wXqyAPoQgk6t'); //京东箱包馆 - await JDUserSignPre(Wait(stop), 'JDClothing', '京东商城-服饰', '4RBT3H9jmgYg1k2kBnHF8NAHm7m8'); //京东服饰 - await JDUserSignPre(Wait(stop), 'JDSchool', '京东商城-校园', '2QUxWHx5BSCNtnBDjtt5gZTq7zdZ'); //京东校园 - await JDUserSignPre(Wait(stop), 'JDHealth', '京东商城-健康', 'w2oeK5yLdHqHvwef7SMMy4PL8LF'); //京东健康 - await JDUserSignPre(Wait(stop), 'JDShoes', '京东商城-鞋靴', '4RXyb1W4Y986LJW8ToqMK14BdTD'); //京东鞋靴 - await JDUserSignPre(Wait(stop), 'JDChild', '京东商城-童装', '3Af6mZNcf5m795T8dtDVfDwWVNhJ'); //京东童装馆 - await JDUserSignPre(Wait(stop), 'JDBaby', '京东商城-母婴', '3BbAVGQPDd6vTyHYjmAutXrKAos6'); //京东母婴馆 - await JDUserSignPre(Wait(stop), 'JD3C', '京东商城-数码', '4SWjnZSCTHPYjE5T7j35rxxuMTb6'); //京东数码电器馆 - await JDUserSignPre(Wait(stop), 'JDWomen', '京东商城-女装', 'DpSh7ma8JV7QAxSE2gJNro8Q2h9'); //京东女装馆 - await JDUserSignPre(Wait(stop), 'JDBook', '京东商城-图书', '3SC6rw5iBg66qrXPGmZMqFDwcyXi'); //京东图书 - await JDUserSignPre(Wait(stop), 'JDShand', '京东拍拍-二手', '3S28janPLYmtFxypu37AYAGgivfp'); //京东拍拍二手 - // await JDUserSignPre(Wait(stop), 'JDMakeup', '京东商城-美妆', '2smCxzLNuam5L14zNJHYu43ovbAP'); //京东美妆馆 - await JDUserSignPre(Wait(stop), 'JDVege', '京东商城-菜场', 'Wcu2LVCFMkBP3HraRvb7pgSpt64'); //京东菜场 - await JDUserSignPre(Wait(stop), 'JDaccompany', '京东商城-陪伴', 'kPM3Xedz1PBiGQjY4ZYGmeVvrts'); //京东陪伴 - // await JDUserSignPre(Wait(stop), 'JDLive', '京东智能-生活', 'KcfFqWvhb5hHtaQkS4SD1UU6RcQ'); //京东智能生活 - await JDUserSignPre(Wait(stop), 'JDClean', '京东商城-清洁', '2Tjm6ay1ZbZ3v7UbriTj6kHy9dn6'); //京东清洁馆 - await JDUserSignPre(Wait(stop), 'JDCare', '京东商城-个护', '2tZssTgnQsiUqhmg5ooLSHY9XSeN'); //京东个人护理馆 - // await JDUserSignPre(Wait(stop), 'JDJewels', '京东商城-珠宝', 'zHUHpTHNTaztSRfNBFNVZscyFZU'); //京东珠宝馆 - await JingRongDoll(Wait(stop), 'JDDouble', '金融京豆-双签', 'F68B2C3E71', '', '', '', 'jingdou'); //京东金融 京豆双签 - break; - } - await Promise.all([ - TotalSteel(), //总钢镚查询 - TotalCash(), //总红包查询 - TotalBean(), //总京豆查询 - TotalSubsidy(), //总金贴查询 - TotalMoney() //总现金查询 - ]); - await notify(); //通知模块 -} - -function notify() { - return new Promise(resolve => { - try { - var bean = 0; - var steel = 0; - var cash = 0; - var money = 0; - var subsidy = 0; - var success = 0; - var fail = 0; - var err = 0; - var notify = ''; - for (var i in merge) { - bean += merge[i].bean ? Number(merge[i].bean) : 0 - steel += merge[i].steel ? Number(merge[i].steel) : 0 - cash += merge[i].Cash ? Number(merge[i].Cash) : 0 - money += merge[i].Money ? Number(merge[i].Money) : 0 - subsidy += merge[i].subsidy ? Number(merge[i].subsidy) : 0 - success += merge[i].success ? Number(merge[i].success) : 0 - fail += merge[i].fail ? Number(merge[i].fail) : 0 - err += merge[i].error ? Number(merge[i].error) : 0 - notify += merge[i].notify ? "\n" + merge[i].notify : "" - } - var Cash = merge.TotalCash && merge.TotalCash.TCash ? `${merge.TotalCash.TCash}红包` : "" - var Steel = merge.TotalSteel && merge.TotalSteel.TSteel ? `${merge.TotalSteel.TSteel}钢镚` : `` - var beans = merge.TotalBean && merge.TotalBean.Qbear ? `${merge.TotalBean.Qbear}京豆${Steel?`, `:``}` : "" - var Money = merge.TotalMoney && merge.TotalMoney.TMoney ? `${merge.TotalMoney.TMoney}现金${Cash?`, `:``}` : "" - var Subsidy = merge.TotalSubsidy && merge.TotalSubsidy.TSubsidy ? `${merge.TotalSubsidy.TSubsidy}金贴${Money||Cash?", ":""}` : "" - var Tbean = bean ? `${bean.toFixed(0)}京豆${steel?", ":""}` : "" - var TSteel = steel ? `${steel.toFixed(2)}钢镚` : "" - var TCash = cash ? `${cash.toFixed(2)}红包${subsidy||money?", ":""}` : "" - var TSubsidy = subsidy ? `${subsidy.toFixed(2)}金贴${money?", ":""}` : "" - var TMoney = money ? `${money.toFixed(2)}现金` : "" - var Ts = success ? `成功${success}个${fail||err?`, `:``}` : `` - var Tf = fail ? `失败${fail}个${err?`, `:``}` : `` - var Te = err ? `错误${err}个` : `` - var one = `【签到概览】: ${Ts+Tf+Te}${Ts||Tf||Te?`\n`:`获取失败\n`}` - var two = Tbean || TSteel ? `【签到奖励】: ${Tbean+TSteel}\n` : `` - var three = TCash || TSubsidy || TMoney ? `【其他奖励】: ${TCash+TSubsidy+TMoney}\n` : `` - var four = `【账号总计】: ${beans+Steel}${beans||Steel?`\n`:`获取失败\n`}` - var five = `【其他总计】: ${Subsidy+Money+Cash}${Subsidy||Money||Cash?`\n`:`获取失败\n`}` - var DName = merge.TotalBean && merge.TotalBean.nickname ? merge.TotalBean.nickname : "获取失败" - var cnNum = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十"]; - const numFix = !Key && !DualKey ? DualAccount - 2 : Key && DualKey ? DualAccount : DualAccount - 1 || DualAccount - const Name = DualKey || OtherKey ? `【签到号${cnNum[numFix]||numFix}】: ${DName}\n` : `` - const disables = $nobyda.read("JD_DailyBonusDisables") - const amount = disables ? disables.split(",").length : 0 - const disa = !notify || amount ? `【温馨提示】: 检测到${$nobyda.disable?`上次执行意外崩溃, `:``}已禁用${notify?`${amount}个`:`所有`}接口, 如需开启请前往BoxJs或查看脚本内第100行注释.\n` : `` - $nobyda.notify("", "", Name + one + two + three + four + five + disa + notify, { - 'media-url': $nobyda.headUrl || 'https://cdn.jsdelivr.net/gh/NobyDa/mini@master/Color/jd.png' - }); - $nobyda.headUrl = null; - if ($nobyda.isJSBox) { - Shortcut = (typeof(Shortcut) == 'undefined' ? '' : Shortcut) + Name + one + two + three + four + five + "\n" - } - double(); - } catch (eor) { - $nobyda.notify("通知模块 " + eor.name + "‼️", JSON.stringify(eor), eor.message) - } finally { - resolve() - } - }); -} - -function ReadCookie() { - DualAccount = 1; - const EnvInfo = $nobyda.isJSBox ? "JD_Cookie" : "CookieJD" - const EnvInfo2 = $nobyda.isJSBox ? "JD_Cookie2" : "CookieJD2" - const EnvInfo3 = $nobyda.isJSBox ? "JD_Cookies" : "CookiesJD" - if (DeleteCookie) { - if ($nobyda.read(EnvInfo) || $nobyda.read(EnvInfo2) || ($nobyda.read(EnvInfo3) || '[]') != '[]') { - $nobyda.write("", EnvInfo) - $nobyda.write("", EnvInfo2) - $nobyda.write("", EnvInfo3) - $nobyda.notify("京东Cookie清除成功 !", "", '请手动关闭脚本内"DeleteCookie"选项') - $nobyda.done() - return - } - $nobyda.notify("脚本终止", "", '未关闭脚本内"DeleteCookie"选项 ‼️') - $nobyda.done() - return - } else if ($nobyda.isRequest) { - GetCookie() - return - } - Key = Key || $nobyda.read(EnvInfo) - DualKey = DualKey || $nobyda.read(EnvInfo2) - OtherKey = OtherKey || $nobyda.read(EnvInfo3) - KEY = Key || DualKey - if (KEY || OtherKey) { - if ($nobyda.isJSBox || $nobyda.isNode) { - if (Key) $nobyda.write(Key, EnvInfo); - if (DualKey) $nobyda.write(DualKey, EnvInfo2); - if (OtherKey) $nobyda.write(OtherKey, EnvInfo3); - if (stop !== '0') $nobyda.write(stop, "JD_DailyBonusDelay"); - } - out = parseInt($nobyda.read("JD_DailyBonusTimeOut")) || out - stop = Wait($nobyda.read("JD_DailyBonusDelay"), true) || Wait(stop, true) - boxdis = $nobyda.read("JD_Crash_disable") === "false" || $nobyda.isNode || $nobyda.isJSBox ? false : boxdis - LogDetails = $nobyda.read("JD_DailyBonusLog") === "true" || LogDetails - ReDis = ReDis ? $nobyda.write("", "JD_DailyBonusDisables") : "" - if (KEY) { - all() - } else { - double() - } - } else { - $nobyda.notify("京东签到", "", "脚本终止, 未获取Cookie ‼️") - $nobyda.done() - } -} - -function double() { - KEY = ''; - if (DualAccount == 1) { - DualAccount++; - KEY = Key ? DualKey : '' - } - if (!KEY && OtherKey) { - DualAccount++; - let cks = []; - try { - cks = JSON.parse(OtherKey); - } catch (e) { - cks = []; - console.log(`\n第三及以上账号Cookie读取失败, 请检查Json格式.`) - } - if (cks.length + 2 >= DualAccount) { - KEY = cks[DualAccount - 3].cookie; - } - } - if (KEY) { - all() - } else { - if ($nobyda.isJSBox) { - $intents.finish(Shortcut) - } - $nobyda.time(); - $nobyda.done(); - } -} - -function JingDongBean(s) { - merge.JDBean = {}; - return new Promise(resolve => { - if (disable("JDBean")) return resolve() - setTimeout(() => { - const JDBUrl = { - url: 'https://api.m.jd.com/client.action', - headers: { - Cookie: KEY - }, - body: 'functionId=signBeanIndex&appid=ld' - }; - $nobyda.post(JDBUrl, function(error, response, data) { - try { - if (error) { - throw new Error(error) - } else { - const cc = JSON.parse(data) - const Details = LogDetails ? "response:\n" + data : ''; - if (cc.code == 3) { - console.log("\n" + "京东商城-京豆Cookie失效 " + Details) - merge.JDBean.notify = "京东商城-京豆: 失败, 原因: Cookie失效‼️" - merge.JDBean.fail = 1 - } else if (data.match(/跳转至拼图/)) { - merge.JDBean.notify = "京东商城-京豆: 失败, 需要拼图验证 ⚠️" - merge.JDBean.fail = 1 - } else if (data.match(/\"status\":\"?1\"?/)) { - console.log("\n" + "京东商城-京豆签到成功 " + Details) - if (data.match(/dailyAward/)) { - merge.JDBean.notify = "京东商城-京豆: 成功, 明细: " + cc.data.dailyAward.beanAward.beanCount + "京豆 🐶" - merge.JDBean.bean = cc.data.dailyAward.beanAward.beanCount - } else if (data.match(/continuityAward/)) { - merge.JDBean.notify = "京东商城-京豆: 成功, 明细: " + cc.data.continuityAward.beanAward.beanCount + "京豆 🐶" - merge.JDBean.bean = cc.data.continuityAward.beanAward.beanCount - } else if (data.match(/新人签到/)) { - const quantity = data.match(/beanCount\":\"(\d+)\".+今天/) - merge.JDBean.bean = quantity ? quantity[1] : 0 - merge.JDBean.notify = "京东商城-京豆: 成功, 明细: " + (quantity ? quantity[1] : "无") + "京豆 🐶" - } else { - merge.JDBean.notify = "京东商城-京豆: 成功, 明细: 无京豆 🐶" - } - merge.JDBean.success = 1 - } else { - merge.JDBean.fail = 1 - console.log("\n" + "京东商城-京豆签到失败 " + Details) - if (data.match(/(已签到|新人签到)/)) { - merge.JDBean.notify = "京东商城-京豆: 失败, 原因: 已签过 ⚠️" - } else if (data.match(/人数较多|S101/)) { - merge.JDBean.notify = "京东商城-京豆: 失败, 签到人数较多 ⚠️" - } else { - merge.JDBean.notify = "京东商城-京豆: 失败, 原因: 未知 ⚠️" - } - } - } - } catch (eor) { - $nobyda.AnError("京东商城-京豆", "JDBean", eor, response, data) - } finally { - resolve() - } - }) - }, s) - if (out) setTimeout(resolve, out + s) - }); -} - -function JingDongTurn(s) { - merge.JDTurn = {}, merge.JDTurn.notify = "", merge.JDTurn.success = 0, merge.JDTurn.bean = 0; - return new Promise((resolve, reject) => { - if (disable("JDTurn")) return reject() - const JDTUrl = { - url: 'https://api.m.jd.com/client.action?functionId=wheelSurfIndex&body=%7B%22actId%22%3A%22jgpqtzjhvaoym%22%2C%22appSource%22%3A%22jdhome%22%7D&appid=ld', - headers: { - Cookie: KEY, - } - }; - $nobyda.get(JDTUrl, async function(error, response, data) { - try { - if (error) { - throw new Error(error) - } else { - const cc = JSON.parse(data).data.lotteryCode - const Details = LogDetails ? "response:\n" + data : ''; - if (cc) { - console.log("\n" + "京东商城-转盘查询成功 " + Details) - return resolve(cc) - } else { - merge.JDTurn.notify = "京东商城-转盘: 失败, 原因: 查询错误 ⚠️" - merge.JDTurn.fail = 1 - console.log("\n" + "京东商城-转盘查询失败 " + Details) - } - } - } catch (eor) { - $nobyda.AnError("京东转盘-查询", "JDTurn", eor, response, data) - } finally { - reject() - } - }) - if (out) setTimeout(reject, out + s) - }).then(data => { - return JingDongTurnSign(s, data); - }, () => {}); -} - -function JingDongTurnSign(s, code) { - return new Promise(resolve => { - setTimeout(() => { - const JDTUrl = { - url: `https://api.m.jd.com/client.action?functionId=lotteryDraw&body=%7B%22actId%22%3A%22jgpqtzjhvaoym%22%2C%22appSource%22%3A%22jdhome%22%2C%22lotteryCode%22%3A%22${code}%22%7D&appid=ld`, - headers: { - Cookie: KEY, - } - }; - $nobyda.get(JDTUrl, async function(error, response, data) { - try { - if (error) { - throw new Error(error) - } else { - const cc = JSON.parse(data) - const Details = LogDetails ? "response:\n" + data : ''; - const also = merge.JDTurn.notify ? true : false - if (cc.code == 3) { - console.log("\n" + "京东转盘Cookie失效 " + Details) - merge.JDTurn.notify = "京东商城-转盘: 失败, 原因: Cookie失效‼️" - merge.JDTurn.fail = 1 - } else if (data.match(/(\"T216\"|活动结束)/)) { - merge.JDTurn.notify = "京东商城-转盘: 失败, 原因: 活动结束 ⚠️" - merge.JDTurn.fail = 1 - } else if (data.match(/(京豆|\"910582\")/)) { - console.log("\n" + "京东商城-转盘签到成功 " + Details) - merge.JDTurn.bean += Number(cc.data.prizeSendNumber) || 0 - merge.JDTurn.notify += `${also?`\n`:``}京东商城-转盘: ${also?`多次`:`成功`}, 明细: ${cc.data.prizeSendNumber||`无`}京豆 🐶` - merge.JDTurn.success += 1 - if (cc.data.chances != "0") { - await JingDongTurnSign(2000, code) - } - } else if (data.match(/未中奖/)) { - merge.JDTurn.notify += `${also?`\n`:``}京东商城-转盘: ${also?`多次`:`成功`}, 状态: 未中奖 🐶` - merge.JDTurn.success += 1 - if (cc.data.chances != "0") { - await JingDongTurnSign(2000, code) - } - } else { - console.log("\n" + "京东商城-转盘签到失败 " + Details) - merge.JDTurn.fail = 1 - if (data.match(/(T215|次数为0)/)) { - merge.JDTurn.notify = "京东商城-转盘: 失败, 原因: 已转过 ⚠️" - } else if (data.match(/(T210|密码)/)) { - merge.JDTurn.notify = "京东商城-转盘: 失败, 原因: 无支付密码 ⚠️" - } else { - merge.JDTurn.notify += `${also?`\n`:``}京东商城-转盘: 失败, 原因: 未知 ⚠️${also?` (多次)`:``}` - } - } - } - } catch (eor) { - $nobyda.AnError("京东商城-转盘", "JDTurn", eor, response, data) - } finally { - resolve() - } - }) - }, s) - if (out) setTimeout(resolve, out + s) - }); -} - -function JingRongSteel(s) { - merge.JRSteel = {}; - return new Promise(resolve => { - if (disable("JRSteel")) return resolve() - setTimeout(() => { - const JRSUrl = { - url: 'https://ms.jr.jd.com/gw/generic/hy/h5/m/signIn1', - headers: { - Cookie: KEY - }, - body: "reqData=%7B%22channelSource%22%3A%22JRAPP6.0%22%2C%22riskDeviceParam%22%3A%22%7B%7D%22%7D" - }; - $nobyda.post(JRSUrl, function(error, response, data) { - try { - if (error) throw new Error(error) - const cc = JSON.parse(data) - const Details = LogDetails ? "response:\n" + data : ''; - if (data.match(/\"resBusiCode\":0/)) { - console.log("\n" + "京东金融-钢镚签到成功 " + Details) - const leng = cc.resultData.resBusiData.actualTotalRewardsValue - const spare = cc.resultData.resBusiData.baseReward - merge.JRSteel.steel = leng ? leng > 9 ? `0.${leng}` : `0.0${leng}` : spare ? spare : 0 - merge.JRSteel.notify = `京东金融-钢镚: 成功, 明细: ${merge.JRSteel.steel || `无`}钢镚 💰` - merge.JRSteel.success = 1 - } else { - console.log("\n" + "京东金融-钢镚签到失败 " + Details) - merge.JRSteel.fail = 1 - if (data.match(/已经领取|\"resBusiCode\":15/)) { - merge.JRSteel.notify = "京东金融-钢镚: 失败, 原因: 已签过 ⚠️" - } else if (data.match(/未实名/)) { - merge.JRSteel.notify = "京东金融-钢镚: 失败, 账号未实名 ⚠️" - } else if (data.match(/(\"resultCode\":3|请先登录)/)) { - merge.JRSteel.notify = "京东金融-钢镚: 失败, 原因: Cookie失效‼️" - } else { - merge.JRSteel.notify = "京东金融-钢镚: 失败, 原因: 未知 ⚠️" - } - } - } catch (eor) { - $nobyda.AnError("京东金融-钢镚", "JRSteel", eor, response, data) - } finally { - resolve() - } - }) - }, s) - if (out) setTimeout(resolve, out + s) - }); -} - -function JingDongShake(s) { - if (!merge.JDShake) merge.JDShake = {}, merge.JDShake.success = 0, merge.JDShake.bean = 0, merge.JDShake.notify = ''; - return new Promise(resolve => { - if (disable("JDShake")) return resolve() - setTimeout(() => { - const JDSh = { - url: 'https://api.m.jd.com/client.action?appid=vip_h5&functionId=vvipclub_shaking', - headers: { - Cookie: KEY, - } - }; - $nobyda.get(JDSh, async function(error, response, data) { - try { - if (error) { - throw new Error(error) - } else { - const Details = LogDetails ? "response:\n" + data : ''; - const cc = JSON.parse(data) - const also = merge.JDShake.notify ? true : false - if (data.match(/prize/)) { - console.log("\n" + "京东商城-摇一摇签到成功 " + Details) - merge.JDShake.success += 1 - if (cc.data.prizeBean) { - merge.JDShake.bean += cc.data.prizeBean.count || 0 - merge.JDShake.notify += `${also?`\n`:``}京东商城-摇摇: ${also?`多次`:`成功`}, 明细: ${merge.JDShake.bean || `无`}京豆 🐶` - } else if (cc.data.prizeCoupon) { - merge.JDShake.notify += `${also?`\n`:``}京东商城-摇摇: ${also?`多次, `:``}获得满${cc.data.prizeCoupon.quota}减${cc.data.prizeCoupon.discount}优惠券→ ${cc.data.prizeCoupon.limitStr}` - } else { - merge.JDShake.notify += `${also?`\n`:``}京东商城-摇摇: 成功, 明细: 未知 ⚠️${also?` (多次)`:``}` - } - if (cc.data.luckyBox.freeTimes != 0) { - await JingDongShake(s) - } - } else { - console.log("\n" + "京东商城-摇一摇签到失败 " + Details) - if (data.match(/true/)) { - merge.JDShake.notify += `${also?`\n`:``}京东商城-摇摇: 成功, 明细: 无奖励 🐶${also?` (多次)`:``}` - merge.JDShake.success += 1 - if (cc.data.luckyBox.freeTimes != 0) { - await JingDongShake(s) - } - } else { - merge.JDShake.fail = 1 - if (data.match(/(无免费|8000005|9000005)/)) { - merge.JDShake.notify = "京东商城-摇摇: 失败, 原因: 已摇过 ⚠️" - } else if (data.match(/(未登录|101)/)) { - merge.JDShake.notify = "京东商城-摇摇: 失败, 原因: Cookie失效‼️" - } else { - merge.JDShake.notify += `${also?`\n`:``}京东商城-摇摇: 失败, 原因: 未知 ⚠️${also?` (多次)`:``}` - } - } - } - } - } catch (eor) { - $nobyda.AnError("京东商城-摇摇", "JDShake", eor, response, data) - } finally { - resolve() - } - }) - }, s) - if (out) setTimeout(resolve, out + s) - }); -} - -function JDUserSignPre(s, key, title, ac) { - merge[key] = {}; - if ($nobyda.isJSBox) { - return JDUserSignPre2(s, key, title, ac); - } else { - return JDUserSignPre1(s, key, title, ac); - } -} - -function JDUserSignPre1(s, key, title, acData, ask) { - return new Promise((resolve, reject) => { - if (disable(key, title, 1)) return reject() - const JDUrl = { - url: 'https://api.m.jd.com/?client=wh5&functionId=qryH5BabelFloors', - headers: { - Cookie: KEY - }, - opts: { - 'filter': 'try{var od=JSON.parse(body);var params=(od.floatLayerList||[]).filter(o=>o.params&&o.params.match(/enActK/)).map(o=>o.params).pop()||(od.floorList||[]).filter(o=>o.template=="signIn"&&o.signInfos&&o.signInfos.params&&o.signInfos.params.match(/enActK/)).map(o=>o.signInfos&&o.signInfos.params).pop();var tId=(od.floorList||[]).filter(o=>o.boardParams&&o.boardParams.turnTableId).map(o=>o.boardParams.turnTableId).pop();var page=od.paginationFlrs;return JSON.stringify({qxAct:params||null,qxTid:tId||null,qxPage:page||null})}catch(e){return `=> 过滤器发生错误: ${e.message}`}' - }, - body: `body=${encodeURIComponent(`{"activityId":"${acData}"${ask?`,"paginationParam":"2","paginationFlrs":"${ask}"`:``}}`)}` - }; - $nobyda.post(JDUrl, async function(error, response, data) { - try { - if (error) { - throw new Error(error) - } else { - const od = JSON.parse(data || '{}'); - const turnTableId = od.qxTid || (od.floorList || []).filter(o => o.boardParams && o.boardParams.turnTableId).map(o => o.boardParams.turnTableId).pop(); - const page = od.qxPage || od.paginationFlrs; - if (data.match(/enActK/)) { // 含有签到活动数据 - let params = od.qxAct || (od.floatLayerList || []).filter(o => o.params && o.params.match(/enActK/)).map(o => o.params).pop() - if (!params) { // 第一处找到签到所需数据 - // floatLayerList未找到签到所需数据,从floorList中查找 - let signInfo = (od.floorList || []).filter(o => o.template == 'signIn' && o.signInfos && o.signInfos.params && o.signInfos.params.match(/enActK/)) - .map(o => o.signInfos).pop(); - if (signInfo) { - if (signInfo.signStat == '1') { - console.log(`\n${title}重复签到`) - merge[key].notify = `${title}: 失败, 原因: 已签过 ⚠️` - merge[key].fail = 1 - } else { - params = signInfo.params; - } - } else { - merge[key].notify = `${title}: 失败, 活动查找异常 ⚠️` - merge[key].fail = 1 - } - } - if (params) { - return resolve({ - params: params - }); // 执行签到处理 - } - } else if (turnTableId) { // 无签到数据, 但含有关注店铺签到 - const boxds = $nobyda.read("JD_Follow_disable") === "false" ? false : true - if (boxds) { - console.log(`\n${title}关注店铺`) - return resolve(parseInt(turnTableId)) - } else { - merge[key].notify = `${title}: 失败, 需要关注店铺 ⚠️` - merge[key].fail = 1 - } - } else if (page && !ask) { // 无签到数据, 尝试带参查询 - const boxds = $nobyda.read("JD_Retry_disable") === "false" ? false : true - if (boxds) { - console.log(`\n${title}二次查询`) - return resolve(page) - } else { - merge[key].notify = `${title}: 失败, 请尝试开启增强 ⚠️` - merge[key].fail = 1 - } - } else { - merge[key].notify = `${title}: 失败, ${!data ? `需要手动执行` : `不含活动数据`} ⚠️` - merge[key].fail = 1 - } - } - reject() - } catch (eor) { - $nobyda.AnError(title, key, eor, response, data) - reject() - } - }) - if (out) setTimeout(reject, out + s) - }).then(data => { - disable(key, title, 2) - if (typeof(data) == "object") return JDUserSign1(s, key, title, encodeURIComponent(JSON.stringify(data))); - if (typeof(data) == "number") return JDUserSign2(s, key, title, data); - if (typeof(data) == "string") return JDUserSignPre1(s, key, title, acData, data); - }, () => disable(key, title, 2)) -} - -function JDUserSignPre2(s, key, title, acData) { - return new Promise((resolve, reject) => { - if (disable(key, title, 1)) return reject() - const JDUrl = { - url: `https://pro.m.jd.com/mall/active/${acData}/index.html`, - headers: { - Cookie: KEY, - } - }; - $nobyda.get(JDUrl, async function(error, response, data) { - try { - if (error) { - throw new Error(error) - } else { - const act = data.match(/\"params\":\"\{\\\"enActK.+?\\\"\}\"/) - const turnTable = data.match(/\"turnTableId\":\"(\d+)\"/) - const page = data.match(/\"paginationFlrs\":\"(\[\[.+?\]\])\"/) - if (act) { // 含有签到活动数据 - return resolve(act) - } else if (turnTable) { // 无签到数据, 但含有关注店铺签到 - const boxds = $nobyda.read("JD_Follow_disable") === "false" ? false : true - if (boxds) { - console.log(`\n${title}关注店铺`) - return resolve(parseInt(turnTable[1])) - } else { - merge[key].notify = `${title}: 失败, 需要关注店铺 ⚠️` - merge[key].fail = 1 - } - } else if (page) { // 无签到数据, 尝试带参查询 - const boxds = $nobyda.read("JD_Retry_disable") === "false" ? false : true - if (boxds) { - console.log(`\n${title}二次查询`) - return resolve(page[1]) - } else { - merge[key].notify = `${title}: 失败, 请尝试开启增强 ⚠️` - merge[key].fail = 1 - } - } else { - merge[key].notify = `${title}: 失败, ${!data ? `需要手动执行` : `不含活动数据`} ⚠️` - merge[key].fail = 1 - } - } - reject() - } catch (eor) { - $nobyda.AnError(title, key, eor, response, data) - reject() - } - }) - if (out) setTimeout(reject, out + s) - }).then(data => { - disable(key, title, 2) - if (typeof(data) == "object") return JDUserSign1(s, key, title, encodeURIComponent(`{${data}}`)); - if (typeof(data) == "number") return JDUserSign2(s, key, title, data) - if (typeof(data) == "string") return JDUserSignPre1(s, key, title, acData, data) - }, () => disable(key, title, 2)) -} - -function JDUserSign1(s, key, title, body) { - return new Promise(resolve => { - setTimeout(() => { - const JDUrl = { - url: 'https://api.m.jd.com/client.action?functionId=userSign', - headers: { - Cookie: KEY - }, - body: `body=${body}&client=wh5` - }; - $nobyda.post(JDUrl, function(error, response, data) { - try { - if (error) { - throw new Error(error) - } else { - const Details = LogDetails ? `response:\n${data}` : ''; - if (data.match(/签到成功/)) { - console.log(`\n${title}签到成功(1)${Details}`) - if (data.match(/\"text\":\"\d+京豆\"/)) { - merge[key].bean = data.match(/\"text\":\"(\d+)京豆\"/)[1] - } - merge[key].notify = `${title}: 成功, 明细: ${merge[key].bean || '无'}京豆 🐶` - merge[key].success = 1 - } else { - console.log(`\n${title}签到失败(1)${Details}`) - if (data.match(/(已签到|已领取)/)) { - merge[key].notify = `${title}: 失败, 原因: 已签过 ⚠️` - } else if (data.match(/(不存在|已结束|未开始)/)) { - merge[key].notify = `${title}: 失败, 原因: 活动已结束 ⚠️` - } else if (data.match(/\"code\":\"?3\"?/)) { - merge[key].notify = `${title}: 失败, 原因: Cookie失效‼️` - } else { - const ng = data.match(/\"(errorMessage|subCodeMsg)\":\"(.+?)\"/) - merge[key].notify = `${title}: 失败, ${ng?ng[2]:`原因: 未知`} ⚠️` - } - merge[key].fail = 1 - } - } - } catch (eor) { - $nobyda.AnError(title, key, eor, response, data) - } finally { - resolve() - } - }) - }, s) - if (out) setTimeout(resolve, out + s) - }); -} - -async function JDUserSign2(s, key, title, tid) { - await new Promise(resolve => { - $nobyda.get({ - url: `https://jdjoy.jd.com/api/turncard/channel/detail?turnTableId=${tid}&invokeKey=NRp8OPxZMFXmGkaE`, - headers: { - Cookie: KEY - } - }, function(error, response, data) { - resolve() - }) - if (out) setTimeout(resolve, out + s) - }); - return new Promise(resolve => { - setTimeout(() => { - const JDUrl = { - url: 'https://jdjoy.jd.com/api/turncard/channel/sign?invokeKey=NRp8OPxZMFXmGkaE', - headers: { - Cookie: KEY - }, - body: `turnTableId=${tid}` - }; - $nobyda.post(JDUrl, function(error, response, data) { - try { - if (error) { - throw new Error(error) - } else { - const Details = LogDetails ? `response:\n${data}` : ''; - if (data.match(/\"success\":true/)) { - console.log(`\n${title}签到成功(2)${Details}`) - if (data.match(/\"jdBeanQuantity\":\d+/)) { - merge[key].bean = data.match(/\"jdBeanQuantity\":(\d+)/)[1] - } - merge[key].notify = `${title}: 成功, 明细: ${merge[key].bean || '无'}京豆 🐶` - merge[key].success = 1 - } else { - const captcha = /请进行验证/.test(data); - if (data.match(/(已经签到|已经领取)/)) { - merge[key].notify = `${title}: 失败, 原因: 已签过 ⚠️` - } else if (data.match(/(不存在|已结束|未开始)/)) { - merge[key].notify = `${title}: 失败, 原因: 活动已结束 ⚠️` - } else if (data.match(/(没有登录|B0001)/)) { - merge[key].notify = `${title}: 失败, 原因: Cookie失效‼️` - } else if (!captcha) { - const ng = data.match(/\"(errorMessage|subCodeMsg)\":\"(.+?)\"/) - merge[key].notify = `${title}: 失败, ${ng?ng[2]:`原因: 未知`} ⚠️` - } - if (!captcha) merge[key].fail = 1; - console.log(`\n${title}签到失败(2)${captcha?`\n需要拼图验证, 跳过通知记录 ⚠️`:``}${Details}`) - } - } - } catch (eor) { - $nobyda.AnError(title, key, eor, response, data) - } finally { - resolve() - } - }) - }, 200 + s) - if (out) setTimeout(resolve, out + s + 200) - }); -} - -function JDFlashSale(s) { - merge.JDFSale = {}; - return new Promise(resolve => { - if (disable("JDFSale")) return resolve() - setTimeout(() => { - const JDPETUrl = { - url: 'https://api.m.jd.com/client.action?functionId=partitionJdSgin', - headers: { - Cookie: KEY - }, - body: "body=%7B%22version%22%3A%22v2%22%7D&client=apple&clientVersion=9.0.8&openudid=1fce88cd05c42fe2b054e846f11bdf33f016d676&sign=6768e2cf625427615dd89649dd367d41&st=1597248593305&sv=121" - }; - $nobyda.post(JDPETUrl, async function(error, response, data) { - try { - if (error) { - throw new Error(error) - } else { - const Details = LogDetails ? "response:\n" + data : ''; - const cc = JSON.parse(data) - if (cc.result && cc.result.code == 0) { - console.log("\n" + "京东商城-闪购签到成功 " + Details) - merge.JDFSale.bean = cc.result.jdBeanNum || 0 - merge.JDFSale.notify = "京东商城-闪购: 成功, 明细: " + (merge.JDFSale.bean || "无") + "京豆 🐶" - merge.JDFSale.success = 1 - } else { - console.log("\n" + "京东商城-闪购签到失败 " + Details) - if (data.match(/(已签到|已领取|\"2005\")/)) { - merge.JDFSale.notify = "京东商城-闪购: 失败, 原因: 已签过 ⚠️" - } else if (data.match(/不存在|已结束|\"2008\"|\"3001\"/)) { - await FlashSaleDivide(s); //瓜分京豆 - return - } else if (data.match(/(\"code\":\"3\"|\"1003\")/)) { - merge.JDFSale.notify = "京东商城-闪购: 失败, 原因: Cookie失效‼️" - } else { - const msg = data.match(/\"msg\":\"([\u4e00-\u9fa5].+?)\"/) - merge.JDFSale.notify = `京东商城-闪购: 失败, ${msg ? msg[1] : `原因: 未知`} ⚠️` - } - merge.JDFSale.fail = 1 - } - } - } catch (eor) { - $nobyda.AnError("京东商城-闪购", "JDFSale", eor, response, data) - } finally { - resolve() - } - }) - }, s) - if (out) setTimeout(resolve, out + s) - }); -} - -function FlashSaleDivide(s) { - return new Promise(resolve => { - setTimeout(() => { - const Url = { - url: 'https://api.m.jd.com/client.action?functionId=partitionJdShare', - headers: { - Cookie: KEY - }, - body: "body=%7B%22version%22%3A%22v2%22%7D&client=apple&clientVersion=9.0.8&openudid=1fce88cd05c42fe2b054e846f11bdf33f016d676&sign=49baa3b3899b02bbf06cdf41fe191986&st=1597682588351&sv=111" - }; - $nobyda.post(Url, function(error, response, data) { - try { - if (error) { - throw new Error(error) - } else { - const Details = LogDetails ? "response:\n" + data : ''; - const cc = JSON.parse(data) - if (cc.result.code == 0) { - merge.JDFSale.success = 1 - merge.JDFSale.bean = cc.result.jdBeanNum || 0 - merge.JDFSale.notify = "京东闪购-瓜分: 成功, 明细: " + (merge.JDFSale.bean || "无") + "京豆 🐶" - console.log("\n" + "京东闪购-瓜分签到成功 " + Details) - } else { - merge.JDFSale.fail = 1 - console.log("\n" + "京东闪购-瓜分签到失败 " + Details) - if (data.match(/已参与|已领取|\"2006\"/)) { - merge.JDFSale.notify = "京东闪购-瓜分: 失败, 原因: 已瓜分 ⚠️" - } else if (data.match(/不存在|已结束|未开始|\"2008\"|\"2012\"/)) { - merge.JDFSale.notify = "京东闪购-瓜分: 失败, 原因: 活动已结束 ⚠️" - } else if (data.match(/\"code\":\"1003\"|未获取/)) { - merge.JDFSale.notify = "京东闪购-瓜分: 失败, 原因: Cookie失效‼️" - } else { - const msg = data.match(/\"msg\":\"([\u4e00-\u9fa5].+?)\"/) - merge.JDFSale.notify = `京东闪购-瓜分: 失败, ${msg ? msg[1] : `原因: 未知`} ⚠️` - } - } - } - } catch (eor) { - $nobyda.AnError("京东闪购-瓜分", "JDFSale", eor, response, data) - } finally { - resolve() - } - }) - }, s) - if (out) setTimeout(resolve, out + s) - }); -} - -function JingDongCash(s) { - merge.JDCash = {}; - return new Promise(resolve => { - if (disable("JDCash")) return resolve() - setTimeout(() => { - const JDCAUrl = { - url: 'https://api.m.jd.com/client.action?functionId=ccSignInNew', - headers: { - Cookie: KEY - }, - body: "body=%7B%22pageClickKey%22%3A%22CouponCenter%22%2C%22eid%22%3A%22O5X6JYMZTXIEX4VBCBWEM5PTIZV6HXH7M3AI75EABM5GBZYVQKRGQJ5A2PPO5PSELSRMI72SYF4KTCB4NIU6AZQ3O6C3J7ZVEP3RVDFEBKVN2RER2GTQ%22%2C%22shshshfpb%22%3A%22v1%5C%2FzMYRjEWKgYe%2BUiNwEvaVlrHBQGVwqLx4CsS9PH1s0s0Vs9AWk%2B7vr9KSHh3BQd5NTukznDTZnd75xHzonHnw%3D%3D%22%2C%22childActivityUrl%22%3A%22openapp.jdmobile%253a%252f%252fvirtual%253fparams%253d%257b%255c%2522category%255c%2522%253a%255c%2522jump%255c%2522%252c%255c%2522des%255c%2522%253a%255c%2522couponCenter%255c%2522%257d%22%2C%22monitorSource%22%3A%22cc_sign_ios_index_config%22%7D&client=apple&clientVersion=8.5.0&d_brand=apple&d_model=iPhone8%2C2&openudid=1fce88cd05c42fe2b054e846f11bdf33f016d676&scope=11&screen=1242%2A2208&sign=1cce8f76d53fc6093b45a466e93044da&st=1581084035269&sv=102" - }; - $nobyda.post(JDCAUrl, function(error, response, data) { - try { - if (error) { - throw new Error(error) - } else { - const Details = LogDetails ? "response:\n" + data : ''; - const cc = JSON.parse(data) - if (cc.busiCode == "0") { - console.log("\n" + "京东现金-红包签到成功 " + Details) - merge.JDCash.success = 1 - merge.JDCash.Cash = cc.result.signResult.signData.amount || 0 - merge.JDCash.notify = `京东现金-红包: 成功, 明细: ${merge.JDCash.Cash || `无`}红包 🧧` - } else { - console.log("\n" + "京东现金-红包签到失败 " + Details) - merge.JDCash.fail = 1 - if (data.match(/(\"busiCode\":\"1002\"|完成签到)/)) { - merge.JDCash.notify = "京东现金-红包: 失败, 原因: 已签过 ⚠️" - } else if (data.match(/(不存在|已结束)/)) { - merge.JDCash.notify = "京东现金-红包: 失败, 原因: 活动已结束 ⚠️" - } else if (data.match(/(\"busiCode\":\"3\"|未登录)/)) { - merge.JDCash.notify = "京东现金-红包: 失败, 原因: Cookie失效‼️" - } else { - const msg = data.split(/\"msg\":\"([\u4e00-\u9fa5].+?)\"/)[1]; - merge.JDCash.notify = `京东现金-红包: 失败, ${msg||`原因: 未知`} ⚠️` - } - } - } - } catch (eor) { - $nobyda.AnError("京东现金-红包", "JDCash", eor, response, data) - } finally { - resolve() - } - }) - }, s) - if (out) setTimeout(resolve, out + s) - }); -} - -function JDMagicCube(s, sign) { - merge.JDCube = {}; - return new Promise((resolve, reject) => { - if (disable("JDCube")) return reject() - const JDUrl = { - url: `https://api.m.jd.com/client.action?functionId=getNewsInteractionInfo&appid=smfe${sign?`&body=${encodeURIComponent(`{"sign":${sign}}`)}`:``}`, - headers: { - Cookie: KEY, - } - }; - $nobyda.get(JDUrl, async (error, response, data) => { - try { - if (error) throw new Error(error) - const Details = LogDetails ? "response:\n" + data : ''; - console.log(`\n京东魔方-尝试查询活动(${sign}) ${Details}`) - if (data.match(/\"interactionId\":\d+/)) { - resolve({ - id: data.match(/\"interactionId\":(\d+)/)[1], - sign: sign || null - }) - } else if (data.match(/配置异常/) && sign) { - await JDMagicCube(s, sign == 2 ? 1 : null) - reject() - } else { - resolve(null) - } - } catch (eor) { - $nobyda.AnError("京东魔方-查询", "JDCube", eor, response, data) - reject() - } - }) - if (out) setTimeout(reject, out + s) - }).then(data => { - return JDMagicCubeSign(s, data) - }, () => {}); -} - -function JDMagicCubeSign(s, id) { - return new Promise(resolve => { - setTimeout(() => { - const JDMCUrl = { - url: `https://api.m.jd.com/client.action?functionId=getNewsInteractionLotteryInfo&appid=smfe${id?`&body=${encodeURIComponent(`{${id.sign?`"sign":${id.sign},`:``}"interactionId":${id.id}}`)}`:``}`, - headers: { - Cookie: KEY, - } - }; - $nobyda.get(JDMCUrl, function(error, response, data) { - try { - if (error) { - throw new Error(error) - } else { - const Details = LogDetails ? "response:\n" + data : ''; - const cc = JSON.parse(data) - if (data.match(/(\"name\":)/)) { - console.log("\n" + "京东商城-魔方签到成功 " + Details) - merge.JDCube.success = 1 - if (data.match(/(\"name\":\"京豆\")/)) { - merge.JDCube.bean = cc.result.lotteryInfo.quantity || 0 - merge.JDCube.notify = `京东商城-魔方: 成功, 明细: ${merge.JDCube.bean || `无`}京豆 🐶` - } else { - merge.JDCube.notify = `京东商城-魔方: 成功, 明细: ${cc.result.lotteryInfo.name || `未知`} 🎉` - } - } else { - console.log("\n" + "京东商城-魔方签到失败 " + Details) - merge.JDCube.fail = 1 - if (data.match(/(一闪而过|已签到|已领取)/)) { - merge.JDCube.notify = "京东商城-魔方: 失败, 原因: 无机会 ⚠️" - } else if (data.match(/(不存在|已结束)/)) { - merge.JDCube.notify = "京东商城-魔方: 失败, 原因: 活动已结束 ⚠️" - } else if (data.match(/(\"code\":3)/)) { - merge.JDCube.notify = "京东商城-魔方: 失败, 原因: Cookie失效‼️" - } else { - merge.JDCube.notify = "京东商城-魔方: 失败, 原因: 未知 ⚠️" - } - } - } - } catch (eor) { - $nobyda.AnError("京东商城-魔方", "JDCube", eor, response, data) - } finally { - resolve() - } - }) - }, s) - if (out) setTimeout(resolve, out + s) - }); -} - -function JingDongSubsidy(s) { - merge.subsidy = {}; - return new Promise(resolve => { - if (disable("subsidy")) return resolve() - setTimeout(() => { - const subsidyUrl = { - url: 'https://ms.jr.jd.com/gw/generic/uc/h5/m/signIn7', - headers: { - Referer: "https://active.jd.com/forever/cashback/index", - Cookie: KEY - } - }; - $nobyda.get(subsidyUrl, function(error, response, data) { - try { - if (error) { - throw new Error(error) - } else { - const Details = LogDetails ? "response:\n" + data : ''; - const cc = JSON.parse(data) - if (cc.resultCode == 0 && cc.resultData.data && cc.resultData.data.thisAmount) { - console.log("\n" + "京东商城-金贴签到成功 " + Details) - merge.subsidy.subsidy = cc.resultData.data.thisAmountStr - merge.subsidy.notify = `京东商城-金贴: 成功, 明细: ${merge.subsidy.subsidy||`无`}金贴 💰` - merge.subsidy.success = 1 - } else { - console.log("\n" + "京东商城-金贴签到失败 " + Details) - merge.subsidy.fail = 1 - if (data.match(/已存在|"thisAmount":0/)) { - merge.subsidy.notify = "京东商城-金贴: 失败, 原因: 无金贴 ⚠️" - } else if (data.match(/请先登录/)) { - merge.subsidy.notify = "京东商城-金贴: 失败, 原因: Cookie失效‼️" - } else { - const msg = data.split(/\"msg\":\"([\u4e00-\u9fa5].+?)\"/)[1]; - merge.subsidy.notify = `京东商城-金贴: 失败, ${msg||`原因: 未知`} ⚠️` - } - } - } - } catch (eor) { - $nobyda.AnError("京东商城-金贴", "subsidy", eor, response, data) - } finally { - resolve() - } - }) - }, s) - if (out) setTimeout(resolve, out + s) - }); -} - -function JingRongDoll(s, key, title, code, type, num, award, belong) { - merge[key] = {}; - return new Promise(resolve => { - if (disable(key)) return resolve() - setTimeout(() => { - const DollUrl = { - url: "https://nu.jr.jd.com/gw/generic/jrm/h5/m/process", - headers: { - Cookie: KEY - }, - body: `reqData=${encodeURIComponent(`{"actCode":"${code}","type":${type?type:`3`}${code=='F68B2C3E71'?`,"frontParam":{"belong":"${belong}"}`:code==`1DF13833F7`?`,"frontParam":{"channel":"JR","belong":4}`:``}}`)}` - }; - $nobyda.post(DollUrl, async function(error, response, data) { - try { - if (error) { - throw new Error(error) - } else { - var cc = JSON.parse(data) - const Details = LogDetails ? "response:\n" + data : ''; - if (cc.resultCode == 0) { - if (cc.resultData.data.businessData != null) { - console.log(`\n${title}查询成功 ${Details}`) - if (cc.resultData.data.businessData.pickStatus == 2) { - if (data.match(/\"rewardPrice\":\"\d.*?\"/)) { - const JRDoll_bean = data.match(/\"rewardPrice\":\"(\d.*?)\"/)[1] - const JRDoll_type = data.match(/\"rewardName\":\"金贴奖励\"/) ? true : false - await JingRongDoll(s, key, title, code, '4', JRDoll_bean, JRDoll_type) - } else { - merge[key].success = 1 - merge[key].notify = `${title}: 成功, 明细: 无奖励 🐶` - } - } else if (code == 'F68B2C3E71' || code == '1DF13833F7') { - if (!data.match(/"businessCode":"30\dss?q"/)) { - merge[key].success = 1 - const ct = data.match(/\"count\":\"?(\d.*?)\"?,/) - if (code == 'F68B2C3E71' && belong == 'xianjin') { - merge[key].Money = ct ? ct[1] > 9 ? `0.${ct[1]}` : `0.0${ct[1]}` : 0 - merge[key].notify = `${title}: 成功, 明细: ${merge[key].Money||`无`}现金 💰` - } else if (code == 'F68B2C3E71' && belong == 'jingdou') { - merge[key].bean = ct ? ct[1] : 0; - merge[key].notify = `${title}: 成功, 明细: ${merge[key].bean||`无`}京豆 🐶` - } else if (code == '1DF13833F7') { - merge[key].subsidy = ct ? ct[1] : 0; - merge[key].notify = `${title}: 成功, 明细: ${merge[key].subsidy||`无`}金贴 💰` - } - } else { - const es = cc.resultData.data.businessMsg - const ep = cc.resultData.data.businessData.businessMsg - const tp = data.match(/已领取|300ss?q/) ? `已签过` : `${ep||es||cc.resultMsg||`未知`}` - merge[key].notify = `${title}: 失败, 原因: ${tp} ⚠️` - merge[key].fail = 1 - } - } else { - merge[key].notify = `${title}: 失败, 原因: 已签过 ⚠️`; - merge[key].fail = 1 - } - } else if (cc.resultData.data.businessCode == 200) { - console.log(`\n${title}签到成功 ${Details}`) - if (!award) { - merge[key].bean = num ? num.match(/\d+/)[0] : 0 - } else { - merge[key].subsidy = num || 0 - } - merge[key].success = 1 - merge[key].notify = `${title}: 成功, 明细: ${(award?num:merge[key].bean)||`无`}${award?`金贴 💰`:`京豆 🐶`}` - } else { - console.log(`\n${title}领取异常 ${Details}`) - if (num) console.log(`\n${title} 请尝试手动领取, 预计可得${num}${award?`金贴`:`京豆`}: \nhttps://uf1.jr.jd.com/up/redEnvelopes/index.html?actCode=${code}\n`); - merge[key].fail = 1; - merge[key].notify = `${title}: 失败, 原因: 领取异常 ⚠️`; - } - } else { - console.log(`\n${title}签到失败 ${Details}`) - const redata = typeof(cc.resultData) == 'string' ? cc.resultData : '' - merge[key].notify = `${title}: 失败, ${cc.resultCode==3?`原因: Cookie失效‼️`:`${redata||'原因: 未知 ⚠️'}`}` - merge[key].fail = 1; - } - } - } catch (eor) { - $nobyda.AnError(title, key, eor, response, data) - } finally { - resolve() - } - }) - }, s) - if (out) setTimeout(resolve, out + s) - }); -} - -function JingDongGetCash(s) { - merge.JDGetCash = {}; - return new Promise(resolve => { - if (disable("JDGetCash")) return resolve() - setTimeout(() => { - const GetCashUrl = { - url: 'https://api.m.jd.com/client.action?functionId=cash_sign&body=%7B%22remind%22%3A0%2C%22inviteCode%22%3A%22%22%2C%22type%22%3A0%2C%22breakReward%22%3A0%7D&client=apple&clientVersion=9.0.8&openudid=1fce88cd05c42fe2b054e846f11bdf33f016d676&sign=7e2f8bcec13978a691567257af4fdce9&st=1596954745073&sv=111', - headers: { - Cookie: KEY, - } - }; - $nobyda.get(GetCashUrl, function(error, response, data) { - try { - if (error) { - throw new Error(error) - } else { - const cc = JSON.parse(data); - const Details = LogDetails ? "response:\n" + data : ''; - if (cc.data.success && cc.data.result) { - console.log("\n" + "京东商城-现金签到成功 " + Details) - merge.JDGetCash.success = 1 - merge.JDGetCash.Money = cc.data.result.signCash || 0 - merge.JDGetCash.notify = `京东商城-现金: 成功, 明细: ${cc.data.result.signCash||`无`}现金 💰` - } else { - console.log("\n" + "京东商城-现金签到失败 " + Details) - merge.JDGetCash.fail = 1 - if (data.match(/\"bizCode\":201|已经签过/)) { - merge.JDGetCash.notify = "京东商城-现金: 失败, 原因: 已签过 ⚠️" - } else if (data.match(/\"code\":300|退出登录/)) { - merge.JDGetCash.notify = "京东商城-现金: 失败, 原因: Cookie失效‼️" - } else { - merge.JDGetCash.notify = "京东商城-现金: 失败, 原因: 未知 ⚠️" - } - } - } - } catch (eor) { - $nobyda.AnError("京东商城-现金", "JDGetCash", eor, response, data) - } finally { - resolve() - } - }) - }, s) - if (out) setTimeout(resolve, out + s) - }); -} - -function JingDongStore(s) { - merge.JDGStore = {}; - return new Promise(resolve => { - if (disable("JDGStore")) return resolve() - setTimeout(() => { - $nobyda.get({ - url: 'https://api.m.jd.com/api?appid=jdsupermarket&functionId=smtg_sign&clientVersion=8.0.0&client=m&body=%7B%7D', - headers: { - Cookie: KEY, - Origin: `https://jdsupermarket.jd.com` - } - }, (error, response, data) => { - try { - if (error) throw new Error(error); - const cc = JSON.parse(data); - const Details = LogDetails ? "response:\n" + data : ''; - if (cc.data && cc.data.success === true && cc.data.bizCode === 0) { - console.log(`\n京东商城-超市签到成功 ${Details}`) - merge.JDGStore.success = 1 - merge.JDGStore.bean = cc.data.result.jdBeanCount || 0 - merge.JDGStore.notify = `京东商城-超市: 成功, 明细: ${merge.JDGStore.bean||`无`}京豆 🐶` - } else { - if (!cc.data) cc.data = {} - console.log(`\n京东商城-超市签到失败 ${Details}`) - const tp = cc.data.bizCode == 811 ? `已签过` : cc.data.bizCode == 300 ? `Cookie失效` : `${cc.data.bizMsg||`未知`}` - merge.JDGStore.notify = `京东商城-超市: 失败, 原因: ${tp}${cc.data.bizCode==300?`‼️`:` ⚠️`}` - merge.JDGStore.fail = 1 - } - } catch (eor) { - $nobyda.AnError("京东商城-超市", "JDGStore", eor, response, data) - } finally { - resolve() - } - }) - }, s) - if (out) setTimeout(resolve, out + s) - }); -} - -function JDSecKilling(s) { //领券中心 - merge.JDSecKill = {}; - return new Promise((resolve, reject) => { - if (disable("JDSecKill")) return reject(); - setTimeout(() => { - $nobyda.post({ - url: 'https://api.m.jd.com/client.action', - headers: { - Cookie: KEY, - Origin: 'https://h5.m.jd.com' - }, - body: 'functionId=homePageV2&appid=SecKill2020' - }, (error, response, data) => { - try { - if (error) throw new Error(error); - const Details = LogDetails ? "response:\n" + data : ''; - const cc = JSON.parse(data); - if (cc.code == 203 || cc.code == 3 || cc.code == 101) { - merge.JDSecKill.notify = `京东秒杀-红包: 失败, 原因: Cookie失效‼️`; - } else if (cc.result && cc.result.projectId && cc.result.taskId) { - console.log(`\n京东秒杀-红包查询成功 ${Details}`) - return resolve({ - projectId: cc.result.projectId, - taskId: cc.result.taskId - }) - } else { - merge.JDSecKill.notify = `京东秒杀-红包: 失败, 暂无有效活动 ⚠️`; - } - merge.JDSecKill.fail = 1; - console.log(`\n京东秒杀-红包查询失败 ${Details}`) - reject() - } catch (eor) { - $nobyda.AnError("京东秒杀-查询", "JDSecKill", eor, response, data) - reject() - } - }) - }, s) - if (out) setTimeout(resolve, out + s) - }).then(async (id) => { - await new Promise(resolve => { - $nobyda.post({ - url: 'https://api.m.jd.com/client.action', - headers: { - Cookie: KEY, - Origin: 'https://h5.m.jd.com' - }, - body: `functionId=doInteractiveAssignment&body=%7B%22encryptProjectId%22%3A%22${id.projectId}%22%2C%22encryptAssignmentId%22%3A%22${id.taskId}%22%2C%22completionFlag%22%3Atrue%7D&client=wh5&appid=SecKill2020` - }, (error, response, data) => { - try { - if (error) throw new Error(error); - const Details = LogDetails ? "response:\n" + data : ''; - const cc = JSON.parse(data); - if (cc.msg == 'success' && cc.subCode == 0) { - console.log(`\n京东秒杀-红包签到成功 ${Details}`); - const qt = data.match(/"discount":(\d.*?),/); - merge.JDSecKill.success = 1; - merge.JDSecKill.Cash = qt ? qt[1] : 0; - merge.JDSecKill.notify = `京东秒杀-红包: 成功, 明细: ${merge.JDSecKill.Cash||`无`}红包 🧧`; - } else { - console.log(`\n京东秒杀-红包签到失败 ${Details}`); - merge.JDSecKill.fail = 1; - merge.JDSecKill.notify = `京东秒杀-红包: 失败, ${cc.subCode==103?`原因: 已领取`:cc.msg?cc.msg:`原因: 未知`} ⚠️`; - } - } catch (eor) { - $nobyda.AnError("京东秒杀-领取", "JDSecKill", eor, response, data); - } finally { - resolve(); - } - }) - }) - }, () => {}); -} - -function JingDongBuyCar(s, ActId) { - merge.JDBuyCar = {}; - return new Promise((resolve, reject) => { - if (disable("JDBuyCar")) return reject(); - setTimeout(() => { - $nobyda.get({ - url: 'https://cgame-stadium.jd.com/api/v1/first/login', - headers: { - Cookie: KEY, - ActivityId: ActId - } - }, (error, response, data) => { - try { - if (error) throw new Error(error); - const Details = LogDetails ? "response:\n" + data : ''; - console.log(`\n京东汽车-检查签到状态 ${Details}`) - const cc = JSON.parse(data); - if (cc.status && cc.data && cc.data.firstLoginStatus) { - resolve() - } else { - const qt = cc.status && cc.data && cc.data.firstLoginStatus === false ? `原因: 已签过` : cc.error && cc.error.code == 2000 ? `原因: Cookie失效` : cc.error && cc.error.msg ? cc.error.msg : `原因: 未知`; - merge.JDBuyCar.notify = `京东商城-汽车: 失败, ${qt}${cc.error&&cc.error.code==2000?`‼️`:` ⚠️`}` - merge.JDBuyCar.fail = 1; - reject() - } - } catch (eor) { - $nobyda.AnError("京东汽车-状态", "JDBuyCar", eor, response, data) - reject() - } - }) - }, s) - if (out) setTimeout(resolve, out + s) - }).then(async () => { - await new Promise(resolve => { - $nobyda.post({ - url: 'https://cgame-stadium.jd.com/api/v1/sign', - headers: { - Cookie: KEY, - ActivityId: ActId - } - }, (error, response, data) => { - try { - if (error) throw new Error(error); - const Details = LogDetails ? "response:\n" + data : ''; - const cc = JSON.parse(data); - if (cc.status === true) { - console.log(`\n京东商城-汽车签到成功 ${Details}`); - merge.JDBuyCar.success = 1; - merge.JDBuyCar.bean = cc.data && cc.data.beanNum ? cc.data.beanNum : 0 - merge.JDBuyCar.notify = `京东商城-汽车: 成功, 明细: ${merge.JDBuyCar.bean||`无`}京豆 🐶`; - } else { - console.log(`\n京东商城-汽车签到失败 ${Details}`); - merge.JDBuyCar.fail = 1; - merge.JDBuyCar.notify = `京东商城-汽车: 失败, ${cc.error&&cc.error.msg?cc.error.msg:`原因: 未知`} ⚠️`; - } - } catch (eor) { - $nobyda.AnError("京东汽车-签到", "JDBuyCar", eor, response, data); - } finally { - resolve(); - } - }) - }) - }, () => {}); -} - -function TotalSteel() { - merge.TotalSteel = {}; - return new Promise(resolve => { - if (disable("TSteel")) return resolve() - $nobyda.get({ - url: 'https://coin.jd.com/m/gb/getBaseInfo.html', - headers: { - Cookie: KEY - } - }, (error, response, data) => { - try { - if (error) throw new Error(error); - const Details = LogDetails ? "response:\n" + data : ''; - if (data.match(/(\"gbBalance\":\d+)/)) { - console.log("\n" + "京东-总钢镚查询成功 " + Details) - const cc = JSON.parse(data) - merge.TotalSteel.TSteel = cc.gbBalance - } else { - console.log("\n" + "京东-总钢镚查询失败 " + Details) - } - } catch (eor) { - $nobyda.AnError("账户钢镚-查询", "TotalSteel", eor, response, data) - } finally { - resolve() - } - }) - if (out) setTimeout(resolve, out) - }); -} - -function TotalBean() { - merge.TotalBean = {}; - return new Promise(resolve => { - if (disable("Qbear")) return resolve() - $nobyda.get({ - url: 'https://me-api.jd.com/user_new/info/GetJDUserInfoUnion', - headers: { - Cookie: KEY - } - }, (error, response, data) => { - try { - if (error) throw new Error(error); - const Details = LogDetails ? "response:\n" + data : ''; - const cc = JSON.parse(data) - if (cc.msg == 'success' && cc.retcode == 0) { - merge.TotalBean.nickname = cc.data.userInfo.baseInfo.nickname || "" - merge.TotalBean.Qbear = cc.data.assetInfo.beanNum || 0 - $nobyda.headUrl = cc.data.userInfo.baseInfo.headImageUrl || "" - console.log(`\n京东-总京豆查询成功 ${Details}`) - } else { - merge.TotalBean.nickname = cc.retcode == 1001 ? "Cookie失效 ‼️" : ""; - console.log(`\n京东-总京豆查询失败 ${Details}`) - } - } catch (eor) { - $nobyda.AnError("账户京豆-查询", "TotalBean", eor, response, data) - } finally { - resolve() - } - }) - if (out) setTimeout(resolve, out) - }); -} - -function TotalCash() { - merge.TotalCash = {}; - return new Promise(resolve => { - if (disable("TCash")) return resolve() - $nobyda.post({ - url: 'https://api.m.jd.com/client.action?functionId=myhongbao_balance', - headers: { - Cookie: KEY - }, - body: "body=%7B%22fp%22%3A%22-1%22%2C%22appToken%22%3A%22apphongbao_token%22%2C%22childActivityUrl%22%3A%22-1%22%2C%22country%22%3A%22cn%22%2C%22openId%22%3A%22-1%22%2C%22childActivityId%22%3A%22-1%22%2C%22applicantErp%22%3A%22-1%22%2C%22platformId%22%3A%22appHongBao%22%2C%22isRvc%22%3A%22-1%22%2C%22orgType%22%3A%222%22%2C%22activityType%22%3A%221%22%2C%22shshshfpb%22%3A%22-1%22%2C%22platformToken%22%3A%22apphongbao_token%22%2C%22organization%22%3A%22JD%22%2C%22pageClickKey%22%3A%22-1%22%2C%22platform%22%3A%221%22%2C%22eid%22%3A%22-1%22%2C%22appId%22%3A%22appHongBao%22%2C%22childActiveName%22%3A%22-1%22%2C%22shshshfp%22%3A%22-1%22%2C%22jda%22%3A%22-1%22%2C%22extend%22%3A%22-1%22%2C%22shshshfpa%22%3A%22-1%22%2C%22activityArea%22%3A%22-1%22%2C%22childActivityTime%22%3A%22-1%22%7D&client=apple&clientVersion=8.5.0&d_brand=apple&networklibtype=JDNetworkBaseAF&openudid=1fce88cd05c42fe2b054e846f11bdf33f016d676&sign=fdc04c3ab0ee9148f947d24fb087b55d&st=1581245397648&sv=120" - }, (error, response, data) => { - try { - if (error) throw new Error(error); - const Details = LogDetails ? "response:\n" + data : ''; - if (data.match(/(\"totalBalance\":\d+)/)) { - console.log("\n" + "京东-总红包查询成功 " + Details) - const cc = JSON.parse(data) - merge.TotalCash.TCash = cc.totalBalance - } else { - console.log("\n" + "京东-总红包查询失败 " + Details) - } - } catch (eor) { - $nobyda.AnError("账户红包-查询", "TotalCash", eor, response, data) - } finally { - resolve() - } - }) - if (out) setTimeout(resolve, out) - }); -} - -function TotalSubsidy() { - merge.TotalSubsidy = {}; - return new Promise(resolve => { - if (disable("TotalSubsidy")) return resolve() - $nobyda.get({ - url: 'https://ms.jr.jd.com/gw/generic/uc/h5/m/mySubsidyBalance', - headers: { - Cookie: KEY, - Referer: 'https://active.jd.com/forever/cashback/index?channellv=wojingqb' - } - }, (error, response, data) => { - try { - if (error) throw new Error(error); - const cc = JSON.parse(data) - const Details = LogDetails ? "response:\n" + data : ''; - if (cc.resultCode == 0 && cc.resultData && cc.resultData.data) { - console.log("\n京东-总金贴查询成功 " + Details) - merge.TotalSubsidy.TSubsidy = cc.resultData.data.balance || 0 - } else { - console.log("\n京东-总金贴查询失败 " + Details) - } - } catch (eor) { - $nobyda.AnError("账户金贴-查询", "TotalSubsidy", eor, response, data) - } finally { - resolve() - } - }) - if (out) setTimeout(resolve, out) - }); -} - -function TotalMoney() { - merge.TotalMoney = {}; - return new Promise(resolve => { - if (disable("TotalMoney")) return resolve() - $nobyda.get({ - url: 'https://api.m.jd.com/client.action?functionId=cash_exchangePage&body=%7B%7D&build=167398&client=apple&clientVersion=9.1.9&openudid=1fce88cd05c42fe2b054e846f11bdf33f016d676&sign=762a8e894dea8cbfd91cce4dd5714bc5&st=1602179446935&sv=102', - headers: { - Cookie: KEY - } - }, (error, response, data) => { - try { - if (error) throw new Error(error); - const cc = JSON.parse(data) - const Details = LogDetails ? "response:\n" + data : ''; - if (cc.code == 0 && cc.data && cc.data.bizCode == 0 && cc.data.result) { - console.log("\n京东-总现金查询成功 " + Details) - merge.TotalMoney.TMoney = cc.data.result.totalMoney || 0 - } else { - console.log("\n京东-总现金查询失败 " + Details) - } - } catch (eor) { - $nobyda.AnError("账户现金-查询", "TotalMoney", eor, response, data) - } finally { - resolve() - } - }) - if (out) setTimeout(resolve, out) - }); -} - -function disable(Val, name, way) { - const read = $nobyda.read("JD_DailyBonusDisables") - const annal = $nobyda.read("JD_Crash_" + Val) - if (annal && way == 1 && boxdis) { - var Crash = $nobyda.write("", "JD_Crash_" + Val) - if (read) { - if (read.indexOf(Val) == -1) { - var Crash = $nobyda.write(`${read},${Val}`, "JD_DailyBonusDisables") - console.log(`\n${name}-触发自动禁用 ‼️`) - merge[Val].notify = `${name}: 崩溃, 触发自动禁用 ‼️` - merge[Val].error = 1 - $nobyda.disable = 1 - } - } else { - var Crash = $nobyda.write(Val, "JD_DailyBonusDisables") - console.log(`\n${name}-触发自动禁用 ‼️`) - merge[Val].notify = `${name}: 崩溃, 触发自动禁用 ‼️` - merge[Val].error = 1 - $nobyda.disable = 1 - } - return true - } else if (way == 1 && boxdis) { - var Crash = $nobyda.write(name, "JD_Crash_" + Val) - } else if (way == 2 && annal) { - var Crash = $nobyda.write("", "JD_Crash_" + Val) - } - if (read && read.indexOf(Val) != -1) { - return true - } else { - return false - } -} - -function Wait(readDelay, ini) { - if (!readDelay || readDelay === '0') return 0 - if (typeof(readDelay) == 'string') { - var readDelay = readDelay.replace(/"|"|'|'/g, ''); //prevent novice - if (readDelay.indexOf('-') == -1) return parseInt(readDelay) || 0; - const raw = readDelay.split("-").map(Number); - const plan = parseInt(Math.random() * (raw[1] - raw[0] + 1) + raw[0], 10); - if (ini) console.log(`\n初始化随机延迟: 最小${raw[0]/1000}秒, 最大${raw[1]/1000}秒`); - // else console.log(`\n预计等待: ${(plan / 1000).toFixed(2)}秒`); - return ini ? readDelay : plan - } else if (typeof(readDelay) == 'number') { - return readDelay > 0 ? readDelay : 0 - } else return 0 -} - -function GetCookie() { - try { - if ($request.method != 'OPTIONS' && $request.headers && $request.url !== 'http://www.apple.com/') { - let acObj = {}; - // 提取ck数据 - let CV = ($request.headers['Cookie'] || $request.headers['cookie'] || '').replace(/ /g, ''); - let ckItems = CV.split(';').filter(s => /^(pt_key|pt_pin)=.+/.test(s)).sort(); - if (ckItems.length == 2) { - acObj.cookie = ckItems.join(';') + ';'; - acObj.userName = decodeURIComponent(acObj.cookie.match(/pt_pin=(.+?);/)[1]); - } - // 无cookie数据进行提示,有ck数据,找到账号位进行存储 - if (!acObj.cookie) { - $nobyda.notify("写入京东Cookie失败", "", "请查看脚本内说明, 登录网页获取 ‼️") - return - } else { - const allCk = [$nobyda.read('CookieJD'), $nobyda.read('CookieJD2')]; - const ocks = $nobyda.read('CookiesJD'); - let oldCks = []; - try { - oldCks = (ocks && JSON.parse(ocks)) || []; - } catch (e) { - console.log(`写入京东Cookie时转换京东扩展账号数据CookiesJD异常,扩展账号信息:\n${ocks}`) - oldCks = []; - } - oldCks.forEach(item => allCk.push(item.cookie)); - let [status, seatNo] = chooseSeatNo(acObj.cookie, allCk, /pt_pin=(.+?);/); - if (status) { - if (status > 0) { - let WT = ''; - if (seatNo < 2) { - WT = $nobyda.write(acObj.cookie, `CookieJD${seatNo?seatNo+1:''}`); - } else { - if (oldCks.length <= seatNo - 2) { - oldCks.push(acObj); - } else { - oldCks[seatNo - 2] = acObj; - } - WT = $nobyda.write(JSON.stringify(oldCks, null, 2), 'CookiesJD'); - } - $nobyda.notify(`用户名: ${acObj.userName}`, ``, `${status==2?`更新`:`写入`}京东 [账号${seatNo+1}] Cookie${WT?`成功 🎉`:`失败 ‼️`}`) - } else { - console.log(`\n用户名: ${acObj.userName}\n与历史京东 [账号${seatNo+1}] Cookie相同, 跳过写入 ⚠️`) - } - } - } - } else if ($request.url === 'http://www.apple.com/') { - $nobyda.notify("京东签到", "", "类型错误, 手动运行请选择上下文环境为Cron ⚠️"); - } else { - $nobyda.notify("京东签到", "写入Cookie失败", "请检查匹配URL或配置内脚本类型 ⚠️"); - } - } catch (eor) { - $nobyda.write("", "CookieJD") - $nobyda.write("", "CookieJD2") - $nobyda.write("", "CookiesJD") - $nobyda.notify("写入京东Cookie失败", "", '已尝试清空历史Cookie, 请重试 ⚠️') - console.log(`\n写入京东Cookie出现错误 ‼️\n${JSON.stringify(eor)}\n\n${eor}\n\n${JSON.stringify($request.headers)}\n`) - } finally { - $nobyda.done() - } -} -// 获取新ck存放位置 -function chooseSeatNo(newCk, allCk, reg) { - // status-获取操作状态-0:异常、1-新增、2-更新、-1-相同 seatNo-存储位置,默认添加到最后面 - let [status, seatNo] = [1, allCk.length]; - try { - let newId = ((newCk || '').match(reg) || ['', ''])[1]; - for (let i = 0, len = allCk.length; i < len; i++) { - let oldId = ((allCk[i] || '').match(reg) || ['', ''])[1]; - if (oldId) { - // 账号位数据存在,判断是否为当前账号的数据,不是则跳过,否则设置数据并跳出循环 - if (oldId == newId) { - seatNo = i; - status = newCk == allCk[i] ? -1 : 2; - break; - } - } else if (seatNo == len) { - // 旧cookie无效且在初始账号位,先标记新cookie数据存储于此位置 - seatNo = i; - status = 1; - } - } - } catch (e) { - // 异常时,不操作cookie - status = 0; - console.log(`\n查询账号存储位置异常 ‼️\n${JSON.stringify(e)}\n\n${e}\n`) - } - return [status, seatNo]; -} - -// Modified from yichahucha -function nobyda() { - const start = Date.now() - const isRequest = typeof $request != "undefined" - const isSurge = typeof $httpClient != "undefined" - const isQuanX = typeof $task != "undefined" - const isLoon = typeof $loon != "undefined" - const isJSBox = typeof $app != "undefined" && typeof $http != "undefined" - const isNode = typeof require == "function" && !isJSBox; - const NodeSet = 'CookieSet.json' - const node = (() => { - if (isNode) { - const request = require('request'); - const fs = require("fs"); - return ({ - request, - fs - }) - } else { - return (null) - } - })() - const notify = (title, subtitle, message, rawopts) => { - const Opts = (rawopts) => { //Modified from https://github.com/chavyleung/scripts/blob/master/Env.js - if (!rawopts) return rawopts - if (typeof rawopts === 'string') { - if (isLoon) return rawopts - else if (isQuanX) return { - 'open-url': rawopts - } - else if (isSurge) return { - url: rawopts - } - else return undefined - } else if (typeof rawopts === 'object') { - if (isLoon) { - let openUrl = rawopts.openUrl || rawopts.url || rawopts['open-url'] - let mediaUrl = rawopts.mediaUrl || rawopts['media-url'] - return { - openUrl, - mediaUrl - } - } else if (isQuanX) { - let openUrl = rawopts['open-url'] || rawopts.url || rawopts.openUrl - let mediaUrl = rawopts['media-url'] || rawopts.mediaUrl - return { - 'open-url': openUrl, - 'media-url': mediaUrl - } - } else if (isSurge) { - let openUrl = rawopts.url || rawopts.openUrl || rawopts['open-url'] - return { - url: openUrl - } - } - } else { - return undefined - } - } - console.log(`${title}\n${subtitle}\n${message}`) - if (isQuanX) $notify(title, subtitle, message, Opts(rawopts)) - if (isSurge) $notification.post(title, subtitle, message, Opts(rawopts)) - if (isJSBox) $push.schedule({ - title: title, - body: subtitle ? subtitle + "\n" + message : message - }) - } - const write = (value, key) => { - if (isQuanX) return $prefs.setValueForKey(value, key) - if (isSurge) return $persistentStore.write(value, key) - if (isNode) { - try { - if (!node.fs.existsSync(NodeSet)) node.fs.writeFileSync(NodeSet, JSON.stringify({})); - const dataValue = JSON.parse(node.fs.readFileSync(NodeSet)); - if (value) dataValue[key] = value; - if (!value) delete dataValue[key]; - return node.fs.writeFileSync(NodeSet, JSON.stringify(dataValue)); - } catch (er) { - return AnError('Node.js持久化写入', null, er); - } - } - if (isJSBox) { - if (!value) return $file.delete(`shared://${key}.txt`); - return $file.write({ - data: $data({ - string: value - }), - path: `shared://${key}.txt` - }) - } - } - const read = (key) => { - if (isQuanX) return $prefs.valueForKey(key) - if (isSurge) return $persistentStore.read(key) - if (isNode) { - try { - if (!node.fs.existsSync(NodeSet)) return null; - const dataValue = JSON.parse(node.fs.readFileSync(NodeSet)) - return dataValue[key] - } catch (er) { - return AnError('Node.js持久化读取', null, er) - } - } - if (isJSBox) { - if (!$file.exists(`shared://${key}.txt`)) return null; - return $file.read(`shared://${key}.txt`).string - } - } - const adapterStatus = (response) => { - if (response) { - if (response.status) { - response["statusCode"] = response.status - } else if (response.statusCode) { - response["status"] = response.statusCode - } - } - return response - } - const get = (options, callback) => { - options.headers['User-Agent'] = 'JD4iPhone/167169 (iPhone; iOS 13.4.1; Scale/3.00)' - if (isQuanX) { - if (typeof options == "string") options = { - url: options - } - options["method"] = "GET" - //options["opts"] = { - // "hints": false - //} - $task.fetch(options).then(response => { - callback(null, adapterStatus(response), response.body) - }, reason => callback(reason.error, null, null)) - } - if (isSurge) { - options.headers['X-Surge-Skip-Scripting'] = false - $httpClient.get(options, (error, response, body) => { - callback(error, adapterStatus(response), body) - }) - } - if (isNode) { - node.request(options, (error, response, body) => { - callback(error, adapterStatus(response), body) - }) - } - if (isJSBox) { - if (typeof options == "string") options = { - url: options - } - options["header"] = options["headers"] - options["handler"] = function(resp) { - let error = resp.error; - if (error) error = JSON.stringify(resp.error) - let body = resp.data; - if (typeof body == "object") body = JSON.stringify(resp.data); - callback(error, adapterStatus(resp.response), body) - }; - $http.get(options); - } - } - const post = (options, callback) => { - options.headers['User-Agent'] = 'JD4iPhone/167169 (iPhone; iOS 13.4.1; Scale/3.00)' - if (options.body) options.headers['Content-Type'] = 'application/x-www-form-urlencoded' - if (isQuanX) { - if (typeof options == "string") options = { - url: options - } - options["method"] = "POST" - //options["opts"] = { - // "hints": false - //} - $task.fetch(options).then(response => { - callback(null, adapterStatus(response), response.body) - }, reason => callback(reason.error, null, null)) - } - if (isSurge) { - options.headers['X-Surge-Skip-Scripting'] = false - $httpClient.post(options, (error, response, body) => { - callback(error, adapterStatus(response), body) - }) - } - if (isNode) { - node.request.post(options, (error, response, body) => { - callback(error, adapterStatus(response), body) - }) - } - if (isJSBox) { - if (typeof options == "string") options = { - url: options - } - options["header"] = options["headers"] - options["handler"] = function(resp) { - let error = resp.error; - if (error) error = JSON.stringify(resp.error) - let body = resp.data; - if (typeof body == "object") body = JSON.stringify(resp.data) - callback(error, adapterStatus(resp.response), body) - } - $http.post(options); - } - } - const AnError = (name, keyname, er, resp, body) => { - if (typeof(merge) != "undefined" && keyname) { - if (!merge[keyname].notify) { - merge[keyname].notify = `${name}: 异常, 已输出日志 ‼️` - } else { - merge[keyname].notify += `\n${name}: 异常, 已输出日志 ‼️ (2)` - } - merge[keyname].error = 1 - } - return console.log(`\n‼️${name}发生错误\n‼️名称: ${er.name}\n‼️描述: ${er.message}${JSON.stringify(er).match(/\"line\"/)?`\n‼️行列: ${JSON.stringify(er)}`:``}${resp&&resp.status?`\n‼️状态: ${resp.status}`:``}${body?`\n‼️响应: ${resp&&resp.status!=503?body:`Omit.`}`:``}`) - } - const time = () => { - const end = ((Date.now() - start) / 1000).toFixed(2) - return console.log('\n签到用时: ' + end + ' 秒') - } - const done = (value = {}) => { - if (isQuanX) return $done(value) - if (isSurge) isRequest ? $done(value) : $done() - } - return { - AnError, - isRequest, - isJSBox, - isSurge, - isQuanX, - isLoon, - isNode, - notify, - write, - read, - get, - post, - time, - done - } -}; -ReadCookie(); diff --git a/Scripts/SignIn/JD/jd.618.adapt.js b/Scripts/SignIn/JD/jd.618.adapt.js deleted file mode 100644 index 83eec6d..0000000 --- a/Scripts/SignIn/JD/jd.618.adapt.js +++ /dev/null @@ -1,405 +0,0 @@ -const $ = new Env('京东618') -$.VAL_url = $.getdata('chavy_url_jd816') -$.VAL_body = $.getdata('chavy_body_jd816') -$.VAL_headers = $.getdata('chavy_headers_jd816') -$.VAL_isSignShop = $.getdata('CFG_618_isSignShop') || 'true' -$.VAL_isJoinBrand = $.getdata('CFG_618_isJoinBrand') || 'false' -$.VAL_radommsMin = $.getdata('CFG_618_radomms_min') || '2000' -$.VAL_radommsMax = $.getdata('CFG_618_radomms_max') || '5000' - -!(async () => { - $.log('', `🔔 ${$.name}, 开始!`, '') - await getData() - await getActs() - await getShops() - await execActs() - showmsg() -})() - .catch((e) => { - $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '') - }) - .finally(() => { - $.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 结束!`, ''), $.done() - }) - -function getData() { - return new Promise((resove) => { - $.post(taskurl('cakebaker_getHomeData'), (error, response, data) => { - try { - if (error) throw new Error(error) - const _info = JSON.parse(data).data.result.cakeBakerInfo - $.secretp = _info.secretp - if (!$.secretp) throw new Error('获取 secretp 失败!') - $.log(`❕ ${$.name}, 获取密钥!`) - $.log(` 密钥 = ${$.secretp.slice(0, 10)}...`) - $.log(` 等级 = ${_info.raiseInfo.scoreLevel}`) - $.log(` 分数 = ${_info.raiseInfo.totalScore} => ${_info.raiseInfo.nextLevelScore}`) - $.log(` 延时 = ${$.VAL_radommsMin} => ${$.VAL_radommsMax} 毫秒`, '') - } catch (e) { - $.log(`❗️ ${$.name}, 获取密钥!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '') - } finally { - resove() - } - }) - }) -} - -function getShops() { - return new Promise((resove) => { - $.post(taskurl('cakebaker_bigBrandHomeData'), (error, response, data) => { - try { - $.log(`❕ ${$.name}, 获取商店!`) - if (error) throw new Error(error) - $.shopActs = [] - JSON.parse(data).data.result.bigBrandList.forEach((_shopa) => { - const _shopact = { - _raw: _shopa, - id: _shopa.venderId, - name: _shopa.name - } - $.shopActs.push(_shopact) - }) - $.log(` 商店数量 = ${$.shopActs.length}`, '') - } catch (e) { - $.log(`❗️ ${$.name}, 获取商店!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '') - } finally { - resove() - } - }) - }) -} - -function getActs() { - return new Promise((resove) => { - $.post(taskurl('cakebaker_getTaskDetail'), (error, response, data) => { - try { - $.log(`❕ ${$.name}, 获取活动!`) - if (error) throw new Error(error) - $.acts = [] - JSON.parse(data).data.result.taskVos.forEach((_a) => { - const _act = { - _raw: _a, - id: _a.taskId, - name: _a.taskName, - times: _a.times, - maxTimes: _a.maxTimes, - waitDuration: _a.waitDuration === 0 ? 1 : _a.waitDuration, - isProd: _a.productInfoVos ? true : false, - isBrand: _a.shoppingActivityVos && _a.taskId === 42 ? true : false, - tasks: [] - } - const _vo = _a[Object.keys(_a).find((key) => (_a[key] && _a[key].itemId) || (_a[key] && _a[key][0] && _a[key][0].itemId))] - if (Array.isArray(_vo)) { - _vo.forEach((_task) => _act.tasks.push({ - _raw: _task, - id: _task.itemId, - name: _task.title || _task.shopName || _task.taskName || '未知名称' - })) - } else { - _act.tasks = Array(_act.maxTimes - _act.times).fill({ - _raw: _vo, - id: _vo.itemId, - name: _act.name - }) - } - $.acts.push(_act) - }) - if (!$.acts) throw new Error('获取活动失败!') - $.log(` 活动数量 = ${$.acts.length}`, '') - } catch (e) { - $.log(`❗️ ${$.name}, 获取活动!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '') - } finally { - resove() - } - }) - }) -} - -async function execActs() { - $.log(`❕ ${$.name}, 执行活动!`) - for (let _actIdx = 0; _actIdx < $.acts.length; _actIdx++) { - const _act = $.acts[_actIdx] - $.log(` ${_actIdx + 1}. ${_act.name} (${_act.times}/${_act.maxTimes})`) - if (_act.times === _act.maxTimes) { - $.log(` @跳过: 全部完成!`, '') - continue - } - // 跳过:邀请好友、加入战队 - if ([2, 12].includes(_act.id)) { - $.log(' 跳过!', '') - continue - } - // 甄选优品 - else if (_act.isProd) { - await getProdAct(_act) - for (let subactIdx = 0; subactIdx < _act.subacts.length; subactIdx++) { - const subact = _act.subacts[subactIdx] - $.log(` ${subactIdx + 1}. ${subact.name} (${subact.times}/${subact.maxTimes})`) - if (subact.times === subact.maxTimes) { - $.log(` @跳过: 全部完成!`, '') - continue - } - for (let subataskIdx = 0; subataskIdx < subact.tasks.length; subataskIdx++) { - const subatask = subact.tasks[subataskIdx] - $.log(` ${subataskIdx + 1}. ${subatask.name.slice(0, 15)}...`) - if (subatask._raw.status && subatask._raw.status === 2) { - $.log(` @跳过: 已经做过!`, '') - continue - } - await sendtask(subact, subatask, true) - $.log(` @认领任务: ${subatask.isClaimSuc ? '🟢' : '🔴'}`) - if (subatask.isskip) { - $.log(` @跳过: ${subatask.msg}`) - const randomms = genRadomms() - $.log(` @等待: 8 秒 + ${randomms} 毫秒`, '') - await new Promise($.wait(8000 + randomms)) - } else { - const randomms = genRadomms() - $.log(` @等待: ${subact.waitDuration} 秒 + ${randomms} 毫秒`) - await new Promise($.wait(subact.waitDuration * 1000 + randomms)) - await sendtask(subact, subatask) - $.log(` @完成任务: ${subatask.isExecSuc ? '🟢' : '🔴'}`) - $.log(` @等待: 5 秒 + ${randomms} 毫秒`, '') - await new Promise($.wait(5000 + randomms)) - } - } - } - } - // 开通会员 - else if (_act.isBrand) { - if ($.VAL_isJoinBrand === 'true' || $.VAL_isJoinBrand === true) { - for (let taskIdx = 0; taskIdx < _act.tasks.length; taskIdx++) { - const task = _act.tasks[taskIdx] - $.log(` ${taskIdx + 1}. ${task.name}`) - await joinBrand(task) - $.log(` @加入会员: ${task.isJoinSuc ? '🟢' : '🔴'}`) - const randomms = genRadomms() - $.log(` @等待: ${_act.waitDuration} 秒 + ${randomms} 毫秒`) - await new Promise($.wait(_act.waitDuration * 1000 + randomms)) - await brandAward(task) - $.log(` @完成任务: ${task.isAwardSuc ? '🟢' : '🔴'}`) - $.log(` @等待: 5 秒 + ${randomms} 毫秒`, '') - await new Promise($.wait(5000 + randomms)) - } - } else { - $.log(` @跳过: BoxJs 设置为 关闭 品牌会员!`, '') - } - } - // 普通任务 - else { - for (let taskIdx = 0; taskIdx < _act.tasks.length; taskIdx++) { - const task = _act.tasks[taskIdx] - $.log(` ${taskIdx + 1}. ${task.name}`) - if (task._raw.status && task._raw.status === 2) { - $.log(` @跳过: 已经做过!`, '') - continue - } - await sendtask(_act, task, true) - $.log(` @认领任务: ${task.isClaimSuc ? '🟢' : '🔴'}`) - if (task.isskip || task.ishot) { - $.log(` @跳过: ${task.msg}`) - const randomms = genRadomms() - $.log(` @等待: 8 秒 + ${randomms} 毫秒`, '') - await new Promise($.wait(8000 + randomms)) - } else { - const randomms = genRadomms() - $.log(` @等待: ${_act.waitDuration} 秒 + ${randomms} 毫秒`) - await new Promise($.wait(_act.waitDuration * 1000 + randomms)) - await sendtask(_act, task) - $.log(` @完成任务: ${task.isExecSuc ? '🟢' : '🔴'}`) - $.log(` @等待: 5 秒 + ${randomms} 毫秒`, '') - await new Promise($.wait(5000 + randomms)) - } - } - } - } - - // 商店签到 - $.log(` ${$.acts.length + 1}. 商店签到 (${$.shopActs.length})`) - if ($.VAL_isSignShop === 'true' || $.VAL_isSignShop === true) { - for (let _shopIdx = 0; _shopIdx < $.shopActs.length; _shopIdx++) { - const shop = $.shopActs[_shopIdx] - $.log(` ${_shopIdx + 1}. ${shop.name}`) - await signshop(shop) - shop.msg = /,/.test(shop.msg) ? shop.msg.split(',')[1] : shop.msg - $.log(` @签到: ${shop.isSuc ? '🟢 已领取!' : shop.code === 402 ? '⚪️ 无效活动!' : `🔴 ${shop.msg}`}`) - const randomms = genRadomms() - $.log(` @等待: 8 秒 + ${randomms} 毫秒`, '') - await new Promise($.wait(8000 + randomms)) - } - } else { - $.log(` @跳过: BoxJs 设置为 关闭 商店签到!`, '') - } -} - -// 商品类活动 -function getProdAct(act) { - return new Promise((resove) => { - const body = {taskIds: act.tasks.map((task) => task.id).toString()} - $.post(taskurl('cakebaker_getFeedDetail', JSON.stringify(body)), (error, response, data) => { - try { - const _result = JSON.parse(data).data.result - const _vo = _result[Object.keys(_result).find((key) => Array.isArray(_result[key] && _result[key][0] && _result[key][0].productInfoVos))] - act.subacts = [] - _vo.forEach((_suba) => { - const _subact = { - _raw: _suba, - id: _suba.taskId, - name: _suba.taskName, - times: _suba.times, - maxTimes: _suba.maxTimes, - waitDuration: _suba.waitDuration === 0 ? 1 : _suba.waitDuration, - isProd: _suba.productInfoVos ? true : false, - tasks: [] - } - _suba.productInfoVos.slice(0, 5).forEach((_prodvo) => { - const _taskname = _prodvo.skuName || _prodvo.title || _prodvo.shopName || _prodvo.taskName || '未知名称' - _subact.tasks.push({ - _raw: _prodvo, - id: _prodvo.itemId, - name: _taskname - }) - }) - act.subacts.push(_subact) - }) - } catch (e) { - $.log(`❗️ ${$.name}, 执行商品类活动!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '') - } finally { - resove() - } - }) - }) -} - -function sendtask(act, task, isClaim = false) { - return new Promise((resove) => { - const body = { - taskId: act.id, - itemId: task.id, - actionType: isClaim ? 1 : undefined, - safeStr: JSON.stringify({secretp: $.secretp}) - } - $.post(taskurl('cakebaker_ckCollectScore', JSON.stringify(body)), (error, response, data) => { - try { - const _data = JSON.parse(data) - const _issuc = _data.data.bizCode === 0 || _data.data.bizCode === -5 || _data.data.bizCode === -15 - if (isClaim) task.isClaimSuc = _issuc - else task.isExecSuc = _issuc - task.isskip = _data.data.bizCode === -5 - task.ishot = _data.data.bizCode === -15 - task.msg = _data.data.bizMsg || '无' - } catch (e) { - if (isClaim) task.isClaimSuc = false - else task.isExecSuc = false - task.isskip = false - task.ishot = false - task.msg = error || e - } finally { - resove() - } - }) - }) -} - -function signshop(shop) { - return new Promise((resove) => { - const body = {channel: 2, venderId: shop.id} - $.post(taskurl('interact_center_sign_collectGift', JSON.stringify(body)), (error, response, data) => { - try { - const _data = JSON.parse(data) - shop.isSuc = _data.code === 407000005 || _data.code === 200 ? true : false - shop.code = _data.code - shop.msg = _data.msg - } catch (e) { - shop.isSuc = false - shop.msg = error || e - } finally { - resove() - } - }) - }) -} - -function joinBrand(task) { - return new Promise((resove) => { - const body = { - venderId: task._raw.copy1, - shopId: task._raw.copy1, - bindByVerifyCodeFlag: 1, - registerExtend: {}, - writeChildFlag: 0, - channel: 4032 - } - const joinurl = `https://api.m.jd.com/client.action?appid=jd_shop_member&functionId=bindWithVender&body=${encodeURIComponent(JSON.stringify(body))}&client=H5&clientVersion=8.5.6&uuid=88888` - const url = {url: joinurl, headers: JSON.parse($.VAL_headers)} - delete url.headers['Content-Length'] - $.get(url, (error, response, data) => { - try { - const _data = JSON.parse(data) - task.isJoinSuc = _data.busiCode === '0' - task.msg = _data.message || '无' - } catch (e) { - task.isJoinSuc = false - task.msg = error || e - } finally { - resove() - } - }) - }) -} - -function brandAward(task) { - return new Promise((resove) => { - const body = {venderId: task._raw.copy1, itemId: task.id} - $.post(taskurl('cakebaker_taskBigBrandAward', JSON.stringify(body)), (error, response, data) => { - try { - const _data = JSON.parse(data) - const _issuc = _data.data.bizCode === 0 || _data.data.bizCode === -5 || _data.data.bizCode === -15 - task.isAwardSuc = _issuc - task.msg = _data.data.bizMsg || '无' - } catch (e) { - task.isAwardSuc = false - task.msg = error || e - } finally { - resove() - } - }) - }) -} - -function taskurl(fid, body = '{}') { - const url = {url: `https://api.m.jd.com/client.action`} - url.headers = JSON.parse($.VAL_headers) - url.body = `functionId=${fid}&body=${body}&client=wh5&clientVersion=1.0.0` - return url -} - -function genRadomms() { - const max = $.VAL_radommsMax * 1 - const min = $.VAL_radommsMin * 1 - return parseInt(Math.random() * (max - min + 1) + min, 10) -} - -function showmsg() { -} - -// 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); - const e = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; - t && e.push(t), s && e.push(s), i && e.push(i), console.log(e.join("\n")) - }), 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 && (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)) -} diff --git a/Scripts/SignIn/JD/jd.618.boom.js b/Scripts/SignIn/JD/jd.618.boom.js deleted file mode 100644 index 43275de..0000000 --- a/Scripts/SignIn/JD/jd.618.boom.js +++ /dev/null @@ -1,106 +0,0 @@ -const $ = new Env('京东618炸弹') -$.VAL_url = $.getdata('chavy_url_jd816') -$.VAL_body = $.getdata('chavy_body_jd816') -$.VAL_headers = $.getdata('chavy_headers_jd816') -$.VAL_boomtimes = $.getdata('CFG_BOOM_times_JD618') || 1 -$.VAL_boominterval = $.getdata('CFG_BOOM_interval_JD618') || 100 - -!(async () => { - $.log('', `🔔 ${$.name}, 开始!`, '') - await boom() - await showmsg() -})() - .catch((e) => { - $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '') - }) - .finally(() => { - $.log('', `🔔 ${$.name}, 结束!`, ''), $.done() - }) - -async function boom() { - $.boomacts = [] - $.boomdesc = [] - for (let boomIdx = 0; boomIdx < $.VAL_boomtimes; boomIdx++) { - const isLastBoom = boomIdx === $.VAL_boomtimes - 1 - $.boomdesc.push(`💣 [${moment('mm:ss')}] 发送第 ${boomIdx + 1} 个炸弹 ${isLastBoom ? '(最后一个)' : ''}`) - const boomAct = new Promise((resove) => { - $.post(taskurl('cakebaker_pk_getCakeBomb'), (error, response, data) => { - try { - if (error) throw new Error(error) - const _data = JSON.parse(data) - const _issuc = _data.code === 0 && _data.data && _data.data.bizCode === 0 - $.boom = {isSuc: _issuc, boomIdx, ..._data.data.result} - if (isLastBoom) $.boomdesc.push(`❕ [${moment('mm:ss')}] 第 ${boomIdx + 1} 炸: ${$.boom.tip}`) - } catch (e) { - $.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '') - } finally { - resove() - } - }) - }) - $.boomacts.push(boomAct) - if (isLastBoom) await boomAct - await new Promise($.wait($.VAL_boominterval * 1)) - $.boomdesc.push(`❕ [${moment('mm:ss')}] 等待: ${$.VAL_boominterval} 毫秒!`) - } -} - -function moment(fmt) { - const now = new Date() - const o = { - 'M+': now.getMonth() + 1, - 'd+': now.getDate(), - 'h+': now.getHours(), - 'm+': now.getMinutes(), - 's+': now.getSeconds(), - 'q+': Math.floor((now.getMonth() + 3) / 3), - S: now.getMilliseconds() - } - if (/(y+)/.test(fmt)) { - fmt = fmt.replace(RegExp.$1, (now.getFullYear() + '').substr(4 - RegExp.$1.length)) - } - for (var k in o) { - if (new RegExp('(' + k + ')').test(fmt)) { - fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)) - } - } - return fmt -} - -function taskurl(fid, body = '{}') { - const url = {url: `https://api.m.jd.com/client.action`} - url.headers = JSON.parse($.VAL_headers) - url.body = `functionId=${fid}&body=${body}&client=wh5&clientVersion=1.0.0` - return url -} - -async function showmsg() { - await Promise.all($.boomacts) - $.subt = `我方: ${$.boom.groupLevel || '❓'}层, 对方: ${$.boom.opponentLevel || 0}层, 炸掉: ${$.boom.destroyLevel || 0}层` - $.desc = [$.boom.tip || '提示: 无!', '点击查看详情', ...$.boomdesc] - $.msg(`${$.name} (第 ${$.boom.boomIdx + 1} 炸)`, $.subt, $.desc.join('\n')) - // return new Promise((resove) => { - // 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); - const e = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; - t && e.push(t), s && e.push(s), i && e.push(i), console.log(e.join("\n")) - }), 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 && (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)) -} diff --git a/Scripts/SignIn/JD/jd.618.cookie.js b/Scripts/SignIn/JD/jd.618.cookie.js deleted file mode 100644 index e37bff6..0000000 --- a/Scripts/SignIn/JD/jd.618.cookie.js +++ /dev/null @@ -1,72 +0,0 @@ -/** - * - * 进入 叠蛋糕 主页获取 Cookies - * - * Surge: - * Rewrite: JD618 = type=http-request,pattern=^https:\/\/api.m.jd.com\/client.action\?functionId=cakebaker_getHomeData,script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.cookie.js,requires-body=true - * Tasks: JD618 = type=cron,cronexp="10,30,50 0,1 * * *",script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.js,wake-system=true,timeout=1200 - * Tasks: JD618.Boom = type=cron,cronexp="0 10,12,18,20,21 * * *",script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.boom.js,wake-system=true - * Tasks: JD618.Boom = type=cron,cronexp="30 21 * * *",script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.boom.js,wake-system=true - * - * QuanX: - * ^https:\/\/api.m.jd.com\/client.action\?functionId=cakebaker_getHomeData url script-request-body https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.cookie.js - * - * [task_local] - * # 远程 - * 10,30,50 0,1 * * * https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.adapt.js, tag=京东618 - * 0 10,12,18,20,21 * * * https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.boom.js, tag=京东618炸弹 - * 30 21 * * * https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.boom.js, tag=京东618炸弹 - * - * Loon: - * cron "10,30,50 0,1 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.adapt.js, timeout=600, tag=京东618 - * cron "0 10,12,18,20,21 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.boom.js, tag=京东618炸弹 - * cron "30 21 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.boom.js, tag=京东618炸弹 - * http-request ^https:\/\/api.m.jd.com\/client.action\?functionId=cakebaker_getHomeData script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.cookie.js,requires-body=true - * - * [MITM] - * hostname = api.m.jd.com - */ - -const $ = new Env('京东618') - -!(async () => { - $.log('', `🔔 ${$.name}, 获取会话: 开始!`, '') - const VAL_url = $request.url - const VAL_body = $request.body - const VAL_headers = JSON.stringify($request.headers) - if (VAL_url && VAL_body && VAL_headers) { - $.setdata($request.url, 'chavy_url_jd816') - $.setdata($request.body, 'chavy_body_jd816') - $.setdata(JSON.stringify($request.headers), 'chavy_headers_jd816') - $.subt = '获取会话: 成功!' - } -})() - .catch((e) => { - $.subt = '获取会话: 失败!' - $.desc = `原因: ${e}` - $.log(`❌ ${$.name}, 获取会话: 失败! 原因: ${e}!`) - }) - .finally(() => { - $.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 获取会话: 结束!`, ''), $.done() - }) - -// 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); - const e = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; - t && e.push(t), s && e.push(s), i && e.push(i), console.log(e.join("\n")) - }), 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 && (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)) -} diff --git a/Scripts/SignIn/JD/jd.618.cookie.sgmodule b/Scripts/SignIn/JD/jd.618.cookie.sgmodule deleted file mode 100644 index 56aa5ac..0000000 --- a/Scripts/SignIn/JD/jd.618.cookie.sgmodule +++ /dev/null @@ -1,9 +0,0 @@ -#!name=Chavy iOS JD618 Cookies Module -#!desc=获取京东 618 活动会话信息 -#!system=ios - -[Script] -Rewrite: JD618 = type=http-request,pattern=^https:\/\/api.m.jd.com\/client.action\?functionId=cakebaker_getHomeData,script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.cookie.js,requires-body=true,debug=true - -[MITM] -hostname = %INSERT%, api.m.jd.com \ No newline at end of file diff --git a/Scripts/SignIn/JD/jd.618.js b/Scripts/SignIn/JD/jd.618.js deleted file mode 100644 index 83eec6d..0000000 --- a/Scripts/SignIn/JD/jd.618.js +++ /dev/null @@ -1,405 +0,0 @@ -const $ = new Env('京东618') -$.VAL_url = $.getdata('chavy_url_jd816') -$.VAL_body = $.getdata('chavy_body_jd816') -$.VAL_headers = $.getdata('chavy_headers_jd816') -$.VAL_isSignShop = $.getdata('CFG_618_isSignShop') || 'true' -$.VAL_isJoinBrand = $.getdata('CFG_618_isJoinBrand') || 'false' -$.VAL_radommsMin = $.getdata('CFG_618_radomms_min') || '2000' -$.VAL_radommsMax = $.getdata('CFG_618_radomms_max') || '5000' - -!(async () => { - $.log('', `🔔 ${$.name}, 开始!`, '') - await getData() - await getActs() - await getShops() - await execActs() - showmsg() -})() - .catch((e) => { - $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '') - }) - .finally(() => { - $.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 结束!`, ''), $.done() - }) - -function getData() { - return new Promise((resove) => { - $.post(taskurl('cakebaker_getHomeData'), (error, response, data) => { - try { - if (error) throw new Error(error) - const _info = JSON.parse(data).data.result.cakeBakerInfo - $.secretp = _info.secretp - if (!$.secretp) throw new Error('获取 secretp 失败!') - $.log(`❕ ${$.name}, 获取密钥!`) - $.log(` 密钥 = ${$.secretp.slice(0, 10)}...`) - $.log(` 等级 = ${_info.raiseInfo.scoreLevel}`) - $.log(` 分数 = ${_info.raiseInfo.totalScore} => ${_info.raiseInfo.nextLevelScore}`) - $.log(` 延时 = ${$.VAL_radommsMin} => ${$.VAL_radommsMax} 毫秒`, '') - } catch (e) { - $.log(`❗️ ${$.name}, 获取密钥!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '') - } finally { - resove() - } - }) - }) -} - -function getShops() { - return new Promise((resove) => { - $.post(taskurl('cakebaker_bigBrandHomeData'), (error, response, data) => { - try { - $.log(`❕ ${$.name}, 获取商店!`) - if (error) throw new Error(error) - $.shopActs = [] - JSON.parse(data).data.result.bigBrandList.forEach((_shopa) => { - const _shopact = { - _raw: _shopa, - id: _shopa.venderId, - name: _shopa.name - } - $.shopActs.push(_shopact) - }) - $.log(` 商店数量 = ${$.shopActs.length}`, '') - } catch (e) { - $.log(`❗️ ${$.name}, 获取商店!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '') - } finally { - resove() - } - }) - }) -} - -function getActs() { - return new Promise((resove) => { - $.post(taskurl('cakebaker_getTaskDetail'), (error, response, data) => { - try { - $.log(`❕ ${$.name}, 获取活动!`) - if (error) throw new Error(error) - $.acts = [] - JSON.parse(data).data.result.taskVos.forEach((_a) => { - const _act = { - _raw: _a, - id: _a.taskId, - name: _a.taskName, - times: _a.times, - maxTimes: _a.maxTimes, - waitDuration: _a.waitDuration === 0 ? 1 : _a.waitDuration, - isProd: _a.productInfoVos ? true : false, - isBrand: _a.shoppingActivityVos && _a.taskId === 42 ? true : false, - tasks: [] - } - const _vo = _a[Object.keys(_a).find((key) => (_a[key] && _a[key].itemId) || (_a[key] && _a[key][0] && _a[key][0].itemId))] - if (Array.isArray(_vo)) { - _vo.forEach((_task) => _act.tasks.push({ - _raw: _task, - id: _task.itemId, - name: _task.title || _task.shopName || _task.taskName || '未知名称' - })) - } else { - _act.tasks = Array(_act.maxTimes - _act.times).fill({ - _raw: _vo, - id: _vo.itemId, - name: _act.name - }) - } - $.acts.push(_act) - }) - if (!$.acts) throw new Error('获取活动失败!') - $.log(` 活动数量 = ${$.acts.length}`, '') - } catch (e) { - $.log(`❗️ ${$.name}, 获取活动!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '') - } finally { - resove() - } - }) - }) -} - -async function execActs() { - $.log(`❕ ${$.name}, 执行活动!`) - for (let _actIdx = 0; _actIdx < $.acts.length; _actIdx++) { - const _act = $.acts[_actIdx] - $.log(` ${_actIdx + 1}. ${_act.name} (${_act.times}/${_act.maxTimes})`) - if (_act.times === _act.maxTimes) { - $.log(` @跳过: 全部完成!`, '') - continue - } - // 跳过:邀请好友、加入战队 - if ([2, 12].includes(_act.id)) { - $.log(' 跳过!', '') - continue - } - // 甄选优品 - else if (_act.isProd) { - await getProdAct(_act) - for (let subactIdx = 0; subactIdx < _act.subacts.length; subactIdx++) { - const subact = _act.subacts[subactIdx] - $.log(` ${subactIdx + 1}. ${subact.name} (${subact.times}/${subact.maxTimes})`) - if (subact.times === subact.maxTimes) { - $.log(` @跳过: 全部完成!`, '') - continue - } - for (let subataskIdx = 0; subataskIdx < subact.tasks.length; subataskIdx++) { - const subatask = subact.tasks[subataskIdx] - $.log(` ${subataskIdx + 1}. ${subatask.name.slice(0, 15)}...`) - if (subatask._raw.status && subatask._raw.status === 2) { - $.log(` @跳过: 已经做过!`, '') - continue - } - await sendtask(subact, subatask, true) - $.log(` @认领任务: ${subatask.isClaimSuc ? '🟢' : '🔴'}`) - if (subatask.isskip) { - $.log(` @跳过: ${subatask.msg}`) - const randomms = genRadomms() - $.log(` @等待: 8 秒 + ${randomms} 毫秒`, '') - await new Promise($.wait(8000 + randomms)) - } else { - const randomms = genRadomms() - $.log(` @等待: ${subact.waitDuration} 秒 + ${randomms} 毫秒`) - await new Promise($.wait(subact.waitDuration * 1000 + randomms)) - await sendtask(subact, subatask) - $.log(` @完成任务: ${subatask.isExecSuc ? '🟢' : '🔴'}`) - $.log(` @等待: 5 秒 + ${randomms} 毫秒`, '') - await new Promise($.wait(5000 + randomms)) - } - } - } - } - // 开通会员 - else if (_act.isBrand) { - if ($.VAL_isJoinBrand === 'true' || $.VAL_isJoinBrand === true) { - for (let taskIdx = 0; taskIdx < _act.tasks.length; taskIdx++) { - const task = _act.tasks[taskIdx] - $.log(` ${taskIdx + 1}. ${task.name}`) - await joinBrand(task) - $.log(` @加入会员: ${task.isJoinSuc ? '🟢' : '🔴'}`) - const randomms = genRadomms() - $.log(` @等待: ${_act.waitDuration} 秒 + ${randomms} 毫秒`) - await new Promise($.wait(_act.waitDuration * 1000 + randomms)) - await brandAward(task) - $.log(` @完成任务: ${task.isAwardSuc ? '🟢' : '🔴'}`) - $.log(` @等待: 5 秒 + ${randomms} 毫秒`, '') - await new Promise($.wait(5000 + randomms)) - } - } else { - $.log(` @跳过: BoxJs 设置为 关闭 品牌会员!`, '') - } - } - // 普通任务 - else { - for (let taskIdx = 0; taskIdx < _act.tasks.length; taskIdx++) { - const task = _act.tasks[taskIdx] - $.log(` ${taskIdx + 1}. ${task.name}`) - if (task._raw.status && task._raw.status === 2) { - $.log(` @跳过: 已经做过!`, '') - continue - } - await sendtask(_act, task, true) - $.log(` @认领任务: ${task.isClaimSuc ? '🟢' : '🔴'}`) - if (task.isskip || task.ishot) { - $.log(` @跳过: ${task.msg}`) - const randomms = genRadomms() - $.log(` @等待: 8 秒 + ${randomms} 毫秒`, '') - await new Promise($.wait(8000 + randomms)) - } else { - const randomms = genRadomms() - $.log(` @等待: ${_act.waitDuration} 秒 + ${randomms} 毫秒`) - await new Promise($.wait(_act.waitDuration * 1000 + randomms)) - await sendtask(_act, task) - $.log(` @完成任务: ${task.isExecSuc ? '🟢' : '🔴'}`) - $.log(` @等待: 5 秒 + ${randomms} 毫秒`, '') - await new Promise($.wait(5000 + randomms)) - } - } - } - } - - // 商店签到 - $.log(` ${$.acts.length + 1}. 商店签到 (${$.shopActs.length})`) - if ($.VAL_isSignShop === 'true' || $.VAL_isSignShop === true) { - for (let _shopIdx = 0; _shopIdx < $.shopActs.length; _shopIdx++) { - const shop = $.shopActs[_shopIdx] - $.log(` ${_shopIdx + 1}. ${shop.name}`) - await signshop(shop) - shop.msg = /,/.test(shop.msg) ? shop.msg.split(',')[1] : shop.msg - $.log(` @签到: ${shop.isSuc ? '🟢 已领取!' : shop.code === 402 ? '⚪️ 无效活动!' : `🔴 ${shop.msg}`}`) - const randomms = genRadomms() - $.log(` @等待: 8 秒 + ${randomms} 毫秒`, '') - await new Promise($.wait(8000 + randomms)) - } - } else { - $.log(` @跳过: BoxJs 设置为 关闭 商店签到!`, '') - } -} - -// 商品类活动 -function getProdAct(act) { - return new Promise((resove) => { - const body = {taskIds: act.tasks.map((task) => task.id).toString()} - $.post(taskurl('cakebaker_getFeedDetail', JSON.stringify(body)), (error, response, data) => { - try { - const _result = JSON.parse(data).data.result - const _vo = _result[Object.keys(_result).find((key) => Array.isArray(_result[key] && _result[key][0] && _result[key][0].productInfoVos))] - act.subacts = [] - _vo.forEach((_suba) => { - const _subact = { - _raw: _suba, - id: _suba.taskId, - name: _suba.taskName, - times: _suba.times, - maxTimes: _suba.maxTimes, - waitDuration: _suba.waitDuration === 0 ? 1 : _suba.waitDuration, - isProd: _suba.productInfoVos ? true : false, - tasks: [] - } - _suba.productInfoVos.slice(0, 5).forEach((_prodvo) => { - const _taskname = _prodvo.skuName || _prodvo.title || _prodvo.shopName || _prodvo.taskName || '未知名称' - _subact.tasks.push({ - _raw: _prodvo, - id: _prodvo.itemId, - name: _taskname - }) - }) - act.subacts.push(_subact) - }) - } catch (e) { - $.log(`❗️ ${$.name}, 执行商品类活动!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '') - } finally { - resove() - } - }) - }) -} - -function sendtask(act, task, isClaim = false) { - return new Promise((resove) => { - const body = { - taskId: act.id, - itemId: task.id, - actionType: isClaim ? 1 : undefined, - safeStr: JSON.stringify({secretp: $.secretp}) - } - $.post(taskurl('cakebaker_ckCollectScore', JSON.stringify(body)), (error, response, data) => { - try { - const _data = JSON.parse(data) - const _issuc = _data.data.bizCode === 0 || _data.data.bizCode === -5 || _data.data.bizCode === -15 - if (isClaim) task.isClaimSuc = _issuc - else task.isExecSuc = _issuc - task.isskip = _data.data.bizCode === -5 - task.ishot = _data.data.bizCode === -15 - task.msg = _data.data.bizMsg || '无' - } catch (e) { - if (isClaim) task.isClaimSuc = false - else task.isExecSuc = false - task.isskip = false - task.ishot = false - task.msg = error || e - } finally { - resove() - } - }) - }) -} - -function signshop(shop) { - return new Promise((resove) => { - const body = {channel: 2, venderId: shop.id} - $.post(taskurl('interact_center_sign_collectGift', JSON.stringify(body)), (error, response, data) => { - try { - const _data = JSON.parse(data) - shop.isSuc = _data.code === 407000005 || _data.code === 200 ? true : false - shop.code = _data.code - shop.msg = _data.msg - } catch (e) { - shop.isSuc = false - shop.msg = error || e - } finally { - resove() - } - }) - }) -} - -function joinBrand(task) { - return new Promise((resove) => { - const body = { - venderId: task._raw.copy1, - shopId: task._raw.copy1, - bindByVerifyCodeFlag: 1, - registerExtend: {}, - writeChildFlag: 0, - channel: 4032 - } - const joinurl = `https://api.m.jd.com/client.action?appid=jd_shop_member&functionId=bindWithVender&body=${encodeURIComponent(JSON.stringify(body))}&client=H5&clientVersion=8.5.6&uuid=88888` - const url = {url: joinurl, headers: JSON.parse($.VAL_headers)} - delete url.headers['Content-Length'] - $.get(url, (error, response, data) => { - try { - const _data = JSON.parse(data) - task.isJoinSuc = _data.busiCode === '0' - task.msg = _data.message || '无' - } catch (e) { - task.isJoinSuc = false - task.msg = error || e - } finally { - resove() - } - }) - }) -} - -function brandAward(task) { - return new Promise((resove) => { - const body = {venderId: task._raw.copy1, itemId: task.id} - $.post(taskurl('cakebaker_taskBigBrandAward', JSON.stringify(body)), (error, response, data) => { - try { - const _data = JSON.parse(data) - const _issuc = _data.data.bizCode === 0 || _data.data.bizCode === -5 || _data.data.bizCode === -15 - task.isAwardSuc = _issuc - task.msg = _data.data.bizMsg || '无' - } catch (e) { - task.isAwardSuc = false - task.msg = error || e - } finally { - resove() - } - }) - }) -} - -function taskurl(fid, body = '{}') { - const url = {url: `https://api.m.jd.com/client.action`} - url.headers = JSON.parse($.VAL_headers) - url.body = `functionId=${fid}&body=${body}&client=wh5&clientVersion=1.0.0` - return url -} - -function genRadomms() { - const max = $.VAL_radommsMax * 1 - const min = $.VAL_radommsMin * 1 - return parseInt(Math.random() * (max - min + 1) + min, 10) -} - -function showmsg() { -} - -// 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); - const e = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; - t && e.push(t), s && e.push(s), i && e.push(i), console.log(e.join("\n")) - }), 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 && (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)) -} diff --git a/Scripts/SignIn/JD/jd.618.sgmodule b/Scripts/SignIn/JD/jd.618.sgmodule deleted file mode 100644 index 9c42a37..0000000 --- a/Scripts/SignIn/JD/jd.618.sgmodule +++ /dev/null @@ -1,8 +0,0 @@ -#!name=Chavy iOS JD618 Task Module -#!desc=执行京东 618 活动任务 -#!system=ios - -[Script] -Tasks: JD618 = type=cron,cronexp="10,30,50 0,1 * * *",script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.adapt.js,wake-system=true,timeout=1200 -Tasks: JD618.Boom = type=cron,cronexp="0 10,12,18,20,21 * * *",script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.boom.js,wake-system=true -Tasks: JD618.Boom = type=cron,cronexp="30 21 * * *",script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/jd/jd.618.boom.js,wake-system=true \ No newline at end of file diff --git a/Scripts/SignIn/JDHome/README.md b/Scripts/SignIn/JDHome/README.md deleted file mode 100644 index 58a8a05..0000000 --- a/Scripts/SignIn/JDHome/README.md +++ /dev/null @@ -1,104 +0,0 @@ -# 京东到家 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 -> 感谢 [@barry](https://t.me/barrymchen) 编写 -> -> 感谢 [@GideonSenku](https://github.com/GideonSenku) 对代码优化 - -## 配置 (Surge) - -```properties -[MITM] -daojia.jd.com - -[Script] -http-request ^https:\/\/daojia.jd.com/client(.*?)functionId=signin(.*?)userSigninNew script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/jddj/jddj.cookie.js - -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/jddj/jddj.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -daojia.jd.com - -[rewrite_local] - -# [商店版] QuanX v1.0.6-build194 及更早版本 -# ^https:\/\/daojia.jd.com/client(.*?)functionId=signin(.*?)userSigninNew url script-request-header jddj.cookie.js - -# [TestFlight] QuanX v1.0.6-build195 及以后版本 -^https:\/\/daojia.jd.com/client(.*?)functionId=signin(.*?)userSigninNew url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/jddj/jddj.cookie.js - -[task_local] -1 0 * * * jddj.js -``` - -## 说明 - -1. 先把`daojia.jd.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`jddj.cookie.js`和`jddj.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 手机App打开,`我的`> `签到有惊喜`>`签到`手机浏览器打开`https://daojia.jd.com/html/index.html`,`我的`> `签到有惊喜` >`签到` -4. 系统提示: `获取Cookie: 成功` -5. 把获取 Cookie 的脚本注释掉 - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) - -[@barry](https://t.me/barrymchen) - -[@GideonSenku](https://github.com/GideonSenku) \ No newline at end of file diff --git a/Scripts/SignIn/JDHome/jddj.cookie.js b/Scripts/SignIn/JDHome/jddj.cookie.js deleted file mode 100644 index c3db59e..0000000 --- a/Scripts/SignIn/JDHome/jddj.cookie.js +++ /dev/null @@ -1,56 +0,0 @@ -const cookieName = '京东到家' -const signheaderKey = 'chen_signheader_jddj' -const chen = init() -if (this.$request) { - const signheaderVal = JSON.stringify($request.headers) - if (signheaderVal) { - chen.setdata(signheaderVal, signheaderKey) - chen.msg(cookieName, `获取Cookie: 成功`, ``) - } -} - -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} -} - -chen.done() diff --git a/Scripts/SignIn/JDHome/jddj.js b/Scripts/SignIn/JDHome/jddj.js deleted file mode 100644 index 7a7b8a6..0000000 --- a/Scripts/SignIn/JDHome/jddj.js +++ /dev/null @@ -1,75 +0,0 @@ -const cookieName = '京东到家' -const signheaderKey = 'chen_signheader_jddj' -const chen = init() -const signheaderVal = chen.getdata(signheaderKey) -sign() - -function sign() { - let url = { - url: `https://daojia.jd.com/client?functionId=signin%2FuserSigninNew&body=%7B%7D`, - headers: JSON.parse(signheaderVal) - } - chen.get(url, (error, response, data) => { - chen.log(`${cookieName}, data: ${data}`) - let res = JSON.parse(data) - const title = `${cookieName}` - let subTitle = `` - let detail = `` - if (res.success && res.result.points != 'undefined') { - subTitle = `签到结果:成功` - detail = `获取鲜豆:${res.result.points}` - } else if (!res.success && res.code == 202) { - subTitle = `签到结果: 失败` - detail = `说明: ${res.msg}` - } else if (!res.success && res.code == -1) { - subTitle = `签到成功,请勿重复操作` - } else { - subTitle = `未知错误,截图日志` - } - chen.msg(title, subTitle, detail) - }) -} - -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} -} \ No newline at end of file diff --git a/Scripts/SignIn/KuaiKan/KKMH.js b/Scripts/SignIn/KuaiKan/KKMH.js deleted file mode 100644 index 24c50ad..0000000 --- a/Scripts/SignIn/KuaiKan/KKMH.js +++ /dev/null @@ -1,204 +0,0 @@ -/* -快看漫画签到脚本 - -更新时间: 2022.06.18 -脚本兼容: QuantumultX, Surge4, Loon, Node.js -电报频道: @NobyDa -问题反馈: @NobyDa_bot - -获取Cookie说明: -打开快看漫画App后(AppStore中国区),点击"我的", 如通知成功获取cookie, 则可以使用此签到脚本. -获取Cookie后, 请将Cookie脚本禁用并移除主机名,以免产生不必要的MITM. -脚本将在每天上午9:00执行, 您可以修改执行时间。 - -如果使用Node.js, 需自行安装got与tough-cookie模块. 例: npm install got tough-cookie -g - -Node.js用户抓取Cookie说明: -开启抓包, 打开快看漫画App后(AppStore中国区),点击"我的" 返回抓包app搜索关键字 passport/user 复制请求头Cookie填入以下cookie处的单引号内即可 -*/ - -var cookie = '' - -var barkKey = ''; //Bark APP 通知推送key - -/********************* - QuantumultX 远程脚本配置: - ********************** - [task_local] - 0 9 * * * https://raw.githubusercontent.com/NobyDa/Script/master/KuaiKan-DailyBonus/KKMH.js, tag=快看漫画, img-url=https://ftp.bmp.ovh/imgs/2020/09/a3345da5e9094363.png, enabled=true - - [rewrite_local] - # 获取Cookie - ^https:\/\/api\.kkmh\.com\/v\d\/passport\/user url script-request-header https://raw.githubusercontent.com/NobyDa/Script/master/KuaiKan-DailyBonus/KKMH.js - - [mitm] - hostname= api.kkmh.com - - ********************** - Surge 4.2.0+ 脚本配置: - ********************** - [Script] - 快看漫画签到 = type=cron,cronexp=0 9 * * *,script-path=https://raw.githubusercontent.com/NobyDa/Script/master/KuaiKan-DailyBonus/KKMH.js - - 快看漫画获取Cookie = type=http-request,pattern=^https:\/\/api\.kkmh\.com\/v\d\/passport\/user,script-path=https://raw.githubusercontent.com/NobyDa/Script/master/KuaiKan-DailyBonus/KKMH.js - - [MITM] - hostname= api.kkmh.com - - ************************ - Loon 2.1.0+ 脚本配置: - ************************ - - [Script] - # 快看漫画签到 - cron "0 9 * * *" script-path=https://raw.githubusercontent.com/NobyDa/Script/master/KuaiKan-DailyBonus/KKMH.js - - # 获取Cookie - http-request ^https:\/\/api\.kkmh\.com\/v\d\/passport\/user script-path=https://raw.githubusercontent.com/NobyDa/Script/master/KuaiKan-DailyBonus/KKMH.js - - [Mitm] - hostname= api.kkmh.com - - */ -var LogDetails = false; //响应日志 -var $ = new Env('快看漫画'); -var date = new Date() -var imgUrl = { - 'open-url': 'kuaikan://', - 'media-url': 'https://ftp.bmp.ovh/imgs/2020/09/16da56c186ffa6a2.png' -}; - -(async () => { - if (typeof $request != "undefined") { - GetCookie() - } else if (cookie || $.getdata("@KKMH.COOKIE")) { - if (cookie) $.setdata(cookie, "@KKMH.COOKIE"); - LogDetails = $.getdata("@KKMH.LOG") === "true" || LogDetails - await Checkin(); - } else { - $.msg($.name, "", "签到终止, 未获取Cookie ⚠️", imgUrl); - } -})().finally(() => { - $.done(); -}) - -function Checkin() { - return new Promise(resolve => { - $.get({ - url: 'https://h5.kuaikanmanhua.com/v2/checkin/task_center/checkin', - headers: { - 'Cookie': cookie || $.getdata("@KKMH.COOKIE"), - 'User-Agent': 'Kuaikan/5.75.0/575000(iPhone;Scale/3.00) (iPhone; CPU)', - 'X-Device': '0' - } - }, async (error, response, data) => { - try { - if (error) throw new Error(error) - const cc = JSON.parse(data) - const Details = LogDetails ? data ? `response:\n${data}` : '' : '' - if (cc.code == 200) { - $.log(`${$.name} 成功${Details}`) - const pop = cc.data.check_in_home_info.pop_title - const text = cc.data.check_in_home_info.check_in_bubble_text - const title = cc.data.check_in_home_info.check_in_title - const score = cc.data.check_in_home_info.user_score - const kkb = cc.data.check_in_home_info.user_kkb - const uid = $.getdata("@KKMH.COOKIE") ? $.getdata("@KKMH.COOKIE").match(/uid=(\d+)/) : '' - const rep = $.getdata("@KKMH.DATE") == date.getDate() && (uid ? uid[1] : '') == $.getdata("@KKMH.UID") - const gift = await GiftPack(title); - $.subtitle = rep ? '今天已签过!' : pop; - $.msgBody = `${rep?``:text+', '}现有${$.score||score}积分, ${$.kkb||kkb}KK币\n${gift||title} 🎉`; - $.setdata(JSON.stringify(date.getDate()), "@KKMH.DATE") - $.setdata(uid ? uid[1] : '', "@KKMH.UID") - } else { - $.log(`${$.name} 失败${Details}`) - if (cc.code == 401) { - $.msgBody = 'Cookie失效 ⚠️'; - } else { - $.msgBody = cc.message || '未知错误 ⚠️'; - } - } - } catch (err) { - $.logErr(err) - $.msgBody = `错误, 已输出日志 ⚠️`; - } finally { - $.msg($.name, $.subtitle || '', $.msgBody, imgUrl); - if (barkKey) { - await BarkNotify($, barkKey, $.name, $.msgBody); - } - resolve() - } - }) - }) -} - -function GiftPack(type) { - return new Promise(resolve => { - if (!type.match(/今(日|天)可领/)) return resolve(); - $.get({ - url: 'https://h5.kuaikanmanhua.com/v1/checkin/api/check/open_gift_bag', - headers: { - 'Cookie': cookie || $.getdata("@KKMH.COOKIE"), - 'User-Agent': 'Kuaikan/5.75.0/575000(iPhone;Scale/3.00) (iPhone; CPU)', - 'X-Device': '0' - } - }, (error, response, data) => { - try { - if (error) throw new Error(error) - const cc = JSON.parse(data) - const Details = LogDetails ? data ? `response:\n${data}` : '' : '' - if (cc.code == 200 && cc.data) { - $.log(`${$.name} 成功${Details}`) - $.kkb = cc.data.giftBagKkb ? cc.data.giftBagKkb + cc.data.kkb : cc.data.kkb - $.score = cc.data.score; - $.gifts = `领取连签礼包成功`; - if (cc.data.giftBagScore) $.gifts += `, +${cc.data.giftBagScore}积分`; - if (cc.data.giftBagKkb) $.gifts += `, +${cc.data.giftBagKkb}KK币`; - if (cc.data.giftBagSupplement) $.gifts += `, +1 补签胶囊`; - if (cc.data.giftBagCardCoupon) $.gifts += `, +1 ${cc.data.cardCoupon.title}`; - if (cc.data.giftBagYouzanCoupon) $.gifts += `, +1 ${cc.data.youzanCoupon.title}`; - } else { - $.log(`${$.name} 失败${Details}`) - $.gifts = `领取连签礼包失败, ${cc.message || '未知错误'}` - } - } catch (err) { - $.logErr(err) - $.gifts = `领取连签礼包错误, 已输出日志` - } finally { - resolve($.gifts) - } - }) - }) -} - -function GetCookie() { - const RA = $.getdata("@KKMH.COOKIE") - const TM = $.getdata("@KKMH.TIME") - const CK = $request.headers['Cookie'] || $request.headers['cookie']; - if (JSON.stringify($request.headers).match(/session=/) && CK) { - if (RA != CK) { - if ($.setdata(CK, "@KKMH.COOKIE")) { - $.setdata(JSON.stringify(Date.now()), "@KKMH.TIME") - if (!TM || TM && (Date.now() - TM) / 1000 >= 21600) { - $.msg(`${RA?`更新`:`首次写入`}${$.name}Cookie成功 🎉`, "", "", imgUrl) - } else if (RA.match(/uid=\d+/)[0] == CK.match(/uid=\d+/)[0]) { - $.log(`\n更新${$.name}Cookie成功! 🎉\n检测到频繁通知, 已转为输出日志`) - } else { - $.msg(`更新${$.name}Cookie成功 🎉`, "", "", imgUrl) - } - } else { - $.msg(`${RA?`更新`:`首次写入`}${$.name}Cookie失败‼️`, "", "", imgUrl) - } - } else { - $.log(`${$.name}-Cookie相同, 跳过写入 ⚠️`) - } - } else { - $.log(`${$.name}-请求不含Cookie, 跳过写入 ‼️`) - } -} - -//Bark APP notify -async function BarkNotify(c,k,t,b){for(let i=0;i<3;i++){console.log(`🔷Bark notify >> Start push (${i+1})`);const s=await new Promise((n)=>{c.post({url:'https://api.day.app/push',headers:{'Content-Type':'application/json'},body:JSON.stringify({title:t,body:b,device_key:k,ext_params:{group:t}})},(e,r,d)=>r&&r.status==200?n(1):n(d||e))});if(s===1){console.log('✅Push success!');break}else{console.log(`❌Push failed! >> ${s.message||s}`)}}} - -//Compatible code from https://github.com/chavyleung/scripts/blob/master/Env.min.js -function Env(t,e){class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),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&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}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),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;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),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}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,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||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,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/Scripts/SignIn/MGTV/README.md b/Scripts/SignIn/MGTV/README.md deleted file mode 100644 index 61f464c..0000000 --- a/Scripts/SignIn/MGTV/README.md +++ /dev/null @@ -1,91 +0,0 @@ -# 芒果 TV - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -## 配置 (Surge) - -```properties -[MITM] -credits.bz.mgtv.com - -[Script] -http-request ^https:\/\/credits.bz.mgtv.com\/user\/creditsTake script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/mgtv/mgtv.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/mgtv/mgtv.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -credits.bz.mgtv.com - -[rewrite_local] -^https:\/\/credits.bz.mgtv.com\/user\/creditsTake url script-request-header mgtv.cookie.js - -[task_local] -1 0 * * * mgtv.js -``` - -## 说明 - -1. 先把`credits.bz.mgtv.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`mgtv.cookie.js`和`mgtv.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP 然后手动签到 1 次, 系统提示: `获取Cookie: 成功` -4. 最后就可以把第 1 条脚本注释掉了 -5. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/MGTV/mgtv.cookie.js b/Scripts/SignIn/MGTV/mgtv.cookie.js deleted file mode 100644 index 48e0dfc..0000000 --- a/Scripts/SignIn/MGTV/mgtv.cookie.js +++ /dev/null @@ -1,58 +0,0 @@ -const cookieName = '芒果TV' -const signurlKey = 'chavy_signurl_mgtv' -const signheaderKey = 'chavy_signheader_mgtv' -const chavy = init() - -if ($request && $request.method != 'OPTIONS') { - const signurlVal = $request.url - const signheaderVal = JSON.stringify($request.headers) - if (signurlVal) chavy.setdata(signurlVal, signurlKey) - if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey) - chavy.msg(cookieName, `获取Cookie: 成功`, ``) -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/MGTV/mgtv.js b/Scripts/SignIn/MGTV/mgtv.js deleted file mode 100644 index 6074794..0000000 --- a/Scripts/SignIn/MGTV/mgtv.js +++ /dev/null @@ -1,75 +0,0 @@ -const cookieName = '芒果TV' -const signurlKey = 'chavy_signurl_mgtv' -const signheaderKey = 'chavy_signheader_mgtv' -const chavy = init() -const signurlVal = chavy.getdata(signurlKey) -const signheaderVal = chavy.getdata(signheaderKey) - -sign() - -function sign() { - const url = {url: signurlVal, headers: JSON.parse(signheaderVal)} - url.body = '{}' - chavy.post(url, (error, response, data) => { - chavy.log(`${cookieName}, data: ${data}`) - const title = `${cookieName}` - let subTitle = '' - let detail = '' - const result = JSON.parse(data.match(/\(([^\)]*)\)/)[1]) - if (result.code == 200) { - subTitle = `签到结果: 成功` - detail = `共签: ${result.data.curDay}天, 连签: ${result.data.curDayTotal}天, 积分: ${result.data.balance} +${result.data.credits})` - } else if (result.code == 1002) { - subTitle = `签到结果: 成功 (重复签到)` - } else { - subTitle = `签到结果: 失败` - detail = `编码: ${result.code}, 说明: ${result.msg}` - } - chavy.msg(title, subTitle, detail) - chavy.done() - }) -} - -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} -} diff --git a/Scripts/SignIn/MaoMicd/README.md b/Scripts/SignIn/MaoMicd/README.md deleted file mode 100644 index 9004cb0..0000000 --- a/Scripts/SignIn/MaoMicd/README.md +++ /dev/null @@ -1,91 +0,0 @@ -# 猫咪音乐网 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -## 配置 (Surge) - -```properties -[MITM] -www.maomicd.com - -[Script] -http-request https:\/\/www.maomicd.com\/plugin.php\?id=k_misign:sign&operation=qiandao script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/maomicd/maomicd.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/maomicd/maomicd.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -www.maomicd.com - -[rewrite_local] -https:\/\/www.maomicd.com\/plugin.php\?id=k_misign:sign&operation=qiandao url script-request-header maomicd.cookie.js - -[task_local] -1 0 * * * maomicd.js -``` - -## 说明 - -1. 先把`www.maomicd.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`maomicd.cookie.js`和`maomicd.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 网站 `https://www.maomicd.com` 然后手动签到 1 次, 系统提示: `获取Cookie: 成功` -4. 最后就可以把获取 Cookie 的脚本注释掉了 -5. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/MaoMicd/maomicd.cookie.js b/Scripts/SignIn/MaoMicd/maomicd.cookie.js deleted file mode 100644 index 3f24036..0000000 --- a/Scripts/SignIn/MaoMicd/maomicd.cookie.js +++ /dev/null @@ -1,58 +0,0 @@ -const cookieName = '猫咪音乐网' -const signurlKey = 'chavy_signurl_maomicd' -const signheaderKey = 'chavy_signheader_maomicd' -const chavy = init() - -if ($request && $request.method != 'OPTIONS') { - const signurlVal = $request.url - const signheaderVal = JSON.stringify($request.headers) - if (signurlVal) chavy.setdata(signurlVal, signurlKey) - if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey) - chavy.msg(cookieName, `获取Cookie: 成功`, ``) -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/MaoMicd/maomicd.js b/Scripts/SignIn/MaoMicd/maomicd.js deleted file mode 100644 index 948a4e9..0000000 --- a/Scripts/SignIn/MaoMicd/maomicd.js +++ /dev/null @@ -1,72 +0,0 @@ -const cookieName = '猫咪音乐网' -const signurlKey = 'chavy_signurl_maomicd' -const signheaderKey = 'chavy_signheader_maomicd' -const chavy = init() -const signurlVal = chavy.getdata(signurlKey) -const signheaderVal = chavy.getdata(signheaderKey) - -sign() - -function sign() { - const url = {url: signurlVal, headers: JSON.parse(signheaderVal)} - chavy.get(url, (error, response, data) => { - chavy.log(`${cookieName}, data: ${data}`) - let subTitle = `` - let detail = `` - let result = data.match(/()<\/root>/) - if (result) { - result = result[2] - if (result == '') subTitle = `签到结果: 成功` - else if (result.indexOf('今日已签') >= 0) subTitle = `签到结果: 成功 (重复签到)` - else (subTitle = `签到结果: 未知`), (detail = `说明: ${result}`) - } else { - subTitle = `签到结果: 失败` - } - chavy.msg(cookieName, subTitle, detail) - chavy.done() - }) -} - -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} -} diff --git a/Scripts/SignIn/Mcdd/README.md b/Scripts/SignIn/Mcdd/README.md deleted file mode 100644 index b658b35..0000000 --- a/Scripts/SignIn/Mcdd/README.md +++ /dev/null @@ -1,91 +0,0 @@ -# 叮咚买菜 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -## 配置 (Surge) - -```properties -[MITM] -maicai.api.ddxq.mobi - -[Script] -http-request ^https:\/\/maicai.api.ddxq.mobi\/point\/home script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/mcdd/mcdd.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/mcdd/mcdd.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -maicai.api.ddxq.mobi - -[rewrite_local] -^https:\/\/maicai.api.ddxq.mobi\/point\/home url script-request-header mcdd.cookie.js - -[task_local] -1 0 * * * mcdd.js -``` - -## 说明 - -1. 先把`maicai.api.ddxq.mobi`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`mcdd.cookie.js`和`mcdd.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP, 访问下`我的`>`积分` -4. 系统提示: `获取Cookie: 成功` (如果不提示获取成功, 尝试杀进程再进个人中心) -5. 最后就可以把第 1 条脚本注释掉了 - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/Mcdd/mcdd.cookie.js b/Scripts/SignIn/Mcdd/mcdd.cookie.js deleted file mode 100644 index 08653a0..0000000 --- a/Scripts/SignIn/Mcdd/mcdd.cookie.js +++ /dev/null @@ -1,70 +0,0 @@ -const chavy = init() -const cookieName = '叮咚买菜' -const KEY_homeurl = 'chavy_home_url_mcdd' -const KEY_homeheader = 'chavy_home_header_mcdd' - -if ($request && $request.method != 'OPTIONS') { - try { - chavy.log(`🔔 ${cookieName} 开始获取: Cookies`) - const VAL_homeurl = $request.url - const VAL_homeheader = JSON.stringify($request.headers) - if (VAL_homeurl) { - chavy.setdata(VAL_homeurl, KEY_homeurl) - chavy.log(`❕ ${cookieName} VAL_homeurl: ${VAL_homeurl}`) - } - if (VAL_homeheader) { - chavy.setdata(VAL_homeheader, KEY_homeheader) - chavy.log(`❕ ${cookieName} VAL_homeheader: ${VAL_homeheader}`) - } - chavy.msg(cookieName, `获取Cookie: 成功`, ``) - } catch (e) { - chavy.msg(cookieName, `获取Cookie: 失败`, e) - chavy.log(`❌ ${cookieName} 获取Cookie: 失败: ${e}`) - } -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/Mcdd/mcdd.js b/Scripts/SignIn/Mcdd/mcdd.js deleted file mode 100644 index 63889b8..0000000 --- a/Scripts/SignIn/Mcdd/mcdd.js +++ /dev/null @@ -1,233 +0,0 @@ -const chavy = init() -const cookieName = '叮咚买菜' -const KEY_homeurl = 'chavy_home_url_mcdd' -const KEY_homeheader = 'chavy_home_header_mcdd' - -const signinfo = {} -let VAL_homeurl = chavy.getdata(KEY_homeurl) -let VAL_homeheader = chavy.getdata(KEY_homeheader) - -;(exec = async () => { - chavy.log(`🔔 ${cookieName} 开始签到`) - await signapp() - await getlottery() - if (signinfo.draw_num > 0) for (let i = 0; i < signinfo.draw_num; i++) await lotteryapp(i) - await browseapp() - await getinfo() - showmsg() - chavy.done() -})().catch((e) => chavy.log(`❌ ${cookieName} 签到失败: ${e}`), chavy.done()) - -function getinfo() { - return new Promise((resolve, reject) => { - const url = {url: VAL_homeurl, headers: JSON.parse(VAL_homeheader)} - chavy.get(url, (error, response, data) => { - try { - signinfo.info = JSON.parse(data) - if (typeof signinfo.is_today_sign === 'undefined') signinfo.is_today_sign = signinfo.info.data.user_sign.is_today_sign - resolve() - } catch (e) { - chavy.msg(cookieName, `获取信息: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} getinfo - 获取信息失败: ${e}`) - chavy.log(`❌ ${cookieName} getinfo - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function signapp() { - return new Promise((resolve, reject) => { - const url = {url: `https://ddxq.mobi/api/v2/user/signin/`, headers: JSON.parse(VAL_homeheader)} - url.headers['Accept'] = '*/*' - url.headers['Origin'] = 'https://activity.m.ddxq.mobi' - url.headers['Accept-Encoding'] = 'gzip, deflate, br' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['Host'] = 'ddxq.mobi' - url.headers['Connection'] = 'keep-alive' - url.headers['Referer'] = 'https://activity.m.ddxq.mobi/' - url.headers['Content-Length'] = '129' - url.headers['Accept-Language'] = 'zh-cn' - url.body = VAL_homeurl.split('?')[1] - 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() - } - }) - }) -} - -function getlottery() { - return new Promise((resolve, reject) => { - const getlotteryurl = `https://maicai.api.ddxq.mobi/lottery/index?${VAL_homeurl.split('?')[1]}&event_id=5dbacee44df3e3ed628ce721` - const url = {url: getlotteryurl, headers: JSON.parse(VAL_homeheader)} - url.headers['Origin'] = 'https://activity.m.ddxq.mobi' - url.headers['Connection'] = 'keep-alive' - url.headers['Accept'] = '*/*' - url.headers['Referer'] = 'https://activity.m.ddxq.mobi/' - url.headers['Host'] = 'maicai.api.ddxq.mobi' - url.headers['Accept-Encoding'] = 'gzip, deflate, br' - url.headers['Accept-Language'] = 'zh-cn' - chavy.get(url, (error, response, data) => { - try { - signinfo.lotteryinfo = JSON.parse(data) - if (typeof signinfo.draw_num === 'undefined') signinfo.draw_num = signinfo.lotteryinfo.data.draw_num - resolve() - } catch (e) { - chavy.msg(cookieName, `获取抽奖: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} getlottery - 获取抽奖失败: ${e}`) - chavy.log(`❌ ${cookieName} getlottery - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function lotteryapp(cnt) { - return new Promise((resolve, reject) => { - setTimeout(() => { - const lotteryappurl = `https://maicai.api.ddxq.mobi/lottery/draw?${VAL_homeurl.split('?')[1]}&event_id=5dbacee44df3e3ed628ce721` - const url = {url: lotteryappurl, headers: JSON.parse(VAL_homeheader)} - url.headers['Origin'] = 'https://activity.m.ddxq.mobi' - url.headers['Connection'] = 'keep-alive' - url.headers['Accept'] = '*/*' - url.headers['Referer'] = 'https://activity.m.ddxq.mobi/' - url.headers['Host'] = 'maicai.api.ddxq.mobi' - url.headers['Accept-Encoding'] = 'gzip, deflate, br' - url.headers['Accept-Language'] = 'zh-cn' - chavy.get(url, (error, response, data) => { - try { - if (!signinfo.lottery) signinfo.lottery = [] - signinfo.lottery.push(JSON.parse(data)) - resolve() - } catch (e) { - chavy.msg(cookieName, `获取抽奖: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} lotteryapp - 获取抽奖失败: ${e}`) - chavy.log(`❌ ${cookieName} lotteryapp - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }, cnt * 5000) - }) -} - -function browseapp() { - return new Promise((resolve, reject) => { - const browseappurl = `https://maicai.api.ddxq.mobi/point/completeTask` - const url = {url: browseappurl, headers: JSON.parse(VAL_homeheader)} - url.body = `${VAL_homeurl.split('?')[1]}&station_id=5500fe01916edfe0738b4e43&task_type=21` - url.headers['Accept'] = '*/*' - url.headers['Origin'] = 'https://maicai.m.ddxq.mobi' - url.headers['Accept-Encoding'] = 'gzip, deflate, br' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['Host'] = 'maicai.api.ddxq.mobi' - url.headers['Connection'] = 'keep-alive' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 xzone/9.7.5 station_id/5500fe01916edfe0738b4e43' - url.headers['Referer'] = 'https://maicai.m.ddxq.mobi/?v=1.30.0' - url.headers['Content-Length'] = '152' - url.headers['Accept-Language'] = 'zh-cn' - chavy.post(url, (error, response, data) => { - try { - signinfo.browseapp = JSON.parse(data) - resolve() - } catch (e) { - chavy.msg(cookieName, `浏览商品: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} browseapp - 浏览商品失败: ${e}`) - chavy.log(`❌ ${cookieName} browseapp - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function showmsg() { - let subTitle, detail - if (signinfo.signapp.code == 0) { - if (signinfo.is_today_sign === false) subTitle = '签到: 成功' - else subTitle = '签到: 重复' - detail = `积分: ${signinfo.info.data.point_num} (+${signinfo.signapp.data.point}), 价值: ${signinfo.info.data.point_money}` - } else { - subTitle = '签到: 失败' - detail = `编码: ${signinfo.signapp.code}, 说明: ${signinfo.signapp.message}` - chavy.log(`❌ ${cookieName} showmsg - 签到失败: ${JSON.stringify(signinfo.signapp)}`) - } - - if (signinfo.lotteryinfo.code == 0) { - if (signinfo.draw_num == 0) subTitle += '; 抽奖: 已转' - else subTitle += `; 抽奖: ${signinfo.draw_num}次` - } else { - subTitle = '抽奖: 失败' - detail = `编码: ${signinfo.lotteryinfo.code}, 说明: ${signinfo.lotteryinfo.message}` - chavy.log(`❌ ${cookieName} showmsg - 抽奖失败: ${JSON.stringify(signinfo.lotteryinfo)}`) - } - - if (signinfo.browseapp.code == 0) { - subTitle += '; 浏览任务: 成功' - } else if (signinfo.browseapp.code == -1) { - subTitle += '; 浏览任务: 重复' - } else { - subTitle = '浏览任务: 失败' - detail = `编码: ${signinfo.browseapp.code}, 说明: ${signinfo.browseapp.msg}` - chavy.log(`❌ ${cookieName} showmsg - 浏览任务失败: ${JSON.stringify(signinfo.browseapp)}`) - } - - if (signinfo.lottery) { - detail += '\n查看抽奖详情\n' - for (let i = 0; i < signinfo.lottery.length; i++) { - if (signinfo.lottery[i].code == 0) detail += `\n抽奖 (${i + 1}): ${signinfo.lottery[i].data.prize.title}` - else detail += `\n抽奖 (${i + 1}): ${signinfo.lottery[i].msg}` - } - } - - chavy.msg(cookieName, subTitle, detail) -} - -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} -} diff --git a/Scripts/SignIn/Meituan/README.md b/Scripts/SignIn/Meituan/README.md deleted file mode 100644 index bab5ffb..0000000 --- a/Scripts/SignIn/Meituan/README.md +++ /dev/null @@ -1,98 +0,0 @@ -# 美团 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> QuanX 需要: v1.0.6-build195 及以后版本 (TestFlight) - -## 配置 (Surge) - -```properties -[MITM] -hostname = i.meituan.com - -[Script] -http-request ^https:\/\/i.meituan.com\/evolve\/signin\/signpost\/ script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/meituan/meituan.cookie.js, requires-body=true -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/meituan/meituan.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -i.meituan.com - -[rewrite_local] - -# [商店版] QuanX v1.0.6-build194 及更早版本 -# 不支持 - -# [TestFlight] QuanX v1.0.6-build195 及以后版本 -^https:\/\/i.meituan.com\/evolve\/signin\/signpost\/ url script-request-body meituan.cookie.js - -[task_local] -1 0 * * * meituan.js -``` - -## 说明 - -1. 先把`i.meituan.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`meituan.cookie.js`和`meituan.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP , 然后手动签到 1 次, 系统提示: `获取Cookie: 成功` (`首页` > `红包签到`) -4. 把获取 Cookie 的脚本注释掉 -5. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/Meituan/meituan.cookie.js b/Scripts/SignIn/Meituan/meituan.cookie.js deleted file mode 100644 index b5f5e1f..0000000 --- a/Scripts/SignIn/Meituan/meituan.cookie.js +++ /dev/null @@ -1,64 +0,0 @@ -const cookieName = '美团' -const tokenurlKey = 'chavy_tokenurl_meituan' -const tokenheaderKey = 'chavy_tokenheader_meituan' -const signurlKey = 'chavy_signurl_meituan' -const signheaderKey = 'chavy_signheader_meituan' -const signbodyKey = 'chavy_signbody_meituan' -const chavy = init() - -const requrl = $request.url -if ($request && $request.method != 'OPTIONS' && requrl.match(/\/evolve\/signin\/signpost\//)) { - const signurlVal = requrl - const signheaderVal = JSON.stringify($request.headers) - const signbodyVal = $request.body - if (signurlVal) chavy.setdata(signurlVal, signurlKey) - if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey) - if (signbodyVal) chavy.setdata(signbodyVal, signbodyKey) - chavy.msg(cookieName, `获取Cookie: 成功`, ``) -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/Meituan/meituan.js b/Scripts/SignIn/Meituan/meituan.js deleted file mode 100644 index 5d460d6..0000000 --- a/Scripts/SignIn/Meituan/meituan.js +++ /dev/null @@ -1,86 +0,0 @@ -const cookieName = '美团' -const tokenurlKey = 'chavy_tokenurl_meituan' -const tokenheaderKey = 'chavy_tokenheader_meituan' -const signurlKey = 'chavy_signurl_meituan' -const signheaderKey = 'chavy_signheader_meituan' -const signbodyKey = 'chavy_signbody_meituan' -const chavy = init() -const tokenurlVal = chavy.getdata(tokenurlKey) -const tokenheaderVal = chavy.getdata(tokenheaderKey) -const signurlVal = chavy.getdata(signurlKey) -const signheaderVal = chavy.getdata(signheaderKey) -const signBodyVal = chavy.getdata(signbodyKey) - -sign() - -function sign() { - const url = {url: signurlVal, headers: JSON.parse(signheaderVal), body: signBodyVal} - chavy.post(url, (error, response, data) => { - chavy.log(`${cookieName}, data: ${data}`) - const result = JSON.parse(data) - let subTitle = `` - let detail = `` - if (result.code == 0) { - subTitle = `签到结果: 成功` - detail = `本周连签: ${result.data[0].circleSignTimes}天` - for (r of result.data[0].signInAwardRecords) { - const rinfo = JSON.parse(r.info) - if (rinfo.type == `cash`) detail += `, 奖励金: ${rinfo.amount / 100}元` - else if (rinfo.type == `coupon`) detail += `\n优惠券: ${rinfo.name}: ${rinfo.amount}元 (${rinfo.condition})` - else detail += `\n未知奖励!` - } - } else if (result.code == 2002) { - subTitle = `签到结果: 成功 (重复签到)` - detail = `说明: ${result.msg}` - } else { - subTitle = `签到结果: 失败` - detail = `编码: ${result.code}, 说明: ${result.msg}` - } - chavy.msg(cookieName, subTitle, detail) - chavy.done() - }) -} - -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} -} diff --git a/Scripts/SignIn/Midu/README.md b/Scripts/SignIn/Midu/README.md deleted file mode 100644 index de37a13..0000000 --- a/Scripts/SignIn/Midu/README.md +++ /dev/null @@ -1,117 +0,0 @@ -# 米读 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> QuanX 需要: v1.0.6-build195 及以后版本 (TestFlight) - -> 感谢 [@GideonSenku](https://github.com/GideonSenku) Commit - -> 2020.04.29 添加阅读时长 -> 2020.04.30 添加签到、掷骰子 -> 2002.05.01 添加阅读双签 -> 2002.05.01 添加签到双签 -> 2020.05.04 使用python生成无限账户签到和阅读JavaScript脚本 -## 配置 (Surge) - -```properties -[MITM] -apiwz.midukanshu.com - -[Script] -http-request ^https:\/\/apiwz\.midukanshu\.com script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/midu/midu.cookie.js, requires-body=true - - -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/midu/miduSign.js -cron "*/1 * * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/midu/miduRead.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -apiwz.midukanshu.com - -[rewrite_local] - -# [商店版] QuanX v1.0.6-build194 及更早版本 -^https:\/\/apiwz\.midukanshu\.com url script-request-body midu.cookie.js - -# [TestFlight] QuanX v1.0.6-build195 及以后版本 -^https:\/\/apiwz\.midukanshu\.com url script-request-body https://raw.githubusercontent.com/chavyleung/scripts/master/midu/midu.cookie.js - - - -[task_local] -*/1 * * * * miduRead.js -0 1 * * * miduSign.js -``` - -## 说明 - -0. 越狱用户请关闭越狱状态,否则会视为作弊用户!!! -1. 先把`apiwz.midukanshu.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`midu.cookie.js`和`miduRead.js`&`miduSign.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP 进入`我的` -> `疯狂摇摇乐`,系统提示: `签到:获取Cookie: 成功` -4. 阅读时长获取Cookie:打开 APP 选取文章阅读, `书城` > `任意文章阅读` 等到提示获取Cookie成功即可 -5. 把获取 Cookie 的脚本注释掉 -6. 建议将`miduRead.js`脚本`task`执行次数改成每分钟执行以达到阅读时长 -7. 若要双签到,切换账号获取账户二的Cookie即可 -8. 赞赏:邀请码`A1040276307`,[直达链接](http://html34.qukantoutiao.net/qpr2/bBmQ.html?pid=5eb14518) -9. 无限账户签到请移步:[GideonSenku](https://github.com/GideonSenku/scripts/tree/master/midu),目前支持仅制支持Surge -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) - -[@GideonSenku](https://github.com/GideonSenku) diff --git a/Scripts/SignIn/Midu/midu.cookie.js b/Scripts/SignIn/Midu/midu.cookie.js deleted file mode 100644 index 9e419ff..0000000 --- a/Scripts/SignIn/Midu/midu.cookie.js +++ /dev/null @@ -1,172 +0,0 @@ -// 账号一 -const readTimeheaderKey = 'senku_readTimeheader_midu' -const signbodyKey = 'senku_signbody_midu' -// 账号二 -const readTimeheaderKey2 = 'senku_readTimeheader_midu2' -const signbodyKey2 = 'senku_signbody_midu2' - -const senku = init() -const requrl = $request.url - - -if ($request && $request.method != 'OPTIONS' && requrl.match(/\/user\/readTimeBase\/readTime/)) { - try { - const readTimebodyVal = $request.body - const CookieValue = $request.headers - senku.log(`🍎${readTimebodyVal}`) - senku.log(`🍎${senku.getdata(readTimebodyKey)}`) - var account = senku.getdata('tokenMidu_read') ? senku.getdata('tokenMidu_read') : null - var account2 = senku.getdata('tokenMidu_read2') ? senku.getdata('tokenMidu_read2') : null - var tokenVal = CookieValue['token'] - if (!account || tokenVal == account) { - var CookieName = '【账号一】' - var CookieKey = 'senku_readTimeheader_midu' - var tokenKey = 'tokenMidu_read' - var readTimebodyKey = 'senku_readTimebody_midu' - } else if (!account2 || tokenVal == account2) { - var CookieName = '【账号二】' - var CookieKey = 'senku_readTimeheader_midu2' - var tokenKey = 'tokenMidu_read2' - var readTimebodyKey = 'senku_readTimebody_midu2' - } - senku.log(`🍎${CookieName}`) - if (CookieName && senku.getdata(tokenKey)) { - if (senku.getdata(tokenKey) != tokenVal) { - var token = senku.setdata(tokenVal, tokenKey) - var header = senku.setdata(JSON.stringify(CookieValue), CookieKey) - var body = senku.setdata(readTimebodyVal, readTimebodyKey) - senku.setdata(readTimebodyVal, readTimebodyKey) - senku.log(`🔔${readTimebodyVal}`) - senku.log(`🔔${JSON.stringify(CookieValue)}`) - if (!token && !header && !body) { - senku.msg("米读", "阅读文章数据", "获取Cookie失败 ‼️") - senku.msg("米读", "阅读", "更新" + CookieName + "Cookie失败 ‼️") - } else { - senku.msg("米读", "阅读文章数据", "获取Cookie成功 🎉") - senku.msg("米读", "阅读", "更新" + CookieName + "Cookie成功 🎉") - } - } - } else if (CookieName) { - var token = senku.setdata(tokenVal, tokenKey) - var header = senku.setdata(CookieValue['tk'], CookieKey) - var body = senku.setdata(readTimebodyVal, readTimebodyKey) - senku.log(`🍎${tokenVal}`) - senku.log(`🔔${readTimebodyVal}`) - if (!header && !token && !body) { - senku.msg("米读", "阅读文章数据", "获取Cookie失败 ‼️") - senku.msg("米读", "阅读", "首次写入" + CookieName + "Cookie失败 ‼️") - } else { - senku.setdata('no', 'bind') - senku.msg("米读", "阅读文章数据", "获取Cookie成功 🎉") - senku.msg("米读", "阅读", "首次写入" + CookieName + "Cookie成功 🎉") - } - } else { - senku.msg("米读", "更新米读->阅读Cookie失败", '非历史写入账号 ‼️') - } - - } catch (error) { - senku.log(`❌error:${error}`) - } -} - -if ($request && $request.method != 'OPTIONS' && requrl.match(/\/wz\/dice\/index/)) { - try { - var CookieValue = $request.body - var account = senku.getdata('tokenMidu_sign') ? senku.getdata('tokenMidu_sign') : null - var account2 = senku.getdata('tokenMidu_sign2') ? senku.getdata('tokenMidu_sign2') : null - var tkVal = CookieValue.match(/token=[a-zA-Z0-9._-]+/)[0] - var tokenVal = tkVal.substring(6, tkVal.length) - if (!account || tokenVal == account) { - var CookieName = '【账号一】' - var CookieKey = 'senku_signbody_midu' - var tokenKey = 'tokenMidu_sign' - } else if (!account2 || tokenVal == account2) { - var CookieName = '【账号二】' - var CookieKey = 'senku_signbody_midu2' - var tokenKey = 'tokenMidu_sign2' - } else { - senku.msg("米读", "更新米读->签到Cookie失败", '非历史写入账号 ‼️') - } - senku.log(`🍎${senku.getdata(tokenKey)}`) - senku.log(`🍎${tokenVal}`) - if (senku.getdata(tokenKey)) { - if (senku.getdata(tokenKey) != tokenVal) { - var token = senku.setdata(tokenVal, tokenKey) - var body = senku.setdata(CookieValue, CookieKey) - if (!body && !token) { - senku.msg("米读", "签到", "更新" + CookieName + "Cookie失败 ‼️") - } else { - senku.msg("米读", "签到", "更新" + CookieName + "Cookie成功 🎉") - } - } - } else { - var token = senku.setdata(tokenVal, tokenKey) - var body = senku.setdata(CookieValue, CookieKey) - senku.log(`🍎${tokenVal}`) - if (!body && !token) { - senku.msg("米读", "签到", "首次写入" + CookieName + "Cookie失败 ‼️") - } else { - senku.setdata('no', 'bind') - senku.msg("米读", "签到", "首次写入" + CookieName + "Cookie成功 🎉") - } - } - } catch (error) { - senku.log(`❌error:${error}`) - } -} - -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 - } -} - -senku.done() \ No newline at end of file diff --git a/Scripts/SignIn/Midu/miduRead.js b/Scripts/SignIn/Midu/miduRead.js deleted file mode 100644 index d525c31..0000000 --- a/Scripts/SignIn/Midu/miduRead.js +++ /dev/null @@ -1,374 +0,0 @@ -// 赞赏:邀请码`A1040276307` -// 链接`http://html34.qukantoutiao.net/qpr2/bBmQ.html?pid=5eb14518` -// 农妇山泉 -> 有点咸 - -/******************** - * 1、 为了方便任意脚本可以清除Cookie, 任意一个脚本将DeleteCookie = true且选择要清除的账号都可以生效 - * 2、 debug模式可以在Surge&&Qx中开启,方便你判定多用户及脚本运行情况 - * 3、 Qx==>dubug:miduRede构造请求 - * 4、 Surge==>debug:load脚本->evalaute - * 5、脚本默认每半小时通知一次,建议自己先debug看看是否成功 - *********************/ - -// 是否开启清除Cookie -const DeleteCookie = false // 清除所有Cookie,将下方改为true,默认false - -// 选取清除操作 -const DeleteCookieAll = false // 清除所有 -const DeleteCookieOne = false // 清除账户一 -const DeleteCookieTwo = false // 清除账户二 - -const debug = false // 开启debug模式,每次脚本执行会显示通知,默认false - -const bind = true // 绑定作者邀请码,默认true,可更改为false - -const cookieName = '米读阅读时长' - -const senku = init() - -debug ? senku.setdata('true', 'debug') : senku.setdata('false', 'debug') -bind ? '' : senku.setdata('', 'bind'); -if (DeleteCookie) { - const one = senku.getdata('tokenMidu_read') - const two = senku.getdata('tokenMidu_sign') - const three = senku.getdata('tokenMidu_read2') - const four = senku.getdata('tokenMidu_sign2') - if (DeleteCookieAll) { - if (one || two || three || four) { - senku.setdata("", 'senku_signbody_midu') - senku.setdata("", 'senku_signbody_midu2') - senku.setdata("", 'senku_readTimebody_midu') - senku.setdata("", 'senku_readTimebody_midu2') - senku.setdata("", 'senku_readTimeheader_midu') - senku.setdata("", 'senku_readTimeheader_midu2') - senku.setdata("", "tokenMidu_read") - senku.setdata("", "tokenMidu_read2") - senku.setdata("", "tokenMidu_sign") - senku.setdata("", "tokenMidu_sign2") - senku.msg("米读 Cookie清除成功 !", "", '请手动关闭脚本内"DeleteCookie"选项') - } else { - senku.msg("米读 无可清除的Cookie !", "", '请手动关闭脚本内"DeleteCookie"选项') - } - } else if (DeleteCookieOne) { - if (one || two) { - senku.setdata("", 'senku_signbody_midu') - senku.setdata("", 'senku_readTimebody_midu') - senku.setdata("", 'senku_readTimeheader_midu') - senku.setdata("", "tokenMidu_read") - senku.setdata("", "tokenMidu_sign") - senku.msg("米读 Cookie清除成功 !", "清除账户一选项", '请手动关闭脚本内"DeleteCookie"选项') - } else { - senku.msg("米读 无可清除的Cookie !", "清除账户一选项", '请手动关闭脚本内"DeleteCookie"选项') - } - } else if (DeleteCookieTwo) { - if (three || four) { - senku.setdata("", 'senku_signbody_midu2') - senku.setdata("", 'senku_readTimebody_midu2') - senku.setdata("", 'senku_readTimeheader_midu2') - senku.setdata("", "tokenMidu_read2") - senku.setdata("", "tokenMidu_sign2") - senku.msg("米读 Cookie清除成功 !", "清除账户二选项", '请手动关闭脚本内"DeleteCookie"选项') - } else { - senku.msg("米读 无可清除的Cookie !", "清除账户二选项", '请手动关闭脚本内"DeleteCookie"选项') - } - } else { - senku.msg("米读 清除Cookie !", "未选取任何选项", '请手动关闭脚本内"DeleteCookie"选项') - } -} - - -function initial() { - signinfo = { - addnumList: [], - rollList: [], - doubleList: [] - } -} - -; -(sign = () => { - senku.log(`🔔 ${cookieName}`) - senku.getdata('tokenMidu_read') ? '' : senku.msg('米读阅读', '', '不存在Cookie') - DualAccount = true - if (senku.getdata('tokenMidu_read')) { - tokenVal = senku.getdata('tokenMidu_read') - readTimeheaderVal = senku.getdata('senku_readTimeheader_midu') - readTimebodyVal = senku.getdata('senku_readTimebody_midu') - signbodyVal = senku.getdata('senku_signbody_midu') - all() - } - senku.done() -})() - - -async function all() { - try { - senku.log(`🍎${readTimeheaderVal}`) - const headerVal = readTimeheaderVal - const urlVal = readTimebodyVal - const key = signbodyVal - const token = tokenVal - initial() - - await readTime(headerVal, token, urlVal) - await userInfo(key) - await prizeInfo(key) - if (signinfo.prizeInfo && signinfo.prizeInfo.data && signinfo.prizeInfo.data.total_num) { - await prizeTask(key) - await drawPrize(key) - } - await showmsg() - senku.done() - } catch (e) { - senku.msg(cookieName, `失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} - 失败: ${e}`) - senku.done() - } -} - -function double() { - initial() - DualAccount = false - if (senku.getdata('tokenMidu_read2')) { - tokenVal = senku.getdata('tokenMidu_read2') - readTimeheaderVal = senku.getdata('senku_readTimeheader_midu2') - readTimebodyVal = senku.getdata('senku_readTimebody_midu2') - signbodyVal = senku.getdata('senku_signbody_midu2') - all() - } -} - -// 抽奖 -function drawPrize(bodyVal) { - return new Promise((resolve, reject) => { - const drawPrizeurlVal = 'https://apiwz.midukanshu.com/wz/task/drawPrize?' + bodyVal - const url = { - url: drawPrizeurlVal, - headers: {} - } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.post(url, (error, response, data) => { - try { - senku.log(`🐍🐢 ${cookieName} drawPrize - response: ${JSON.stringify(response)}`) - if (data) { - signinfo.drawPrize = JSON.parse(data) - } - resolve() - } catch (e) { - // senku.msg(cookieName, `抽奖: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} drawPrize - 抽奖失败: ${e}`) - senku.log(`❌ ${cookieName} drawPrize - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 观看视频获取抽奖机会 -function prizeTask(bodyVal) { - return new Promise((resolve, reject) => { - const prizeTaskurlVal = 'https://apiwz.midukanshu.com/wz/task/prizeTask?' + bodyVal - const url = { - url: prizeTaskurlVal, - headers: {} - } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.post(url, (error, response, data) => { - try { - senku.log(`🐍🐢 ${cookieName} prizeTask - response: ${JSON.stringify(response)}`) - if (data) { - signinfo.prizeTask = JSON.parse(data) - } - resolve() - } catch (e) { - // senku.msg(cookieName, `观看视频抽奖: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} prizeTask - 观看视频抽奖失败: ${e}`) - senku.log(`❌ ${cookieName} prizeTask - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 抽奖信息 -function prizeInfo(bodyVal) { - return new Promise((resolve, reject) => { - const prizeInfourlVal = 'https://apiwz.midukanshu.com/wz/task/prizeList?' + bodyVal - const url = { - url: prizeInfourlVal, - headers: {} - } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.post(url, (error, response, data) => { - try { - senku.log(`🐍🐢 ${cookieName} prizeInfo - response: ${JSON.stringify(response)}`) - if (data) { - signinfo.prizeInfo = JSON.parse(data) - } - resolve() - } catch (e) { - // senku.msg(cookieName, `抽奖信息: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} prizeInfo - 抽奖信息失败: ${e}`) - senku.log(`❌ ${cookieName} prizeInfo - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 阅读时长 -function readTime(header, token, urlVal) { - return new Promise((resolve, reject) => { - const url = { - url: 'https://apiwz.midukanshu.com/user/readTimeBase/readTime?' + urlVal, - headers: { - 'host': 'apiwz.midukanshu.com', - 'versionName': '1.7.2.0501.1930', - "User-Agent": "MRSpeedNovel/0430.1512 CFNetwork/1125.2 Darwin/19.5.0", - "Content-Type": "application/x-www-form-urlencoded; charset=utf-8", - 'token': token, - 'tk': header - } - } - - senku.post(url, (error, response, data) => { - try { - senku.log(`🐍🐢 ${cookieName} readTime - response: ${JSON.stringify(response)}`) - if (data) { - signinfo.readTime = JSON.parse(data) - } - resolve() - } catch (e) { - // senku.msg(cookieName, `阅读时长: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} readTime - 阅读时长失败: ${e}`) - senku.log(`❌ ${cookieName} readTime - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 用户信息 -function userInfo(bodyVal) { - return new Promise((resolve, reject) => { - const userInfourlVal = 'https://apiwz.midukanshu.com/wz/user/getInfo?' + bodyVal - const url = { - url: userInfourlVal, - headers: {} - } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.post(url, (error, response, data) => { - try { - senku.log(`🐍🐢 ${cookieName} userInfo - response: ${JSON.stringify(response)}`) - if (data) { - signinfo.userInfo = JSON.parse(data) - } - resolve() - } catch (e) { - // senku.msg(cookieName, `用户信息: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} userInfo - 用户信息失败: ${e}`) - senku.log(`❌ ${cookieName} userInfo - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function showmsg() { - return new Promise((resolve, reject) => { - let subTitle = '' - let detail = '' - const name = signinfo.userInfo && signinfo.userInfo.data && signinfo.userInfo.data.nickname ? signinfo.userInfo.data.nickname : `账户已退出` - if (signinfo.readTime && signinfo.readTime.code == 0) { - const coin = signinfo.readTime.data.coin - const readTotalMinute = signinfo.readTime.data.readTotalMinute - const total_coin = signinfo.readTime.data.total_coin - coin == 0 ? detail += `` : detail += `【阅读时长】获得${coin}💰` - readTotalMinute ? detail += ` 阅读时长${readTotalMinute / 2}分钟,该账户:${total_coin}💰` : detail += `该账户:${total_coin}💰` - } else if (signinfo.readTime && signinfo.readTime.code != 0) { - detail += `【阅读时长】错误代码${signinfo.readTime.code},错误信息${signinfo.readTime.message}` - senku.msg(cookieName + ` 用户:${name}`, subTitle, detail) - } - - if (senku.getdata('debug') == 'true' || detail && signinfo.readTime && signinfo.readTime.data && signinfo.readTime.data.readTotalMinute % 60 == 0) { - senku.msg(cookieName + ` 用户:${name}`, subTitle, detail) - } else if (senku.getdata('debug') == 'true' || signinfo.readTime && signinfo.readTime.data && signinfo.readTime.data.readTotalMinute % 60 == 0) { - senku.msg(cookieName + ` 用户:${name}`, '阅读结果', '时间未到') - } - - // 大转盘抽手机 - // if (signinfo.drawPrize) { - // if (signinfo.drawPrize.code == 0) { - // detail += `【转盘奖励】本次${drawPrize.data.title}\n` - // } else { - // detail += `【转盘奖励】无次数抽奖` - // } - // senku.msg(cookieName + ` 用户:${name}`, subTitle, detail) - // } - if (DualAccount) double() - 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 - } -} \ No newline at end of file diff --git a/Scripts/SignIn/Midu/miduRead.py b/Scripts/SignIn/Midu/miduRead.py deleted file mode 100644 index 2f7b38f..0000000 --- a/Scripts/SignIn/Midu/miduRead.py +++ /dev/null @@ -1,174 +0,0 @@ -""" -@author: GideonSenku, modified by pysta -@file: SurgeToJs.py -@createTime: 2020-05-01 - -本脚本用作曲线双阅读,结合APP:py3使用 -1、登陆要阅读的账号一、二、三.....,理论无限 -2、Surge抓包记录找到https://apiwz.midukanshu.com/user/readTimeBase/readTime选择该记录导出,使用pythonista3运行miduRead.py -3、在Surge->脚本->新增, 脚本名:自定义不要重复就好, 脚本类型选择Cron, cron表达式: */1 * * * * 脚本位置->本地 -4、编辑脚本:贴贴py3的结果 -""" - -import zipfile -import json -import appex -import clipboard -import console - - -def get_request_data(path): - - with zipfile.ZipFile(path, 'r') as z: - with z.open('model.json') as f: - data = json.load(f) - if 'request.dump' in z.namelist(): - with z.open('request.dump') as f: - body = str(f.read(), encoding='utf-8') - data['requestBody'] = body - return data - - -path = appex.get_file_path() -data = get_request_data(path) - -body = data.get('requestBody', '') -url = data['URL'] -method = data['method'].lower() -headers = {k: v for k, v in [ - i.split(': ', 1) for i in data['requestHeader'].split('\r\n')[1:] if i]} - -js = """ -// 赞赏:邀请码`A1040276307` -// 链接`http://html34.qukantoutiao.net/qpr2/bBmQ.html?pid=5eb14518` -// 农妇山泉 -> 有点咸 - -const cookieName = '米读阅读时长' -const signinfo = {} -const senku = init() -// 开启debug模式,每次脚本执行会显示通知,默认false -const debug = false - - -debug ? senku.setdata('true', 'debug') : senku.setdata('false', 'debug') -""" -js = js + f''' -const urlVal = {json.dumps(url)} -const bodyVal = {json.dumps(body)} -const headerVal = {json.dumps(headers, indent=4)} -const request = {{ - url: urlVal, - headers: headerVal, - body: bodyVal -}} - -''' -js = js + """ -; -(sign = async () => { - senku.log(`🔔 ${cookieName}`) - await readTime() - showmsg() - senku.done() -})().catch((e) => senku.log(`❌ ${cookieName} 签到失败: ${e}`), senku.done()) - - -// 阅读时长 -function readTime() { - return new Promise((resolve, reject) => { - senku.post(request, (error, response, data) => { - try { - senku.log(`❕ ${cookieName} readTime - response: ${JSON.stringify(response)}`) - signinfo.readTime = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `阅读时长: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} readTime - 签到失败: ${e}`) - senku.log(`❌ ${cookieName} readTime - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function showmsg() { - let subTitle = '' - let detail = '' - if (signinfo.readTime && signinfo.readTime.code == 0) { - const coin = signinfo.readTime.data.coin - const readTotalMinute = signinfo.readTime.data.readTotalMinute - const total_coin = signinfo.readTime.data.total_coin - coin == 0 ? detail += `` : detail += `【阅读时长】获得${coin}💰` - readTotalMinute ? detail += ` 阅读时长${readTotalMinute / 2}分钟,该账户:${total_coin}💰` : detail += `该账户:${total_coin}💰` - } else if (signinfo.readTime.code != 0) { - detail += `【阅读时长】错误代码${signinfo.readTime.code},错误信息${signinfo.readTime.message}` - senku.msg(cookieName, subTitle, detail) - } else { - detail += '【阅读时长】失败' - senku.msg(cookieName, subTitle, detail) - } - - if (senku.getdata('debug') == 'true' || detail && signinfo.readTime.data.readTotalMinute % 60 == 0) { - senku.msg(cookieName, subTitle, detail) - } else if (senku.getdata('debug') == 'true' || signinfo.readTime.data.readTotalMinute % 60 == 0) { - senku.msg(cookieName, '阅读结果', '时间未到') - } -} - -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 - } -} -""" -print(js) -clipboard.set(js) -console.hud_alert('Copyed!') diff --git a/Scripts/SignIn/Midu/miduSign.js b/Scripts/SignIn/Midu/miduSign.js deleted file mode 100644 index a077130..0000000 --- a/Scripts/SignIn/Midu/miduSign.js +++ /dev/null @@ -1,452 +0,0 @@ -// 赞赏:邀请码`A1040276307` -// 链接`http://html34.qukantoutiao.net/qpr2/bBmQ.html?pid=5eb14518` -// 农妇山泉 -> 有点咸 - -/******************** - * 1、 为了方便任意脚本可以清除Cookie, 任意一个脚本将DeleteCookie = true且选择要清除的账号都可以生效 - * 2、 debug模式可以在Surge&&Qx中开启,方便你判定多用户及脚本运行情况 - * 3、 Qx==>dubug:miduRede构造请求 - * 4、 Surge==>debug:load脚本->evalaute - * 5、脚本默认每半小时通知一次,建议自己先debug看看是否成功 - *********************/ - -// 是否开启清除Cookie -const DeleteCookie = false // 清除所有Cookie,将下方改为true,默认false - -// 选取清除操作 -const DeleteCookieAll = false // 清除所有 -const DeleteCookieOne = false // 清除账户一 -const DeleteCookieTwo = false // 清除账户二 - -const bind = true // 绑定作者邀请码,默认true,可更改为false - -const cookieName = '米读' -const senku = init() - -if (DeleteCookie) { - const one = senku.getdata('tokenMidu_read') - const two = senku.getdata('tokenMidu_sign') - const three = senku.getdata('tokenMidu_read2') - const four = senku.getdata('tokenMidu_sign2') - if (DeleteCookieAll) { - if (one || two || three || four) { - senku.setdata("", 'senku_signbody_midu') - senku.setdata("", 'senku_signbody_midu2') - senku.setdata("", 'senku_readTimebody_midu') - senku.setdata("", 'senku_readTimebody_midu2') - senku.setdata("", 'senku_readTimeheader_midu') - senku.setdata("", 'senku_readTimeheader_midu2') - senku.setdata("", "tokenMidu_read") - senku.setdata("", "tokenMidu_read2") - senku.setdata("", "tokenMidu_sign") - senku.setdata("", "tokenMidu_sign2") - senku.msg("米读 Cookie清除成功 !", "", '请手动关闭脚本内"DeleteCookie"选项') - } else { - senku.msg("米读 无可清除的Cookie !", "", '请手动关闭脚本内"DeleteCookie"选项') - } - } else if (DeleteCookieOne) { - if (one || two) { - senku.setdata("", 'senku_signbody_midu') - senku.setdata("", 'senku_readTimebody_midu') - senku.setdata("", 'senku_readTimeheader_midu') - senku.setdata("", "tokenMidu_read") - senku.setdata("", "tokenMidu_sign") - senku.msg("米读 Cookie清除成功 !", "清除账户一选项", '请手动关闭脚本内"DeleteCookie"选项') - } else { - senku.msg("米读 无可清除的Cookie !", "清除账户一选项", '请手动关闭脚本内"DeleteCookie"选项') - } - } else if (DeleteCookieTwo) { - if (three || four) { - senku.setdata("", 'senku_signbody_midu2') - senku.setdata("", 'senku_readTimebody_midu2') - senku.setdata("", 'senku_readTimeheader_midu2') - senku.setdata("", "tokenMidu_read2") - senku.setdata("", "tokenMidu_sign2") - senku.msg("米读 Cookie清除成功 !", "清除账户二选项", '请手动关闭脚本内"DeleteCookie"选项') - } else { - senku.msg("米读 无可清除的Cookie !", "清除账户二选项", '请手动关闭脚本内"DeleteCookie"选项') - } - } else { - senku.msg("米读 清除Cookie !", "未选取任何选项", '请手动关闭脚本内"DeleteCookie"选项') - } -} - -function initial() { - signinfo = { - addnumList: [], - rollList: [], - doubleList: [] - } -} - -bind ? '' : senku.setdata('', 'bind') - - -; -(sign = () => { - senku.log(`🔔 ${cookieName}`) - senku.getdata('tokenMidu_sign') ? '' : senku.msg('米读签到', '', '不存在Cookie') - DualAccount = true - if (senku.getdata('tokenMidu_sign')) { - tokenVal = senku.getdata('tokenMidu_read') - readTimeheaderVal = senku.getdata('senku_readTimeheader_midu') - readTimebodyVal = senku.getdata('senku_readTimebody_midu') - signbodyVal = senku.getdata('senku_signbody_midu') - all() - } -})() - -async function all() { - try { - senku.log(`🍎${signbodyVal}`) - const headerVal = readTimeheaderVal - const urlVal = readTimebodyVal - const key = signbodyVal - const token = tokenVal - initial() - await userInfo(key) - await signDay(key) - await signVideo(key) - await dice_index(key) - if (signinfo.dice_index && signinfo.dice_index.code == 0) { - const remain_add_num = signinfo.dice_index.data.remain_add_chance_num - - for (let index = 0; index < remain_add_num; index++) { - await dice_addnum(key) - } - await dice_index(key) - const chance_num = signinfo.dice_index.data.chance_num - for (let index = 0; index < chance_num; index++) { - await dice_roll(key) - await dice_double(key) - } - } - - if (senku.getdata('bind')) { - await Bind() - } - await showmsg() - senku.done() - } catch (e) { - senku.msg(cookieName, `失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} - 失败: ${e}`) - senku.done() - } -} - -function double() { - initial() - DualAccount = false - if (senku.getdata('tokenMidu_sign2')) { - tokenVal = senku.getdata('tokenMidu_read2') - readTimeheaderVal = senku.getdata('senku_readTimeheader_midu2') - readTimebodyVal = senku.getdata('senku_readTimebody_midu2') - signbodyVal = senku.getdata('senku_signbody_midu2') - all() - } -} - -// 绑定 -function Bind() { - return new Promise((resolve, reject) => { - const BindurlVal = 'http://fisson.1sapp.com/nlx/shareLink/tmpBind' - const url = { - url: BindurlVal, - headers: {}, - body: 'app_id=7&act_type=1&act_name=grad_pupil&invite_code=A1040276307&telephone=' + signinfo.userInfo.data.mobile - } - url.headers['Host'] = 'fisson.1sapp.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.post(url, (error, response, data) => { - senku.setdata('', 'bind') - resolve() - }) - }) -} - -// 用户信息 -function userInfo(bodyVal) { - return new Promise((resolve, reject) => { - const userInfourlVal = 'https://apiwz.midukanshu.com/wz/user/getInfo?' + bodyVal - const url = { - url: userInfourlVal, - headers: {} - } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.post(url, (error, response, data) => { - try { - senku.log(`🐍🐢 ${cookieName} userInfo - response: ${JSON.stringify(response)}`) - signinfo.userInfo = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `获取用户信息: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} userInfo - 获取用户信息失败: ${e}`) - senku.log(`❌ ${cookieName} userInfo - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - - -// 骰子信息 -function dice_index(bodyVal) { - return new Promise((resolve, reject) => { - const dice_index_urlVal = 'https://apiwz.midukanshu.com/wz/dice/index?' + bodyVal - const url = { - url: dice_index_urlVal, - headers: {} - } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.post(url, (error, response, data) => { - try { - senku.log(`🐍🐢 ${cookieName} dice_index - response: ${JSON.stringify(response)}`) - signinfo.dice_index = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `骰子信息: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} dice_index - 骰子信息失败: ${e}`) - senku.log(`❌ ${cookieName} dice_index - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 掷骰子 -function dice_roll(bodyVal) { - return new Promise((resolve, reject) => { - const dice_roll_urlVal = 'https://apiwz.midukanshu.com/wz/dice/roll?' + bodyVal - const url = { - url: dice_roll_urlVal, - headers: {} - } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.post(url, (error, response, data) => { - try { - senku.log(`🐍🐢 ${cookieName} dice_roll - response: ${JSON.stringify(response)}`) - if (JSON.parse(data).code == 0) { - signinfo.rollList.push(JSON.parse(data)) - } - resolve() - } catch (e) { - senku.msg(cookieName, `掷骰子: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} dice_roll - 掷骰子失败: ${e}`) - senku.log(`❌ ${cookieName} dice_roll - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 骰子双倍奖励 -function dice_double(bodyVal) { - return new Promise((resolve, reject) => { - const dice_double_urlVal = 'https://apiwz.midukanshu.com/wz/dice/doubleReward?' + bodyVal - const url = { - url: dice_double_urlVal, - headers: {} - } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.post(url, (error, response, data) => { - try { - senku.log(`🐍🐢 ${cookieName} dice_double - response: ${JSON.stringify(response)}`) - if (JSON.parse(data).code == 0) { - signinfo.doubleList.push(JSON.parse(data)) - } - resolve() - } catch (e) { - senku.msg(cookieName, `骰子双倍奖励: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} dice_double - 骰子双倍奖励失败: ${e}`) - senku.log(`❌ ${cookieName} dice_double - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 获取骰子次数 -function dice_addnum(bodyVal) { - return new Promise((resolve, reject) => { - const dice_addnum_urlVal = 'https://apiwz.midukanshu.com/wz/dice/addChangeNumByRewardVideo?' + bodyVal - const url = { - url: dice_addnum_urlVal, - headers: {} - } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 13_4_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 miduapp qapp' - senku.post(url, (error, response, data) => { - try { - senku.log(`🐍🐢 ${cookieName} dice_addnum - response: ${JSON.stringify(response)}`) - if (JSON.parse(data).code == 0) { - signinfo.addnumList.push(JSON.parse(data)) - } - resolve() - } catch (e) { - senku.msg(cookieName, `获取骰子次数: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} dice_addnum - 获取骰子次数失败: ${e}`) - senku.log(`❌ ${cookieName} dice_addnum - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 每日签到 -function signDay(bodyVal) { - return new Promise((resolve, reject) => { - const signurlVal = 'https://apiwz.midukanshu.com/wz/task/signInV2?' + bodyVal - const url = { - url: signurlVal, - headers: {} - } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.post(url, (error, response, data) => { - try { - senku.log(`🐍🐢 ${cookieName} signDay - response: ${JSON.stringify(response)}`) - signinfo.signDay = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `签到结果: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} signDay - 签到失败: ${e}`) - senku.log(`❌ ${cookieName} signDay - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 签到视频奖励 -function signVideo(bodyVal) { - return new Promise((resolve, reject) => { - const signVideourlVal = 'https://apiwz.midukanshu.com/wz/task/signVideoReward?' + bodyVal - const url = { - url: signVideourlVal, - headers: {} - } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.post(url, (error, response, data) => { - try { - senku.log(`🐍🐢 ${cookieName} signVideo - response: ${JSON.stringify(response)}`) - signinfo.signVideo = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `签到视频: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} signVideo - 签到视频失败: ${e}`) - senku.log(`❌ ${cookieName} signVideo - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - - -function showmsg() { - return new Promise((resolve, reject) => { - let subTitle = '' - let detail = '' - const name = signinfo.userInfo.data.nickname ? signinfo.userInfo.data.nickname : `未设置昵称` - // 签到信息 - if (signinfo.signDay && signinfo.signDay.code == 0) { - if (signinfo.signDay.data) { - const amount = signinfo.signDay.data.amount - amount ? detail += `【签到奖励】获得${amount}💰\n` : detail += `【签到奖励】已获取过奖励\n` - } - } else subTitle += '签到:失败' - - if (signinfo.signVideo && signinfo.signVideo.code == 0) { - const amount = signinfo.signVideo.data.amount - amount ? detail += `【签到视频】获得${amount}💰\n` : detail += `【签到视频】已获取过奖励\n` - } else subTitle += '签到视频:失败' - - // 骰子信息 - // 次数 - if (signinfo.addnumList.length > 0) { - detail += `【骰子次数】增加${signinfo.addnumList.length}次\n` - } else { - detail += `【骰子次数】无次数增加\n` - } - // 掷骰子 - if (signinfo.rollList.length > 0) { - let i = 0 - for (const roll of signinfo.rollList) { - i += 1 - roll.code == 0 ? detail += `【骰子奖励】第${i}次${roll.data.roll_coin}💰\n` : detail += `【骰子奖励】已获取过奖励\n` - } - } else { - detail += `【骰子奖励】无次数掷骰子\n` - } - senku.msg(cookieName + ` 用户:${name}`, subTitle, detail) - if (DualAccount) double() - 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 - } -} \ No newline at end of file diff --git a/Scripts/SignIn/Midu/miduSign.py b/Scripts/SignIn/Midu/miduSign.py deleted file mode 100644 index 0703d93..0000000 --- a/Scripts/SignIn/Midu/miduSign.py +++ /dev/null @@ -1,479 +0,0 @@ -""" -@author: GideonSenku, modified by pysta -@file: SurgeToJs.py -@createTime: 2020-05-01 - -本脚本用作曲线双阅读,结合APP:py3使用 -1、登陆要阅读的账号一、二、三.....,理论无限 -2、Surge抓包记录找到https://apiwz.midukanshu.com/wz/dice/index,选择该记录导出,使用pythonista3运行miduSign.py -3、在Surge->脚本->新增, 脚本名:自定义不要重复就好, 脚本类型选择Cron, cron表达式: */1 * * * * 脚本位置->本地 -54、编辑脚本:贴贴py3的结果 -""" - -import zipfile -import json -import appex -import clipboard -import console - - -def get_request_data(path): - - with zipfile.ZipFile(path, 'r') as z: - with z.open('model.json') as f: - data = json.load(f) - if 'request.dump' in z.namelist(): - with z.open('request.dump') as f: - body = str(f.read(), encoding='utf-8') - data['requestBody'] = body - return data - - -path = appex.get_file_path() -data = get_request_data(path) - -body = data.get('requestBody', '') -url = data['URL'] -method = data['method'].lower() -headers = {k: v for k, v in [ - i.split(': ', 1) for i in data['requestHeader'].split('\r\n')[1:] if i]} - -js = """ -// 赞赏:邀请码`A1040276307` -// 链接`http://html34.qukantoutiao.net/qpr2/bBmQ.html?pid=5eb14518` -// 农妇山泉 -> 有点咸 - -const cookieName = '米读' - -const senku = init() - - -const signinfo = { - addnumList: [], - rollList: [], - doubleList: [] -} -""" -js = js + f''' -const urlVal = {json.dumps(url)} -const bodyVal = {json.dumps(body)} -const headerVal = {json.dumps(headers, indent=4)} -const request = {{ - url: urlVal, - headers: headerVal, - body: bodyVal -}} - -''' -js = js + """ - -; -(sign = async () => { - senku.log(`🔔 ${cookieName}`) - await userInfo() - await signDay() - await signVideo() - await dice_index() - if (signinfo.dice_index && signinfo.dice_index.code == 0) { - const remain_add_num = signinfo.dice_index.data.remain_add_chance_num - - for (let index = 0; index < remain_add_num; index++) { - await dice_addnum() - } - await dice_index() - const chance_num = signinfo.dice_index.data.chance_num - for (let index = 0; index < chance_num; index++) { - await dice_roll() - await dice_double() - } - } - await userInfo() - await prizeInfo() - if (signinfo.prizeInfo.data.total_num) { - await prizeTask() - await drawPrize() - } - await Bind() - showmsg() - senku.done() -})().catch((e) => senku.log(`❌ ${cookieName} 签到失败: ${e}`), senku.done()) - - -// 用户信息 -function userInfo() { - return new Promise((resolve, reject) => { - const userInfourlVal = 'https://apiwz.midukanshu.com/wz/user/getInfo?' + bodyVal - const url = { - url: userInfourlVal, - headers: headerVal - } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.post(url, (error, response, data) => { - try { - senku.log(`🐍🐢 ${cookieName} userInfo - response: ${JSON.stringify(response)}`) - signinfo.userInfo = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `获取用户信息: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} userInfo - 获取用户信息失败: ${e}`) - senku.log(`❌ ${cookieName} userInfo - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} -// 绑定 -function Bind() { - return new Promise((resolve, reject) => { - const BindurlVal = 'http://fisson.1sapp.com/nlx/shareLink/tmpBind' - const url = { - url: BindurlVal, - headers: {}, - body: 'app_id=7&act_type=1&act_name=grad_pupil&invite_code=A1040276307&telephone=' + signinfo.userInfo.data.mobile - } - url.headers['Host'] = 'fisson.1sapp.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.post(url, (error, response, data) => { - senku.setdata('', 'bind') - resolve() - }) - }) -} -// 抽奖 -function drawPrize() { - return new Promise((resolve, reject) => { - const drawPrizeurlVal = 'https://apiwz.midukanshu.com/wz/task/drawPrize?' + bodyVal - const url = { - url: drawPrizeurlVal, - headers: {} - } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.post(url, (error, response, data) => { - try { - senku.log(`🐍🐢 ${cookieName} drawPrize - response: ${JSON.stringify(response)}`) - signinfo.drawPrize = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `抽奖: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} drawPrize - 抽奖失败: ${e}`) - senku.log(`❌ ${cookieName} drawPrize - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 观看视频获取抽奖机会 -function prizeTask() { - return new Promise((resolve, reject) => { - const prizeTaskurlVal = 'https://apiwz.midukanshu.com/wz/task/prizeTask?' + bodyVal - const url = { - url: prizeTaskurlVal, - headers: {} - } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.post(url, (error, response, data) => { - try { - senku.log(`🐍🐢 ${cookieName} prizeTask - response: ${JSON.stringify(response)}`) - signinfo.prizeTask = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `观看视频抽奖: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} prizeTask - 观看视频抽奖失败: ${e}`) - senku.log(`❌ ${cookieName} prizeTask - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 抽奖信息 -function prizeInfo() { - return new Promise((resolve, reject) => { - const prizeInfourlVal = 'https://apiwz.midukanshu.com/wz/task/prizeList?' + bodyVal - const url = { - url: prizeInfourlVal, - headers: {} - } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.post(url, (error, response, data) => { - try { - senku.log(`🐍🐢 ${cookieName} prizeInfo - response: ${JSON.stringify(response)}`) - signinfo.prizeInfo = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `抽奖信息: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} prizeInfo - 抽奖信息失败: ${e}`) - senku.log(`❌ ${cookieName} prizeInfo - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 骰子信息 -function dice_index() { - return new Promise((resolve, reject) => { - const dice_index_urlVal = 'https://apiwz.midukanshu.com/wz/dice/index?' + bodyVal - const url = { - url: dice_index_urlVal, - headers: headerVal - } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.post(url, (error, response, data) => { - try { - senku.log(`🐍🐢 ${cookieName} dice_index - response: ${JSON.stringify(response)}`) - signinfo.dice_index = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `骰子信息: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} dice_index - 骰子信息失败: ${e}`) - senku.log(`❌ ${cookieName} dice_index - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 掷骰子 -function dice_roll() { - return new Promise((resolve, reject) => { - const dice_roll_urlVal = 'https://apiwz.midukanshu.com/wz/dice/roll?' + bodyVal - const url = { - url: dice_roll_urlVal, - headers: headerVal - } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.post(url, (error, response, data) => { - try { - senku.log(`🐍🐢 ${cookieName} dice_roll - response: ${JSON.stringify(response)}`) - if (JSON.parse(data).code == 0) { - signinfo.rollList.push(JSON.parse(data)) - } - resolve() - } catch (e) { - senku.msg(cookieName, `掷骰子: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} dice_roll - 掷骰子失败: ${e}`) - senku.log(`❌ ${cookieName} dice_roll - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 骰子双倍奖励 -function dice_double() { - return new Promise((resolve, reject) => { - const dice_double_urlVal = 'https://apiwz.midukanshu.com/wz/dice/doubleReward?' + bodyVal - const url = { - url: dice_double_urlVal, - headers: headerVal - } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.post(url, (error, response, data) => { - try { - senku.log(`🐍🐢 ${cookieName} dice_double - response: ${JSON.stringify(response)}`) - if (JSON.parse(data).code == 0) { - signinfo.doubleList.push(JSON.parse(data)) - } - resolve() - } catch (e) { - senku.msg(cookieName, `骰子双倍奖励: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} dice_double - 骰子双倍奖励失败: ${e}`) - senku.log(`❌ ${cookieName} dice_double - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 获取骰子次数 -function dice_addnum() { - return new Promise((resolve, reject) => { - const dice_addnum_urlVal = 'https://apiwz.midukanshu.com/wz/dice/addChangeNumByRewardVideo?' + bodyVal - const url = { - url: dice_addnum_urlVal, - headers: headerVal - } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 13_4_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 miduapp qapp' - senku.post(url, (error, response, data) => { - try { - senku.log(`🐍🐢 ${cookieName} dice_addnum - response: ${JSON.stringify(response)}`) - if (JSON.parse(data).code == 0) { - signinfo.addnumList.push(JSON.parse(data)) - } - resolve() - } catch (e) { - senku.msg(cookieName, `获取骰子次数: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} dice_addnum - 获取骰子次数失败: ${e}`) - senku.log(`❌ ${cookieName} dice_addnum - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 每日签到 -function signDay() { - return new Promise((resolve, reject) => { - const signurlVal = 'https://apiwz.midukanshu.com/wz/task/signInV2?' + bodyVal - const url = { - url: signurlVal, - headers: headerVal - } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.post(url, (error, response, data) => { - try { - senku.log(`🐍🐢 ${cookieName} signDay - response: ${JSON.stringify(response)}`) - signinfo.signDay = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `签到结果: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} signDay - 签到失败: ${e}`) - senku.log(`❌ ${cookieName} signDay - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 签到视频奖励 -function signVideo() { - return new Promise((resolve, reject) => { - const signVideourlVal = 'https://apiwz.midukanshu.com/wz/task/signVideoReward?' + bodyVal - const url = { - url: signVideourlVal, - headers: headerVal - } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.post(url, (error, response, data) => { - try { - senku.log(`🐍🐢 ${cookieName} signVideo - response: ${JSON.stringify(response)}`) - signinfo.signVideo = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `签到视频: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} signVideo - 签到视频失败: ${e}`) - senku.log(`❌ ${cookieName} signVideo - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - - -function showmsg() { - let subTitle = '' - let detail = '' - const name = signinfo.userInfo.data.nickname ? signinfo.userInfo.data.nickname : `未设置昵称` - // 签到信息 - if (signinfo.signDay && signinfo.signDay.code == 0) { - if (signinfo.signDay.data) { - const amount = signinfo.signDay.data.amount - amount ? detail += `【签到奖励】获得${amount}💰\n` : detail += `【签到奖励】已获取过奖励\n` - } - } else subTitle += '签到:失败' - - if (signinfo.signVideo && signinfo.signVideo.code == 0) { - const amount = signinfo.signVideo.data.amount - amount ? detail += `【签到视频】获得${amount}💰\n` : detail += `【签到视频】已获取过奖励\n` - } else subTitle += '签到视频:失败' - - // 骰子信息 - // 次数 - if (signinfo.addnumList.length > 0) { - detail += `【骰子次数】增加${signinfo.addnumList.length}次\n` - } else { - detail += `【骰子次数】无次数增加\n` - } - // 掷骰子 - if (signinfo.rollList.length > 0) { - let i = 0 - for (const roll of signinfo.rollList) { - i += 1 - roll.code == 0 ? detail += `【骰子奖励】第${i}次${roll.data.roll_coin}💰\n` : detail += `【骰子奖励】已获取过奖励\n` - } - } else { - detail += `【骰子奖励】无次数掷骰子\n` - } - senku.msg(cookieName + ` 用户:${name}`, subTitle, detail) -} - -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 - } -} -""" -print(js) -clipboard.set(js) -console.hud_alert('Copyed!') diff --git a/Scripts/SignIn/Mihoyo/README.md b/Scripts/SignIn/Mihoyo/README.md deleted file mode 100644 index 8b9a96a..0000000 --- a/Scripts/SignIn/Mihoyo/README.md +++ /dev/null @@ -1,91 +0,0 @@ -# 米游社 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -## 配置 (Surge) - -```properties -[MITM] -api-takumi.mihoyo.com - -[Script] -http-request ^https:\/\/api-takumi.mihoyo.com\/apihub\/api\/getGameList script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/mihoyo/mihoyo.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/mihoyo/mihoyo.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -api-takumi.mihoyo.com - -[rewrite_local] -^https:\/\/api-takumi.mihoyo.com\/apihub\/api\/getGameList url script-request-header mihoyo.cookie.js - -[task_local] -1 0 * * * mihoyo.js -``` - -## 说明 - -1. 先把`api-takumi.mihoyo.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`mihoyo.cookie.js`和`mihoyo.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP , 系统提示: `获取Cookie: 成功` -4. 最后就可以把第 1 条脚本注释掉了 -5. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/Mihoyo/mihoyo.cookie.js b/Scripts/SignIn/Mihoyo/mihoyo.cookie.js deleted file mode 100644 index f1e829f..0000000 --- a/Scripts/SignIn/Mihoyo/mihoyo.cookie.js +++ /dev/null @@ -1,58 +0,0 @@ -const cookieName = '米游社' -const signurlKey = 'chavy_signurl_mihoyo' -const signheaderKey = 'chavy_signheader_mihoyo' -const chavy = init() - -if ($request && $request.method != 'OPTIONS') { - const signurlVal = $request.url - const signheaderVal = JSON.stringify($request.headers) - if (signurlVal) chavy.setdata(signurlVal, signurlKey) - if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey) - chavy.msg(cookieName, `获取Cookie: 成功`, ``) -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/Mihoyo/mihoyo.js b/Scripts/SignIn/Mihoyo/mihoyo.js deleted file mode 100644 index 6b17ec7..0000000 --- a/Scripts/SignIn/Mihoyo/mihoyo.js +++ /dev/null @@ -1,104 +0,0 @@ -const cookieName = '米游社' -const signurlKey = 'chavy_signurl_mihoyo' -const signheaderKey = 'chavy_signheader_mihoyo' -const chavy = init() -const signurlVal = chavy.getdata(signurlKey) -const signheaderVal = chavy.getdata(signheaderKey) -const signinfo = [] -let bbslist = [] - -sign() - -function sign() { - const url = {url: `https://api-takumi.mihoyo.com/apihub/api/getGameList`, headers: JSON.parse(signheaderVal)} - chavy.get(url, (error, response, data) => { - const result = JSON.parse(data) - bbslist = result.data.list - for (bbs of bbslist) signbbs(bbs) - check() - }) -} - -function signbbs(bbs) { - const url = { - url: `https://api-takumi.mihoyo.com/apihub/sapi/signIn?gids=${bbs.id}`, - headers: JSON.parse(signheaderVal) - } - chavy.post(url, (error, response, data) => signinfo.push(data)) -} - -function check(checkms = 0) { - if (bbslist.length == signinfo.length) { - showmsg() - } else { - if (checkms > 5000) { - chavy.msg(`${cookieName}`, `签到失败: 超时退出`, ``) - chavy.done() - } else { - setTimeout(() => check(checkms + 100), 100) - } - } -} - -function showmsg() { - const totalcnt = bbslist.length - let signed = 0 - let skiped = 0 - let succnt = 0 - let failcnt = 0 - for (info of signinfo) { - const i = JSON.parse(info) - if (i.retcode == 0) (signed += 1), (succnt += 1) - else if (i.retcode == 1008) (signed += 1), (skiped += 1) - else failcnt += 1 - } - let subtitle = totalcnt == signed ? '签到结果: 全部成功' : '签到结果: 部分成功' - subtitle = 0 == signed ? '签到结果: 全部失败' : subtitle - const detail = `共签: ${signed}/${totalcnt}, 本次成功: ${succnt}, 失败: ${failcnt}, 重签: ${skiped}` - chavy.msg(cookieName, subtitle, detail) - chavy.done() -} - -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} -} diff --git a/Scripts/SignIn/NeteaseMusic/README.md b/Scripts/SignIn/NeteaseMusic/README.md deleted file mode 100644 index 197b5ba..0000000 --- a/Scripts/SignIn/NeteaseMusic/README.md +++ /dev/null @@ -1,90 +0,0 @@ -# 网易云音乐 - -> 2020.6.15 -> -> 1. 增加自动重试机制 (BoxJs 可调整次数及间隔) -> 2. 增加等级显示 (需按新方式获取会话) - -## 配置 (Surge & Loon) - -```properties -[MITM] -music.163.com - -[Script] -http-request ^https:\/\/music.163.com\/weapi\/user\/level script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/neteasemusic/neteasemusic.cookie.js,requires-body=true -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/neteasemusic/neteasemusic.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -music.163.com - -[rewrite_local] -^https:\/\/music.163.com\/weapi\/user\/level url script-request-body neteasemusic.cookie.js - -[task_local] -1 0 * * * neteasemusic.js -``` - -## 说明 - -1. 先登录: -2. 再访问: -3. 提示: `获取会话: 成功!` - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/NeteaseMusic/neteasemusic.cookie.js b/Scripts/SignIn/NeteaseMusic/neteasemusic.cookie.js deleted file mode 100644 index 976a1e0..0000000 --- a/Scripts/SignIn/NeteaseMusic/neteasemusic.cookie.js +++ /dev/null @@ -1,61 +0,0 @@ -const $ = new Env('网易云音乐') - -!(async () => { - $.log('', `🔔 ${$.name}, 获取会话: 开始!`, '') - const session = {} - session.url = $request.url - session.body = $request.body - session.headers = $request.headers - delete session.headers['Content-Length'] - $.log('', `url: ${session.url}`, `body: ${session.body}`, `headers: ${JSON.stringify(session.headers)}`) - if ($.setdata(JSON.stringify(session), 'chavy_cookie_neteasemusic')) { - $.subt = '获取会话: 成功!' - } else { - $.subt = '获取会话: 失败!' - } -})() - .catch((e) => { - $.subt = '获取会话: 失败!' - $.desc = `原因: ${e}` - $.log(`❌ ${$.name}, 获取会话: 失败! 原因: ${e}!`) - }) - .finally(() => { - $.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 获取会话: 结束!`, ''), $.done() - }) - -// prettier-ignore -function Env(s) { - this.name = s, this.data = null, this.logs = [], this.isSurge = (() => "undefined" != typeof $httpClient), this.isQuanX = (() => "undefined" != typeof $task), this.isNode = (() => "undefined" != typeof module && !!module.exports), this.log = ((...s) => { - this.logs = [...this.logs, ...s], s ? console.log(s.join("\n")) : console.log(this.logs.join("\n")) - }), this.msg = ((s = this.name, t = "", i = "") => { - this.isSurge() && $notification.post(s, t, i), this.isQuanX() && $notify(s, t, i); - const e = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; - s && e.push(s), t && e.push(t), i && e.push(i), console.log(e.join("\n")) - }), this.getdata = (s => { - if (this.isSurge()) return $persistentStore.read(s); - if (this.isQuanX()) return $prefs.valueForKey(s); - if (this.isNode()) { - const t = "box.dat"; - return this.fs = this.fs ? this.fs : require("fs"), this.fs.existsSync(t) ? (this.data = JSON.parse(this.fs.readFileSync(t)), this.data[s]) : null - } - }), this.setdata = ((s, t) => { - if (this.isSurge()) return $persistentStore.write(s, t); - if (this.isQuanX()) return $prefs.setValueForKey(s, t); - if (this.isNode()) { - const i = "box.dat"; - return this.fs = this.fs ? this.fs : require("fs"), !!this.fs.existsSync(i) && (this.data = JSON.parse(this.fs.readFileSync(i)), this.data[t] = s, this.fs.writeFileSync(i, JSON.stringify(this.data)), !0) - } - }), this.wait = ((s, t = s) => i => setTimeout(() => i(), Math.floor(Math.random() * (t - s + 1) + s))), this.get = ((s, t) => this.send(s, "GET", t)), this.post = ((s, t) => this.send(s, "POST", t)), this.send = ((s, t, i) => { - if (this.isSurge()) { - const e = "POST" == t ? $httpClient.post : $httpClient.get; - e(s, (s, t, e) => { - t && (t.body = e, t.statusCode = t.status), i(s, t, e) - }) - } - this.isQuanX() && (s.method = t, $task.fetch(s).then(s => { - s.status = s.statusCode, i(null, s, s.body) - }, s => i(s.error, s, s))), this.isNode() && (this.request = this.request ? this.request : require("request"), s.method = t, s.gzip = !0, this.request(s, (s, t, e) => { - t && (t.status = t.statusCode), i(null, t, e) - })) - }), this.done = ((s = {}) => this.isNode() ? null : $done(s)) -} diff --git a/Scripts/SignIn/NeteaseMusic/neteasemusic.js b/Scripts/SignIn/NeteaseMusic/neteasemusic.js deleted file mode 100644 index e789857..0000000 --- a/Scripts/SignIn/NeteaseMusic/neteasemusic.js +++ /dev/null @@ -1,136 +0,0 @@ -const $ = new Env('网易云音乐') -$.VAL_session = $.getdata('chavy_cookie_neteasemusic') -$.CFG_retryCnt = ($.getdata('CFG_neteasemusic_retryCnt') || '10') * 1 -$.CFG_retryInterval = ($.getdata('CFG_neteasemusic_retryInterval') || '500') * 1 - -!(async () => { - $.log('', `🔔 ${$.name}, 开始!`, '') - init() - await signweb() - await signapp() - await getInfo() - await showmsg() -})() - .catch((e) => { - $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '') - }) - .finally(() => { - $.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 结束!`, ''), $.done() - }) - -function init() { - $.isNewCookie = /https:\/\/music.163.com\/weapi\/user\/level/.test($.VAL_session) - $.Cookie = $.isNewCookie ? JSON.parse($.VAL_session).headers.Cookie : $.VAL_session -} - -async function signweb() { - for (let signIdx = 0; signIdx < $.CFG_retryCnt; signIdx++) { - await new Promise((resove) => { - const url = {url: `http://music.163.com/api/point/dailyTask?type=1`, headers: {}} - url.headers['Cookie'] = $.Cookie - url.headers['Host'] = 'music.163.com' - 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' - $.get(url, (error, response, data) => { - try { - $.isWebSuc = JSON.parse(data).code === -2 - $.log(`[Web] 第 ${signIdx + 1} 次: ${data}`) - } catch (e) { - $.isWebSuc = false - $.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, '') - } finally { - resove() - } - }) - }) - await new Promise($.wait($.CFG_retryInterval)) - if ($.isWebSuc) break - } -} - -async function signapp() { - for (let signIdx = 0; signIdx < $.CFG_retryCnt; signIdx++) { - await new Promise((resove) => { - const url = {url: `http://music.163.com/api/point/dailyTask?type=0`, headers: {}} - url.headers['Cookie'] = $.Cookie - url.headers['Host'] = 'music.163.com' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Mobile/15E148 Safari/604.1' - $.get(url, (error, response, data) => { - try { - $.isAppSuc = JSON.parse(data).code === -2 - $.log(`[App] 第 ${signIdx + 1} 次: ${data}`) - } catch (e) { - $.isAppSuc = false - $.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, '') - } finally { - resove() - } - }) - }) - await new Promise($.wait($.CFG_retryInterval)) - if ($.isAppSuc) break - } -} - -function getInfo() { - if (!$.isNewCookie) return - return new Promise((resove) => { - $.post(JSON.parse($.VAL_session), (error, response, data) => { - try { - $.userInfo = JSON.parse(data) - } catch (e) { - $.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, '') - } finally { - resove() - } - }) - }) -} - -function showmsg() { - return new Promise((resove) => { - $.subt = $.isWebSuc ? 'PC: 成功' : 'PC: 失败' - $.subt += $.isAppSuc ? ', APP: 成功' : ', APP: 失败' - if ($.isNewCookie && $.userInfo) { - $.desc = `等级: ${$.userInfo.data.level}, 听歌: ${$.userInfo.data.nowPlayCount} => ${$.userInfo.data.nextPlayCount} 升级 (首)` - $.desc = $.userInfo.data.level === 10 ? `等级: ${$.userInfo.data.level}, 你的等级已爆表!` : $.desc - } - resove() - }) -} - -// prettier-ignore -function Env(s) { - this.name = s, this.data = null, this.logs = [], this.isSurge = (() => "undefined" != typeof $httpClient), this.isQuanX = (() => "undefined" != typeof $task), this.isNode = (() => "undefined" != typeof module && !!module.exports), this.log = ((...s) => { - this.logs = [...this.logs, ...s], s ? console.log(s.join("\n")) : console.log(this.logs.join("\n")) - }), this.msg = ((s = this.name, t = "", i = "") => { - this.isSurge() && $notification.post(s, t, i), this.isQuanX() && $notify(s, t, i); - const e = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; - s && e.push(s), t && e.push(t), i && e.push(i), console.log(e.join("\n")) - }), this.getdata = (s => { - if (this.isSurge()) return $persistentStore.read(s); - if (this.isQuanX()) return $prefs.valueForKey(s); - if (this.isNode()) { - const t = "box.dat"; - return this.fs = this.fs ? this.fs : require("fs"), this.fs.existsSync(t) ? (this.data = JSON.parse(this.fs.readFileSync(t)), this.data[s]) : null - } - }), this.setdata = ((s, t) => { - if (this.isSurge()) return $persistentStore.write(s, t); - if (this.isQuanX()) return $prefs.setValueForKey(s, t); - if (this.isNode()) { - const i = "box.dat"; - return this.fs = this.fs ? this.fs : require("fs"), !!this.fs.existsSync(i) && (this.data = JSON.parse(this.fs.readFileSync(i)), this.data[t] = s, this.fs.writeFileSync(i, JSON.stringify(this.data)), !0) - } - }), this.wait = ((s, t = s) => i => setTimeout(() => i(), Math.floor(Math.random() * (t - s + 1) + s))), this.get = ((s, t) => this.send(s, "GET", t)), this.post = ((s, t) => this.send(s, "POST", t)), this.send = ((s, t, i) => { - if (this.isSurge()) { - const e = "POST" == t ? $httpClient.post : $httpClient.get; - e(s, (s, t, e) => { - t && (t.body = e, t.statusCode = t.status), i(s, t, e) - }) - } - this.isQuanX() && (s.method = t, $task.fetch(s).then(s => { - s.status = s.statusCode, i(null, s, s.body) - }, s => i(s.error, s, s))), this.isNode() && (this.request = this.request ? this.request : require("request"), s.method = t, s.gzip = !0, this.request(s, (s, t, e) => { - t && (t.status = t.statusCode), i(null, t, e) - })) - }), this.done = ((s = {}) => this.isNode() ? null : $done(s)) -} diff --git a/Scripts/SignIn/NeteaseMusic/quanx/neteasemusic.cookie.js b/Scripts/SignIn/NeteaseMusic/quanx/neteasemusic.cookie.js deleted file mode 100644 index d499002..0000000 --- a/Scripts/SignIn/NeteaseMusic/quanx/neteasemusic.cookie.js +++ /dev/null @@ -1,45 +0,0 @@ -const $ = new Env('网易云音乐') - -!(async () => { - $.log('', `🔔 ${$.name}, 获取会话: 开始!`, '') - const session = {} - session.url = $request.url - session.body = $request.body - session.headers = $request.headers - delete session.headers['Content-Length'] - $.log('', `url: ${session.url}`, `body: ${session.body}`, `headers: ${JSON.stringify(session.headers)}`) - if ($.setdata(JSON.stringify(session), 'chavy_cookie_neteasemusic')) { - $.subt = '获取会话: 成功!' - } else { - $.subt = '获取会话: 失败!' - } -})() - .catch((e) => { - $.subt = '获取会话: 失败!' - $.desc = `原因: ${e}` - $.log(`❌ ${$.name}, 获取会话: 失败! 原因: ${e}!`) - }) - .finally(() => { - $.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 获取会话: 结束!`, ''), $.done() - }) - -// 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); - const e = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; - t && e.push(t), s && e.push(s), i && e.push(i), console.log(e.join("\n")) - }), 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 && (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)) -} diff --git a/Scripts/SignIn/NeteaseMusic/quanx/neteasemusic.js b/Scripts/SignIn/NeteaseMusic/quanx/neteasemusic.js deleted file mode 100644 index f9e18b1..0000000 --- a/Scripts/SignIn/NeteaseMusic/quanx/neteasemusic.js +++ /dev/null @@ -1,120 +0,0 @@ -const $ = new Env('网易云音乐') -$.VAL_session = $.getdata('chavy_cookie_neteasemusic') -$.CFG_retryCnt = ($.getdata('CFG_neteasemusic_retryCnt') || '10') * 1 -$.CFG_retryInterval = ($.getdata('CFG_neteasemusic_retryInterval') || '500') * 1 - -!(async () => { - $.log('', `🔔 ${$.name}, 开始!`, '') - init() - await signweb() - await signapp() - await getInfo() - await showmsg() -})() - .catch((e) => { - $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '') - }) - .finally(() => { - $.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 结束!`, ''), $.done() - }) - -function init() { - $.isNewCookie = /https:\/\/music.163.com\/weapi\/user\/level/.test($.VAL_session) - $.Cookie = $.isNewCookie ? JSON.parse($.VAL_session).headers.Cookie : $.VAL_session -} - -async function signweb() { - for (let signIdx = 0; signIdx < $.CFG_retryCnt; signIdx++) { - await new Promise((resove) => { - const url = {url: `http://music.163.com/api/point/dailyTask?type=1`, headers: {}} - url.headers['Cookie'] = $.Cookie - url.headers['Host'] = 'music.163.com' - 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' - $.get(url, (error, response, data) => { - try { - $.isWebSuc = JSON.parse(data).code === -2 - $.log(`[Web] 第 ${signIdx + 1} 次: ${data}`) - } catch (e) { - $.isWebSuc = false - $.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, '') - } finally { - resove() - } - }) - }) - await new Promise($.wait($.CFG_retryInterval)) - if ($.isWebSuc) break - } -} - -async function signapp() { - for (let signIdx = 0; signIdx < $.CFG_retryCnt; signIdx++) { - await new Promise((resove) => { - const url = {url: `http://music.163.com/api/point/dailyTask?type=0`, headers: {}} - url.headers['Cookie'] = $.Cookie - url.headers['Host'] = 'music.163.com' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Mobile/15E148 Safari/604.1' - $.get(url, (error, response, data) => { - try { - $.isAppSuc = JSON.parse(data).code === -2 - $.log(`[App] 第 ${signIdx + 1} 次: ${data}`) - } catch (e) { - $.isAppSuc = false - $.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, '') - } finally { - resove() - } - }) - }) - await new Promise($.wait($.CFG_retryInterval)) - if ($.isAppSuc) break - } -} - -function getInfo() { - if (!$.isNewCookie) return - return new Promise((resove) => { - $.post(JSON.parse($.VAL_session), (error, response, data) => { - try { - $.userInfo = JSON.parse(data) - } catch (e) { - $.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, '') - } finally { - resove() - } - }) - }) -} - -function showmsg() { - return new Promise((resove) => { - $.subt = $.isWebSuc ? 'PC: 成功' : 'PC: 失败' - $.subt += $.isAppSuc ? ', APP: 成功' : ', APP: 失败' - if ($.isNewCookie && $.userInfo) { - $.desc = `等级: ${$.userInfo.data.level}, 听歌: ${$.userInfo.data.nowPlayCount} => ${$.userInfo.data.nextPlayCount} 升级 (首)` - $.desc = $.userInfo.data.level === 10 ? `等级: ${$.userInfo.data.level}, 你的等级已爆表!` : $.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); - const e = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; - t && e.push(t), s && e.push(s), i && e.push(i), console.log(e.join("\n")) - }), 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 && (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)) -} diff --git a/Scripts/SignIn/NeteaseNews/README.md b/Scripts/SignIn/NeteaseNews/README.md deleted file mode 100644 index c97bb18..0000000 --- a/Scripts/SignIn/NeteaseNews/README.md +++ /dev/null @@ -1,96 +0,0 @@ -# 网易新闻 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> 2020.2.4 QuanX v1.0.6-build195 及以后版本可以直接使用 `neteasenews.cookie.js` 自动获取 Cookie - -> 2020.2.4 如果是 195 以前的版本, 或者想尝试手动抓包获取参数, 请点[这里](https://github.com/chavyleung/scripts/tree/master/neteasenews/README.old.md) - -## 配置 (Surge) - -```properties -[MITM] -*.m.163.com - -[Script] -http-request ^https:\/\/(.*?)c\.m\.163\.com\/uc\/api\/sign\/v3\/commit script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/neteasenews/neteasenews.cookie.js,requires-body=true -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/neteasenews/neteasenews.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -*.m.163.com - -[rewrite_local] -^https:\/\/(.*?)c\.m\.163\.com\/uc\/api\/sign\/v3\/commit url script-request-body neteasenews.cookie.js - -[task_local] -1 0 * * * neteasenews.js -``` - -## 说明 - -1. 先把`*.m.163.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`neteasenews.cookie.js`和`neteasenews.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP 然后手动签到 1 次: -4. 系统提示: `获取Cookie: 成功`, `获取Body: 成功` -5. 最后就可以把第 1 条脚本注释掉了 -6. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/NeteaseNews/neteasenews.cookie.js b/Scripts/SignIn/NeteaseNews/neteasenews.cookie.js deleted file mode 100644 index 4ad34b5..0000000 --- a/Scripts/SignIn/NeteaseNews/neteasenews.cookie.js +++ /dev/null @@ -1,103 +0,0 @@ -const cookieName = '网易新闻' -const cookieKey = 'chavy_cookie_neteasenews' -const bodyKey = 'chavy_body_neteasenews' -const chavy = init() -let cookieVal = null -let bodyVal = `` - -if ($request.body) { - cookieVal = JSON.stringify($request.headers) - bodyVal = bodyVal ? bodyVal : $request.body -} else { - // ([^:]*):\s(.*)\n? - // cookieObj['$1'] = $request.headers['$1']\n - const cookieObj = {} - cookieObj['Content-Length'] = `699` - cookieObj['isDirectRequest'] = `1` - cookieObj['X-NR-Trace-Id'] = $request.headers['X-NR-Trace-Id'] - cookieObj['User-DA'] = $request.headers['User-DA'] - cookieObj['Accept-Encoding'] = `gzip, deflate, br` - cookieObj['Connection'] = `keep-alive` - cookieObj['Content-Type'] = `application/x-www-form-urlencoded` - cookieObj['User-D'] = $request.headers['User-D'] - cookieObj['User-U'] = $request.headers['User-U'] - cookieObj['User-id'] = $request.headers['User-id'] - cookieObj['User-C'] = $request.headers['User-C'] - cookieObj['User-tk'] = $request.headers['User-tk'] - cookieObj['User-N'] = $request.headers['User-N'] - cookieObj['User-Agent'] = `NewsApp/64.1 iOS/13.3 (iPhone10,1)` - cookieObj['Host'] = `c.m.163.com` - cookieObj['User-LC'] = $request.headers['User-LC'] - cookieObj['Accept-Language'] = `zh-cn` - cookieObj['Accept'] = `*/*` - cookieObj['User-L'] = $request.headers['User-L'] - cookieVal = JSON.stringify(cookieObj) -} - -if (cookieVal) { - chavy.setdata(cookieVal, cookieKey) - chavy.msg(`${cookieName}`, '获取Cookie: 成功', '') - chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`) -} else { - chavy.msg(`${cookieName}`, '获取Cookie: 失败', '说明: 未知') - chavy.log(`[${cookieName}] 获取Cookie: 失败, cookie: ${cookieVal}`) -} -if (bodyVal) { - chavy.setdata(bodyVal, bodyKey) - chavy.msg(`${cookieName}`, '获取Body: 成功', '') - chavy.log(`[${cookieName}] 获取Body: 成功, body: ${bodyVal}`) -} else { - if (isQuanX()) { - chavy.msg(`${cookieName}`, '获取Body: 失败', '说明: QuanX用户请手动抓包 body 参数!') - chavy.log(`[${cookieName}] 获取Body: 失败, 说明: QuanX用户请手动抓包 body 参数!`) - } else { - chavy.msg(`${cookieName}`, '获取Body: 失败', '说明: 未知') - chavy.log(`[${cookieName}] 获取Body: 失败, body: ${bodyVal}`) - } -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/NeteaseNews/neteasenews.js b/Scripts/SignIn/NeteaseNews/neteasenews.js deleted file mode 100644 index 1ba3021..0000000 --- a/Scripts/SignIn/NeteaseNews/neteasenews.js +++ /dev/null @@ -1,85 +0,0 @@ -const cookieName = '网易新闻' -const cookieKey = 'chavy_cookie_neteasenews' -const bodyKey = 'chavy_body_neteasenews' -const chavy = init() -const cookieVal = JSON.parse(chavy.getdata(cookieKey)) -const bodyVal = chavy.getdata(bodyKey) - -sign() - -function sign() { - if (bodyVal) { - let url = {url: `https://c.m.163.com/uc/api/sign/v2/commit`, headers: cookieVal} - url.body = bodyVal - chavy.post(url, (error, response, data) => { - chavy.log(`${cookieName}, data: ${data}`) - let result = JSON.parse(data) - const title = `${cookieName}` - let subTitle = `` - let detail = `` - if (result.code == 200) { - subTitle = '签到结果: 成功' - detail = `连签: +${result.data.serialDays}, 金币: ${result.data.awardGoldCoin}, 说明: ${result.msg}` - } else if (result.code == 700) { - subTitle = '签到结果: 成功 (重复签到)' - detail = `说明: ${result.msg}` - } else { - subTitle = '签到结果: 失败' - detail = `编码: ${result.code}, 说明: ${result.msg}` - } - chavy.msg(title, subTitle, detail) - }) - } else { - const title = `${cookieName}` - let subTitle = `签到结果: 失败` - let detail = `说明: body参数为空` - if (isQuanX()) detail += `, QuanX用户请手动抓包 body 参数!` - chavy.msg(title, subTitle, detail) - } - - chavy.done() -} - -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} -} diff --git a/Scripts/SignIn/NeteaseNews/抓包步骤/第10步.png b/Scripts/SignIn/NeteaseNews/抓包步骤/第10步.png deleted file mode 100644 index 1ed3ace..0000000 Binary files a/Scripts/SignIn/NeteaseNews/抓包步骤/第10步.png and /dev/null differ diff --git a/Scripts/SignIn/NeteaseNews/抓包步骤/第1步.png b/Scripts/SignIn/NeteaseNews/抓包步骤/第1步.png deleted file mode 100644 index 12072ca..0000000 Binary files a/Scripts/SignIn/NeteaseNews/抓包步骤/第1步.png and /dev/null differ diff --git a/Scripts/SignIn/NeteaseNews/抓包步骤/第2步.png b/Scripts/SignIn/NeteaseNews/抓包步骤/第2步.png deleted file mode 100644 index fa049c2..0000000 Binary files a/Scripts/SignIn/NeteaseNews/抓包步骤/第2步.png and /dev/null differ diff --git a/Scripts/SignIn/NeteaseNews/抓包步骤/第3步.png b/Scripts/SignIn/NeteaseNews/抓包步骤/第3步.png deleted file mode 100644 index 8dcb33a..0000000 Binary files a/Scripts/SignIn/NeteaseNews/抓包步骤/第3步.png and /dev/null differ diff --git a/Scripts/SignIn/NeteaseNews/抓包步骤/第4-5步.png b/Scripts/SignIn/NeteaseNews/抓包步骤/第4-5步.png deleted file mode 100644 index 7639860..0000000 Binary files a/Scripts/SignIn/NeteaseNews/抓包步骤/第4-5步.png and /dev/null differ diff --git a/Scripts/SignIn/NeteaseNews/抓包步骤/第6步.png b/Scripts/SignIn/NeteaseNews/抓包步骤/第6步.png deleted file mode 100644 index fd6c947..0000000 Binary files a/Scripts/SignIn/NeteaseNews/抓包步骤/第6步.png and /dev/null differ diff --git a/Scripts/SignIn/NeteaseNews/抓包步骤/第7步.png b/Scripts/SignIn/NeteaseNews/抓包步骤/第7步.png deleted file mode 100644 index 5ac76d1..0000000 Binary files a/Scripts/SignIn/NeteaseNews/抓包步骤/第7步.png and /dev/null differ diff --git a/Scripts/SignIn/NeteaseNews/抓包步骤/第8步.png b/Scripts/SignIn/NeteaseNews/抓包步骤/第8步.png deleted file mode 100644 index 8879d88..0000000 Binary files a/Scripts/SignIn/NeteaseNews/抓包步骤/第8步.png and /dev/null differ diff --git a/Scripts/SignIn/NeteaseNews/抓包步骤/第9步.png b/Scripts/SignIn/NeteaseNews/抓包步骤/第9步.png deleted file mode 100644 index cde2e37..0000000 Binary files a/Scripts/SignIn/NeteaseNews/抓包步骤/第9步.png and /dev/null differ diff --git a/Scripts/SignIn/Nio/README.md b/Scripts/SignIn/Nio/README.md deleted file mode 100644 index 48efcfe..0000000 --- a/Scripts/SignIn/Nio/README.md +++ /dev/null @@ -1,103 +0,0 @@ -# 蔚来 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 -> 感谢[@danchaw](https://github.com/danchaw) PR -## 配置 (Surge) - -```properties -[MITM] -app.nio.com - -[Script] -http-request ^https:\/\/app\.nio\.com\/api\/1\/app\/daily_checkin script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/nio/nio.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/nio/nio.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -app.nio.com - -[rewrite_local] - -# [商店版] -^https:\/\/app\.nio\.com\/api\/1\/app\/daily_checkin url script-request-header nio.cookie.js - -# [TestFlight] -^https:\/\/app\.nio\.com\/api\/1\/app\/daily_checkin url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/nio/nio.cookie.js - -[task_local] - -# [商店版] -1 0 * * * nio.js - -# [TestFlight] -1 0 * * * https://raw.githubusercontent.com/chavyleung/scripts/master/nio/nio.js -``` - -## 说明 - -1. 先把`app.nio.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`nio.cookie.js`和`nio.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP[蔚来](https://apps.apple.com/cn/app/%E8%94%9A%E6%9D%A5/id1116095987) 然后手动签到 1 次, 系统提示: `获取Cookie: 成功` -4. 最后就可以把第 1 条脚本注释掉了 -5. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) - -[@danchaw](https://github.com/danchaw) diff --git a/Scripts/SignIn/Nio/nio.cookie.js b/Scripts/SignIn/Nio/nio.cookie.js deleted file mode 100644 index e26fdaa..0000000 --- a/Scripts/SignIn/Nio/nio.cookie.js +++ /dev/null @@ -1,68 +0,0 @@ -const cookieName = '蔚来' -const signurlKey = 'signurl_nextevcar' -const signheaderKey = 'signheader_nextevcar' -const nextevcar = init() - -if ($request && $request.method == 'POST') { - const signurlVal = $request.url - const signheaderVal = JSON.stringify($request.headers) - - if (signurlVal) nextevcar.setdata(signurlVal, signurlKey) - if (signheaderVal) nextevcar.setdata(signheaderVal, signheaderKey) - nextevcar.msg(cookieName, `获取Cookie: 成功`, ``) -} - -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)) - } - } - put = (url, cb) => { - if (isSurge()) { - $httpClient.put(url, cb) - } - if (isQuanX()) { - url.method = 'PUT' - $task.fetch(url).then((resp) => cb(null, {}, resp.body)) - } - } - done = (value = {}) => { - $done(value) - } - return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done} -} - -nextevcar.done() \ No newline at end of file diff --git a/Scripts/SignIn/Nio/nio.js b/Scripts/SignIn/Nio/nio.js deleted file mode 100644 index f36851f..0000000 --- a/Scripts/SignIn/Nio/nio.js +++ /dev/null @@ -1,83 +0,0 @@ -const cookieName = '蔚来' -const signurlKey = 'signurl_nextevcar' -const signheaderKey = 'signheader_nextevcar' -const nextevcar = init() -const signurlVal = nextevcar.getdata(signurlKey) -const signheaderVal = nextevcar.getdata(signheaderKey) - -sign() - -function sign() { - const url = {url: signurlVal, headers: JSON.parse(signheaderVal)} - nextevcar.post(url, (error, response, data) => { - nextevcar.log(`${cookieName}, data: ${data}`) - const title = `${cookieName}` - let subTitle = '' - let detail = '' - const result = JSON.parse(data) - if (result.result_code == "success") { - subTitle = `签到结果: 成功` - detail = `签到积分: ${result.data.stats.credit_amount}, 连签: ${result.data.stats.continuous_checkin_days}天` - } else if (result.result_code == "credit_limit_reached") { - subTitle = `签到结果: 成功 (重复签到)` - } else { - subTitle = `签到结果: 失败` - detail = `说明: ${result.debug_msg}, 请重新获取` - } - nextevcar.msg(title, subTitle, detail) - nextevcar.done() - }) -} - -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)) - } - } - put = (url, cb) => { - if (isSurge()) { - $httpClient.put(url, cb) - } - if (isQuanX()) { - url.method = 'PUT' - $task.fetch(url).then((resp) => cb(null, {}, resp.body)) - } - } - done = (value = {}) => { - $done(value) - } - return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done} -} diff --git a/Scripts/SignIn/NoteYoudao/noteyoudao.cookie.js b/Scripts/SignIn/NoteYoudao/noteyoudao.cookie.js deleted file mode 100644 index 633991b..0000000 --- a/Scripts/SignIn/NoteYoudao/noteyoudao.cookie.js +++ /dev/null @@ -1,44 +0,0 @@ -const $ = new Env('有道云笔记') - -!(async () => { - $.log('', `🔔 ${$.name}, 获取会话: 开始!`, '') - const VAL_url = $request.url - const VAL_body = $request.body - const VAL_headers = JSON.stringify($request.headers) - - $.log('', `❌ ${$.name}`, `url: ${$request.url}`, `body: ${$request.body}`, `headers: ${JSON.stringify($request.headers)}`, '') - - if (VAL_url && VAL_body && VAL_headers) { - $.setdata(VAL_url, 'chavy_signurl_noteyoudao') - $.setdata(VAL_body, 'chavy_signbody_noteyoudao') - $.setdata(VAL_headers, 'chavy_signheaders_noteyoudao') - $.subt = '获取会话: 成功 (签到)!' - } -})() - .catch((e) => { - $.subt = '获取会话: 失败!' - $.desc = `原因: ${e}` - $.log(`❌ ${$.name}, 获取会话: 失败! 原因: ${e}!`) - }) - .finally(() => { - $.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 获取会话: 结束!`, ''), $.done() - }) - -// 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 && (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)) -} diff --git a/Scripts/SignIn/NoteYoudao/noteyoudao.js b/Scripts/SignIn/NoteYoudao/noteyoudao.js deleted file mode 100644 index f5259ad..0000000 --- a/Scripts/SignIn/NoteYoudao/noteyoudao.js +++ /dev/null @@ -1,205 +0,0 @@ -const $ = new Env('有道云笔记') -$.VAL_login = $.getdata('chavy_login_noteyoudao') -$.VAL_sign_url = $.getdata('chavy_signurl_noteyoudao') -$.VAL_sign_body = $.getdata('chavy_signbody_noteyoudao') -$.VAL_sign_headers = $.getdata('chavy_signheaders_noteyoudao') - -!(async () => { - await loginapp() - await signinapp() - await logindaily() - await showmsg() -})() - .catch((e) => $.logErr(e)) - .finally(() => $.done()) - -function loginapp() { - return new Promise((resove) => { - const {url, body, headers} = JSON.parse($.VAL_login) - $.post({url, body, headers: JSON.parse(headers)}, (error, response, data) => { - try { - if (error) throw new Error(error) - $.log(`❕ ${$.name}, 登录: ${JSON.stringify(response)}`) - } catch (e) { - $.log(`❗️ ${$.name}, 每日登录: 失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '') - } finally { - resove() - } - }) - }) -} - -function logindaily() { - return new Promise((resove) => { - const url = { - url: 'https://note.youdao.com/yws/api/daupromotion?method=sync', - headers: JSON.parse($.VAL_sign_headers) - } - delete url.headers.Cookie - $.post(url, (error, response, data) => { - try { - if (error) throw new Error(error) - $.log(`❕ ${$.name}, 每日登录: ${data}`) - $.daily = JSON.parse(data) - } catch (e) { - $.log(`❗️ ${$.name}, 每日登录: 失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '') - } finally { - resove() - } - }) - }) -} - -function signinapp() { - return new Promise((resove) => { - const url = {url: $.VAL_sign_url, body: $.VAL_sign_body, headers: JSON.parse($.VAL_sign_headers)} - delete url.headers.Cookie - $.post(url, (error, response, data) => { - try { - if (error) throw new Error(error) - $.log(`❕ ${$.name}, 每日签到: ${data}`) - $.signin = JSON.parse(data) - } catch (e) { - $.log(`❗️ ${$.name}, 每日登录: 失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '') - } finally { - resove() - } - }) - }) -} - -function showmsg() { - return new Promise((resove) => { - const dailyFlag = $.daily.accept === true ? '成功' : '重复' - const signinFlag = $.signin.success === 1 ? '成功' : $.signin.success === 0 ? '重复' : '错误' - $.subt = `每日登录: ${dailyFlag}, 每日签到: ${signinFlag}` - const continuousDays = `连签: ${$.daily.rewardSpace / 1024 / 1024}天` - const rewardSpace = `本次获得: ${$.daily.rewardSpace / 1024 / 1024}MB` - const totalReward = `总共获得: ${$.daily.totalRewardSpace / 1024 / 1024}MB` - $.desc = `${continuousDays}, ${rewardSpace}, ${totalReward}` - resove() - }) -} - -// 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) -} diff --git a/Scripts/SignIn/QMKg/README.md b/Scripts/SignIn/QMKg/README.md deleted file mode 100644 index 61966b5..0000000 --- a/Scripts/SignIn/QMKg/README.md +++ /dev/null @@ -1,104 +0,0 @@ -# 全民K歌 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> QuanX 需要: v1.0.6-build195 及以后版本 (TestFlight) - -> 感谢 [@GideonSenku](https://github.com/GideonSenku) Commit - -## 配置 (Surge) - -```properties -[MITM] -node.kg.qq.com - -[Script] -http-request ^https://node\.kg\.qq\.com/webapp/proxy? script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/qmkg/qmkg.cookie.js, requires-body=true - -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/qmkg/qmkg.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -node.kg.qq.com - -[rewrite_local] - -# [商店版] QuanX v1.0.6-build194 及更早版本 -# 不支持 - -# [TestFlight] QuanX v1.0.6-build195 及以后版本 -^https://node\.kg\.qq\.com/webapp/proxy? url script-request-body https://raw.githubusercontent.com/chavyleung/scripts/master/qmkg/qmkg.cookie.js - -[task_local] -1 0 * * * qmkg.js -``` - -## 说明 - -1. 先把`node.kg.qq.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`qmkg.cookie.js`和`qmkg.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP 手动签到一次: 访问下右下角 `我的` > `任务中心` > `签到` -4. 系统提示: `获取Cookie: 成功` -5. 把获取 Cookie 的脚本注释掉 -6. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) - -[@GideonSenku](https://github.com/GideonSenku) diff --git a/Scripts/SignIn/QMKg/qmkg.cookie.js b/Scripts/SignIn/QMKg/qmkg.cookie.js deleted file mode 100644 index fc73ba1..0000000 --- a/Scripts/SignIn/QMKg/qmkg.cookie.js +++ /dev/null @@ -1,68 +0,0 @@ -const cookieName = '全民K歌' -const signurlKey = 'senku_signurl_qmkg' -const signheaderKey = 'senku_signheader_qmkg' -const signbodyKey = 'senku_signbody_qmkg' -const senku = init() - -const requrl = $request.url -if ($request && $request.method != 'OPTIONS') { - const signurlVal = requrl - const signheaderVal = JSON.stringify($request.headers) - const signbodyVal = $request.body - const cmd = JSON.parse($request.body).cmd - senku.log(`signurlVal:${signurlVal}`) - senku.log(`signheaderVal:${signheaderVal}`) - senku.log(`signbodyVal:${signbodyVal}`) - if (signurlVal) senku.setdata(signurlVal, signurlKey) - if (signheaderVal) senku.setdata(signheaderVal, signheaderKey) - if (signbodyVal && cmd == 'task.revisionSignInGetAward') { - senku.setdata(signbodyVal, signbodyKey) - senku.msg(cookieName, `获取Cookie: 成功`, ``) - } -} - -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} -} - -senku.done() diff --git a/Scripts/SignIn/QMKg/qmkg.js b/Scripts/SignIn/QMKg/qmkg.js deleted file mode 100644 index e986b6c..0000000 --- a/Scripts/SignIn/QMKg/qmkg.js +++ /dev/null @@ -1,76 +0,0 @@ -const cookieName = '全民K歌' -const signurlKey = 'senku_signurl_qmkg' -const signheaderKey = 'senku_signheader_qmkg' -const signbodyKey = 'senku_signbody_qmkg' -const senku = init() -const signurlVal = senku.getdata(signurlKey) -const signheaderVal = senku.getdata(signheaderKey) -const signBodyVal = senku.getdata(signbodyKey) - -sign() - -function sign() { - const url = {url: signurlVal, headers: JSON.parse(signheaderVal), body: signBodyVal} - senku.post(url, (error, response, data) => { - const result = JSON.parse(data) - const total = result.data['task.revisionSignInGetAward'].total - const ret = result.data['task.revisionSignInGetAward'].ret - let subTitle = `` - let detail = `` - if (total != 0) { - const num = result.data['task.revisionSignInGetAward'].awards[0].num - subTitle = `签到结果: 成功` - detail = `获得鲜花: ${num}朵,已连续签到:${total}天` - } else if (ret == -11532) { - subTitle = `签到结果: 成功 (重复签到)` - } else { - subTitle = `签到结果: 失败` - } - senku.msg(cookieName, subTitle, detail) - senku.done() - }) -} - -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} -} diff --git a/Scripts/SignIn/QQMusic/README.md b/Scripts/SignIn/QQMusic/README.md deleted file mode 100644 index 1ec74f1..0000000 --- a/Scripts/SignIn/QQMusic/README.md +++ /dev/null @@ -1,104 +0,0 @@ -# QQ 音乐 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> QuanX 需要 v1.0.6-build195 及以后版本 - -> QuanX 需要 v1.0.6-build195 及以后版本 - -> QuanX 需要 v1.0.6-build195 及以后版本 - -> 2020.2.13 腾讯系的 Cookie 果然活不久, 弃坑! - -## 配置 (Surge) - -```properties -[MITM] -*.y.qq.com - -[Script] -# 注意获取Cookie有两条脚本 -http-request ^https:\/\/u.y.qq.com\/cgi\-bin\/musicu.fcg requires-body=true,script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/qqmusic/qqmusic.cookie.js -http-response ^https:\/\/u.y.qq.com\/cgi\-bin\/musicu.fcg requires-body=true,script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/qqmusic/qqmusic.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/qqmusic/qqmusic.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -*.y.qq.com - -[rewrite_local] -# 195及以后版本 (注意获取Cookie有两条脚本) -^https:\/\/u.y.qq.com\/cgi\-bin\/musicu.fcg url script-request-body qqmusic.cookie.js -^https:\/\/u.y.qq.com\/cgi\-bin\/musicu.fcg url script-response-body qqmusic.cookie.js - -[task_local] -1 0 * * * qqmusic.js -``` - -## 说明 - -1. 先把`*.y.qq.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`qqmusic.cookie.js`和`qqmusic.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP 然后手动签到 1 次 -4. 系统提示: `获取Cookie: 成功` -5. 最后就可以把第 1 条脚本注释掉了 -6. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/QQMusic/qqmusic.cookie.js b/Scripts/SignIn/QQMusic/qqmusic.cookie.js deleted file mode 100644 index b2b35ba..0000000 --- a/Scripts/SignIn/QQMusic/qqmusic.cookie.js +++ /dev/null @@ -1,95 +0,0 @@ -const cookieName = 'QQ音乐' -const signurlKey = 'chavy_signurl_qqmusic' -const signheaderKey = 'chavy_header_qqmusic' -const signbodyKey = 'chavy_body_qqmusic' -const signFlagKey = 'chavy_flag_qqmusic' -const chavy = init() - -if ($request && $request.body) { - // 每日签到: UserGrow.UserGrowScore receive_score - // 每月签到: music.activeCenter.MonthLoginSvr MonthScore - // 签到记录: UserGrow.UserGrowScore sign_record - const is_receive_score = $request.body.indexOf(`receive_score`) >= 0 - const is_MonthScore = $request.body.indexOf(`MonthScore`) >= 0 - const is_sign_record = $request.body.indexOf(`sign_record`) >= 0 - if ($request.headers['Cookie'] && is_receive_score) { - let signFlagVal = is_receive_score ? `receive_score` : `` - signFlagVal = is_MonthScore ? `MonthScore` : signFlagVal - signFlagVal = is_sign_record ? `sign_record` : signFlagVal - const signurlVal = $request.url - const signheaderVal = JSON.stringify($request.headers) - const signbodyVal = $request.body - if (signurlVal) chavy.setdata(signurlVal, signurlKey) - if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey) - if (signbodyVal) chavy.setdata(signbodyVal, signbodyKey) - if (signFlagVal) chavy.setdata(signFlagVal, signFlagKey) - chavy.msg(`${cookieName}`, '获取Cookie: 成功', '') - // chavy.log(`[${cookieName}] 获取Cookie: 成功, SignUrl: ${signurlVal}`) - // chavy.log(`[${cookieName}] 获取Cookie: 成功, SignHeader: ${signheaderVal}`) - // chavy.log(`[${cookieName}] 获取Cookie: 成功, SignBody: ${signbodyVal}`) - } -} else if ($response && $response.body && $request.url == chavy.getdata(signurlKey) && `receive_score` == chavy.getdata(signFlagKey)) { - const respbodyObj = JSON.parse($response.body) - if (respbodyObj && respbodyObj.req_0 && respbodyObj.req_0.data && respbodyObj.req_0.data.totalDays) { - chavy.msg(`${cookieName}`, '手动签到: 成功 (每日签到)', `共签: ${respbodyObj.req_0.data.totalDays}天, 今天积分: +${respbodyObj.req_0.data.todayScore}, 明天积分: +${respbodyObj.req_0.data.tomrrowScore}`) - chavy.log(`[${cookieName}] 手动签到: 成功 (每日签到), 共签: ${respbodyObj.req_0.data.totalDays}天, 今天积分: +${respbodyObj.req_0.data.todayScore}, 明天积分: +${respbodyObj.req_0.data.tomrrowScore}`) - } -} else if ($response && $response.body && $request.url == chavy.getdata(signurlKey) && `MonthScore` == chavy.getdata(signFlagKey)) { - const respbodyObj = JSON.parse($response.body) - if (respbodyObj && respbodyObj.req_0 && respbodyObj.req_0.data && respbodyObj.req_0.data.totalDays) { - chavy.msg(`${cookieName}`, '手动签到: 成功 (每月首签)', `共签: ${respbodyObj.req_0.data.totalDays}天, 积分: +${respbodyObj.req_0.data.todayScore}`) - chavy.log(`[${cookieName}] 手动签到: 成功 (每月首签), 说明: 共签: ${respbodyObj.req_0.data.totalDays}天, 积分: +${respbodyObj.req_0.data.todayScore}`) - } -} else if ($response && $response.body && $request.url == chavy.getdata(signurlKey) && `sign_record` == chavy.getdata(signFlagKey)) { - const respbodyObj = JSON.parse($response.body) - if (respbodyObj && respbodyObj.req_0 && respbodyObj.req_0.data && respbodyObj.req_0.data.totalDays) { - chavy.msg(`${cookieName}`, '获取签到: 成功', `共签: ${respbodyObj.req_0.data.totalDays}天, 积分: +${respbodyObj.req_0.data.todayScore}`) - chavy.log(`[${cookieName}] 获取签到: 成功, 说明: 共签: ${respbodyObj.req_0.data.totalDays}天, 积分: +${respbodyObj.req_0.data.todayScore}`) - } -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/QQMusic/qqmusic.js b/Scripts/SignIn/QQMusic/qqmusic.js deleted file mode 100644 index e0c1f67..0000000 --- a/Scripts/SignIn/QQMusic/qqmusic.js +++ /dev/null @@ -1,91 +0,0 @@ -const cookieName = 'QQ音乐' -const signurlKey = 'chavy_signurl_qqmusic' -const signheaderKey = 'chavy_header_qqmusic' -const signbodyKey = 'chavy_body_qqmusic' -const chavy = init() -const signurlVal = chavy.getdata(signurlKey) -const signheaderVal = chavy.getdata(signheaderKey) -const signbodyVal = chavy.getdata(signbodyKey) - -sign() - -function sign() { - if (signurlVal && signheaderVal && signbodyVal) { - const url = {url: signurlVal, headers: JSON.parse(signheaderVal), body: signbodyVal} - chavy.post(url, (error, response, data) => { - chavy.log(`${cookieName}, data: ${data}`) - const title = `${cookieName}` - let subTitle = '' - let detail = '' - let result = JSON.parse(data) - if (result.code == 0 && result.req_0 && result.req_0.code == 0) { - if (result.req_0.data.retCode == 0) { - subTitle = `签到结果: 成功` - detail = `共签: ${result.req_0.data.totalDays}天, 今天积分: +${result.req_0.data.todayScore}, 明天积分: +${result.req_0.data.tomrrowScore}` - } else if (result.req_0.data.retCode == 40001) { - subTitle = `签到结果: 成功 (重复签到)` - detail = `说明: ${result.req_0.data.errMsg}` - } else { - subTitle = `签到结果: 失败` - detail = `编码: ${result.req_0.data.retCode}, 说明: ${result.req_0.data.errMsg}` - } - } else { - subTitle = `签到结果: 失败` - detail = `说明: 详见日志` - } - chavy.msg(title, subTitle, detail) - chavy.done() - }) - } else { - const title = `${cookieName}` - const subTitle = '签到结果: 失败' - const detail = `原因: 请先获取Cookie` - chavy.msg(title, subTitle, detail) - chavy.log(`${cookieName}, ${subTitle}, ${detail}`) - chavy.done() - } -} - -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} -} diff --git a/Scripts/SignIn/QQVideo/README.md b/Scripts/SignIn/QQVideo/README.md deleted file mode 100644 index 9e707c9..0000000 --- a/Scripts/SignIn/QQVideo/README.md +++ /dev/null @@ -1,113 +0,0 @@ -# 腾讯视频 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> 2020.2.7 从网页端获取的 Cookie 很稳定! - -> 2020.2.17 增加移动端网页版签到 (请仔细阅读移动端网页版的操作说明) (MITM 新增一条、获取 Cookie 脚本新增一条、两脚本需要更新) - -> 2020.3.2 \[Beta\] 增加移动端抽奖脚本 (部分用户移动端签到时会提示: 无匹配的签到活动, 那就是移动端签不上了) - -> 2020.3.6 移动端每个用户仅可签两周,签到活动结果后,移动端签到不再弹通知 - -> 2020.3.16 移动端签到活动已结束 - -## 配置 (Surge) - -```properties -[MITM] -*.video.qq.com - -[Script] -http-request ^https:\/\/access.video.qq.com\/user\/auth_refresh script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/videoqq/videoqq.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/videoqq/videoqq.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -*.video.qq.com - -[rewrite_local] -^https:\/\/access.video.qq.com\/user\/auth_refresh url script-request-header videoqq.cookie.js - -[task_local] -1 0 * * * videoqq.js -``` - -## 说明 (PC 端) - -1. 先把`*.video.qq.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`videoqq.cookie.js`和`videoqq.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 获取 Cookie: - - 手机浏览器访问: https://film.qq.com/ - - 随便选 1 部电影观看 -4. 系统提示: `获取Cookie: 成功` (如果不提示获取成功, 点自己头像退出登录, 重新登录下应该就能获取) -5. 最后就可以把第 1 条脚本注释掉了 - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 说明 (移动端网页版) - -1. 先把`v.qq.com`加到`[MITM]` -2. 手机浏览器访问下: https://film.qq.com/ 随便选 1 部电影观看 -3. 手机浏览器访问下: http://v.qq.com/x/bu/mobile_checkin 页面提示提示`签到成功`, 系统提示: `获取Cookie: 成功` (为保成功率,请刷新一下页面再获取一次) -4. 运行下签到脚本看是否提示 -5. 最后就可以把第 1 条脚本注释掉了 - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) - -[@Liquor030](https://github.com/Liquor030) diff --git a/Scripts/SignIn/QQVideo/videoqq.cookie.js b/Scripts/SignIn/QQVideo/videoqq.cookie.js deleted file mode 100644 index de3381f..0000000 --- a/Scripts/SignIn/QQVideo/videoqq.cookie.js +++ /dev/null @@ -1,82 +0,0 @@ -const cookieName = '腾讯视频' -const cookieKey = 'chavy_cookie_videoqq' -const authUrlKey = 'chavy_auth_url_videoqq' -const authHeaderKey = 'chavy_auth_header_videoqq' -const msignurlKey = 'chavy_msign_url_videoqq' -const msignheaderKey = 'chavy_msign_header_videoqq' -const chavy = init() - -const cookieVal = $request.headers['Cookie'] -if (cookieVal) { - if ($request.url.indexOf('auth_refresh') > 0) { - const authurl = $request.url - const authHeader = JSON.stringify($request.headers) - if (cookieVal) chavy.setdata(cookieVal, cookieKey) - if (authurl) chavy.setdata(authurl, authUrlKey) - if (authHeader) chavy.setdata(authHeader, authHeaderKey) - chavy.msg(`${cookieName}`, '获取Cookie: 成功', '') - chavy.log(`[${cookieName}] 获取Cookie: 成功, Cookie: ${cookieVal}`) - chavy.log(`[${cookieName}] 获取Cookie: 成功, AuthUrl: ${authurl}`) - chavy.log(`[${cookieName}] 获取Cookie: 成功, AuthHeader: ${authHeader}`) - } else if ($request.url.indexOf('mobile_checkin') > 0) { - const msignurl = $request.url - const msignheader = JSON.stringify($request.headers) - if (msignurl) chavy.setdata(msignurl, msignurlKey) - if (msignheader) chavy.setdata(msignheader, msignheaderKey) - chavy.msg(`${cookieName}`, '获取Cookie: 成功', '') - chavy.log(`[${cookieName}] 获取Cookie: 成功, msignurl: ${msignurl}`) - chavy.log(`[${cookieName}] 获取Cookie: 成功, msignheader: ${msignheader}`) - } else { - chavy.setdata(cookieVal, cookieKey) - chavy.setdata(``, authUrlKey) - chavy.setdata(``, authHeaderKey) - chavy.msg(`${cookieName}`, '获取Cookie: 成功', '') - chavy.log(`[${cookieName}] 获取Cookie: 成功, Cookie: ${cookieVal}`) - } -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/QQVideo/videoqq.js b/Scripts/SignIn/QQVideo/videoqq.js deleted file mode 100644 index 57f1e60..0000000 --- a/Scripts/SignIn/QQVideo/videoqq.js +++ /dev/null @@ -1,146 +0,0 @@ -const chavy = init() -const cookieName = '腾讯视频' -const KEY_signcookie = 'chavy_cookie_videoqq' -const KEY_loginurl = 'chavy_auth_url_videoqq' -const KEY_loginheader = 'chavy_auth_header_videoqq' -const KEY_mh5signurl = 'chavy_msign_url_videoqq' -const KEY_mh5signheader = 'chavy_msign_header_videoqq' - -const signinfo = {} -let VAL_signcookie = chavy.getdata(KEY_signcookie) -let VAL_loginurl = chavy.getdata(KEY_loginurl) -let VAL_loginheader = chavy.getdata(KEY_loginheader) -let VAL_mh5signurl = chavy.getdata(KEY_mh5signurl) -let VAL_mh5signheader = chavy.getdata(KEY_mh5signheader) - -;(sign = async () => { - chavy.log(`🔔 ${cookieName}`) - await login() - await signapp() - await getexp() - showmsg() - chavy.done() -})().catch((e) => chavy.log(`❌ ${cookieName} 签到失败: ${e}`), chavy.done()) - -function login() { - return new Promise((resolve, reject) => { - const url = {url: VAL_loginurl, headers: JSON.parse(VAL_loginheader)} - chavy.get(url, (error, response, data) => { - try { - resolve() - } catch (e) { - chavy.msg(cookieName, `签到结果: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} login - 登录失败: ${e}`) - chavy.log(`❌ ${cookieName} login - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function signapp() { - return new Promise((resolve, reject) => { - const timestamp = Math.round(new Date().getTime() / 1000).toString() - const VAL_signurl = `https://vip.video.qq.com/fcgi-bin/comm_cgi?name=hierarchical_task_system&cmd=2&_=${timestamp}` - let url = {url: VAL_signurl, headers: {}} - 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' - chavy.get(url, (error, response, data) => { - try { - signinfo.signapp = JSON.parse(data.match(/\((.*)\);/)[1]) - resolve() - } catch (e) { - chavy.msg(cookieName, `签到结果: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} signapp - 签到失败: ${e}`) - chavy.log(`❌ ${cookieName} signapp - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function getexp() { - return new Promise((resolve, reject) => { - const timestamp = Math.round(new Date().getTime() / 1000).toString() - const VAL_getexpurl = `https://vip.video.qq.com/fcgi-bin/comm_cgi?name=spp_PropertyNum&cmd=1&growth_value=1&otype=json&_=${timestamp}` - let url = {url: VAL_getexpurl, headers: {}} - 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' - chavy.get(url, (error, response, data) => { - try { - signinfo.expinfo = JSON.parse(data.match(/\((.*)\);/)[1]) - resolve() - } catch (e) { - chavy.msg(cookieName, `签到结果: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} getexp - 签到失败: ${e}`) - chavy.log(`❌ ${cookieName} getexp - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function showmsg() { - if (signinfo.signapp) { - let subTitle, detail - if (signinfo.signapp.ret == 0) { - subTitle = '签到结果: 成功' - if (signinfo.expinfo) { - subTitle += !signinfo.signapp.checkin_score ? ' (重复签到)' : '' - detail = `V力值: ${signinfo.expinfo.GrowthValue.num} (+${signinfo.signapp.checkin_score}), 观影券: ${signinfo.expinfo.MovieTicket.num}, 赠片资格: ${signinfo.expinfo.GiveMovie.num}` - } - } else if (signinfo.signapp.ret == -10006) { - subTitle = '签到结果: 失败' - detail = `原因: 未登录, 说明: ${signinfo.signapp.msg}` - } else if (signinfo.signapp.ret == -10019) { - subTitle = '签到结果: 失败' - detail = `原因: 非会员, 说明: ${signinfo.signapp.msg}` - } else { - subTitle = '签到结果: 未知' - detail = `编码: ${signinfo.signapp.ret}, 说明: ${signinfo.signapp.msg}` - } - chavy.msg(cookieName, subTitle, detail) - } -} - -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} -} diff --git a/Scripts/SignIn/Qimao/README.md b/Scripts/SignIn/Qimao/README.md deleted file mode 100644 index f423df2..0000000 --- a/Scripts/SignIn/Qimao/README.md +++ /dev/null @@ -1,104 +0,0 @@ -# 七猫小说 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 -> 感谢[@danchaw](https://github.com/danchaw) PR -## 配置 (Surge) - -```properties -[MITM] -xiaoshuo.qm989.com - -[Script] -http-request ^https:\/\/xiaoshuo\.qm989\.com script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/qimao/qmnovel.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/qimao/qmnovel.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -xiaoshuo.qm989.com - -[rewrite_local] - -# [商店版] -^https:\/\/xiaoshuo\.qm989\.com url script-request-header qmnovel.js - -# [TestFlight] -^https:\/\/xiaoshuo\.qm989\.com url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/qimao/qmnovel.js - -[task_local] - -# [商店版] -1 0 * * * qmnovel.js - -# [TestFlight] -1 0 * * * https://raw.githubusercontent.com/chavyleung/scripts/master/qimao/qmnovel.js -``` - -## 说明 - -1. 先把`xiaoshuo.qm989.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`qmnovel.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 暂时关闭QX或Surge中的广告屏蔽, 否则无法获取小视频奖励cookie和url -4. 打开 APP[七猫小说](https://apps.apple.com/cn/app/%E4%B8%83%E7%8C%AB%E5%B0%8F%E8%AF%B4-%E7%9C%8B%E5%B0%8F%E8%AF%B4%E7%94%B5%E5%AD%90%E4%B9%A6%E7%9A%84%E9%98%85%E8%AF%BB%E7%A5%9E%E5%99%A8/id1387717110) 然后到APP内福利界面手动日常签到(观看小视频领取奖励),新手领福利签到,视频签到以及幸运大转盘 1 次, 系统提示: `首次写入xxxUrl成功🎉,首次写入xxxCookie成功🎉` -5. 最后就可以把第 1 条脚本注释掉了 -6. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) - -[@danchaw](https://github.com/danchaw) diff --git a/Scripts/SignIn/Qimao/qmnovel.js b/Scripts/SignIn/Qimao/qmnovel.js deleted file mode 100644 index 8ccf761..0000000 --- a/Scripts/SignIn/Qimao/qmnovel.js +++ /dev/null @@ -1,420 +0,0 @@ -var cookieName = '七猫小说' -var qmnovel = init() -var DCURL = qmnovel.getdata("UrlDC") -var DCKEY = qmnovel.getdata("CookieDC") -var NCURL = qmnovel.getdata("UrlNC") -var NCKEY = qmnovel.getdata("CookieNC") -var LTURL = qmnovel.getdata("UrlLT") -var LTKEY = qmnovel.getdata("CookieLT") -var VCURL = qmnovel.getdata("UrlVC") - -const Totalresult = {} -const time = 0 - -let isGetCookie = typeof $request !== 'undefined' - -if (isGetCookie) { - GetCookie() - qmnovel.done() -} else { - all() - qmnovel.done() -} - -async function all() { - qmnovel.log(`🔔 ${cookieName}签到开始`) - await DailyCheckin(time); - await NoviceCheckin(time); - for (let i = 0; i < 5; i++) { - await LuckyTurn(time); - } - await VideoCoin(time) - Notify(); -} - -function GetCookie() { - const dailycheckin = '/api/v1/sign-in/do-sign-in'; - const novice = '/api/v1/task/get-novice-reward'; - const turn = '/api/v2/lucky-draw/do-extracting'; - const video = '/api/v1/sign-in/sign-in-video-coin'; - var url = $request.url; - if (url.indexOf(dailycheckin) != -1) { - if (url) { - var UrlKeyDC = "UrlDC"; - var UrlNameDC = "七猫小说日常签到"; - var UrlValueDC = url; - if (qmnovel.getdata(UrlKeyDC) != (undefined || null)) { - if (qmnovel.getdata(UrlKeyDC) != UrlValueDC) { - var urlDC = qmnovel.setdata(UrlValueDC, UrlKeyDC); - if (!urlDC) { - qmnovel.msg("更新" + UrlNameDC + "Url失败‼️", "", ""); - } else { - qmnovel.msg("更新" + UrlNameDC + "Url成功🎉", "", ""); - } - } else { - qmnovel.msg(UrlNameDC + "Url未变化❗️", "", ""); - } - } else { - var urlDC = qmnovel.setdata(UrlValueDC, UrlKeyDC); - if (!cookieDC) { - qmnovel.msg("首次写入" + UrlNameDC + "Url失败‼️", "", ""); - } else { - qmnovel.msg("首次写入" + UrlNameDC + "Url成功🎉", "", ""); - } - } - } else { - qmnovel.msg("写入" + UrlNameDC + "Url失败‼️", "", "配置错误, 无法读取URL, "); - } - if ($request.headers) { - var CookieKeyDC = "CookieDC"; - var CookieNameDC = "七猫小说日常签到及视频奖励"; - var CookieValueDC = JSON.stringify($request.headers); - if (qmnovel.getdata(CookieKeyDC) != (undefined || null)) { - if (qmnovel.getdata(CookieKeyDC) != CookieValueDC) { - var cookieDC = qmnovel.setdata(CookieValueDC, CookieKeyDC); - if (!cookieDC) { - qmnovel.msg("更新" + CookieNameDC + "Cookie失败‼️", "", ""); - } else { - qmnovel.msg("更新" + CookieNameDC + "Cookie成功🎉", "", ""); - } - } else { - qmnovel.msg(CookieNameDC + "Cookie未变化❗️", "", ""); - } - } else { - var cookieDC = qmnovel.setdata(CookieValueDC, CookieKeyDC); - if (!cookieDC) { - qmnovel.msg("首次写入" + CookieNameDC + "Cookie失败‼️", "", ""); - } else { - qmnovel.msg("首次写入" + CookieNameDC + "Cookie成功🎉", "", ""); - } - } - } else { - qmnovel.msg("写入" + CookieNameDC + "Cookie失败‼️", "", "配置错误, 无法读取请求头, "); - } - } else if (url.indexOf(novice) != -1) { - if (url) { - var UrlKeyNC = "UrlNC"; - var UrlNameNC = "七猫小说新人签到"; - var UrlValueNC = url; - if (qmnovel.getdata(UrlKeyNC) != (undefined || null)) { - if (qmnovel.getdata(UrlKeyNC) != UrlValueNC) { - var urlNC = qmnovel.setdata(UrlValueNC, UrlKeyNC); - if (!urlNC) { - qmnovel.msg("更新" + UrlNameNC + "Url失败‼️", "", ""); - } else { - qmnovel.msg("更新" + UrlNameNC + "Url成功🎉", "", ""); - } - } else { - qmnovel.msg(UrlNameNC + "Url未变化❗️", "", ""); - } - } else { - var urlNC = qmnovel.setdata(UrlValueNC, UrlKeyNC); - if (!urlNC) { - qmnovel.msg("首次写入" + UrlNameNC + "Url失败‼️", "", ""); - } else { - qmnovel.msg("首次写入" + UrlNameNC + "Url成功🎉", "", ""); - } - } - } else { - qmnovel.msg("写入" + UrlNameNC + "Url失败‼️", "", "配置错误, 无法读取URL, "); - } - if ($request.headers) { - var CookieKeyNC = "CookieNC"; - var CookieNameNC = "七猫小说新人签到"; - var CookieValueNC = JSON.stringify($request.headers); - if (qmnovel.getdata(CookieKeyNC) != (undefined || null)) { - if (qmnovel.getdata(CookieKeyNC) != CookieValueNC) { - var cookieNC = qmnovel.setdata(CookieValueNC, CookieKeyNC); - if (!cookieNC) { - qmnovel.msg("更新" + CookieNameNC + "Cookie失败‼️", "", ""); - } else { - qmnovel.msg("更新" + CookieNameNC + "Cookie成功🎉", "", ""); - } - } else { - qmnovel.msg(CookieNameNC + "Cookie未变化❗️", "", ""); - } - } else { - var cookieNC = qmnovel.setdata(CookieValueNC, CookieKeyNC); - if (!cookieNC) { - qmnovel.msg("首次写入" + CookieNameNC + "Cookie失败‼️", "", ""); - } else { - qmnovel.msg("首次写入" + CookieNameNC + "Cookie成功🎉", "", ""); - } - } - } else { - qmnovel.msg("写入" + CookieNameNC + "Cookie失败‼️", "", "配置错误, 无法读取请求头, "); - } - } else if (url.indexOf(turn) != -1) { - if (url) { - var UrlKeyLT = "UrlLT"; - var UrlNameLT = "七猫小说幸运大转盘"; - var UrlValueLT = url; - if (qmnovel.getdata(UrlKeyLT) != (undefined || null)) { - if (qmnovel.getdata(UrlKeyLT) != UrlValueLT) { - var urlLT = qmnovel.setdata(UrlValueLT, UrlKeyLT); - if (!urlLT) { - qmnovel.msg("更新" + UrlNameLT + "Url失败‼️", "", ""); - } else { - qmnovel.msg("更新" + UrlNameLT + "Url成功🎉", "", ""); - } - } else { - qmnovel.msg(UrlNameLT + "Url未变化❗️", "", ""); - } - } else { - var urlLT = qmnovel.setdata(UrlValueLT, UrlKeyLT); - if (!urlLT) { - qmnovel.msg("首次写入" + UrlNameLT + "Url失败‼️", "", ""); - } else { - qmnovel.msg("首次写入" + UrlNameLT + "Url成功🎉", "", ""); - } - } - } else { - qmnovel.msg("写入" + UrlNameLT + "Url失败‼️", "", "配置错误, 无法读取URL, "); - } - if ($request.headers) { - var CookieKeyLT = "CookieLT"; - var CookieNameLT = "七猫小说幸运大转盘"; - var CookieValueLT = JSON.stringify($request.headers); - if (qmnovel.getdata(CookieKeyLT) != (undefined || null)) { - if (qmnovel.getdata(CookieKeyLT) != CookieValueLT) { - var cookieLT = qmnovel.setdata(CookieValueLT, CookieKeyLT); - if (!cookieLT) { - qmnovel.msg("更新" + CookieNameLT + "Cookie失败‼️", "", ""); - } else { - qmnovel.msg("更新" + CookieNameLT + "Cookie成功🎉", "", ""); - } - } else { - qmnovel.msg(CookieNameLT + "Cookie未变化❗️", "", ""); - } - } else { - var cookieLT = qmnovel.setdata(CookieValueLT, CookieKeyLT); - if (!cookieLT) { - qmnovel.msg("首次写入" + CookieNameLT + "Cookie失败‼️", "", ""); - } else { - qmnovel.msg("首次写入" + CookieNameLT + "Cookie成功🎉", "", ""); - } - } - } else { - qmnovel.msg("写入" + CookieNameLT + "Cookie失败‼️", "", "配置错误, 无法读取请求头, "); - } - } else if (url.indexOf(video) != -1) { - if (url) { - var UrlKeyVC = "UrlVC"; - var UrlNameVC = "七猫小说视频奖励"; - var UrlValueVC = url; - if (qmnovel.getdata(UrlKeyVC) != (undefined || null)) { - if (qmnovel.getdata(UrlKeyVC) != UrlValueVC) { - var urlVC = qmnovel.setdata(UrlValueVC, UrlKeyVC); - if (!urlVC) { - qmnovel.msg("更新" + UrlNameVC + "Url失败‼️", "", ""); - } else { - qmnovel.msg("更新" + UrlNameVC + "Url成功🎉", "", ""); - } - } else { - qmnovel.msg(UrlNameVC + "Url未变化❗️", "", ""); - } - } else { - var urlVC = qmnovel.setdata(UrlValueVC, UrlKeyVC); - if (!urlVC) { - qmnovel.msg("首次写入" + UrlNameVC + "Url失败‼️", "", ""); - } else { - qmnovel.msg("首次写入" + UrlNameVC + "Url成功🎉", "", ""); - } - } - } else { - qmnovel.msg("写入" + UrlNameVC + "Url失败‼️", "", "配置错误, 无法读取URL, "); - } - } -} - -function DailyCheckin(t) { - return new Promise(resolve => { - setTimeout(() => { - url = {url: DCURL, headers: JSON.parse(DCKEY)} - qmnovel.get(url, (error, response, data) => { - try { - Totalresult.dailycheckin = JSON.parse(data) - qmnovel.log(`${cookieName}日常签到, data: ${data}`) - resolve('done'); - } catch (e) { - qmnovel.log(`Error: ${error}`) - qmnovel.msg(cookieName, '日常签到结果: 失败‼️', '请查看错误日志‼️') - resolve('done') - } - }) - }, t) - }) -} - -function NoviceCheckin(t) { - return new Promise(resolve => { - setTimeout(() => { - url = {url: NCURL, headers: JSON.parse(NCKEY)} - qmnovel.get(url, (error, response, data) => { - try { - Totalresult.novicecheckin = JSON.parse(data) - qmnovel.log(`${cookieName}新人签到, data: ${data}`) - resolve('done'); - } catch (e) { - qmnovel.log(`Error: ${error}`) - qmnovel.msg(cookieName, '新人签到结果: 失败‼️', '请查看错误日志‼️') - resolve('done') - } - }) - }, t) - }) -} - -function VideoCoin(t) { - return new Promise(resolve => { - setTimeout(() => { - url = {url: VCURL, headers: JSON.parse(DCKEY)} - qmnovel.get(url, (error, response, data) => { - try { - Totalresult.videocoin = JSON.parse(data) - qmnovel.log(`${cookieName}视频奖励, data: ${data}`) - resolve('done'); - } catch (e) { - qmnovel.log(`Error: ${error}`) - qmnovel.msg(cookieName, '领取视频奖励: 失败‼️', '请查看错误日志‼️') - resolve('done'); - } - }) - }, t) - }) -} - -function LuckyTurn(t) { - return new Promise(resolve => { - setTimeout(() => { - url = {url: LTURL, headers: JSON.parse(LTKEY)} - qmnovel.get(url, (error, response, data) => { - try { - Totalresult.luckyturnlist = Totalresult.luckyturnlist ? Totalresult.luckyturnlist : [] - Totalresult.luckyturnlist.push(JSON.parse(data)) - qmnovel.log(`${cookieName}幸运大转盘, data: ${data}`) - resolve('done'); - } catch (e) { - qmnovel.log(`Error: ${error}`) - qmnovel.msg(cookieName, '幸运大转盘: 失败‼️', '请查看错误日志‼️') - resolve('done') - } - }) - }, t) - }) -} - -function Notify() { - let subTitle = ''; - let detail = ''; - if (Totalresult.dailycheckin) { - if (Totalresult.dailycheckin.data) { - subTitle += '日常签到结果: 成功🎉\n' - detail += '日常签到奖励: ' + Totalresult.dailycheckin.data.coin + '金币\n' - } else if (Totalresult.dailycheckin.errors) { - if (Totalresult.dailycheckin.errors.code == 23010103) { - subTitle += '日常签到结果: 成功(重复签到)🎉\n' - } else { - subTitle += '日常签到结果: 失败‼️\n' - detail += '日常签到说明: ' + Totalresult.dailycheckin.errors.details + '\n' - } - } - } - if (Totalresult.videocoin) { - if (Totalresult.videocoin.data) { - subTitle += '领取视频奖励: 成功🎉\n' - detail += '视频奖励: ' + Totalresult.videocoin.data.coin + '金币\n' - } else if (Totalresult.videocoin.errors) { - if (Totalresult.videocoin.errors.code == 23010107) { - subTitle += '领取视频奖励: 成功(重复签到)🎉\n' - detail += '视频奖励说明: ' + Totalresult.videocoin.errors.details + '\n' - } else { - subTitle += '领取视频奖励: 失败‼️\n' - detail += '视频奖励说明: ' + Totalresult.videocoin.errors.details + '\n' - } - } - } - if (Totalresult.novicecheckin) { - if (Totalresult.novicecheckin.data) { - subTitle += '新人签到结果: 成功🎉\n' - detail += '签到奖励: ' + Totalresult.novicecheckin.data.reward_cash + '金币\n' - } else if (Totalresult.novicecheckin.errors) { - if (Totalresult.novicecheckin.errors.code == 13101002) { - subTitle += '新人签到结果: 成功(重复签到)🎉\n' - detail += '新人签到说明: ' + Totalresult.novicecheckin.errors.details + '\n' - } else { - subTitle += '新人签到结果: 失败‼️\n' - detail += '新人签到说明: ' + Totalresult.novicecheckin.errors.details + '\n' - } - } - } - if (Totalresult.luckyturnlist) { - subTitle += '幸运大转盘次数: 5次'; - for (let i = 0; i < 5; i++) { - n = i + 1 - if (Totalresult.luckyturnlist[i].data) { - detail += '第' + n + '次' + '幸运大转盘: 成功🎉 转盘奖励: ' + Totalresult.luckyturnlist[i].data.prize_title + '\n' - } else if (Totalresult.luckyturnlist[i].errors) { - if (Totalresult.luckyturnlist[i].errors.code == 13101002) { - detail += '幸运大转盘: 次数耗尽🚫 说明: ' + Totalresult.luckyturnlist[i].errors.details + '\n' - } else { - detail += '幸运大转盘: 失败‼️ 说明: ' + Totalresult.luckyturnlist[i].errors.details + '\n' - } - } - } - } - qmnovel.msg(cookieName, subTitle, detail) -} - -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)) - } - } - put = (url, cb) => { - if (isSurge()) { - $httpClient.put(url, cb) - } - if (isQuanX()) { - url.method = 'PUT' - $task.fetch(url).then((resp) => cb(null, {}, resp.body)) - } - } - done = (value = {}) => { - $done(value) - } - return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done} -} \ No newline at end of file diff --git a/Scripts/SignIn/Qtt/README.md b/Scripts/SignIn/Qtt/README.md deleted file mode 100644 index a1001f0..0000000 --- a/Scripts/SignIn/Qtt/README.md +++ /dev/null @@ -1,129 +0,0 @@ -# 趣头条 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> QuanX 需要: v1.0.6-build195 及以后版本 (TestFlight) - -> 感谢 [@GideonSenku](https://github.com/GideonSenku) Commit - -> 2020.04.07 添加签到脚本 - -> 2020.04.08 添加视频广告奖励、添加每时段签到奖励 - -> 2020.04.09 添加幸运转盘抽奖 - -> 2020.04.13 简化Cookie获取方式 - -> 2020.04.14 添加阅读篇数,添加首页金币奖励,优化通知 - -> 2020.04.16 阅读篇数奖励自动获取 - -> 2020.04.19 添加睡觉领金币 - -> 2020.04.22 添加幸运转盘额外奖励 -## 配置 (Surge) - -```properties -[MITM] -api.1sapp.com - -[Script] -http-request ^https:\/\/api\.1sapp\.com\/sign\/info? script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/qtt/qtt.cookie.js -http-request ^https:\/\/api\.1sapp\.com\/content\/readV2? script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/qtt/qtt.cookie.js -http-request ^https:\/\/api\.1sapp\.com\/x\/feed\/getReward? script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/qtt/qtt.cookie.js - -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/qtt/qtt.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -api.1sapp.com - -[rewrite_local] - -# [商店版] QuanX v1.0.6-build194 及更早版本 -^https:\/\/api\.1sapp\.com\/sign\/info? url script-request-header qtt.cookie.js -^https:\/\/api\.1sapp\.com\/content\/readV2? url script-request-header qtt.cookie.js -^https:\/\/api\.1sapp\.com\/x\/feed\/getReward? url script-request-header qtt.cookie.js -# [TestFlight] QuanX v1.0.6-build195 及以后版本 -^https:\/\/api\.1sapp\.com\/sign\/info? url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/qtt/qtt.cookie.js -^https:\/\/api\.1sapp\.com\/content\/readV2? url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/qtt/qtt.cookie.js -^https:\/\/api\.1sapp\.com\/x\/feed\/getReward? url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/qtt/qtt.cookie.js - -[task_local] -1 0 * * * qtt.js -``` - -## 说明 - -1. 先把`api.1sapp.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`qtt.cookie.js`和`qtt.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP 进入签到: `右上角` > `签到` -4. 系统提示: `获取Cookie: 成功` -5. 把获取 Cookie 的脚本注释掉 -6. 运行一次脚本, 如果提示重复签到, 那就算成功了! -7. 建议将`task`执行次数改成每小时执行防止错过奖励 -8. 阅读篇数获取Cookie:`小视频`中播放一段时间视频即可获取,具体的阅读篇数奖励请到应用内手动点击 -9. 首页金币奖励:此Cookie在首页的推荐中随机出现,随机获取,并不一定会出现。 -10. 其他问题请看日志报错,日志提示权限错误代表cookie失效 -11. 幸运转盘达到次数可自己手动去获取累计奖励,有机率每周五脚本能够再帮你获取一回奖励 -12. 赞赏:趣头条邀请码`A1040276307`,农妇山泉 -> 有点咸 -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) - -[@GideonSenku](https://github.com/GideonSenku) diff --git a/Scripts/SignIn/Qtt/qtt.cookie.js b/Scripts/SignIn/Qtt/qtt.cookie.js deleted file mode 100644 index d14d924..0000000 --- a/Scripts/SignIn/Qtt/qtt.cookie.js +++ /dev/null @@ -1,95 +0,0 @@ -const cookieName = '趣头条' -const signKey = 'senku_signKey_qtt' -const signXTKKey = 'senku_signXTK_qtt' -const readKey = 'senku_readKey_qtt' -const navCoinKey = 'senku_navCoinKey_qtt' -const senku = init() - -const requrl = $request.url -if ($request && $request.method != 'OPTIONS') { - try { - const tokenVal = '&' + requrl.match(/token=[a-zA-Z0-9_-]+/)[0] - const uuidVal = '&' + requrl.match(/uuid=[a-zA-Z0-9_-]+/)[0] - const signVal = tokenVal + uuidVal - const XTK = requrl.match(/tk=[a-zA-Z0-9_-]+/)[0] - const signXTKVal = XTK.substring(3, XTK.length) - if (signVal) senku.setdata(signVal, signKey) - if (signXTKVal) senku.setdata(signXTKVal, signXTKKey) - senku.msg(cookieName, `签到,获取Cookie: 成功`, ``) - senku.log(`🔔${signVal},🔔${signXTKVal}`) - } catch (error) { - senku.log(`❌error:${error}`) - } -} - -if ($request && $request.method != 'OPTIONS' && requrl.match(/\/content\/readV2\?qdata=[a-zA-Z0-9_-]+/)) { - try { - const readVal = requrl - if (readVal) { - if (senku.setdata(readVal, readKey)) - senku.msg(cookieName, `阅读,获取Cookie: 成功`, ``) - senku.log(`🔔${readVal}`) - } - } catch (error) { - senku.log(`❌error:${error}`) - } -} - -if ($request && $request.method != 'OPTIONS' && requrl.match(/\/x\/feed\/getReward\?qdata=[a-zA-Z0-9_-]+/)) { - try { - const navCoinVal = requrl - if (navCoinVal) { - if (senku.setdata(navCoinVal, navCoinKey)) - senku.msg(cookieName, `首页金币奖励,获取Cookie: 成功`, ``) - senku.log(`🔔${navCoinVal}`) - } - } catch (error) { - senku.log(`❌error:${error}`) - } -} - -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} -} - -senku.done() diff --git a/Scripts/SignIn/Qtt/qtt.js b/Scripts/SignIn/Qtt/qtt.js deleted file mode 100644 index 4efc90a..0000000 --- a/Scripts/SignIn/Qtt/qtt.js +++ /dev/null @@ -1,898 +0,0 @@ -// 赞赏:趣头条邀请码`A1040276307`,农妇山泉 -> 有点咸 -const cookieName = '趣头条' -const signKey = 'senku_signKey_qtt' -const signXTKKey = 'senku_signXTK_qtt' -const readKey = 'senku_readKey_qtt' -const navCoinKey = 'senku_navCoinKey_qtt' -const senku = init() -const signVal = senku.getdata(signKey) -const signXTKVal = senku.getdata(signXTKKey) -const readVal = senku.getdata(readKey) -const navCoinVal = senku.getdata(navCoinKey) -const vsign = 'version=30967000&xhi=200' + signVal -const signurlVal = 'https://api.1sapp.com/sign/sign?' + vsign -const adUrl = 'https://api.1sapp.com/sign/adDone?' + vsign -const getinfoUrlVal = 'https://api.1sapp.com/sign/info?' + vsign -const hourUrlVal = 'https://api.1sapp.com/mission/intPointReward?' + vsign -const coinUrlVal = 'https://api.1sapp.com/app/ioscoin/getInfo?' + vsign -const readReawardVal = 'https://api.1sapp.com/app/ioscoin/readReward?type=content_config&' + vsign -const sleepUrlVal = 'https://mvp-sleeper.qutoutiao.net/v1/sleep/update?status=1&' + vsign -const sleepRewardVal = 'https://mvp-sleeper.qutoutiao.net/v1/reward?which=2&' + vsign -const sleepBagVal = 'https://mvp-sleeper.qutoutiao.net/v1/reward?which=3&' + vsign -const sleepStatusVal = 'https://mvp-sleeper.qutoutiao.net/v1/sleep/status?' + vsign -const luckyUrlVal = 'https://qtt-turntable.qutoutiao.net/press_trigger?' + vsign -const luckyRewardVal = 'https://qtt-turntable.qutoutiao.net/extra_reward?' + vsign -const raindropVal = 'https://work-for-coin.1sapp.com/raindrop/v1/click?sub_id=2&type=2&scene_id=2&' + vsign -const loginVal = 'https://api.1sapp.com/app/user/info/member/v1/get?' + vsign -const sleepNightVal = 'https://cj-activity.1sapp.com/v1/zfb/sleep/coin?from=pm&' + vsign -const sleepMorningVal = 'https://cj-activity.1sapp.com/v1/zfb/sleep/coin?from=am&' + vsign -const sleepinitVal = 'https://api.1sapp.com/dlc/ali/zfbSleepInit?' + vsign -const signinfo = { - playList: [], - luckyList: [], - rainList: [] - } - -; -(sign = async () => { - senku.log(`🔔 ${cookieName}`) - await login() - if (navCoinVal != undefined && navCoinVal.match(/\/x\/feed\/getReward\?qdata=[a-zA-Z0-9_-]+/)) { - await navCoin() - } - if (readVal != undefined && readVal.match(/\/content\/readV2\?qdata=[a-zA-Z0-9_-]+/)) { - await read() - await getcoininfo() - await getreadReward() - } - if (new Date().getHours() == 20 || new Date().getHours() == 12) { - await sleepStatus() - await sleepReward() - await sleep() - if (signinfo.sleepStatus.data.fortune_bag_can_reward) { - await sleepBag() - } - } - if (new Date().getHours() >= 20) { - await sleepinit() - await sleepNight() - } - if (new Date().getHours() >= 5 && new Date().getHours() <= 9) { - await sleepinit() - await sleepMorning() - } - if (new Date().getHours() == 8 || new Date().getHours() == 14) { - await sleepReward() - } - await rain(0) - await rain(1) - await rain(2) - if (new Date().getDay() == 5) { - await luckyReward(3) - await luckyReward(8) - await luckyReward(15) - await luckyReward(20) - await luckyReward(30) - } - await signDay() - await signHour() - await signLucky() - await playone() - await playtwo() - await playthree() - await playfour() - await getinfo() - showmsg() - senku.done() -})().catch((e) => senku.log(`❌ ${cookieName} 签到失败: ${e}`), senku.done()) - -// 每日登录 -function login() { - return new Promise((resolve, reject) => { - const url = { - url: loginVal, - headers: { - 'Host': 'api.1sapp.com', - 'X-Tk': signXTKVal - } - } - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.get(url, (error, response, data) => { - try { - senku.log(`❕ ${cookieName} login- response: ${JSON.stringify(response)}`) - signinfo.login = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `登录结果: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} signDay - 登录失败: ${e}`) - senku.log(`❌ ${cookieName} signDay - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// -function sleepinit() { - return new Promise((resolve, reject) => { - const url = { - url: sleepinitVal, - headers: { - 'Host': 'api.1sapp.com', - 'X-Tk': signXTKVal - } - } - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.get(url, (error, response, data) => { - try { - resolve() - } catch (e) { - senku.msg(cookieName, `睡觉初始化结果: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} sleepinit - 睡觉初始化失败: ${e}`) - senku.log(`❌ ${cookieName} sleepinit - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 睡觉 -function sleep() { - return new Promise((resolve, reject) => { - const url = { - url: sleepUrlVal, - headers: { - 'Host': 'mvp-sleeper.qutoutiao.net', - 'X-Tk': signXTKVal - } - } - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.get(url, (error, response, data) => { - try { - senku.log(`❕ ${cookieName} sleep - response: ${JSON.stringify(response)}`) - signinfo.sleep = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `睡觉结果: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} sleep - 睡觉失败: ${e}`) - senku.log(`❌ ${cookieName} sleep - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 早睡 -function sleepNight() { - return new Promise((resolve, reject) => { - const url = { - url: sleepNightVal, - headers: { - 'Host': 'cj-activity.1sapp.com', - 'X-Tk': signXTKVal - } - } - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.get(url, (error, response, data) => { - try { - senku.log(`❕ ${cookieName} sleepNight - response: ${JSON.stringify(response)}`) - signinfo.sleepNight = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `早睡结果: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} sleepNight - 早睡失败: ${e}`) - senku.log(`❌ ${cookieName} sleepNight - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 早起 -function sleepMorning() { - return new Promise((resolve, reject) => { - const url = { - url: sleepMorningVal, - headers: { - 'Host': 'cj-activity.1sapp.com', - 'X-Tk': signXTKVal - } - } - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.get(url, (error, response, data) => { - try { - senku.log(`❕ ${cookieName} sleepMorning - response: ${JSON.stringify(response)}`) - signinfo.sleepMorning = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `早起结果: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} sleepMorning - 早起失败: ${e}`) - senku.log(`❌ ${cookieName} sleepMorning - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 睡觉金币 -function sleepReward() { - return new Promise((resolve, reject) => { - const url = { - url: sleepRewardVal, - headers: { - 'Host': 'mvp-sleeper.qutoutiao.net', - 'X-Tk': signXTKVal - } - } - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.get(url, (error, response, data) => { - try { - senku.log(`❕ ${cookieName} sleepReward - response: ${JSON.stringify(response)}`) - signinfo.sleepReward = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `睡觉结果: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} sleepReward - 睡觉失败: ${e}`) - senku.log(`❌ ${cookieName} sleepReward - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 睡觉福袋 -function sleepBag() { - return new Promise((resolve, reject) => { - const url = { - url: sleepBagVal, - headers: { - 'Host': 'mvp-sleeper.qutoutiao.net', - 'X-Tk': signXTKVal - } - } - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.get(url, (error, response, data) => { - try { - senku.log(`❕ ${cookieName} sleepBag - response: ${JSON.stringify(response)}`) - signinfo.sleepBag = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `睡觉福袋: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} sleepBag - 睡觉福袋: ${e}`) - senku.log(`❌ ${cookieName} sleepBag - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 睡觉信息 -function sleepStatus() { - return new Promise((resolve, reject) => { - const url = { - url: sleepStatusVal, - headers: { - 'Host': 'mvp-sleeper.qutoutiao.net', - 'X-Tk': signXTKVal - } - } - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.get(url, (error, response, data) => { - try { - senku.log(`❕ ${cookieName} sleepStatus - response: ${JSON.stringify(response)}`) - signinfo.sleepStatus = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `睡觉信息: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} sleepStatus - 睡觉信息: ${e}`) - senku.log(`❌ ${cookieName} sleepStatus - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 雨滴金币 -function rain(seri_num) { - return new Promise((resolve, reject) => { - const raindropUrl = raindropVal + '&serial_number=' + seri_num - const url = { - url: raindropUrl, - headers: { - 'Host': 'work-for-coin.1sapp.com', - 'X-Tk': signXTKVal - } - } - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.get(url, (error, response, data) => { - try { - senku.log(`❕ ${cookieName} rain - response: ${JSON.stringify(response)}`) - signinfo.rainList.push(JSON.parse(data)) - resolve() - } catch (e) { - senku.msg(cookieName, `雨滴结果: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} rain - 雨滴失败: ${e}`) - senku.log(`❌ ${cookieName} rain - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 每日签到 -function signDay() { - return new Promise((resolve, reject) => { - const url = { - url: signurlVal, - headers: { - 'Host': 'api.1sapp.com', - 'X-Tk': signXTKVal - } - } - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.get(url, (error, response, data) => { - try { - senku.log(`❕ ${cookieName} signDay - response: ${JSON.stringify(response)}`) - signinfo.signDay = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `签到结果: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} signDay - 签到失败: ${e}`) - senku.log(`❌ ${cookieName} signDay - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 首页奖励 -function navCoin() { - return new Promise((resolve, reject) => { - const url = { - url: navCoinVal, - headers: { - 'Host': 'api.1sapp.com', - 'X-Tk': signXTKVal - } - } - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.get(url, (error, response, data) => { - try { - senku.log(`❕ ${cookieName} navCoin - response: ${JSON.stringify(response)}`) - signinfo.navCoin = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `首页奖励: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} navCoin - 首页奖励失败: ${e}`) - senku.log(`❌ ${cookieName} navCoin - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 阅读部分 -function read() { - return new Promise((resolve, reject) => { - const url = { - url: readVal, - headers: { - 'Host': 'api.1sapp.com', - 'X-Tk': signXTKVal - } - } - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.get(url, (error, response, data) => { - try { - senku.log(`❕ ${cookieName} read - response: ${JSON.stringify(response)}`) - signinfo.read = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `阅读结果: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} read - 阅读失败: ${e}`) - senku.log(`❌ ${cookieName} read - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 获取阅读奖励 -function getreadReward() { - return new Promise((resolve, reject) => { - try { - if (signinfo.coininfo.data) { - const read_num = signinfo.coininfo.data.read_num - if (read_num < 5 && read_num >= 1) { - resolve(readReward(1)) - } else if (read_num < 15 && read_num >= 5) { - resolve(readReward(5)) - } else if (read_num < 18 && read_num >= 15) { - resolve(readReward(15)) - } else if (read_num == 18) { - resolve(readReward(18)) - } else resolve() - } - } catch (e) { - senku.msg(cookieName, `获取阅读奖励: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} getreadReward - 获取阅读奖励失败: ${e}`) - resolve() - } - }) -} - -// 阅读奖励请求 -function readReward(reward_id) { - return new Promise((resolve, reject) => { - const readRewardUrl = readReawardVal + '&reward_id=' + reward_id - const url = { - url: readRewardUrl, - headers: { - 'Host': 'api.1sapp.com', - 'X-Tk': signXTKVal - } - } - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.get(url, (error, response, data) => { - try { - senku.log(`❕ ${cookieName} readReward - response: ${JSON.stringify(response)}`) - signinfo.readReward = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `阅读奖励请求: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} readReward - 阅读奖励请求失败: ${e}`) - senku.log(`❌ ${cookieName} readReward - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 获取阅读信息 -function getcoininfo() { - return new Promise((resolve, reject) => { - const url = { - url: coinUrlVal, - headers: { - 'Host': 'api.1sapp.com', - 'X-Tk': signXTKVal - } - } - senku.get(url, (error, response, data) => { - try { - senku.log(`❕ ${cookieName} getcoininfo - response: ${JSON.stringify(response)}`) - signinfo.coininfo = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `签到结果: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} getcoininfo - 签到失败: ${e}`) - senku.log(`❌ ${cookieName} getcoininfo - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// FIXME: 时段请求偶尔丢失或伪请求 -function signHour() { - return new Promise((resolve, reject) => { - const url = { - url: hourUrlVal, - headers: { - 'Host': 'api.1sapp.com', - 'X-Tk': signXTKVal - } - } - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.get(url, (error, response, data) => { - try { - senku.log(`❕ ${cookieName} signHour - response: ${JSON.stringify(response)}`) - signinfo.signHour = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `时段签到结果: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} signHour - 时段签到失败: ${e}`) - senku.log(`❌ ${cookieName} signHour - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function signLucky() { - return new Promise((resolve, reject) => { - const url = { - url: luckyUrlVal, - headers: { - 'Host': 'qtt-turntable.qutoutiao.net', - 'X-Tk': signXTKVal - } - } - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.get(url, (error, response, data) => { - try { - senku.log(`❕ ${cookieName} signLucky - response: ${JSON.stringify(response)}`) - signinfo.signLucky = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `幸运转盘: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} signLucky - 幸运转盘失败: ${e}`) - senku.log(`❌ ${cookieName} signLucky - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 幸运转盘额外奖励 -function luckyReward(times) { - return new Promise((resolve, reject) => { - const luckyRewardUrl = luckyRewardVal + '×=' + times - const url = { - url: luckyRewardUrl, - headers: { - 'Host': 'qtt-turntable.qutoutiao.net', - 'X-Tk': signXTKVal - } - } - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - senku.get(url, (error, response, data) => { - try { - senku.log(`❕ ${cookieName} luckyReward - response: ${JSON.stringify(response)}`) - signinfo.luckyList.push(JSON.parse(data)) - resolve() - } catch (e) { - senku.msg(cookieName, `转盘额外奖励请求: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} luckyReward - 转盘额外奖励请求失败: ${e}`) - senku.log(`❌ ${cookieName} luckyReward - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -// 获取签到信息 -function getinfo() { - return new Promise((resolve, reject) => { - const url = { - url: getinfoUrlVal, - headers: { - 'Host': 'api.1sapp.com', - 'X-Tk': signXTKVal - } - } - senku.get(url, (error, response, data) => { - try { - senku.log(`❕ ${cookieName} getinfo - response: ${JSON.stringify(response)}`) - signinfo.info = JSON.parse(data) - resolve() - } catch (e) { - senku.msg(cookieName, `获取信息: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} getinfo - 获取信息失败: ${e}`) - senku.log(`❌ ${cookieName} getinfo - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - - -// 视频广告部分 -function playone() { - return new Promise((resolve, reject) => { - const urlParameter = 'https://api.1sapp.com/sign/adDone?version=30967000&xhi=200&pos=one' + signVal - const url = { - url: urlParameter, - headers: { - 'Host': 'api.1sapp.com', - 'X-Tk': signXTKVal - } - } - url.headers['User-Agent'] = 'Mozilla / 5.0(iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit / 605.1.15(KHTML, like Gecko) Mobile / 15E148' - senku.get(url, (error, response, data) => { - try { - senku.log(`❕ ${cookieName} playAd - response: ${JSON.stringify(response)}`) - signinfo.playList.push(JSON.parse(data)) - resolve() - } catch (e) { - senku.msg(cookieName, `签到结果: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} playAd - 签到失败: ${e}`) - senku.log(`❌ ${cookieName} playAd - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function playtwo() { - return new Promise((resolve, reject) => { - const urlParameter = 'https://api.1sapp.com/sign/adDone?version=30967000&xhi=200&pos=two' + signVal - const url = { - url: urlParameter, - headers: { - 'Host': 'api.1sapp.com', - 'X-Tk': signXTKVal - } - } - url.headers['User-Agent'] = 'Mozilla / 5.0(iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit / 605.1.15(KHTML, like Gecko) Mobile / 15E148' - senku.get(url, (error, response, data) => { - try { - senku.log(`❕ ${cookieName} playAd - response: ${JSON.stringify(response)}`) - signinfo.playList.push(JSON.parse(data)) - resolve() - } catch (e) { - senku.msg(cookieName, `签到结果: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} playAd - 签到失败: ${e}`) - senku.log(`❌ ${cookieName} playAd - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function playthree() { - return new Promise((resolve, reject) => { - const urlParameter = 'https://api.1sapp.com/sign/adDone?version=30967000&xhi=200&pos=three' + signVal - const url = { - url: urlParameter, - headers: { - 'Host': 'api.1sapp.com', - 'X-Tk': signXTKVal - } - } - url.headers['User-Agent'] = 'Mozilla / 5.0(iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit / 605.1.15(KHTML, like Gecko) Mobile / 15E148' - senku.get(url, (error, response, data) => { - try { - senku.log(`❕ ${cookieName} playAd - response: ${JSON.stringify(response)}`) - signinfo.playList.push(JSON.parse(data)) - resolve() - } catch (e) { - senku.msg(cookieName, `签到结果: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} playAd - 签到失败: ${e}`) - senku.log(`❌ ${cookieName} playAd - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function playfour() { - return new Promise((resolve, reject) => { - const urlParameter = 'https://api.1sapp.com/sign/adDone?version=30967000&xhi=200&pos=four' + signVal - const url = { - url: urlParameter, - headers: { - 'Host': 'api.1sapp.com', - 'X-Tk': signXTKVal - } - } - url.headers['User-Agent'] = 'Mozilla / 5.0(iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit / 605.1.15(KHTML, like Gecko) Mobile / 15E148' - senku.get(url, (error, response, data) => { - try { - senku.log(`❕ ${cookieName} playAd - response: ${JSON.stringify(response)}`) - signinfo.playList.push(JSON.parse(data)) - resolve() - } catch (e) { - senku.msg(cookieName, `签到结果: 失败`, `说明: ${e}`) - senku.log(`❌ ${cookieName} playAd - 签到失败: ${e}`) - senku.log(`❌ ${cookieName} playAd - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - - -// 将时间戳格式化 -function tTime(timestamp) { - const date = new Date(timestamp * 1000) - const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-' - const D = (date.getDate() + 1 < 10 ? '0' + date.getDate() : date.getDate()) + ' ' - const h = date.getHours() + ':' - const m = (date.getMinutes() + 1 < 10 ? '0' + (date.getMinutes() + 1) : date.getMinutes() + 1) + '' - return M + D + h + m -} - -// 通知信息部分 -function showmsg() { - let subTitle = `` - let detail = `` - const name = signinfo.login.data.nickname ? signinfo.login.data.nickname : `未设置昵称或Cookie失效` - // signDayMsg - if (signinfo.info && signinfo.info.data.signIn.today == 1) { - if (signinfo.signDay.code == 0) { - subTitle += subTitle == `` ? `` : ` ` - const continuation = signinfo.info.data.signIn.continuation - const amount = signinfo.info.data.signIn.amount - const currentCoin = amount[continuation] - const nextCoin = amount[continuation + 1] - const coins = signinfo.info.data.show_balance_info.coins - subTitle += `每日:成功` - detail += `【每日签到】获得${currentCoin}💰,明日可得${nextCoin}💰\n` - } else subTitle += `` - } else { - subTitle += `每日:失败` - senku.log(`❌ ${cookieName} showmsg - 每日签到: ${JSON.stringify(signinfo.signDay)}`) - } - - // signHourMsg - subTitle += subTitle == `` ? `` : ` ` - if (signinfo.signHour && signinfo.signHour.code == 0) { - subTitle += '时段:成功' - const amount = signinfo.signHour.data.amount - const next_time = tTime(signinfo.signHour.data.next_time) - detail += `【时段签到】获得${amount}💰,下次签到:${next_time}\n` - } else subTitle += `时段:时间未到` - - // readMsg - if (signinfo.read && signinfo.read.data.status_code == 0) { - if (signinfo.coininfo.data) { - const desc = signinfo.coininfo.data.content_config.desc - if (signinfo.readReward != undefined && signinfo.readReward.code == 0) { - detail += `【阅读详情】${desc},奖励:成功\n` - } else if (signinfo.readReward != undefined && signinfo.readReward.code == -113) { - signinfo.coininfo.data.read_num == 18 ? detail += `` : detail += `【阅读详情】${desc},已获取阶段奖励\n` - - } else detail += `【阅读详情】${desc},手动获取金币\n` - } - } else detail += `【阅读详情】失败\n` - - // sleepMsg - if (signinfo.sleep && signinfo.sleep.data.success) { - detail += `【睡觉结果】已开始睡觉\n` - } else if (signinfo.sleepReward && signinfo.sleepReward.data) { - if (signinfo.sleepReward.data.success) { - const coins = signinfo.sleepReward.data.coins - coins == 0 ? detail += `` : detail += `【睡觉金币】获得${coins}💰\n` - } else { - detail += `【睡觉金币】金币获取失败\n` - } - } else if (signinfo.sleep == undefined) { - detail += `` - // sleepBagMsg - } else if (signinfo.sleepBag && signinfo.sleepBag.code == 0) { - const coins = signinfo.sleepBag.data.coins - coins == 0 ? detail += `` : detail += `【睡觉福袋】获得${signinfo.sleepBag.data.coins}💰\n` - } else { - detail += `【睡觉结果】失败\n` - } - // 早睡 - if (signinfo.sleepNight && signinfo.sleepNight.code == 0) { - if (signinfo.sleepNight.data && signinfo.sleepNight.data.coin) { - const coin = signinfo.sleepNight.data.coin - coin == 0 ? detail += `` : detail += `【早睡结果】获得${coin}💰\n` - } - } - // 早起 - if (signinfo.sleepMorning && signinfo.sleepMorning.code == 0) { - if (signinfo.sleepMorning.data && signinfo.sleepMorning.data.coin) { - const coin = signinfo.sleepMorning.data.coin - coin == 0 ? detail += `` : detail += `【早起结果】获得${coin}💰\n` - } - } - - // rainDropMsg - if (signinfo.rainList) { - for (const rains of signinfo.rainList) { - 87 - rains.code == 0 ? detail += `【金币雨滴】成功\n` : detail += `` - } - } else { - detail += `【金币雨滴】失败\n` - } - - // navCoinMsg - if (signinfo.navCoin && signinfo.navCoin.code == 0) { - if (signinfo.coininfo.data) { - const cur_amount = signinfo.navCoin.data.cur_amount - const total_times = signinfo.navCoin.data.total_times - const done_times = signinfo.navCoin.data.done_times - done_times == 15 ? detail += `` : detail += `【首页奖励】${cur_amount} 💰, 完成${done_times} /${total_times}\n` - } - } else if (signinfo.navCoin && signinfo.navCoin.code == -308) { - detail += `【首页奖励】时间未到\n` - } else if (signinfo.navCoin && signinfo.navCoin.code == -2) { - detail += `【首页奖励】Cookie失效\n` - } else detail += `【首页奖励】失败或Cookie不存在\n` - - // signLuckyMsg - subTitle += subTitle == '' ? '' : ' ' - if (signinfo.signLucky && signinfo.signLucky.code == 1) { - subTitle += `幸运转盘:成功` - const amount_coin = signinfo.signLucky.amount_coin - const count = signinfo.signLucky.count - const count_limit = signinfo.signLucky.count_limit - detail += `【幸运转盘】获得${amount_coin},抽奖情况:${count}/${count_limit}次\n` - } else subTitle += `` - - // luckyExtraMsg - if (signinfo.luckyList) { - const times = [3, 8, 15, 20, 30] - let i = 0 - for (const extra of signinfo.luckyList) { - if (extra.code == 0) { - detail += `【转盘额外】次数:${times[i]} 获得${extra.reward_coin}💰\n` - } else if (extra.code == -2) { - detail += `【转盘额外】次数:${times[i]} 重复领取\n` - } else if (extra.code == -1) { - detail += `【转盘额外】次数:${times[i]} 当前次数未达到\n` - } else detail += `【转盘额外】未知错误\n` - i += 1 - } - } else detail += `【转盘额外】失败` - - // playAdsMsg - subTitle += subTitle == '' ? '' : ' ' - if (signinfo.playList) { - if (signinfo.playList[0].code == 0) { - const icon = signinfo.info.data.signIn.ext_ad.icon - const coins = signinfo.info.data.show_balance_info.coins - const continuation = signinfo.info.data.signIn.continuation - for (const poss of icon) { - if (poss.next_time > 0) { - const time = tTime(poss.next_time) - detail += `【视频广告】下次🕥${time} 可获得${poss.amount}💰\n` - } - } - detail += `【账户详情】共计:${coins}💰,连续签到${continuation}天` - } else if (signinfo.playList[0].code == -126) subTitle += `广告:权限错误` - } else subTitle += `广告:失败` - - senku.msg(cookieName + ` 用户:${name}`, subTitle, detail) - senku.done() -} - - -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 - } -} \ No newline at end of file diff --git a/Scripts/SignIn/Qunar/README.md b/Scripts/SignIn/Qunar/README.md deleted file mode 100644 index c3aea52..0000000 --- a/Scripts/SignIn/Qunar/README.md +++ /dev/null @@ -1,92 +0,0 @@ -# 去哪儿 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -## 配置 (Surge) - -```properties -[MITM] -user.qunar.com - -[Script] -http-request ^https:\/\/user.qunar.com\/webapi\/member\/signIndexV2.htm script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/qunar/qunar.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/qunar/qunar.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -user.qunar.com - -[rewrite_local] -^https:\/\/user.qunar.com\/webapi\/member\/signIndexV2.htm url script-request-header qunar.cookie.js - -[task_local] -1 0 * * * qunar.js -``` - -## 说明 - -1. 先把`user.qunar.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`qunar.cookie.js`和`qunar.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP 然后手动签到 1 次: -4. 系统提示: `获取Cookie: 成功` -5. 最后就可以把第 1 条脚本注释掉了 -6. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/Qunar/qunar.cookie.js b/Scripts/SignIn/Qunar/qunar.cookie.js deleted file mode 100644 index 79785c4..0000000 --- a/Scripts/SignIn/Qunar/qunar.cookie.js +++ /dev/null @@ -1,59 +0,0 @@ -const cookieName = '去哪儿' -const cookieKey = 'chavy_cookie_qunar' -const chavy = init() -const cookieVal = JSON.stringify($request.headers) - -if (cookieVal) { - chavy.setdata(cookieVal, cookieKey) - chavy.msg(`${cookieName}`, '获取Cookie: 成功', '') - chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`) -} else { - chavy.msg(`${cookieName}`, '获取Cookie: 失败', '说明: 未知') - chavy.log(`[${cookieName}] 获取Cookie: 失败, cookie: ${cookieVal}`) -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/Qunar/qunar.js b/Scripts/SignIn/Qunar/qunar.js deleted file mode 100644 index 4d39a9d..0000000 --- a/Scripts/SignIn/Qunar/qunar.js +++ /dev/null @@ -1,77 +0,0 @@ -const cookieName = '去哪儿' -const cookieKey = 'chavy_cookie_qunar' -const chavy = init() -const cookieVal = JSON.parse(chavy.getdata(cookieKey)) - -sign() - -function sign() { - let url = {url: `https://user.qunar.com/webapi/member/signNewIndex.htm`, headers: cookieVal} - url.body = `channel=app&platform=ios` - chavy.post(url, (error, response, data) => { - chavy.log(`${cookieName}, data: ${data}`) - let result = JSON.parse(data) - const title = `${cookieName}` - let subTitle = `` - let detail = `` - if (result.errcode == 200) { - if (result.data.modalInfo.title) { - subTitle = '签到结果: 成功' - detail = `${result.data.unit}: ${result.data.preferential.counts}个, 共签: ${result.data.total}天, 连签: ${result.data.continuous}天, 说明: ${result.data.modalInfo.title}` - } else { - subTitle = '签到结果: 成功 (重复签到)' - detail = `${result.data.unit}: ${result.data.preferential.counts}个, 共签: ${result.data.total}天, 连签: ${result.data.continuous}天` - } - } else { - subTitle = '签到结果: 失败' - detail = `编码: ${result.errcode}, 说明: ${result.errmsg}` - } - chavy.msg(title, subTitle, detail) - }) - - chavy.done() -} - -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} -} diff --git a/Scripts/SignIn/RRTV/README.md b/Scripts/SignIn/RRTV/README.md deleted file mode 100644 index abcab66..0000000 --- a/Scripts/SignIn/RRTV/README.md +++ /dev/null @@ -1,102 +0,0 @@ -# 人人视频 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> 2020.1.11 QuanX 在`190`版本开始, 获取 Cookie 方式需要从`script-response-body`改为`script-request-header` - -> 2020.1.31 增加自动领取每日福利 (无需重新获取 Cookie, 直接更新脚本即可!) - -> 2020.3.4 (1) 增加每日答题 (无需重新获取 Cookie, 直接更新脚本即可!) (答题是判断哪个选项回答的人数最多来选择的,所以建议把签到时间放在 00:10 以后!) - -> 2020.3.4 (2) 增加自动开启宝箱 (60 活跃可开`铜箱`和`银箱`, 100 活跃开`金箱`) (仅靠脚本能自动开`铜箱`和`银箱`, `金箱`需要观看视频达一定分钟数, 平常有看视频的朋友可以把签到时间压后一点, 如: `50 23 * * *` ) - -## 配置 (Surge) - -```properties -[MITM] -*.rr.tv - -[Script] -http-request ^https:\/\/api\.rr\.tv\/user\/profile script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/rrtv/rrtv.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/rrtv/rrtv.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -*.rr.tv - -[rewrite_local] -# 189及以前版本 -^https:\/\/api\.rr\.tv\/user\/profile url script-response-body rrtv.cookie.js -# 190及以后版本 -^https:\/\/api\.rr\.tv\/user\/profile url script-request-header rrtv.cookie.js - -[task_local] -1 0 * * * rrtv.js -``` - -## 说明 - -1. 先把`*.rr.tv`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`rrtv.cookie.js`和`rrtv.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP, 访问下`个人中心` -4. 系统提示: `获取Cookie: 成功` (如果不提示获取成功, 尝试杀进程再进个人中心) -5. 最后就可以把第 1 条脚本注释掉了 - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/RRTV/rrtv.cookie.js b/Scripts/SignIn/RRTV/rrtv.cookie.js deleted file mode 100644 index 14575e4..0000000 --- a/Scripts/SignIn/RRTV/rrtv.cookie.js +++ /dev/null @@ -1,56 +0,0 @@ -const cookieName = '人人视频' -const cookieKey = 'chavy_cookie_rrtv' -const chavy = init() -const cookieVal = $request.headers['token'] -if (cookieVal) { - if (chavy.setdata(cookieVal, cookieKey)) { - chavy.msg(`${cookieName}`, '获取Cookie: 成功', '') - chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`) - } -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/RRTV/rrtv.js b/Scripts/SignIn/RRTV/rrtv.js deleted file mode 100644 index 071955c..0000000 --- a/Scripts/SignIn/RRTV/rrtv.js +++ /dev/null @@ -1,324 +0,0 @@ -const chavy = init() -const cookieName = '人人视频' -const KEY_signcookie = 'chavy_cookie_rrtv' - -const signinfo = {} -let VAL_signcookie = chavy.getdata(KEY_signcookie) - -;(exec = async () => { - chavy.log(`🔔 ${cookieName} 开始签到`) - await signdaily() - await signwelfare() - await getquestion() - if (!signinfo.hasAnswered) { - await answerquestion() - await getquestion() - } - await openbox('copperbox', '铜宝箱', 'simpleBody=nUuymDQ/BcC2Q6QH21Tjww23J7qtVaDlUN17k1/KY%2BXGDsRVwDRJ8YfjAMraptIL%0D%0A4t2g56kUpDGFsn9z6%2BofyiL5QwfBYZBZOTw9stNt9mc%3D') - await openbox('silverbox', '银宝箱', 'simpleBody=nUuymDQ/BcC2Q6QH21Tjww23J7qtVaDlUN17k1/KY%2BXGDsRVwDRJ8YfjAMraptIL%0D%0ADPPhFllL7eBnJs52RODWxxe9rquyWdYcDcbyirN6KiE%3D') - await openbox('goldenbox', '金宝箱', 'simpleBody=3abxJMn7LwEdH8u1Xpe2qN6AtFpDhBrmviLyoU%2BunKwnS1IGS7DIfS0HiKtt03G0%0D%0A/zVCARFyXUFFrOxLRrgAS4m/u4BiQYWJzTUeUqLAFZk%3D') - await getinfo() - showmsg() - chavy.done() -})().catch((e) => chavy.log(`❌ ${cookieName} 签到失败: ${e}`), chavy.done()) - -function signdaily() { - return new Promise((resolve, reject) => { - let url = {url: `https://api.rr.tv/rrtv-activity/sign/sign`, headers: {token: VAL_signcookie}} - url.headers['clientType'] = `ios_rrsp_jzsp` - url.headers['Accept-Encoding'] = `gzip, deflate, br` - url.headers['Connection'] = `keep-alive` - url.headers['clientVersion'] = `4.3.5` - url.headers['Content-Type'] = `application/x-www-form-urlencoded; charset=UTF-8` - url.headers['Origin'] = `https://mobile.rr.tv` - url.headers['Referer'] = `https://mobile.rr.tv/` - url.headers['Accept'] = `application/json, text/plain, */*` - url.headers['Host'] = `api.rr.tv` - url.headers['Accept-Language'] = `zh-cn` - url.headers['Content-Length'] = `12` - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 App/RRSPApp platform/iPhone AppVersion/4.3.5' - chavy.post(url, (error, response, data) => { - try { - signinfo.signdaily = JSON.parse(data) - resolve() - } catch (e) { - chavy.msg(cookieName, `日常签到: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} signdaily - 日常签到失败: ${e}`) - chavy.log(`❌ ${cookieName} signdaily - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function signwelfare() { - return new Promise((resolve, reject) => { - let url = {url: `https://api.rr.tv/dailyWelfare/getWelfare`, headers: {token: VAL_signcookie}} - url.headers['clientType'] = `web` - url.headers['Accept-Encoding'] = `gzip, deflate, br` - url.headers['Connection'] = `keep-alive` - url.headers['clientVersion'] = `0.0.1` - url.headers['Content-Type'] = `application/x-www-form-urlencoded; charset=UTF-8` - url.headers['Origin'] = `https://mobile.rr.tv` - url.headers['Referer'] = `https://mobile.rr.tv/mission/` - url.headers['Accept'] = `application/json, text/plain, */*` - url.headers['Host'] = `api.rr.tv` - url.headers['Accept-Language'] = `zh-cn` - url.headers['Content-Length'] = `45` - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 App/RRSPApp platform/iPhone AppVersion/4.3.5' - chavy.post(url, (error, response, data) => { - try { - signinfo.signwelfare = JSON.parse(data) - resolve() - } catch (e) { - chavy.msg(cookieName, `日常签到: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} signwelfare - 日常签到失败: ${e}`) - chavy.log(`❌ ${cookieName} signwelfare - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function getinfo() { - return new Promise((resolve, reject) => { - let url = {url: `https://api.rr.tv/user/profile`, headers: {token: VAL_signcookie}} - url.headers['clientType'] = `ios_rrsp_jzsp` - url.headers['Accept-Encoding'] = `gzip, deflate, br` - url.headers['Connection'] = `keep-alive` - url.headers['clientVersion'] = `4.3.5` - url.headers['Content-Type'] = `application/x-www-form-urlencoded; charset=UTF-8` - url.headers['Origin'] = `https://mobile.rr.tv` - url.headers['Referer'] = `https://mobile.rr.tv/` - url.headers['Accept'] = `application/json, text/plain, */*` - url.headers['Host'] = `api.rr.tv` - url.headers['Accept-Language'] = `zh-cn` - url.headers['Content-Length'] = `0` - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 App/RRSPApp platform/iPhone AppVersion/4.3.5' - chavy.post(url, (error, response, data) => { - try { - signinfo.userinfo = JSON.parse(data) - resolve() - } catch (e) { - chavy.msg(cookieName, `获取会员信息: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} getinfo - 获取会员信息失败: ${e}`) - chavy.log(`❌ ${cookieName} getinfo - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function getquestion() { - return new Promise((resolve, reject) => { - let url = {url: `https://api.rr.tv/v3plus/question/getQuestion`, headers: {token: VAL_signcookie}} - url.headers['clientType'] = `ios_rrsp_jzsp` - url.headers['Accept-Encoding'] = `gzip, deflate, br` - url.headers['Connection'] = `keep-alive` - url.headers['clientVersion'] = `4.3.5` - url.headers['Content-Type'] = `application/x-www-form-urlencoded; charset=UTF-8` - url.headers['Origin'] = `https://mobile.rr.tv` - url.headers['Referer'] = `https://mobile.rr.tv/` - url.headers['Accept'] = `application/json, text/plain, */*` - url.headers['Host'] = `api.rr.tv` - url.headers['Accept-Language'] = `zh-cn` - url.headers['Content-Length'] = `0` - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 App/RRSPApp platform/iPhone AppVersion/4.3.5' - chavy.post(url, (error, response, data) => { - try { - signinfo.question = JSON.parse(data) - signinfo.questionopts = {} - for (opt of signinfo.question.data.question.optionViewList) { - signinfo.questionopts[opt.id] = opt - if (!signinfo.answeropt) signinfo.answeropt = opt - else signinfo.answeropt = opt.answererCount > signinfo.answeropt.answererCount ? opt : signinfo.answeropt - } - signinfo.hasAnswered = signinfo.question.data.question.hasAnswered - if (signinfo.hasAnswered) { - signinfo.selectId = signinfo.question.data.question.selectId - signinfo.isRight = signinfo.questionopts[signinfo.selectId].isRight - } - resolve() - } catch (e) { - chavy.msg(cookieName, `获取问题: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} getquestion - 获取问题失败: ${e}`) - chavy.log(`❌ ${cookieName} getquestion - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function answerquestion() { - return new Promise((resolve, reject) => { - let url = {url: `https://api.rr.tv/v3plus/question/answerQuestion`, headers: {token: VAL_signcookie}} - url.body = `optionId=${signinfo.answeropt.id}` - url.headers['clientType'] = `ios_rrsp_jzsp` - url.headers['Accept-Encoding'] = `gzip, deflate, br` - url.headers['Connection'] = `keep-alive` - url.headers['clientVersion'] = `4.3.5` - url.headers['Content-Type'] = `application/x-www-form-urlencoded; charset=UTF-8` - url.headers['Origin'] = `https://mobile.rr.tv` - url.headers['Referer'] = `https://mobile.rr.tv/` - url.headers['Accept'] = `application/json, text/plain, */*` - url.headers['Host'] = `api.rr.tv` - url.headers['Accept-Language'] = `zh-cn` - url.headers['Content-Length'] = `0` - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 App/RRSPApp platform/iPhone AppVersion/4.3.5' - chavy.post(url, (error, response, data) => { - try { - signinfo.answerquestion = JSON.parse(data) - resolve() - } catch (e) { - chavy.msg(cookieName, `获取问题: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} getquestion - 获取问题失败: ${e}`) - chavy.log(`❌ ${cookieName} getquestion - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function openbox(boxcode, boxname, body) { - return new Promise((resolve, reject) => { - let url = {url: `https://api.rr.tv/v3plus/taskCenter/openBox`, headers: {token: VAL_signcookie}} - url.body = body - url.headers['Accept'] = `*/*` - url.headers['Accept-Encoding'] = `gzip, deflate, br` - url.headers['Accept-Language'] = `zh-Hans-CN;q=1, en-US;q=0.9` - url.headers['Connection'] = `keep-alive` - url.headers['Content-Type'] = `application/x-www-form-urlencoded` - url.headers['Host'] = `api.rr.tv` - url.headers['User-Agent'] = `PUClient/4.3.6 (iPhone; iOS 13.3.1; Scale/2.00)` - url.headers['clientType'] = `ios_rrsp_jzsp` - url.headers['clientVersion'] = `4.3.6` - url.headers['deviceMode'] = `iPhone 8` - url.headers['p'] = `iOS` - chavy.post(url, (error, response, data) => { - try { - signinfo[boxcode] = JSON.parse(data) - resolve() - } catch (e) { - chavy.msg(cookieName, `打开${boxname}: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} getquestion - 打开${boxname}失败: ${e}`) - chavy.log(`❌ ${cookieName} getquestion - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function showmsg() { - let subTitle = '' - let detail = '' - if (signinfo.signdaily) { - subTitle = `签到: ` - if (signinfo.signdaily.code == '0000' || signinfo.signdaily.code == '8750') { - subTitle += signinfo.signdaily.code == '0000' ? '成功; ' : '' - subTitle += signinfo.signdaily.code == '8750' ? '重复; ' : '' - } else { - subTitle += '失败; ' - } - } - if (signinfo.signwelfare) { - subTitle += `福利: ` - if (signinfo.signwelfare.code == '0000' || signinfo.signwelfare.code == '8623') { - subTitle += signinfo.signwelfare.code == '0000' ? '成功; ' : '' - subTitle += signinfo.signwelfare.code == '8623' ? '重复; ' : '' - } else { - subTitle += '失败;' - } - } - if (signinfo.question && signinfo.questionopts) { - subTitle += `答题: ${signinfo.isRight ? '✅' : '❌'}` - } - - if (signinfo.userinfo.code == '0000') { - const levelStr = signinfo.userinfo.data.user.levelStr ? ` (${signinfo.userinfo.data.user.levelStr})` : `` - detail = `等级: ${signinfo.userinfo.data.user.level}${levelStr}, 银币: ${signinfo.userinfo.data.user.silverCount}` - } else { - detail = `编码: ${signinfo.userinfo.code}, 说明: ${signinfo.userinfo.msg}` - } - - if (signinfo.question.data.question) { - detail += `\n查看答题详情` - detail += `\n\n问题: ${signinfo.question.data.question.questionStr}` - for (key in signinfo.questionopts) detail += `\n选项: ${signinfo.questionopts[key].optionStr}, 回答人数: ${signinfo.questionopts[key].answererCount} (${signinfo.questionopts[key].percent})` - if (signinfo.selectId) { - detail += `\n最佳回答: ${signinfo.answeropt.optionStr}` - detail += `\n我的回答: ${signinfo.questionopts[signinfo.selectId].optionStr}` - detail += `${signinfo.isRight ? '✅' : '❌'}\n` - } else { - detail += `\n最佳回答: ${signinfo.answeropt.optionStr}\n` - } - } - - if (signinfo.copperbox) { - if (signinfo.copperbox.code == '0000') { - for (box of signinfo.copperbox.data.boxs) detail += `\n铜宝箱: ${box.rewardName} (+${box.rewardNum})` - } else { - detail += `\n铜宝箱: ${signinfo.copperbox.msg}` - } - } - - if (signinfo.silverbox) { - if (signinfo.silverbox.code == '0000') { - for (box of signinfo.silverbox.data.boxs) detail += `\n银宝箱: ${box.rewardName} (+${box.rewardNum})` - } else { - detail += `\n银宝箱: ${signinfo.silverbox.msg}` - } - } - - if (signinfo.goldenbox) { - if (signinfo.goldenbox.code == '0000') { - for (box of signinfo.goldenbox.data.boxs) detail += `\n金宝箱: ${box.rewardName} (+${box.rewardNum})` - } else { - detail += `\n金宝箱: ${signinfo.goldenbox.msg}` - } - } - chavy.msg(cookieName, subTitle, detail) -} - -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} -} diff --git a/Scripts/SignIn/SMZDM/README.md b/Scripts/SignIn/SMZDM/README.md deleted file mode 100644 index 4a756b6..0000000 --- a/Scripts/SignIn/SMZDM/README.md +++ /dev/null @@ -1,84 +0,0 @@ -# 什么值得买 - -# 注意!注意!注意! - -目前不完美: - -1. ~~签到后系统提示“签到结果: 未知”~~ (Fixed) -2. 签到后手机 APP 上显示未签到(但实际上你用 pc 浏览器登录是会显示已经签到的) - -上述问题待跟进 - -## 配置 - -```properties -[MITM] -*.smzdm.com - -[Script] -http-request ^https:\/\/www\.smzdm\.com\/?.? script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/smzdm/smzdm.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/smzdm/smzdm.js -``` - -## 说明 - -1. 先把`*.smzdm.com`加到`[MITM]` -2. 再把两条远程脚本放到`[Script]` -3. 浏览器访问并登录: https://zhiyou.smzdm.com/user/login -4. 打开浏览器访问: https://www.smzdm.com -5. `Surge`提示: `Cookie [什么值得买] 写入成功` -6. 最后就可以把第 1 条脚本注释掉了 - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/SMZDM/quanx/README.md b/Scripts/SignIn/SMZDM/quanx/README.md deleted file mode 100644 index b3bd920..0000000 --- a/Scripts/SignIn/SMZDM/quanx/README.md +++ /dev/null @@ -1,92 +0,0 @@ -# 什么值得买 - -> 2020.1.11 QuanX 在`190`版本开始, 获取 Cookie 方式需要从`script-response-body`改为`script-request-header` - -# 注意!注意!注意! - -目前不完美: - -1. ~~签到后系统提示“签到结果: 未知”~~ (Fixed) -2. 签到后手机 APP 上显示未签到(但实际上你用 pc 浏览器登录是会显示已经签到的) - -上述问题待跟进 - -## 配置 - -```properties -[MITM] -*.smzdm.com - -[rewrite_local] -# 189及以前版本 -^https:\/\/www\.smzdm\.com\/?.? url script-response-body smzdm.cookie.js -# 190及以后版本 -^https:\/\/www\.smzdm\.com\/?.? url script-request-header smzdm.cookie.js - -[task_local] -1 0 * * * smzdm.js -``` - -## 说明 - -1. 先把`*.smzdm.com`加到`[MITM]` -2. 把`smzdm.cookie.js`和`smzdm.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 再把两条脚本分别放到`[rewrite_local]`和`[task_local]` -4. 浏览器访问并登录: https://zhiyou.smzdm.com/user/login -5. 打开浏览器访问: https://www.smzdm.com -6. `QuanX`提示: `Cookie [什么值得买] 写入成功` -7. 最后就可以把`[rewrite_local]`的脚本注释掉了 - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:01:00`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 QuanX 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/SMZDM/quanx/smzdm.cookie.js b/Scripts/SignIn/SMZDM/quanx/smzdm.cookie.js deleted file mode 100644 index d2fb01a..0000000 --- a/Scripts/SignIn/SMZDM/quanx/smzdm.cookie.js +++ /dev/null @@ -1,15 +0,0 @@ -const cookieName = '什么值得买' -const cookieKey = 'chavy_cookie_smzdm' -const cookieVal = $request.headers['Cookie'] - -if (cookieVal) { - let cookie = $prefs.setValueForKey(cookieVal, cookieKey) - if (cookie) { - let msg = `${cookieName}` - $notify(msg, 'Cookie写入成功', '详见日志') - console.log(msg) - console.log(cookieVal) - } -} - -$done({}) diff --git a/Scripts/SignIn/SMZDM/quanx/smzdm.js b/Scripts/SignIn/SMZDM/quanx/smzdm.js deleted file mode 100644 index 814c5b6..0000000 --- a/Scripts/SignIn/SMZDM/quanx/smzdm.js +++ /dev/null @@ -1,41 +0,0 @@ -const cookieName = '什么值得买' -const cookieKey = 'chavy_cookie_smzdm' -const cookieVal = $prefs.valueForKey(cookieKey) - -function sign() { - let url = { - url: `https://zhiyou.smzdm.com/user/checkin/jsonp_checkin`, - headers: { - Cookie: cookieVal - } - } - url.headers['Referer'] = 'http://www.smzdm.com/' - url.headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36' - - $task.fetch(url).then((response) => { - let data = response.body - let result = JSON.parse(data) - let title = `${cookieName}` - // 签到成功 - if (result && result.data && result.error_code == 0) { - let subTitle = `签到结果: 成功` - let detail = `累计: ${result.data.checkin_num}次, 经验: ${result.data.exp}, 金币: ${result.data.gold}, 积分: ${result.data.point}` - $notify(title, subTitle, detail) - } - // 登录失效 - else if (result && result.data && result.error_code == 99) { - let subTitle = `签到结果: 失败` - let detail = `说明: 登录失效, 请重新获取Cookie` - $notify(title, subTitle, detail) - } - // 签到失败 - else { - let subTitle = `签到结果: 失败` - let detail = `编码: ${result.error_code}, 说明: ${result.error_msg}` - $notify(title, subTitle, detail) - } - console.log(`${cookieName}, data: ${data}`) - }) -} - -sign() diff --git a/Scripts/SignIn/SMZDM/smzdm.cookie.js b/Scripts/SignIn/SMZDM/smzdm.cookie.js deleted file mode 100644 index c443e07..0000000 --- a/Scripts/SignIn/SMZDM/smzdm.cookie.js +++ /dev/null @@ -1,15 +0,0 @@ -const cookieName = '什么值得买' -const cookieKey = 'chavy_cookie_smzdm' -const cookieVal = $request.headers['Cookie'] - -if (cookieVal) { - let cookie = $persistentStore.write(cookieVal, cookieKey) - if (cookie) { - let msg = `${cookieName}` - $notification.post(msg, 'Cookie写入成功', '详见日志') - console.log(msg) - console.log(cookieVal) - } -} - -$done({}) diff --git a/Scripts/SignIn/SMZDM/smzdm.js b/Scripts/SignIn/SMZDM/smzdm.js deleted file mode 100644 index 01bfcee..0000000 --- a/Scripts/SignIn/SMZDM/smzdm.js +++ /dev/null @@ -1,42 +0,0 @@ -const cookieName = '什么值得买' -const cookieKey = 'chavy_cookie_smzdm' -const cookieVal = $persistentStore.read(cookieKey) - -function sign() { - let url = { - url: `https://zhiyou.smzdm.com/user/checkin/jsonp_checkin`, - headers: { - Cookie: cookieVal - } - } - url.headers['Referer'] = 'http://www.smzdm.com/' - url.headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36' - - $httpClient.get(url, (error, response, data) => { - let result = JSON.parse(data) - let title = `${cookieName}` - // 签到成功 - if (result && result.data && result.error_code == 0) { - let subTitle = `签到结果: 成功` - let detail = `累计: ${result.data.checkin_num}次, 经验: ${result.data.exp}, 金币: ${result.data.gold}, 积分: ${result.data.point}` - $notification.post(title, subTitle, detail) - } - // 登录失效 - else if (result && result.data && result.error_code == 99) { - let subTitle = `签到结果: 失败` - let detail = `说明: 登录失效, 请重新获取Cookie` - $notification.post(title, subTitle, detail) - } - // 签到失败 - else { - let subTitle = `签到结果: 失败` - let detail = `编码: ${result.error_code}, 说明: ${result.error_msg}` - $notification.post(title, subTitle, detail) - } - console.log(`${cookieName}, data: ${data}`) - }) - - $done({}) -} - -sign() diff --git a/Scripts/SignIn/SfExpress/README.md b/Scripts/SignIn/SfExpress/README.md deleted file mode 100644 index 4f2809d..0000000 --- a/Scripts/SignIn/SfExpress/README.md +++ /dev/null @@ -1,108 +0,0 @@ -# 顺丰速运 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> 2020.1.22 据实测顺丰的 Cookie 只能存活 1 天不到,大家先弃坑 - -> 2020.3.15 恢复顺丰签到 (更新脚本、更新配置、重取 Cookie) (QuanX&Surge、商店&TF 都支持) - -> 2020.3.20 修复多余的登录失败提示问题 & 修复没有 \$done() 问题 - -> 2020.3.30 增加 27 周年签到 (增加 1 条`mitm`和 1 条`rewrite`) - -> 2020.5.6 移除 27 周年签到 (活动结束) - -## 配置 (Surge) - -```properties -[MITM] -hostname = sf-integral-sign-in.weixinjia.net, mcs-mimp-web.sf-express.com - -[Script] -http-request ^https:\/\/sf-integral-sign-in.weixinjia.net\/app\/index script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/sfexpress/sfexpress.cookie.js -http-request ^https:\/\/mcs-mimp-web.sf-express.com\/mcs-mimp\/share\/(.*?)Redirect script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/sfexpress/sfexpress.cookie.js -cron "*/10 * * * * *" script-path=scripts/sfexpress.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -hostname = sf-integral-sign-in.weixinjia.net, mcs-mimp-web.sf-express.com - -[rewrite_local] -# [商店版] -^https:\/\/sf-integral-sign-in.weixinjia.net\/app\/index url script-request-header sfexpress.cookie.js -^https:\/\/mcs-mimp-web.sf-express.com\/mcs-mimp\/share\/(.*?)Redirect url script-request-header sfexpress.cookie.js - -# [TF版] -^https:\/\/sf-integral-sign-in.weixinjia.net\/app\/index url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/sfexpress/sfexpress.cookie.js -^https:\/\/mcs-mimp-web.sf-express.com\/mcs-mimp\/share\/(.*?)Redirect url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/sfexpress/sfexpress.cookie.js - -[task_local] -1 0 * * * sfexpress.js -``` - -## 说明 - -1. 先把`sf-integral-sign-in.weixinjia.net`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`sfexpress.cookie.js`和`sfexpress.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP, 访问下`我的顺丰` > `去签到` (访问下`去签到`的页面即可, 不用点`签到`), 系统提示: `获取Cookie: 成功` -4. 打开 APP, 访问下`27周年庆`, 系统提示: `获取Cookie: 成功 (27周年)` -5. 最后就可以把第 1 条脚本注释掉了 - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/SfExpress/sfexpress.cookie.js b/Scripts/SignIn/SfExpress/sfexpress.cookie.js deleted file mode 100644 index d26c2d8..0000000 --- a/Scripts/SignIn/SfExpress/sfexpress.cookie.js +++ /dev/null @@ -1,66 +0,0 @@ -const chavy = init() -const cookieName = '顺丰速运' -const KEY_loginurl = 'chavy_loginurl_sfexpress' -const KEY_loginheader = 'chavy_loginheader_sfexpress' -const KEY_login27url = 'chavy_login27url_sfexpress' -const KEY_login27header = 'chavy_login27header_sfexpress' - -if ($request && $request.method != 'OPTIONS' && $request.url.match(/app\/index/)) { - const VAL_loginurl = $request.url - const VAL_loginheader = JSON.stringify($request.headers) - if (VAL_loginurl) chavy.setdata(VAL_loginurl, KEY_loginurl) - if (VAL_loginheader) chavy.setdata(VAL_loginheader, KEY_loginheader) - chavy.msg(cookieName, `获取Cookie: 成功`, ``) -} else if ($request && $request.method != 'OPTIONS' && $request.url.match(/mcs-mimp\/share\/(.*?)Redirect/)) { - const VAL_login27url = $request.url - const VAL_login27header = JSON.stringify($request.headers) - if (VAL_login27url) chavy.setdata(VAL_login27url, KEY_login27url) - if (VAL_login27header) chavy.setdata(VAL_login27header, KEY_login27header) - chavy.msg(cookieName, `获取Cookie: 成功 (27周年)`, ``) -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/SfExpress/sfexpress.js b/Scripts/SignIn/SfExpress/sfexpress.js deleted file mode 100644 index 855e3be..0000000 --- a/Scripts/SignIn/SfExpress/sfexpress.js +++ /dev/null @@ -1,224 +0,0 @@ -const $ = new Env('顺丰速运') -$.VAL_loginurl = $.getdata('chavy_loginurl_sfexpress') -$.VAL_loginheader = $.getdata('chavy_loginheader_sfexpress') - -!(async () => { - await refresh() - await loginapp() - await signapp() - await getinfo() - await showmsg() -})() - .catch((e) => $.logErr(e)) - .finally(() => $.done()) - -function refresh() { - if (!$.isQuanX()) return - return new Promise((resolve) => { - const url = {url: `https://sf-integral-sign-in.weixinjia.net/app/signin`, headers: {Cookie: ''}} - url.body = `date=${new Date().getFullYear()}-${new Date().getMonth() + 1}-${new Date().getDate()}` - $.post(url, () => resolve()) - }) -} - -function loginapp() { - return new Promise((resolve) => { - const url = {url: $.VAL_loginurl} - $.get(url, () => resolve()) - }) -} - -function signapp() { - return new Promise((resolve) => { - const url = { - url: `https://sf-integral-sign-in.weixinjia.net/app/signin`, - headers: JSON.parse($.VAL_loginheader) - } - delete url.headers['Cookie'] - url.headers['Origin'] = 'https://sf-integral-sign-in.weixinjia.net' - url.headers['Connection'] = 'keep-alive' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['Accept'] = 'application/json, text/plain, */*' - url.headers['Host'] = 'sf-integral-sign-in.weixinjia.net' - url.headers['Accept-Language'] = 'zh-cn' - url.headers['Accept-Encoding'] = 'gzip, deflate, br' - url.body = `date=${new Date().getFullYear()}-${new Date().getMonth() + 1}-${new Date().getDate()}` - $.post(url, (err, resp, data) => { - try { - $.signapp = JSON.parse(data) - } catch (e) { - $.logErr(e, resp) - } finally { - resolve() - } - }) - }) -} - -function getinfo() { - return new Promise((resolve) => { - const url = {url: `https://sf-integral-sign-in.weixinjia.net/app/init`, headers: JSON.parse($.VAL_loginheader)} - delete url.headers['Cookie'] - url.headers['Origin'] = 'https://sf-integral-sign-in.weixinjia.net' - url.headers['Connection'] = 'keep-alive' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['Accept'] = 'application/json, text/plain, */*' - url.headers['Host'] = 'sf-integral-sign-in.weixinjia.net' - url.headers['Accept-Encoding'] = 'gzip, deflate, br' - url.headers['Accept-Language'] = 'zh-cn' - $.post(url, (err, resp, data) => { - try { - $.info = JSON.parse(data) - } catch (e) { - $.logErr(e, resp) - } finally { - resolve() - } - }) - }) -} - -function showmsg() { - return new Promise((resolve) => { - if ($.signapp.code == 0 && $.signapp.msg == 'success') { - $.subt = `签到: 成功` - } else if ($.signapp.code == -1) { - if ($.signapp.msg == 'ALREADY_CHECK') { - $.subt = `签到: 重复` - } else { - $.subt = `签到: 失败` - } - } else { - $.subt = `签到: 未知` - $.desc = `说明: ${$.signapp.msg}` - } - if ($.info && $.info.code == 0) { - $.desc = `积分: ${$.info.data.member_info.integral}, 本周连签: ${$.info.data.check_count}天` - } - $.msg($.name, $.subt, $.desc) - 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 - } - - 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) -} diff --git a/Scripts/SignIn/SuNing/README.md b/Scripts/SignIn/SuNing/README.md deleted file mode 100644 index 3599a6b..0000000 --- a/Scripts/SignIn/SuNing/README.md +++ /dev/null @@ -1,112 +0,0 @@ -# 苏宁易购 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> 有一定动手及排查问题能力的同学先上车 - -> 2020.3.15 增加天天低价, 注意更新`mitm`和`rewrite`并进入天天低价获取两次 Cookie - -> 2020.3.16 修复部分机型的`天天红包`就算 Cookie 获取成功也会签到失败问题 - -> 2020.5.7 修复部分场景下报`d.obj.couponRuleName`问题 - -## 配置 (Surge) - -```properties -[MITM] -hostname = passport.suning.com, luckman.suning.com, sign.suning.com, gameapi.suning.com - -[Script] -# 注意有4条获取 Cookie 脚本 -http-request ^https:\/\/passport.suning.com\/ids\/login$ script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/suning/suning.cookie.js, requires-body=true -http-request ^https:\/\/luckman.suning.com\/luck-web\/sign\/api\/clock_sign.do script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/suning/suning.cookie.js -http-request ^https:\/\/sign.suning.com\/sign-web\/m\/promotion\/sign\/doSign.do script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/suning/suning.cookie.js -http-request ^https:\/\/gameapi.suning.com\/sngame-web\/(api\/signin\/private\/customerSignOperation.do|gateway\/api\/queryPrize.do) script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/suning/suning.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/suning/suning.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -hostname = passport.suning.com, luckman.suning.com, sign.suning.com, gameapi.suning.com - -[rewrite_local] -# 注意有4条获取 Cookie 脚本 -^https:\/\/passport.suning.com\/ids\/login$ url script-request-body suning.cookie.js -^https:\/\/luckman.suning.com\/luck-web\/sign\/api\/clock_sign.do url script-request-header suning.cookie.js -^https:\/\/sign.suning.com\/sign-web\/m\/promotion\/sign\/doSign.do url script-request-header suning.cookie.js -^https:\/\/gameapi.suning.com\/sngame-web\/(api\/signin\/private\/customerSignOperation.do|gateway\/api\/queryPrize.do) url script-request-header suning.cookie.js - -[task_local] -1 0 * * * suning.js -``` - -## 说明 - -1. 先把`passport.suning.com, luckman.suning.com, sign.suning.com, gameapi.suning.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`suning.cookie.js`和`suning.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 获取 Cookie: - - 【必要】打开 APP, 系统提示: `获取Cookie: 成功 (登录链接)` - - 【可选】进入 `主页` > `签到有礼`, 系统提示: `获取Cookie: 成功 (每日签到)` - - 【可选】进入 `主页` > `领取红包`, 系统提示: `获取Cookie: 成功 (每日红包)` (如果找不到领取红包,尝试卸载苏宁重新安装) 兼容之前 @barrymchen 写的 snyg.js 如果之前有用这个脚本获取过 Cookie 那不用重新取 - - 【可选】进入 `主页` > `天天低价` > `点右上角宝箱`, 系统提示: `获取Cookie: 成功 (天天低价)`、`获取Cookie: 成功 (查询天天低价)` -4. 把获取 Cookie 的脚本注释或删掉 - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) - -@makexp diff --git a/Scripts/SignIn/SuNing/suning.cookie.js b/Scripts/SignIn/SuNing/suning.cookie.js deleted file mode 100644 index cf979a6..0000000 --- a/Scripts/SignIn/SuNing/suning.cookie.js +++ /dev/null @@ -1,104 +0,0 @@ -const chavy = init() -const cookieName = '苏宁易购' -const KEY_loginurl = 'chavy_login_url_suning' -const KEY_loginbody = 'chavy_login_body_suning' -const KEY_loginheader = 'chavy_login_header_suning' -const KEY_signurl = 'chavy_sign_url_suning' -const KEY_signheader = 'chavy_sign_header_suning' -const KEY_signweburl = 'chavy_signweb_url_suning' -const KEY_signwebheader = 'chavy_signweb_header_suning' -const KEY_signgameurl = 'chavy_signgame_url_suning' -const KEY_signgameheader = 'chavy_signgame_header_suning' -const KEY_signgetgameurl = 'chavy_signgetgame_url_suning' -const KEY_signgetgameheader = 'chavy_signgetgame_header_suning' - -if ($request.url.match(/\/ids\/login/)) { - const VAL_loginurl = $request.url - const VAL_loginbody = $request.body - const VAL_loginheader = JSON.stringify($request.headers) - if (VAL_loginurl) chavy.setdata(VAL_loginurl, KEY_loginurl) - if (VAL_loginbody) chavy.setdata(VAL_loginbody, KEY_loginbody) - if (VAL_loginheader) chavy.setdata(VAL_loginheader, KEY_loginheader) - chavy.msg(`${cookieName}`, '获取Cookie: 成功 (登录链接)', '') - chavy.log(`❕ ${cookieName} 获取Cookie: 成功, VAL_loginurl: ${VAL_loginurl}`) - chavy.log(`❕ ${cookieName} 获取Cookie: 成功, VAL_loginbody: ${VAL_loginbody}`) - chavy.log(`❕ ${cookieName} 获取Cookie: 成功, VAL_loginheader: ${VAL_loginheader}`) -} else if ($request.url.match(/\/sign\/doSign.do/)) { - const VAL_signurl = $request.url - const VAL_signheader = JSON.stringify($request.headers) - if (VAL_signurl) chavy.setdata(VAL_signurl, KEY_signurl) - if (VAL_signheader) chavy.setdata(VAL_signheader, KEY_signheader) - chavy.msg(`${cookieName}`, '获取Cookie: 成功 (每日签到)', '') - chavy.log(`❕ ${cookieName} 获取Cookie: 成功, VAL_signurl: ${VAL_signurl}`) - chavy.log(`❕ ${cookieName} 获取Cookie: 成功, VAL_signheader: ${VAL_signheader}`) -} else if ($request.url.match(/\/api\/clock_sign.do/)) { - const VAL_signweburl = $request.url - const VAL_signwebheader = JSON.stringify($request.headers) - if (VAL_signweburl) chavy.setdata(VAL_signweburl, KEY_signweburl) - if (VAL_signwebheader) chavy.setdata(VAL_signwebheader, KEY_signwebheader) - chavy.msg(`${cookieName}`, '获取Cookie: 成功 (每日红包)', '') - chavy.log(`❕ ${cookieName} 获取Cookie: 成功, VAL_signweburl: ${VAL_signweburl}`) - chavy.log(`❕ ${cookieName} 获取Cookie: 成功, VAL_signwebheader: ${VAL_signwebheader}`) -} else if ($request.url.match(/customerSignOperation.do/)) { - const VAL_signgameurl = $request.url - const VAL_signgameheader = JSON.stringify($request.headers) - if (VAL_signgameurl) chavy.setdata(VAL_signgameurl, KEY_signgameurl) - if (VAL_signgameheader) chavy.setdata(VAL_signgameheader, KEY_signgameheader) - chavy.msg(`${cookieName}`, '获取Cookie: 成功 (天天低价)', '') - chavy.log(`❕ ${cookieName} 获取Cookie: 成功, VAL_signgameurl: ${VAL_signgameurl}`) - chavy.log(`❕ ${cookieName} 获取Cookie: 成功, VAL_signgameheader: ${VAL_signgameheader}`) -} else if ($request.url.match(/queryPrize.do/)) { - const VAL_signgetgameurl = $request.url - const VAL_signgetgameheader = JSON.stringify($request.headers) - if (VAL_signgetgameurl) chavy.setdata(VAL_signgetgameurl, KEY_signgetgameurl) - if (VAL_signgetgameheader) chavy.setdata(VAL_signgetgameheader, KEY_signgetgameheader) - chavy.msg(`${cookieName}`, '获取Cookie: 成功 (查询天天低价)', '') - chavy.log(`❕ ${cookieName} 获取Cookie: 成功, VAL_signgetgameurl: ${VAL_signgetgameurl}`) - chavy.log(`❕ ${cookieName} 获取Cookie: 成功, VAL_signgetgameheader: ${VAL_signgetgameheader}`) -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/SuNing/suning.js b/Scripts/SignIn/SuNing/suning.js deleted file mode 100644 index d17ecfb..0000000 --- a/Scripts/SignIn/SuNing/suning.js +++ /dev/null @@ -1,323 +0,0 @@ -const chavy = init() -const cookieName = '苏宁易购' -const KEY_loginurl = 'chavy_login_url_suning' -const KEY_loginbody = 'chavy_login_body_suning' -const KEY_loginheader = 'chavy_login_header_suning' -const KEY_signurl = 'chavy_sign_url_suning' -const KEY_signheader = 'chavy_sign_header_suning' -const KEY_signweburl = 'chavy_signweb_url_suning' -const KEY_signweburlBarry = 'snyg_userTokenKey' -const KEY_signwebheader = 'chavy_signweb_header_suning' -const KEY_signgameurl = 'chavy_signgame_url_suning' -const KEY_signgameheader = 'chavy_signgame_header_suning' -const KEY_signgetgameurl = 'chavy_signgetgame_url_suning' -const KEY_signgetgameheader = 'chavy_signgetgame_header_suning' -const KEY_runflag = 'chavy_runflag_suning' - -const signinfo = {} -let VAL_loginurl = chavy.getdata(KEY_loginurl) -let VAL_loginbody = chavy.getdata(KEY_loginbody) -let VAL_loginheader = chavy.getdata(KEY_loginheader) -let VAL_signurl = chavy.getdata(KEY_signurl) -let VAL_signheader = chavy.getdata(KEY_signheader) -let VAL_signweburl = chavy.getdata(KEY_signweburl) -let VAL_signweburlBarry = chavy.getdata(KEY_signweburlBarry) -let VAL_signwebheader = chavy.getdata(KEY_signwebheader) -let VAL_signgameurl = chavy.getdata(KEY_signgameurl) -let VAL_signgameheader = chavy.getdata(KEY_signgameheader) -let VAL_signgetgameurl = chavy.getdata(KEY_signgetgameurl) -let VAL_signgetgameheader = chavy.getdata(KEY_signgetgameheader) -let VAL_runflag = chavy.getdata(KEY_runflag) - -;(sign = async () => { - chavy.log(`🔔 ${cookieName}`) - await loginapp() - if (VAL_signurl) await signapp() - await getinfo() - if (VAL_signweburl || VAL_signweburlBarry) await signweb(), await getwebinfo() - if (VAL_signgameurl && VAL_signgetgameurl) await signgame(), await getgameinfo() - showmsg() - chavy.done() -})().catch((e) => chavy.log(`❌ ${cookieName} 签到失败: ${e}`), chavy.done()) - -function loginapp() { - return new Promise((resolve, reject) => { - const url = {url: VAL_loginurl, body: VAL_loginbody, headers: JSON.parse(VAL_loginheader)} - // chavy.log(`❕ ${cookieName} loginapp - VAL_runflag: ${VAL_runflag}`) - // if (VAL_runflag) delete url.headers['Cookie'] - // else chavy.setdata('true', KEY_runflag) - chavy.post(url, (error, response, data) => { - resolve() - }) - }) -} - -function signapp() { - return new Promise((resolve, reject) => { - const url = {url: VAL_signurl, headers: JSON.parse(VAL_signheader)} - delete url.headers['Cookie'] - chavy.get(url, (error, response, data) => { - try { - chavy.log(`❕ ${cookieName} signapp - response: ${JSON.stringify(response)}`) - 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() - } - }) - }) -} - -function signgame() { - return new Promise((resolve, reject) => { - const url = {url: VAL_signgameurl, headers: JSON.parse(VAL_signgameheader)} - delete url.headers['Cookie'] - chavy.get(url, (error, response, data) => { - try { - chavy.log(`❕ ${cookieName} signgame - response: ${JSON.stringify(response)}`) - signinfo.signgame = JSON.parse(data) - resolve() - } catch (e) { - chavy.msg(cookieName, `天天低价: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} signgame - 签到失败: ${e}`) - chavy.log(`❌ ${cookieName} signgame - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function signweb() { - return new Promise((resolve, reject) => { - let url = null - if (VAL_signweburl) { - url = {url: VAL_signweburl, headers: JSON.parse(VAL_signwebheader)} - delete url.headers['Cookie'] - url.headers['Host'] = 'luckman.suning.com' - url.headers['Referer'] = 'https: //luckman.suning.com/luck-web/sign/app/index_sign.htm?wx_navbar_transparent=true' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 SNEBUY-APP 8.5.0 SNCLIENT-WAP' - } else if (VAL_signweburlBarry) { - url = {url: VAL_signweburlBarry, headers: {}} - url.headers['Cookie'] = chavy.getdata('snyg_userCookieKey') - url.headers['Accept'] = 'application/json' - url.headers['Accept-Encoding'] = 'gzip, deflate, br' - url.headers['Connection'] = 'keep-alive' - url.headers['Referer'] = 'https://luckman.suning.com/luck-web/sign/app/index_sign.htm?wx_navbar_transparent=true' - url.headers['Host'] = 'luckman.suning.com' - url.headers['User-Agent'] = chavy.getdata('snyg_userAgentKey') - url.headers['Accept-Language'] = 'en-us' - url.headers['X-Requested-With'] = 'XMLHttpRequest' - } - chavy.get(url, (error, response, data) => { - try { - chavy.log(`❕ ${cookieName} signweb - response: ${JSON.stringify(response)}`) - signinfo.signweb = JSON.parse(data) - resolve() - } catch (e) { - chavy.msg(cookieName, `每日红包: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} signweb - 每日红包失败: ${e}`) - chavy.log(`❌ ${cookieName} signweb - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function getwebinfo() { - return new Promise((resolve, reject) => { - const timestamp = Math.round(new Date().getTime()).toString() - const VAL_webinfourl = `https://luckman.suning.com/luck-web/sign/api/query/detail/record_sign.do?terminal=app&channel=sign&_=${timestamp}` - const url = {url: VAL_webinfourl, headers: JSON.parse(VAL_signheader)} - delete url.headers['Cookie'] - url.headers['Host'] = 'luckman.suning.com' - chavy.get(url, (error, response, data) => { - try { - chavy.log(`❕ ${cookieName} getwebinfo - response: ${JSON.stringify(response)}`) - signinfo.webinfo = JSON.parse(data) - resolve() - } catch (e) { - chavy.msg(cookieName, `领红包结果: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} getwebinfo - 领红包失败: ${e}`) - chavy.log(`❌ ${cookieName} getwebinfo - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function getgameinfo() { - return new Promise((resolve, reject) => { - const url = {url: VAL_signgetgameurl, headers: JSON.parse(VAL_signgetgameheader)} - delete url.headers['Cookie'] - chavy.get(url, (error, response, data) => { - try { - chavy.log(`❕ ${cookieName} getgameinfo - response: ${JSON.stringify(response)}`) - signinfo.gameinfo = JSON.parse(data.match(/\((.*)\)/)[1]) - resolve() - } catch (e) { - chavy.msg(cookieName, `查询天天低价: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} getgameinfo - 查询天天低价失败: ${e}`) - chavy.log(`❌ ${cookieName} getgameinfo - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function getinfo() { - return new Promise((resolve, reject) => { - const timestamp = Math.round(new Date().getTime()).toString() - const url = { - url: `https://sign.suning.com/sign-web/m/newsign/getDiamondInfo.do?_=${timestamp}`, - headers: JSON.parse(VAL_signheader) - } - delete url.headers['Cookie'] - chavy.get(url, (error, response, data) => { - try { - chavy.log(`❕ ${cookieName} getinfo - info: ${JSON.stringify(response)}`) - signinfo.info = JSON.parse(data) - resolve() - } catch (e) { - chavy.msg(cookieName, `获取签到信息: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} getinfo - 获取签到信息失败: ${e}`) - chavy.log(`❌ ${cookieName} getinfo - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function showmsg() { - let subTitle = '' - let detail = '' - let moreDetail = '' - if (signinfo.signapp && signinfo.signapp.code == '1') { - if (signinfo.signapp.data.todayFirstSignFlag == true) subTitle = '签到: 成功' - else subTitle = '签到: 重复' - for (myinfo of signinfo.info.data) { - detail += detail == '' ? '总共: ' : ', ' - detail += myinfo.showLabel - } - if (signinfo.signapp.data.prizeLists) { - detail += `, 说明: 还有${signinfo.signapp.data.remainingPoint}云钻待领取` - const prizeLists = signinfo.signapp.data.prizeLists - const customerDays = signinfo.signapp.data.customerDays - const prize = prizeLists[customerDays - 1] - moreDetail += moreDetail == '' ? '' : '\n' - moreDetail += '\n💎 每日签到: ' - for (res of prize) moreDetail += `\n${res.prizeName}: ${res.prizeContent}` - } - } else { - subTitle = '签到: 失败' - chavy.log(`❌ ${cookieName} showmsg - 每日签到: ${JSON.stringify(signinfo.signapp)}`) - } - - subTitle += subTitle == '' ? '' : ', ' - if (signinfo.signweb) { - if (signinfo.signweb.respCode == '1') { - subTitle += '红包: 成功' - } else if (signinfo.signweb.respCode == '70512') { - subTitle += '红包: 重复' - } else { - subTitle += '红包: 失败' - chavy.log(`❌ ${cookieName} showmsg - 每日红包 - signweb: ${JSON.stringify(signinfo.signweb)}`) - } - } else { - subTitle += '红包: 失败' - chavy.log(`❌ ${cookieName} showmsg - 每日红包 - signweb: ${JSON.stringify(signinfo.signweb)}`) - } - - subTitle += subTitle == '' ? '' : ', ' - if (signinfo.signgame && signinfo.signgame.code == '1') { - if (signinfo.signgame.data.resultCode == 'SG0000') { - subTitle += '低价: 成功' - } else if (signinfo.signgame.data.resultCode == 'SG0103') { - subTitle += '低价: 重复' - } else { - subTitle += '低价: 失败' - chavy.log(`❌ ${cookieName} showmsg - 每日红包 - signgame: ${JSON.stringify(signinfo.signgame)}`) - } - } else { - subTitle += '低价: 失败' - chavy.log(`❌ ${cookieName} showmsg - 每日红包 - signgame: ${JSON.stringify(signinfo.signgame)}`) - } - - if (signinfo.webinfo && signinfo.webinfo.respData) { - const currentIndex = signinfo.webinfo.respData.currentIndex - const detailTreeMap = signinfo.webinfo.respData.detailTreeMap - const currentMap = detailTreeMap[currentIndex] - if (currentMap.signMark == true) { - moreDetail += moreDetail == '' ? '' : '\n' - moreDetail += '\n🧧 每日红包: ' - for (res of currentMap.resList) moreDetail += `\n${res.remark}: ${res.amount}` - } else { - chavy.log(`❌ ${cookieName} showmsg - 每日红包 - webinfo: ${JSON.stringify(signinfo.webinfo)}`) - } - } else { - chavy.log(`❌ ${cookieName} showmsg - 每日红包 - webinfo: ${JSON.stringify(signinfo.webinfo)}`) - } - - if (signinfo.signgame && signinfo.gameinfo && signinfo.gameinfo.code == 1) { - if (signinfo.gameinfo.data.resultCode == 0000) { - moreDetail += moreDetail == '' ? '' : '\n' - moreDetail += '\n💰 天天低价: ' - for (d of signinfo.gameinfo.data.result.datas) - if (d.obj) moreDetail += `\n${d.obj.couponRuleName} (${d.obj.remainValue}元)` - else moreDetail += `\n${d.basePrizeEntity.prizeName} (${d.basePrizeEntity.prizeRules})` - } else { - chavy.log(`❌ ${cookieName} showmsg - 天天低价 - gameinfo: ${JSON.stringify(signinfo.gameinfo)}`) - } - } else { - chavy.log(`❌ ${cookieName} showmsg - 天天低价 - gameinfo: ${JSON.stringify(signinfo.gameinfo)}`) - } - - if (moreDetail) detail += `\n查看签到详情\n${moreDetail}` - chavy.msg(cookieName, subTitle, detail) -} - -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} -} diff --git a/Scripts/SignIn/Tieba/README.md b/Scripts/SignIn/Tieba/README.md deleted file mode 100644 index 43ccc36..0000000 --- a/Scripts/SignIn/Tieba/README.md +++ /dev/null @@ -1,103 +0,0 @@ -# 百度签到 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> 目前支持签到: 贴吧、知道 (2 合 1) - -> 之前已经获取过贴吧 cookie 的话,不需要再次获取 (通用) - -> 2020.1.3: 屏蔽文库签到, 原因: 实际签不上 - -> 2020.1.11 QuanX 在`190`版本开始, 获取 Cookie 方式需要从`script-response-body`改为`script-request-header` - -## 配置 (Surge) - -```properties -[MITM] -tieba.baidu.com - -[Script] -http-request ^https?:\/\/tieba\.baidu\.com\/?.? script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/tieba/tieba.cookie.js -cron "10 0 0 * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/tieba/tieba.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -tieba.baidu.com - -[rewrite_local] -# 189及以前版本 -^https?:\/\/tieba\.baidu\.com\/?.? url script-response-body tieba.cookie.js -# 190及以后版本 -^https?:\/\/tieba\.baidu\.com\/?.? url script-request-header tieba.cookie.js - -[task_local] -1 0 * * * tieba.js -``` - -## 说明 - -1. 先在浏览器登录 `(先登录! 先登录! 先登录!)` -2. 先把`tieba.baidu.com`加到`[MITM]` -3. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`tieba.cookie.js`和`tieba.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -4. 再用浏览器访问一下: https://tieba.baidu.com 或者 https://tieba.baidu.com/index/ -5. 系统提示: `获取Cookie: 成功` -6. 最后就可以把第 1 条脚本注释掉了 - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/Tieba/tieba.cookie.js b/Scripts/SignIn/Tieba/tieba.cookie.js deleted file mode 100644 index d87b747..0000000 --- a/Scripts/SignIn/Tieba/tieba.cookie.js +++ /dev/null @@ -1,64 +0,0 @@ -const cookieName = '百度贴吧' -const cookieKey = 'chavy_cookie_tieba' -const chavy = init() -const cookieVal = $request.headers['Cookie'] - -if (cookieVal.indexOf('BDUSS') > 0) { - let cookie = chavy.setdata(cookieVal, cookieKey) - if (cookie) { - let subTitle = '获取Cookie: 成功' - chavy.msg(`${cookieName}`, subTitle, '') - chavy.log(`[${cookieName}] ${subTitle}, cookie: ${cookieVal}`) - } -} else { - let subTitle = '获取Cookie: 失败' - let detail = `请确保在已登录状态下获取Cookie` - chavy.msg(`${cookieName}`, subTitle, detail) - chavy.log(`[${cookieName}] ${subTitle}, cookie: ${cookieVal}`) -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/Tieba/tieba.js b/Scripts/SignIn/Tieba/tieba.js deleted file mode 100644 index 457025f..0000000 --- a/Scripts/SignIn/Tieba/tieba.js +++ /dev/null @@ -1,343 +0,0 @@ -const $ = new Env('百度签到') -$.VAL_cookies = $.getdata('chavy_cookie_tieba') || $.getdata('CookieTB') - -$.CFG_isOrderBars = $.getdata('CFG_tieba_isOrderBars') || 'false' // 1: 经验排序, 2: 连签排序 -$.CFG_maxShowBars = $.getdata('CFG_tieba_maxShowBars') * 1 || 15 //每次通知数量 -$.CFG_maxSignBars = $.getdata('CFG_tieba_maxSignBars') * 1 || 5 // 每次并发执行多少个任务 -$.CFG_signWaitTime = $.getdata('CFG_tieba_signWaitTime') * 1 || 2000 // 每次并发间隔时间 (毫秒) - -!(async () => { - await tieba() - await zhidao() - await showmsg() -})() - .catch((e) => $.logErr(e)) - .finally(() => $.done()) - -// 贴吧 -function tieba() { - return new Promise((resove) => { - const url = {url: 'https://tieba.baidu.com/mo/q/newmoindex', headers: {Cookie: $.VAL_cookies}} - $.get(url, async (err, resp, data) => { - try { - const _data = JSON.parse(data) - // 处理异常 - if (_data.no !== 0) { - throw new Error(`获取清单失败! 原因: ${_data.error}`) - } - // 组装数据 - $.bars = [] - $.tieba = {tbs: _data.data.tbs} - _data.data.like_forum.forEach((bar) => $.bars.push(barWrapper(bar))) - $.bars = $.bars.sort((a, b) => b.exp - a.exp) - // 开始签到 - await signbars($.bars) - await getbars($.bars) - } catch (e) { - $.logErr(e, resp) - } finally { - resove() - } - }) - }) -} - -async function signbars(bars) { - let signbarActs = [] - // 处理`已签`数据 - bars.filter((bar) => bar.isSign).forEach((bar) => (bar.iscurSign = false)) - // 处理`未签`数据 - let _curbarIdx = 1 - let _signbarCnt = 0 - bars.filter((bar) => !bar.isSign).forEach((bar) => _signbarCnt++) - for (let bar of bars.filter((bar) => !bar.isSign)) { - const signbarAct = (resove) => { - const url = {url: 'https://tieba.baidu.com/sign/add', headers: {Cookie: $.VAL_cookies}} - url.body = `ie=utf-8&kw=${encodeURIComponent(bar.name)}&tbs=${$.tieba.tbs}` - url.headers['Host'] = 'tieba.baidu.com' - url.headers['User-Agent'] = 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 13_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Mobile/15E148 Safari/604.1' - $.post(url, (err, resp, data) => { - try { - const _data = JSON.parse(data) - bar.iscurSign = true - bar.issignSuc = _data.no === 0 || _data.no === 1101 - bar.signNo = _data.no - bar.signMsg = _data.no === 1102 ? '签得太快!' : _data.error - bar.signMsg = _data.no === 2150040 ? '需要验证码!' : _data.error - } catch (e) { - bar.iscurSign = true - bar.issignSuc = false - bar.signNo = null - bar.signMsg = error !== null ? error : e - $.logErr(e, resp) - } finally { - $.log(`❕ 贴吧:【${bar.name}】签到完成!`) - resove() - } - }) - } - signbarActs.push(new Promise(signbarAct)) - if (signbarActs.length === $.CFG_maxSignBars || _signbarCnt === _curbarIdx) { - $.log('', `⏳ 正在发起 ${signbarActs.length} 个签到任务!`) - await Promise.all(signbarActs) - await $.wait($.CFG_signWaitTime) - signbarActs = [] - } - _curbarIdx++ - } -} - -function getbars(bars) { - const getBarActs = [] - for (let bar of bars) { - const getBarAct = (resove) => { - const url = { - url: `http://tieba.baidu.com/sign/loadmonth?kw=${encodeURIComponent(bar.name)}&ie=utf-8`, - headers: {Cookie: $.VAL_cookies} - } - url.headers['Host'] = 'tieba.baidu.com' - url.headers['User-Agent'] = 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 13_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Mobile/15E148 Safari/604.1' - $.get(url, (err, resp, data) => { - try { - const _signinfo = JSON.parse(data).data.sign_user_info - bar.signRank = _signinfo.rank - bar.contsignCnt = _signinfo.sign_keep - bar.totalsignCnt = _signinfo.sign_total - } catch (e) { - bar.contsignCnt = '❓' - $.logErr(e, response) - } finally { - resove() - } - }) - } - getBarActs.push(new Promise(getBarAct)) - } - return Promise.all(getBarActs) -} - -async function zhidao() { - await loginZhidao() - await signZhidao() -} - -function loginZhidao() { - return new Promise((resove) => { - const url = {url: 'https://zhidao.baidu.com/', headers: {Cookie: $.VAL_cookies}} - url.headers['Host'] = 'zhidao.baidu.com' - 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' - $.zhidao = {} - $.post(url, (err, resp, data) => { - try { - $.zhidao.stoken = data.match(/"stoken"[^"]*"([^"]*)"/)[1] - if (!$.zhidao.stoken) { - throw new Error(`获取 stoken 失败! stoken: ${$.zhidao.stoken}`) - } - $.zhidao.isloginSuc = true - $.zhidao.loginMsg = '登录成功' - } catch (e) { - $.zhidao.isloginSuc = false - $.zhidao.loginMsg = '登录失败' - $.logErr(e, resp) - } finally { - resove() - } - }) - }) -} - -function signZhidao() { - // 登录失败, 直接跳出 - if (!$.zhidao.isloginSuc) { - return null - } - return new Promise((resove) => { - const url = {url: 'https://zhidao.baidu.com/submit/user', headers: {Cookie: $.VAL_cookies}} - url.headers['Host'] = 'zhidao.baidu.com' - 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' - const timestamp = Date.parse(new Date()) - const utdata = `61,61,7,0,0,0,12,61,5,2,12,4,24,5,4,1,4,${timestamp}` - url.body = `cm=100509&utdata=${utdata}&stoken=${$.zhidao.stoken}` - $.post(url, (err, resp, data) => { - try { - const _data = JSON.parse(data) - $.zhidao.isSignSuc = true - $.zhidao.signNo = _data.errorNo - $.zhidao.signMsg = _data.errorMsg - } catch (e) { - $.zhidao.isSignSuc = false - $.zhidao.signNo = null - $.zhidao.signMsg = e - $.logErr(e, resp) - } finally { - resove() - } - }) - }) -} - -function barWrapper(bar) { - return {id: bar.forum_id, name: bar.forum_name, exp: bar.user_exp, level: bar.user_level, isSign: bar.is_sign === 1} -} - -function showmsg() { - return new Promise((resolve) => { - // 数据: 签到数量 - const allbarCnt = $.bars.length - let allsignCnt = 0 - let cursignCnt = 0 - let curfailCnt = 0 - $.bars.filter((bar) => bar.isSign).forEach((bar) => (allsignCnt += 1)) - $.bars.filter((bar) => bar.iscurSign && bar.issignSuc).forEach((bar) => (cursignCnt += 1)) - $.bars.filter((bar) => bar.iscurSign && !bar.issignSuc).forEach((bar) => (curfailCnt += 1)) - $.bars = [true, 'true'].includes($.CFG_isOrderBars) ? $.bars.sort((a, b) => b.contsignCnt - a.contsignCnt) : $.bars - allsignCnt += cursignCnt - // 通知: 副标题 - let tiebasubt = '贴吧: ' - if (allbarCnt == allsignCnt) tiebasubt += '成功' - else if (allbarCnt == curfailCnt) tiebasubt += '失败' - else tiebasubt += '部分' - let zhidaosubt = '知道: ' - if ($.zhidao.isSignSuc && $.zhidao.signNo === 0) zhidaosubt += '成功' - else if ($.zhidao.isSignSuc && $.zhidao.signNo === 2) zhidaosubt += '重复' - else zhidaosubt += '失败' - // 通知: 详情 - let _curPage = 1 - const _totalPage = Math.ceil(allbarCnt / $.CFG_maxShowBars) - - $.desc = [] - $.bars.forEach((bar, index) => { - const barno = index + 1 - const signbar = `${bar.isSign || bar.issignSuc ? '🟢' : '🔴'} [${barno}]【${bar.name}】排名: ${bar.signRank}` - const signlevel = `等级: ${bar.level}` - const signexp = `经验: ${bar.exp}` - const signcnt = `连签: ${bar.contsignCnt}/${bar.totalsignCnt}天` - const signmsg = `${bar.isSign || bar.issignSuc ? '' : `失败原因: ${bar.signMsg}\n`}` - $.desc.push(`${signbar}`) - $.desc.push(`${signlevel}, ${signexp}, ${signcnt}`) - $.desc.push(`${signmsg}`) - if (barno % $.CFG_maxShowBars === 0 || barno === allbarCnt) { - const _descinfo = [] - _descinfo.push(`共签: ${allsignCnt}/${allbarCnt}, 本次成功: ${cursignCnt}, 本次失败: ${curfailCnt}`) - _descinfo.push(`点击查看详情, 第 ${_curPage++}/${_totalPage} 页`) - $.subt = `${tiebasubt}, ${zhidaosubt}` - $.desc = [..._descinfo, '', ...$.desc].join('\n') - $.msg($.name, $.subt, $.desc) - $.desc = [] - } - }) - 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/Scripts/SignIn/V2EX/README.md b/Scripts/SignIn/V2EX/README.md deleted file mode 100644 index ae008e7..0000000 --- a/Scripts/SignIn/V2EX/README.md +++ /dev/null @@ -1,75 +0,0 @@ -# V2EX - -## 配置 - -```properties -[MITM] -*.v2ex.com - -[Script] -http-request ^https:\/\/www\.v2ex\.com\/mission\/daily script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/v2ex/v2ex.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/v2ex/v2ex.js -``` - -## 说明 - -1. 先把`*.v2ex.com`加到`[MITM]` -2. 再把两条远程脚本放到`[Script]` -3. 浏览器访问并登录: https://www.v2ex.com -4. 打开浏览器访问: https://www.v2ex.com/mission/daily -5. `Surge`提示: `Cookie [V2EX] 写入成功` -6. 最后就可以把第 1 条脚本注释掉了 - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/V2EX/quanx/README.md b/Scripts/SignIn/V2EX/quanx/README.md deleted file mode 100644 index 352516a..0000000 --- a/Scripts/SignIn/V2EX/quanx/README.md +++ /dev/null @@ -1,82 +0,0 @@ -# 百度贴吧 - -> 2020.1.11 QuanX 在`190`版本开始, 获取 Cookie 方式需要从`script-response-body`改为`script-request-header` - -## 配置 - -```properties -[MITM] -*.v2ex.com - -[rewrite_local] -# 189及以前版本 -^https:\/\/www\.v2ex\.com\/mission\/daily url script-response-body v2ex.cookie.js -# 190及以后版本 -^https:\/\/www\.v2ex\.com\/mission\/daily url script-request-header v2ex.cookie.js - -[task_local] -1 0 * * * v2ex.js -``` - -## 说明 - -1. 先把`*.v2ex.com`加到`[MITM]` -2. 再把两条远程脚本放到`[Script]` -3. 先在浏览器登录 `(先登录! 先登录! 先登录!)` -4. 打开浏览器访问: https://www.v2ex.com/mission/daily -5. `QuanX`提示: `Cookie [V2EX] 写入成功` (如果提示多条写入成功,忽略就好) -6. 最后就可以把第 1 条脚本注释掉了 - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 QuanX 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/V2EX/quanx/v2ex.cookie.js b/Scripts/SignIn/V2EX/quanx/v2ex.cookie.js deleted file mode 100644 index 8e2bfe7..0000000 --- a/Scripts/SignIn/V2EX/quanx/v2ex.cookie.js +++ /dev/null @@ -1,15 +0,0 @@ -const cookieName = 'V2EX' -const cookieKey = 'chavy_cookie_v2ex' -const cookieVal = $request.headers['Cookie'] - -if (cookieVal) { - let cookie = $prefs.setValueForKey(cookieVal, cookieKey) - if (cookie) { - let msg = `${cookieName}` - $notify(msg, 'Cookie写入成功', '详见日志') - console.log(msg) - console.log(cookieVal) - } -} - -$done({}) diff --git a/Scripts/SignIn/V2EX/quanx/v2ex.js b/Scripts/SignIn/V2EX/quanx/v2ex.js deleted file mode 100644 index 78339d3..0000000 --- a/Scripts/SignIn/V2EX/quanx/v2ex.js +++ /dev/null @@ -1,51 +0,0 @@ -const cookieName = 'V2EX' -const cookieKey = 'chavy_cookie_v2ex' -const cookieVal = $prefs.valueForKey(cookieKey) - -function sign() { - let url = { - url: `https://www.v2ex.com/mission/daily`, - method: 'GET', - headers: { - Cookie: cookieVal - } - } - $task.fetch(url).then((response) => { - let data = response.body - if (data.indexOf('每日登录奖励已领取') >= 0) { - let title = `${cookieName}` - let subTitle = `签到结果: 签到跳过` - let detail = `今天已经签过了` - console.log(`${title}, ${subTitle}, ${detail}`) - $notify(title, subTitle, detail) - } else { - signMission(data.match(/]*\/mission\/daily\/redeem\?once=(\d+)[^>]*>/)[1]) - } - }) -} - -function signMission(code) { - let url = { - url: `https://www.v2ex.com/mission/daily/redeem?once=${code}`, - method: 'GET', - headers: {Cookie: cookieVal} - } - $task.fetch(url).then((response) => { - let data = response.body - if (data.indexOf('每日登录奖励已领取') >= 0) { - let title = `${cookieName}` - let subTitle = `签到结果: 签到成功` - let detail = `` - console.log(`${title}, ${subTitle}, ${detail}`) - $notify(title, subTitle, detail) - } else { - let title = `${cookieName}` - let subTitle = `签到结果: 签到失败` - let detail = `详见日志` - console.log(`签到失败: ${cookieName}, data: ${data}`) - $notify(title, subTitle, detail) - } - }) -} - -sign({}) diff --git a/Scripts/SignIn/V2EX/v2ex.cookie.js b/Scripts/SignIn/V2EX/v2ex.cookie.js deleted file mode 100644 index 3135868..0000000 --- a/Scripts/SignIn/V2EX/v2ex.cookie.js +++ /dev/null @@ -1,15 +0,0 @@ -const cookieName = 'V2EX' -const cookieKey = 'chavy_cookie_v2ex' -const cookieVal = $request.headers['Cookie'] - -if (cookieVal) { - let cookie = $persistentStore.write(cookieVal, cookieKey) - if (cookie) { - let msg = `${cookieName}` - $notification.post(msg, 'Cookie写入成功', '详见日志') - console.log(msg) - console.log(cookieVal) - } -} - -$done({}) diff --git a/Scripts/SignIn/V2EX/v2ex.js b/Scripts/SignIn/V2EX/v2ex.js deleted file mode 100644 index c1bf551..0000000 --- a/Scripts/SignIn/V2EX/v2ex.js +++ /dev/null @@ -1,48 +0,0 @@ -const cookieName = 'V2EX' -const cookieKey = 'chavy_cookie_v2ex' -const cookieVal = $persistentStore.read(cookieKey) - -function sign() { - let url = { - url: `https://www.v2ex.com/mission/daily`, - headers: { - Cookie: cookieVal - } - } - $httpClient.get(url, (error, response, data) => { - if (data.indexOf('每日登录奖励已领取') >= 0) { - let title = `${cookieName}` - let subTitle = `签到结果: 签到跳过` - let detail = `今天已经签过了` - console.log(`${title}, ${subTitle}, ${detail}`) - $notification.post(title, subTitle, detail) - } else { - signMission(data.match(/]*\/mission\/daily\/redeem\?once=(\d+)[^>]*>/)[1]) - } - }) - $done({}) -} - -function signMission(code) { - let url = { - url: `https://www.v2ex.com/mission/daily/redeem?once=${code}`, - headers: {Cookie: cookieVal} - } - $httpClient.get(url, (error, response, data) => { - if (data.indexOf('每日登录奖励已领取') >= 0) { - let title = `${cookieName}` - let subTitle = `签到结果: 签到成功` - let detail = `` - console.log(`${title}, ${subTitle}, ${detail}`) - $notification.post(title, subTitle, detail) - } else { - let title = `${cookieName}` - let subTitle = `签到结果: 签到失败` - let detail = `详见日志` - console.log(`签到失败: ${cookieName}, error: ${error}, response: ${response}, data: ${data}`) - $notification.post(title, subTitle, detail) - } - }) -} - -sign({}) diff --git a/Scripts/SignIn/WPS/Readme.md b/Scripts/SignIn/WPS/Readme.md deleted file mode 100644 index 987e39d..0000000 --- a/Scripts/SignIn/WPS/Readme.md +++ /dev/null @@ -1,101 +0,0 @@ -# WPS -# 此 Readme Copied From [@chavyleung](https://github.com/chavyleung/scripts/blob/master/wps/README.md) -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> 2020.3.15 增加小程序签到 - -> 2020.6.10 1.小程序打卡可以自动答题; 2.自动做满邀请 10 个用户任务 (次日打卡送 10 天会员). 感谢 @Wenmoux 提供的邀请人列表 -> 注意 1: 获取 Cookie 的正则有变动, 但不用重取 Cookie -> 注意 2: 把签到时间调整为 06:00 - 13:00 之间 - -> 2020.6.11 不需要单独从小程序获取 Cookie, 添加自动报名脚本 - -## 配置 (Surge) - -```properties -[MITM] -hostname = zt.wps.cn - -[Script] -http-request ^https:\/\/zt.wps.cn\/2018\/docer_check_in\/api\/act_list script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wps/wps.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wps/wps.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -hostname = 110.43.90.61, zt.wps.cn - -[rewrite_local] -^https:\/\/zt.wps.cn\/2018\/docer_check_in\/api\/act_list url script-request-header wps.cookie.js - -[task_local] -1 0 * * * wps.js -``` - -## 说明 - -1. 配置`[MITM]` - - Surge: zt.wps.cn - - QuanX: 110.43.90.61, zt.wps.cn -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`wps.cookie.js`和`wps.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP , 进入签到页面, 系统提示: `获取会话: 成功 (签到)` (不用手动签到) -4. 最后就可以把两条获取 Cookie 的脚本注释掉了 -5. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) \ No newline at end of file diff --git a/Scripts/SignIn/WPS/WPS.js b/Scripts/SignIn/WPS/WPS.js deleted file mode 100644 index a23d864..0000000 --- a/Scripts/SignIn/WPS/WPS.js +++ /dev/null @@ -1,394 +0,0 @@ -const $ = new Env('WPS') -$.VAL_signhomeurl = $.getdata('chavy_signhomeurl_wps') -$.VAL_signhomeheader = $.getdata('chavy_signhomeheader_wps') - -!(async () => { - $.log('', `🔔 ${$.name}, 开始!`, '') - await loginapp() - await signapp() - await getquestion() - await answerwx() - await signwx() - await signupwx() - await getUserInfo() - await invite() - await getSigninfo() - await getSignreward() - await showmsg() -})() - .catch((e) => { - $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '') - }) - .finally(() => { - $.msg($.name, $.subt, $.desc.join('\n')), $.log('', `🔔 ${$.name}, 结束!`, ''), $.done() - }) - -// 登录 App -function loginapp() { - return new Promise((resove) => - $.get({url: $.VAL_signhomeurl, headers: JSON.parse($.VAL_signhomeheader)}, (error, response, data) => { - try { - if (error) throw new Error(error) - $.homeinfo = JSON.parse(data) - if ($.homeinfo.result === 'ok') { - const headers = JSON.parse($.VAL_signhomeheader) - const [, sid] = /wps_sid=(.*?)(;|,|$)/.exec(headers.Cookie) - $.sid = sid - } - } catch (e) { - $.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '') - } finally { - resove() - } - }) - ) -} - -// 签到 App -function signapp() { - return new Promise((resove) => { - const url = { - url: 'https://zt.wps.cn/2018/docer_check_in/api/checkin_today', - headers: JSON.parse($.VAL_signhomeheader) - } - url.headers['Accept'] = 'application/json, text/javascript, */*; q=0.01' - url.headers['Accept-Encoding'] = 'gzip, deflate, br' - url.headers['Origin'] = 'https://zt.wps.cn' - url.headers['Connection'] = 'keep-alive' - url.headers['Host'] = 'zt.wps.cn' - url.headers['Referer'] = 'https://zt.wps.cn/static/2019/docer_check_in_ios/dist/?position=member_ios' - url.headers['Accept-Language'] = 'zh-cn' - url.headers['X-Requested-With'] = 'XMLHttpRequest' - $.post(url, (error, response, data) => { - try { - if (error) throw new Error(error) - $.signapp = JSON.parse(data) - } catch (e) { - $.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '') - } finally { - resove() - } - }) - }) -} - -// 获取并回答问题 -async function answerwx() { - const answers = ['WPS会员全文检索', '100G', 'WPS会员数据恢复', 'WPS会员PDF转doc', 'WPS会员PDF转图片', 'WPS图片转PDF插件', '金山PDF转WORD', 'WPS会员拍照转文字', '使用WPS会员修复', 'WPS全文检索功能', '有,且无限次', '文档修复'] - // 尝试最多 10 次回答问题 - for (let idx = 0; idx < 10; idx++) { - $.log(`问题: ${$.question.title}`) - if ($.question.multi_select === 0) { - const optionIdx = $.question.options.findIndex((option) => answers.includes(option)) - if (optionIdx === -1) { - $.log(`选项: ${$.question.options.join(', ')}`) - $.log('跳过! 原因: 找不到答案.', '') - await getquestion() - } else { - $.log(`选项: ${$.question.options.join(', ')}`) - $.log(`答案: ${optionIdx + 1}.${$.question.options[optionIdx]}`, '') - await answerquestion(optionIdx + 1) - if ($.answer.right) { - $.answer.optionIdx = optionIdx - $.log('回答正确!') - break - } else { - $.log(`回答错误! 详情: ${$.answer._raw.msg}`) - await getquestion() - continue - } - } - } else { - $.log(`选项: ${$.question.options.join(', ')}`) - $.log('跳过! 原因: 不做多选.', '') - await getquestion() - } - } -} - -// 获取问题 -function getquestion() { - return new Promise((resove) => { - const url = {url: 'https://zt.wps.cn/2018/clock_in/api/get_question?award=wps', headers: {sid: $.sid}} - $.get(url, (error, response, data) => { - try { - if (error) throw new Error(error) - $.question = JSON.parse(data).data - } catch (e) { - $.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '') - } finally { - resove() - } - }) - }) -} - -// 回答问题 -function answerquestion(optIdx) { - return new Promise((resove) => { - const body = `answer=${optIdx}` - const url = {url: 'https://zt.wps.cn/2018/clock_in/api/answer?member=wps', body, headers: {sid: $.sid}} - $.post(url, (error, response, data) => { - try { - if (error) throw new Error(error) - const _data = JSON.parse(data) - $.answer = {_raw: _data, right: _data.result === 'ok'} - } catch (e) { - $.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '') - } finally { - resove() - } - }) - }) -} - -function signwx() { - return new Promise((resove) => { - const url = {url: 'https://zt.wps.cn/2018/clock_in/api/clock_in?award=wps', headers: {sid: $.sid}} - $.get(url, (error, response, data) => { - try { - if (error) throw new Error(error) - const _data = JSON.parse(data) - $.signwx = { - _raw: _data, - isSuc: _data.result === 'ok' || (_data.result === 'error' && '已打卡' === _data.msg), - isRepeat: _data.result === 'error' && _data.msg === '已打卡', - isSignupNeed: _data.result === 'error' && _data.msg === '前一天未报名', - msg: _data.msg - } - } catch (e) { - $.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '') - } finally { - resove() - } - }) - }) -} - -function signupwx() { - if (!$.signwx.isSignupNeed) return null - return new Promise((resove) => { - const url = {url: 'http://zt.wps.cn/2018/clock_in/api/sign_up', headers: {sid: $.sid}} - $.get(url, (error, response, data) => { - try { - if (error) throw new Error(error) - const _data = JSON.parse(data) - $.signupwx = { - _raw: _data, - isSuc: _data.result === 'ok', - msg: _data.msg - } - } catch (e) { - $.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '') - } finally { - resove() - } - }) - }) -} - -// 获取签到详情 -function getSigninfo() { - return new Promise((resove) => { - const url = { - url: 'https://zt.wps.cn/2018/docer_check_in/api/checkin_record', - headers: JSON.parse($.VAL_signhomeheader) - } - url.headers['Accept-Encoding'] = 'gzip, deflate, br' - url.headers['Connection'] = 'keep-alive' - url.headers['Referer'] = 'https://zt.wps.cn/static/2019/docer_check_in_ios/dist/?position=member_ios' - url.headers['Accept'] = 'application/json, text/javascript, */*; q=0.01' - url.headers['Host'] = 'zt.wps.cn' - url.headers['Accept-Language'] = 'zh-cn' - url.headers['X-Requested-With'] = 'XMLHttpRequest' - $.get(url, (error, response, data) => { - try { - if (error) throw new Error(error) - $.signinfo = JSON.parse(data) - } catch (e) { - $.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '') - } finally { - resove() - } - }) - }) -} - -// 获取签到奖励 -function getSignreward() { - return new Promise((resove) => { - const url = { - url: 'https://zt.wps.cn/2018/docer_check_in/api/reward_record', - headers: JSON.parse($.VAL_signhomeheader) - } - url.headers['Accept-Encoding'] = 'gzip, deflate, br' - url.headers['Connection'] = 'keep-alive' - url.headers['Referer'] = 'https://zt.wps.cn/static/2019/docer_check_in_ios/dist/?position=member_ios' - url.headers['Accept'] = 'application/json, text/javascript, */*; q=0.01' - url.headers['Host'] = 'zt.wps.cn' - url.headers['Accept-Language'] = 'zh-cn' - url.headers['X-Requested-With'] = 'XMLHttpRequest' - $.get(url, (error, response, data) => { - try { - if (error) throw new Error(error) - $.signreward = JSON.parse(data) - } catch (e) { - $.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '') - } finally { - resove() - } - }) - }) -} - -// 获取用户信息 -function getUserInfo() { - return new Promise((resove) => { - const url = {url: 'https://vip.wps.cn/userinfo', headers: {sid: $.sid}} - $.get(url, (error, response, data) => { - try { - if (error) throw new Error(error) - $.userinfo = JSON.parse(data) - } catch (e) { - $.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '') - } finally { - resove() - } - }) - }) -} - -function invite() { - const sids = [ - 'V02S2UBSfNlvEprMOn70qP3jHPDqiZU00a7ef4a800341c7c3b', - 'V02StVuaNcoKrZ3BuvJQ1FcFS_xnG2k00af250d4002664c02f', - 'V02SWIvKWYijG6Rggo4m0xvDKj1m7ew00a8e26d3002508b828', - 'V02Sr3nJ9IicoHWfeyQLiXgvrRpje6E00a240b890023270f97', - 'V02SBsNOf4sJZNFo4jOHdgHg7-2Tn1s00a338776000b669579', - 'V02ScVbtm2pQD49ArcgGLv360iqQFLs014c8062e000b6c37b6', - 'V02S2oI49T-Jp0_zJKZ5U38dIUSIl8Q00aa679530026780e96', - 'V02ShotJqqiWyubCX0VWTlcbgcHqtSQ00a45564e002678124c', - 'V02SFiqdXRGnH5oAV2FmDDulZyGDL3M00a61660c0026781be1', - 'V02S7tldy5ltYcikCzJ8PJQDSy_ElEs00a327c3c0026782526', - 'V02SPoOluAnWda0dTBYTXpdetS97tyI00a16135e002684bb5c', - 'V02Sb8gxW2inr6IDYrdHK_ywJnayd6s00ab7472b0026849b17', - 'V02SwV15KQ_8n6brU98_2kLnnFUDUOw00adf3fda0026934a7f', - 'V02SC1mOHS0RiUBxeoA8NTliH2h2NGc00a803c35002693584d' - ] - $.invites = [] - const inviteActs = [] - $.log('', '开始邀请: ') - for (let sidIdx = 0; sidIdx < sids.length; sidIdx++) { - inviteActs.push( - new Promise((resove) => { - const body = `invite_userid=${$.userinfo.data.userid}` - const url = {url: 'http://zt.wps.cn/2018/clock_in/api/invite', body, headers: {sid: sids[sidIdx]}} - $.post(url, (error, response, data) => { - try { - if (error) throw new Error(error) - const _data = JSON.parse(data) - const _invite = {_raw: _data, inviteIdx: sidIdx, isSuc: _data.result === 'ok'} - $.invites.push(_invite) - $.log(` 邀请第 ${_invite.inviteIdx + 1} 个用户: ${_invite.isSuc ? '成功!' : '失败!'}`) - } catch (e) { - $.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '') - } finally { - resove() - } - }) - }) - ) - } - return Promise.all(inviteActs) -} - -function showmsg() { - return new Promise((resove) => { - $.subt = '' - $.desc = [] - if (/ok/.test($.signapp.result)) { - $.subt = '签到: 成功' - } else if (/error/.test($.signapp.result) && /recheckin/.test($.signapp.msg)) { - $.subt = '签到: 重复' - } else { - $.subt = '签到: 失败' - } - if ($.signinfo && $.homeinfo.data[0]) { - const current = $.homeinfo.data[0] - $.desc.push(`连签: ${$.signinfo.data.max_days}天, 本期: ${current.end_date} (第${current.id}期)`) - $.desc.push('查看签到详情', '') - } - if ($.signwx) { - $.subt += ', ' - if ($.signwx.isSuc && !$.signwx.isRepeat) $.subt += `打卡: 成功` - else if ($.signwx.isSuc && $.signwx.isRepeat) $.subt += `打卡: 重复` - else if (!$.signwx.isSuc && $.signwx.isSignupNeed && $.signupwx.isSuc) $.subt += `打卡: 报名成功` - else if (!$.signwx.isSuc && $.signwx.isSignupNeed && !$.signupwx.isSuc) $.subt += `打卡: 报名失败` - else $.subt += `打卡: 失败` - $.desc.push(`打卡: ${$.signwx.msg}`) - if ($.signwx.isSignupNeed) { - $.desc.push(`报名: ${$.signupwx.isSuc ? '成功' : `失败! 原因: ${$.signupwx.msg}`}`) - } - $.desc.push(`问题: ${$.question.title}`) - $.desc.push(`答案: ${$.answer.optionIdx + 1}.${$.question.options[$.answer.optionIdx]}`) - } - if ($.invites) { - const invitedCnt = $.invites.filter((invite) => invite.isSuc).length - const inviteCnt = $.invites.length - $.subt += ', 邀请: ' - $.subt += `${invitedCnt}/${inviteCnt}` - } - if ($.signreward && $.signreward.data) { - const maxdays = $.signinfo.data.max_days - let curDays = 0 - $.signreward.data.forEach((r) => { - const rstatus = r.status == 'unreceived' ? '[未领]' : '[已领]' - const limit_days = parseInt(r.limit_days) - const daysstatus = maxdays >= limit_days ? '✅' : '❕' - if (curDays < limit_days) { - curDays = limit_days - $.desc.push('', `${daysstatus} 连签${limit_days}天: `) - } - $.desc.push(` ${rstatus} ${r.reward_name}`) - }) - } - resove() - }) -} - -// prettier-ignore -function Env(s) { - this.name = s, this.data = null, this.logs = [], this.isSurge = (() => "undefined" != typeof $httpClient), this.isQuanX = (() => "undefined" != typeof $task), this.isNode = (() => "undefined" != typeof module && !!module.exports), this.log = ((...s) => { - this.logs = [...this.logs, ...s], s ? console.log(s.join("\n")) : console.log(this.logs.join("\n")) - }), this.msg = ((s = this.name, t = "", i = "") => { - this.isSurge() && $notification.post(s, t, i), this.isQuanX() && $notify(s, t, i); - const e = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; - s && e.push(s), t && e.push(t), i && e.push(i), console.log(e.join("\n")) - }), this.getdata = (s => { - if (this.isSurge()) return $persistentStore.read(s); - if (this.isQuanX()) return $prefs.valueForKey(s); - if (this.isNode()) { - const t = "box.dat"; - return this.fs = this.fs ? this.fs : require("fs"), this.fs.existsSync(t) ? (this.data = JSON.parse(this.fs.readFileSync(t)), this.data[s]) : null - } - }), this.setdata = ((s, t) => { - if (this.isSurge()) return $persistentStore.write(s, t); - if (this.isQuanX()) return $prefs.setValueForKey(s, t); - if (this.isNode()) { - const i = "box.dat"; - return this.fs = this.fs ? this.fs : require("fs"), !!this.fs.existsSync(i) && (this.data = JSON.parse(this.fs.readFileSync(i)), this.data[t] = s, this.fs.writeFileSync(i, JSON.stringify(this.data)), !0) - } - }), this.wait = ((s, t = s) => i => setTimeout(() => i(), Math.floor(Math.random() * (t - s + 1) + s))), this.get = ((s, t) => this.send(s, "GET", t)), this.post = ((s, t) => this.send(s, "POST", t)), this.send = ((s, t, i) => { - if (this.isSurge()) { - const e = "POST" == t ? $httpClient.post : $httpClient.get; - e(s, (s, t, e) => { - t && (t.body = e, t.statusCode = t.status), i(s, t, e) - }) - } - this.isQuanX() && (s.method = t, $task.fetch(s).then(s => { - s.status = s.statusCode, i(null, s, s.body) - }, s => i(s.error, s, s))), this.isNode() && (this.request = this.request ? this.request : require("request"), s.method = t, s.gzip = !0, this.request(s, (s, t, e) => { - t && (t.status = t.statusCode), i(null, t, e) - })) - }), this.done = ((s = {}) => this.isNode() ? null : $done(s)) -} diff --git a/Scripts/SignIn/WPS/wps.cookie.js b/Scripts/SignIn/WPS/wps.cookie.js deleted file mode 100644 index 986595c..0000000 --- a/Scripts/SignIn/WPS/wps.cookie.js +++ /dev/null @@ -1,56 +0,0 @@ -const $ = new Env('WPS') - -!(async () => { - $.log('', `🔔 ${$.name}, 获取会话: 开始!`, '') - const VAL_url = $request.url - const VAL_headers = JSON.stringify($request.headers) - $.log('', `❕ ${$.name}`, `url: ${$request.url}`, `headers: ${JSON.stringify($request.headers)}`, '') - $.setdata(VAL_url, 'chavy_signhomeurl_wps') - $.setdata(VAL_headers, 'chavy_signhomeheader_wps') - $.subt = '获取会话: 成功!' -})() - .catch((e) => { - $.subt = '获取会话: 失败!' - $.desc = `原因: ${e}` - $.log(`❌ ${$.name}, 获取会话: 失败! 原因: ${e}!`) - }) - .finally(() => { - $.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 获取会话: 结束!`, ''), $.done() - }) - -// prettier-ignore -function Env(s) { - this.name = s, this.data = null, this.logs = [], this.isSurge = (() => "undefined" != typeof $httpClient), this.isQuanX = (() => "undefined" != typeof $task), this.isNode = (() => "undefined" != typeof module && !!module.exports), this.log = ((...s) => { - this.logs = [...this.logs, ...s], s ? console.log(s.join("\n")) : console.log(this.logs.join("\n")) - }), this.msg = ((s = this.name, t = "", i = "") => { - this.isSurge() && $notification.post(s, t, i), this.isQuanX() && $notify(s, t, i); - const e = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; - s && e.push(s), t && e.push(t), i && e.push(i), console.log(e.join("\n")) - }), this.getdata = (s => { - if (this.isSurge()) return $persistentStore.read(s); - if (this.isQuanX()) return $prefs.valueForKey(s); - if (this.isNode()) { - const t = "box.dat"; - return this.fs = this.fs ? this.fs : require("fs"), this.fs.existsSync(t) ? (this.data = JSON.parse(this.fs.readFileSync(t)), this.data[s]) : null - } - }), this.setdata = ((s, t) => { - if (this.isSurge()) return $persistentStore.write(s, t); - if (this.isQuanX()) return $prefs.setValueForKey(s, t); - if (this.isNode()) { - const i = "box.dat"; - return this.fs = this.fs ? this.fs : require("fs"), !!this.fs.existsSync(i) && (this.data = JSON.parse(this.fs.readFileSync(i)), this.data[t] = s, this.fs.writeFileSync(i, JSON.stringify(this.data)), !0) - } - }), this.wait = ((s, t = s) => i => setTimeout(() => i(), Math.floor(Math.random() * (t - s + 1) + s))), this.get = ((s, t) => this.send(s, "GET", t)), this.post = ((s, t) => this.send(s, "POST", t)), this.send = ((s, t, i) => { - if (this.isSurge()) { - const e = "POST" == t ? $httpClient.post : $httpClient.get; - e(s, (s, t, e) => { - t && (t.body = e, t.statusCode = t.status), i(s, t, e) - }) - } - this.isQuanX() && (s.method = t, $task.fetch(s).then(s => { - s.status = s.statusCode, i(null, s, s.body) - }, s => i(s.error, s, s))), this.isNode() && (this.request = this.request ? this.request : require("request"), s.method = t, s.gzip = !0, this.request(s, (s, t, e) => { - t && (t.status = t.statusCode), i(null, t, e) - })) - }), this.done = ((s = {}) => this.isNode() ? null : $done(s)) -} \ No newline at end of file diff --git a/Scripts/SignIn/Wanda/wanda.cookie.js b/Scripts/SignIn/Wanda/wanda.cookie.js deleted file mode 100644 index 67cc6d1..0000000 --- a/Scripts/SignIn/Wanda/wanda.cookie.js +++ /dev/null @@ -1,147 +0,0 @@ -/** - * - * hostname = user-api-prd-mx.wandafilm.com - * - * # Surge - * 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 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 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('万达影城') -$._mi_ = 'senku_wanda_mi_' - -!(async () => { - const session = {} - session.url = $request.url - session.headers = JSON.parse($request.headers['MX-API'])['_mi_'] - if (session.headers && $.setdata(session.headers, $._mi_)) { - $.subt = `获取会话: 成功! (${$._mi_})` - } else { - $.subt = `获取会话: 失败! (${$._mi_})` - } - $.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/Scripts/SignIn/Wanda/wanda.js b/Scripts/SignIn/Wanda/wanda.js deleted file mode 100644 index e23227b..0000000 --- a/Scripts/SignIn/Wanda/wanda.js +++ /dev/null @@ -1,533 +0,0 @@ -const $ = new Env('万达电影') -$._mi_ = 'senku_wanda_mi_' -$.desc = [] -$.signCode = '17787285' -$.questionCode = '15884027' -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", - "_mi_": `${$.getdata($._mi_)}`, - "width": 1280, - "json": true, - "cCode": "1_3", - "check": '', - "ts": 0, - "heigth": 720, - "appId": "3" -} - -!(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)) - .finally(() => $.done()) - - -function sign() { - return new Promise((resolve) => { - const signVal = getKey()['key'] + '/activityWholeSign/wholeSignUp.apiactivityCode=' + $.signCode + '&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', - headers: { - 'MX-API': JSON.stringify(mx_api), - }, - body: 'activityCode=' + $.signCode + '&signDate=' + date - } - $.post(url, (err, resp, data) => { - try { - $.sign = JSON.parse(data) - } catch (e) { - $.logErr(e, resp) - } finally { - resolve() - } - }) - }) -} - -function signRecord() { - return new Promise((resolve) => { - const signRecordVal = getKey()['key'] + '/activityWholeSign/getSignRecord.apiactivityCode=' + $.signCode - mx_api['ts'] = getKey()['ts'] - 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=' + $.signCode - } - $.post(url, (err, resp, data) => { - try { - $.signRecord = JSON.parse(data) - } catch (e) { - $.logErr(e, resp) - } finally { - resolve() - } - }) - }) -} - -function lottery() { - return new Promise((resolve) => { - const signVal = getKey()['key'] + '/activityWholeSign/prize/lottery.apiactivityCode=' + $.signCode + '&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=' + $.signCode + '&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=' + $.questionCode - 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=' + $.questionCode - } - $.post(url, (err, resp, data) => { - try { - $.log(`尝试性报名答题`) - } catch (e) { - $.logErr(e, resp) - } finally { - resolve() - } - }) - }) -} - -// 获取题目答案 -function question() { - return new Promise((resolve) => { - const questionVal = getKey()['key'] + '/question/question_list.apiactivityCode=' + $.questionCode - mx_api['ts'] = getKey()['ts'] - 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=' + $.questionCode - } - $.post(url, (err, resp, data) => { - try { - const res = JSON.parse(data) - $.answer = res.data.questionList[0].movie.nameCN - } catch (e) { - $.logErr(e, resp) - } finally { - resolve() - } - }) - }) -} - -// 答题 -function answer() { - return new Promise((resolve) => { - 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 = { - url: 'https://activity-api-mx.wandafilm.com/question/qustion/answer.api', - headers: { - 'MX-API': JSON.stringify(mx_api), - }, - body: 'activityCode=' + $.questionCode + '&answer=%7B%221%22%3A%22' + encodeURI(`${$.answer}`) + '%22%7D' - } - $.post(url, (err, resp, data) => { - try { - $.answer = JSON.parse(data) - } catch (e) { - $.logErr(e, resp) - } finally { - resolve() - } - }) - }) -} - -// 答题后抽奖 -function drawprize_ans() { - return new Promise((resolve) => { - const drawprizeVal = getKey()['key'] + '/question/prize/lottery.apiactivityCode=' + $.questionCode - mx_api['ts'] = getKey()['ts'] - 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=' + $.questionCode - } - $.post(url, (err, resp, data) => { - try { - const res = JSON.parse(data) - $.desc.push(`答题抽奖:${res.data.prize.prizeName}`) - } catch (e) { - $.logErr(e, resp) - } finally { - resolve() - } - }) - }) -} - -function showmsg() { - return new Promise((resolve) => { - $.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}` - $.lottery ? $.desc.push(`签到抽奖:${$.lottery.data.prize.prizeName}`) : `` - $.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; _ < r.length; _++) t = r.charCodeAt(_), n += d.charAt(t >>> 4 & 15) + d.charAt(15 & t); - return n -} - -function rstr2b64(r) { - for (var t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", d = "", n = r.length, _ = 0; _ < n; _ += 3) for (var m = r.charCodeAt(_) << 16 | (_ + 1 < n ? r.charCodeAt(_ + 1) << 8 : 0) | (_ + 2 < n ? r.charCodeAt(_ + 2) : 0), f = 0; f < 4; f++) 8 * _ + 6 * f > 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; d < e.length; d++) e[d] = r.charCodeAt(2 * d) << 8 | r.charCodeAt(2 * d + 1); - var a = Math.ceil(8 * r.length / (Math.log(t.length) / Math.log(2))), i = Array(a); - for (n = 0; n < a; n++) { - for (f = Array(), m = 0, d = 0; d < e.length; d++) m = (m << 16) + e[d], _ = Math.floor(m / h), m -= _ * h, (f.length > 0 || _ > 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; ++_ < r.length;) t = r.charCodeAt(_), d = _ + 1 < r.length ? r.charCodeAt(_ + 1) : 0, 55296 <= t && t <= 56319 && 56320 <= d && d <= 57343 && (t = 65536 + ((1023 & t) << 10) + (1023 & d), _++), t <= 127 ? n += String.fromCharCode(t) : t <= 2047 ? n += String.fromCharCode(192 | t >>> 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 < r.length; d++) t += String.fromCharCode(255 & r.charCodeAt(d), r.charCodeAt(d) >>> 8 & 255); - return t -} - -function str2rstr_utf16be(r) { - for (var t = "", d = 0; d < r.length; d++) t += String.fromCharCode(r.charCodeAt(d) >>> 8 & 255, 255 & r.charCodeAt(d)); - return t -} - -function rstr2binl(r) { - for (var t = Array(r.length >> 2), d = 0; d < t.length; d++) t[d] = 0; - for (d = 0; d < 8 * r.length; d += 8) t[d >> 5] |= (255 & r.charCodeAt(d / 8)) << d % 32; - return t -} - -function binl2rstr(r) { - for (var t = "", d = 0; d < 32 * r.length; d += 8) t += String.fromCharCode(r[d >> 5] >>> d % 32 & 255); - return t -} - -function binl_md5(r, t) { - r[t >> 5] |= 128 << t % 32, r[14 + (t + 64 >>> 9 << 4)] = t; - for (var d = 1732584193, n = -271733879, _ = -1732584194, m = 271733878, f = 0; f < r.length; f += 16) { - var h = d, e = n, a = _, i = m; - d = md5_ff(d, n, _, m, r[f + 0], 7, -680876936), m = md5_ff(m, d, n, _, r[f + 1], 12, -389564586), _ = md5_ff(_, m, d, n, r[f + 2], 17, 606105819), n = md5_ff(n, _, m, d, r[f + 3], 22, -1044525330), d = md5_ff(d, n, _, m, r[f + 4], 7, -176418897), m = md5_ff(m, d, n, _, r[f + 5], 12, 1200080426), _ = md5_ff(_, m, d, n, r[f + 6], 17, -1473231341), n = md5_ff(n, _, m, d, r[f + 7], 22, -45705983), d = md5_ff(d, n, _, m, r[f + 8], 7, 1770035416), m = md5_ff(m, d, n, _, r[f + 9], 12, -1958414417), _ = md5_ff(_, m, d, n, r[f + 10], 17, -42063), n = md5_ff(n, _, m, d, r[f + 11], 22, -1990404162), d = md5_ff(d, n, _, m, r[f + 12], 7, 1804603682), m = md5_ff(m, d, n, _, r[f + 13], 12, -40341101), _ = md5_ff(_, m, d, n, r[f + 14], 17, -1502002290), n = md5_ff(n, _, m, d, r[f + 15], 22, 1236535329), d = md5_gg(d, n, _, m, r[f + 1], 5, -165796510), m = md5_gg(m, d, n, _, r[f + 6], 9, -1069501632), _ = md5_gg(_, m, d, n, r[f + 11], 14, 643717713), n = md5_gg(n, _, m, d, r[f + 0], 20, -373897302), d = md5_gg(d, n, _, m, r[f + 5], 5, -701558691), m = md5_gg(m, d, n, _, r[f + 10], 9, 38016083), _ = md5_gg(_, m, d, n, r[f + 15], 14, -660478335), n = md5_gg(n, _, m, d, r[f + 4], 20, -405537848), d = md5_gg(d, n, _, m, r[f + 9], 5, 568446438), m = md5_gg(m, d, n, _, r[f + 14], 9, -1019803690), _ = md5_gg(_, m, d, n, r[f + 3], 14, -187363961), n = md5_gg(n, _, m, d, r[f + 8], 20, 1163531501), d = md5_gg(d, n, _, m, r[f + 13], 5, -1444681467), m = md5_gg(m, d, n, _, r[f + 2], 9, -51403784), _ = md5_gg(_, m, d, n, r[f + 7], 14, 1735328473), n = md5_gg(n, _, m, d, r[f + 12], 20, -1926607734), d = md5_hh(d, n, _, m, r[f + 5], 4, -378558), m = md5_hh(m, d, n, _, r[f + 8], 11, -2022574463), _ = md5_hh(_, m, d, n, r[f + 11], 16, 1839030562), n = md5_hh(n, _, m, d, r[f + 14], 23, -35309556), d = md5_hh(d, n, _, m, r[f + 1], 4, -1530992060), m = md5_hh(m, d, n, _, r[f + 4], 11, 1272893353), _ = md5_hh(_, m, d, n, r[f + 7], 16, -155497632), n = md5_hh(n, _, m, d, r[f + 10], 23, -1094730640), d = md5_hh(d, n, _, m, r[f + 13], 4, 681279174), m = md5_hh(m, d, n, _, r[f + 0], 11, -358537222), _ = md5_hh(_, m, d, n, r[f + 3], 16, -722521979), n = md5_hh(n, _, m, d, r[f + 6], 23, 76029189), d = md5_hh(d, n, _, m, r[f + 9], 4, -640364487), m = md5_hh(m, d, n, _, r[f + 12], 11, -421815835), _ = md5_hh(_, m, d, n, r[f + 15], 16, 530742520), n = md5_hh(n, _, m, d, r[f + 2], 23, -995338651), d = md5_ii(d, n, _, m, r[f + 0], 6, -198630844), m = md5_ii(m, d, n, _, r[f + 7], 10, 1126891415), _ = md5_ii(_, m, d, n, r[f + 14], 15, -1416354905), n = md5_ii(n, _, m, d, r[f + 5], 21, -57434055), d = md5_ii(d, n, _, m, r[f + 12], 6, 1700485571), m = md5_ii(m, d, n, _, r[f + 3], 10, -1894986606), _ = md5_ii(_, m, d, n, r[f + 10], 15, -1051523), n = md5_ii(n, _, m, d, r[f + 1], 21, -2054922799), d = md5_ii(d, n, _, m, r[f + 8], 6, 1873313359), m = md5_ii(m, d, n, _, r[f + 15], 10, -30611744), _ = md5_ii(_, m, d, n, r[f + 6], 15, -1560198380), n = md5_ii(n, _, m, d, r[f + 13], 21, 1309151649), d = md5_ii(d, n, _, m, r[f + 4], 6, -145523070), m = md5_ii(m, d, n, _, r[f + 11], 10, -1120210379), _ = md5_ii(_, m, d, n, r[f + 2], 15, 718787259), n = md5_ii(n, _, m, d, r[f + 9], 21, -343485551), d = safe_add(d, h), n = safe_add(n, e), _ = safe_add(_, a), m = safe_add(m, i) - } - return Array(d, n, _, m) -} - -function md5_cmn(r, t, d, n, _, m) { - return safe_add(bit_rol(safe_add(safe_add(t, r), safe_add(n, m)), _), d) -} - -function md5_ff(r, t, d, n, _, m, f) { - return md5_cmn(t & d | ~t & n, r, t, _, m, f) -} - -function md5_gg(r, t, d, n, _, m, f) { - return md5_cmn(t & n | d & ~n, r, t, _, m, f) -} - -function md5_hh(r, t, d, n, _, m, f) { - return md5_cmn(t ^ d ^ n, r, t, _, m, f) -} - -function md5_ii(r, t, d, n, _, m, f) { - return md5_cmn(d ^ (t | ~n), r, t, _, m, f) -} - -function safe_add(r, t) { - var d = (65535 & r) + (65535 & t), n = (r >> 16) + (t >> 16) + (d >> 16); - return n << 16 | 65535 & d -} - -function bit_rol(r, t) { - return r << t | 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) -} diff --git a/Scripts/SignIn/WmMeituan/README.md b/Scripts/SignIn/WmMeituan/README.md deleted file mode 100644 index 3326e48..0000000 --- a/Scripts/SignIn/WmMeituan/README.md +++ /dev/null @@ -1,103 +0,0 @@ -# 美团外卖 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -## 配置 (Surge) - -```properties -[MITM] -promotion.waimai.meituan.com - -[Script] -# 注意获取Cookie有两条脚本 -http-request ^https:\/\/promotion.waimai.meituan.com\/playcenter\/signIn\/entry script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wmmeituan/wmmeituan.cookie.js -http-request ^https:\/\/promotion.waimai.meituan.com\/playcenter\/signIn\/doaction script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wmmeituan/wmmeituan.cookie.js,requires-body=true -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wmmeituan/wmmeituan.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -promotion.waimai.meituan.com - -[rewrite_local] -# 注意获取Cookie有两条脚本 -# TestFlight与商店版都支持 (但如果你是TestFlight, 建议使用TestFlight的配置) - -# [商店版] QuanX v1.0.6-build194 及更早版本 -^https:\/\/promotion.waimai.meituan.com\/playcenter\/signIn\/entry url script-request-header wmmeituan.cookie.js -^https:\/\/promotion.waimai.meituan.com\/playcenter\/signIn\/doaction url script-request-header wmmeituan.cookie.js - -# [TestFlight] QuanX v1.0.6-build195 及以后版本 -^https:\/\/promotion.waimai.meituan.com\/playcenter\/signIn\/entry url script-request-header wmmeituan.cookie.js -^https:\/\/promotion.waimai.meituan.com\/playcenter\/signIn\/doaction url script-request-body wmmeituan.cookie.js - -[task_local] -1 0 * * * wmmeituan.js -``` - -## 说明 - -1. 先把`promotion.waimai.meituan.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`wmmeituan.cookie.js`和`wmmeituan.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP , 进入签到页面, 系统提示: `获取刷新链接: 成功` -4. 然后手动签到 1 次, 系统提示: `获取Cookie: 成功` -5. 把获取 Cookie 的脚本注释掉 -6. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/WmMeituan/wmmeituan.cookie.js b/Scripts/SignIn/WmMeituan/wmmeituan.cookie.js deleted file mode 100644 index 3337ce2..0000000 --- a/Scripts/SignIn/WmMeituan/wmmeituan.cookie.js +++ /dev/null @@ -1,82 +0,0 @@ -const cookieName = '美团外卖' -const tokenurlKey = 'chavy_tokenurl_wmmeituan' -const tokenheaderKey = 'chavy_tokenheader_wmmeituan' -const signurlKey = 'chavy_signurl_wmmeituan' -const signheaderKey = 'chavy_signheader_wmmeituan' -const signbodyKey = 'chavy_signbody_wmmeituan' -const chavy = init() - -const requrl = $request.url -const reqRef = $request.headers.Referer -if ($request && $request.method != 'OPTIONS' && requrl.match(/playcenter\/signIn\/entry/)) { - const tokenurlVal = requrl - const tokenheaderVal = JSON.stringify($request.headers) - if (tokenurlVal) chavy.setdata(tokenurlVal, tokenurlKey) - if (tokenheaderVal) chavy.setdata(tokenheaderVal, tokenheaderKey) - title = chavy.msg(cookieName, `获取刷新链接: 成功`, ``) -} else if ($request && $request.method != 'OPTIONS' && requrl.match(/playcenter\/signIn\/doaction/)) { - const signurlVal = requrl - const signheaderVal = JSON.stringify($request.headers) - const signbodyVal = $request.body - if (signurlVal) chavy.setdata(signurlVal, signurlKey) - if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey) - if (signbodyVal) chavy.setdata(signbodyVal, signbodyKey) - else { - const tokenurlVal = chavy.getdata(tokenurlKey) - const body = {} - body.activityViewId = tokenurlVal.match(/activityViewId=(.*?)(&|$)/)[1] - body.lat = tokenurlVal.match(/lat=(.*?)(&|$)/)[1] - body.lng = tokenurlVal.match(/lng=(.*?)(&|$)/)[1] - body.checkLogin = true - body.appType = 3 - body.deviceType = 2 - chavy.setdata(JSON.stringify(body), signbodyKey) - } - title = chavy.msg(cookieName, `获取Cookie: 成功`, ``) -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/WmMeituan/wmmeituan.js b/Scripts/SignIn/WmMeituan/wmmeituan.js deleted file mode 100644 index c9450e0..0000000 --- a/Scripts/SignIn/WmMeituan/wmmeituan.js +++ /dev/null @@ -1,80 +0,0 @@ -const cookieName = '美团外卖' -const tokenurlKey = 'chavy_tokenurl_wmmeituan' -const tokenheaderKey = 'chavy_tokenheader_wmmeituan' -const signurlKey = 'chavy_signurl_wmmeituan' -const signheaderKey = 'chavy_signheader_wmmeituan' -const signbodyKey = 'chavy_signbody_wmmeituan' -const chavy = init() -const tokenurlVal = chavy.getdata(tokenurlKey) -const tokenheaderVal = chavy.getdata(tokenheaderKey) -const signurlVal = chavy.getdata(signurlKey) -const signheaderVal = chavy.getdata(signheaderKey) -const signBodyVal = chavy.getdata(signbodyKey) - -sign() - -function sign() { - const url = {url: signurlVal, headers: JSON.parse(signheaderVal), body: signBodyVal} - chavy.post(url, (error, response, data) => { - chavy.log(`${cookieName}, data: ${data}`) - const result = JSON.parse(data) - let subTitle = `` - let detail = `` - if (result.code == 0 && result.subcode == 0) { - subTitle = `签到结果: 成功` - detail = `说明: ${result.msg}` - } else if (result.code == 1 && result.subcode == 3) { - subTitle = `签到结果: 成功 (重复签到)` - detail = `说明: ${result.msg}` - } else { - subTitle = `签到结果: 失败` - detail = `编码: ${result.code}-${result.subcode}, 说明: ${result.msg}` - } - chavy.msg(cookieName, subTitle, detail) - chavy.done() - }) -} - -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} -} diff --git a/Scripts/SignIn/Wykl/README.md b/Scripts/SignIn/Wykl/README.md deleted file mode 100644 index d7dc04e..0000000 --- a/Scripts/SignIn/Wykl/README.md +++ /dev/null @@ -1,104 +0,0 @@ -# 网易考拉(弃坑) - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> QuanX 需要: v1.0.6-build195 及以后版本 (TestFlight) - -> 感谢 [@GideonSenku](https://github.com/GideonSenku) Commit - -## 配置 (Surge) - -```properties -[MITM] -m-bean.kaola.com - -[Script] -http-request ^https:\/\/m-bean\.kaola\.com/m/point/sign\.html script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wykl/wykl.cookie.js, requires-body=true - -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wykl/wykl.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -m-bean.kaola.com - -[rewrite_local] - -# [商店版] QuanX v1.0.6-build194 及更早版本 -# ^https:\/\/m-bean\.kaola\.com/m/point/sign\.html url script-request-body wykl.cookie.js - -# [TestFlight] QuanX v1.0.6-build195 及以后版本 -^https:\/\/m-bean\.kaola\.com/m/point/sign\.html url script-request-body https://raw.githubusercontent.com/chavyleung/scripts/master/wykl/wykl.cookie.js - -[task_local] -1 0 * * * wykl.js -``` - -## 说明 - -1. 先把`m-bean.kaola.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`wykl.cookie.js`和`wykl.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP 手动签到一次: 访问下右下角 `我的考拉` > `领考拉豆` > `签到` -4. 系统提示: `获取Cookie: 成功` -5. 把获取 Cookie 的脚本注释掉 -6. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) - -[@GideonSenku](https://github.com/GideonSenku) diff --git a/Scripts/SignIn/Wykl/wykl.cookie.js b/Scripts/SignIn/Wykl/wykl.cookie.js deleted file mode 100644 index f191c7e..0000000 --- a/Scripts/SignIn/Wykl/wykl.cookie.js +++ /dev/null @@ -1,62 +0,0 @@ -const cookieName = '网易考拉' -const signurlKey = 'senku_signurl_wykl' -const signheaderKey = 'senku_signheader_wykl' -const signbodyKey = 'senku_signbody_wykl' -const senku = init() - -const requrl = $request.url -if ($request && $request.method != 'OPTIONS') { - const signurlVal = requrl - const signheaderVal = JSON.stringify($request.headers) - const signbodyVal = $request.body - if (signurlVal) senku.setdata(signurlVal, signurlKey) - if (signheaderVal) senku.setdata(signheaderVal, signheaderKey) - if (signbodyVal) senku.setdata(signbodyVal, signbodyKey) - senku.msg(cookieName, `获取Cookie: 成功`, ``) -} - -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} -} - -senku.done() diff --git a/Scripts/SignIn/Wykl/wykl.js b/Scripts/SignIn/Wykl/wykl.js deleted file mode 100644 index 7e108eb..0000000 --- a/Scripts/SignIn/Wykl/wykl.js +++ /dev/null @@ -1,75 +0,0 @@ -const cookieName = '网易考拉' -const signurlKey = 'senku_signurl_wykl' -const signheaderKey = 'senku_signheader_wykl' -const signbodyKey = 'senku_signbody_wykl' -const senku = init() -const signurlVal = senku.getdata(signurlKey) -const signheaderVal = senku.getdata(signheaderKey) -const signBodyVal = senku.getdata(signbodyKey) - -sign() - -function sign() { - const url = {url: signurlVal, headers: JSON.parse(signheaderVal), body: signBodyVal} - senku.post(url, (error, response, data) => { - senku.log(`${cookieName}, data: ${data}`) - const res = JSON.parse(data) - let subTitle = `` - let detail = `` - if (res.retCode == 200) { - subTitle = `签到结果: 成功` - detail = `获得:${res.data.popupWindowInfo.frontRewardName},签到天数:${res.data.signCount}` - } else if (res.retCode == 401 || res.retCode == 403 || res.code == 401) { - subTitle = `签到结果: 成功 (重复签到)` - } else { - subTitle = `签到结果: 失败` - detail = `编码: ${res.code}, 说明: ${res.msg}` - } - senku.msg(cookieName, subTitle, detail) - senku.done() - }) -} - -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} -} diff --git a/Scripts/SignIn/Ximalaya/README.md b/Scripts/SignIn/Ximalaya/README.md deleted file mode 100644 index 50d3365..0000000 --- a/Scripts/SignIn/Ximalaya/README.md +++ /dev/null @@ -1,102 +0,0 @@ -# 喜马拉雅 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> 2020.1.9 部分场景不能获取 Cookie 请更换匹配正则 - -> 2020.1.11 QuanX 在`190`版本开始, 获取 Cookie 方式需要从`script-response-body`改为`script-request-header` - -> 2020.3.9 增加自动执行每日`浏览发现页`任务 (更新脚本即可, 无需重新获取 cookike) - -> 2020.3.12 移除`浏览发现页`, 原因: 需要观看视频 3 分钟 - -## 配置 (Surge) - -```properties -[MITM] -mobwsa.ximalaya.com - -[Script] -http-request ^https?:\/\/.*\/mobile\-user\/homePage\/.* script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/ximalaya/ximalaya.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/ximalaya/ximalaya.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -mobwsa.ximalaya.com - -[rewrite_local] -# 189及以前版本 -^https?:\/\/.*\/mobile\-user\/homePage\/.* url script-response-body ximalaya.cookie.js -# 190及以后版本 -^https?:\/\/.*\/mobile\-user\/homePage\/.* url script-request-header ximalaya.cookie.js - -[task_local] -1 0 * * * ximalaya.js -``` - -## 说明 - -1. 先把`mobwsa.ximalaya.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`ximalaya.cookie.js`和`ximalaya.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP, 访问下右下角`账号` -4. 系统提示: `获取Cookie: 成功` & `获取Token: 成功`(如果不提示获取成功, 尝试杀进程再进`账号`) -5. 最后就可以把第 1 条脚本注释掉了 - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/Ximalaya/ximalaya.cookie.js b/Scripts/SignIn/Ximalaya/ximalaya.cookie.js deleted file mode 100644 index 3eb7d8b..0000000 --- a/Scripts/SignIn/Ximalaya/ximalaya.cookie.js +++ /dev/null @@ -1,56 +0,0 @@ -const cookieName = '喜马拉雅' -const cookieKey = 'chavy_cookie_ximalaya' -const chavy = init() -const cookieVal = $request.headers['Cookie'] -if (cookieVal) { - if (chavy.setdata(cookieVal, cookieKey)) { - chavy.msg(`${cookieName}`, '获取Cookie: 成功', '') - chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`) - } -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/Ximalaya/ximalaya.js b/Scripts/SignIn/Ximalaya/ximalaya.js deleted file mode 100644 index 64ee019..0000000 --- a/Scripts/SignIn/Ximalaya/ximalaya.js +++ /dev/null @@ -1,187 +0,0 @@ -const chavy = init() -const cookieName = '喜马拉雅' -const KEY_signcookie = 'chavy_cookie_ximalaya' - -const signinfo = {} -let VAL_signcookie = chavy.getdata(KEY_signcookie) - -;(exec = async () => { - chavy.log(`🔔 ${cookieName} 开始签到`) - await getinfo() - if (signinfo.info.isTickedToday == false) await signapp() - // await browseapp() - await getacc() - showmsg() - chavy.done() -})().catch((e) => chavy.log(`❌ ${cookieName} 签到失败: ${e}`), chavy.done()) - -function signapp() { - return new Promise((resolve, reject) => { - const url = { - url: `https://m.ximalaya.com/starwar/lottery/check-in/check/action`, - headers: {Cookie: VAL_signcookie} - } - url.headers['Accept'] = `application/json, text/plain, */*` - url.headers['Accept-Encoding'] = `gzip, deflate, br` - url.headers['Accept-Language'] = `zh-cn` - url.headers['Connection'] = `keep-alive` - url.headers['Host'] = `m.ximalaya.com` - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 iting/6.6.45 kdtunion_iting/1.0 iting(main)/6.6.45/ios_1' - chavy.post(url, (error, response, data) => { - try { - signinfo.signapp = data - resolve() - } catch (e) { - chavy.msg(cookieName, `签到结果: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} signapp - 签到失败: ${e}`) - chavy.log(`❌ ${cookieName} signapp - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function browseapp() { - return new Promise((resolve, reject) => { - const timestamp = Math.round(new Date().getTime() / 1000).toString() - const browseappurl = `https://mobile.ximalaya.com/daily-label-mobile/v1/task/checkIn/ts-${timestamp}?coinSwitch=true` - const url = {url: browseappurl, headers: {Cookie: VAL_signcookie}} - url.headers['Accept'] = '*/*' - url.headers['Accept-Encoding'] = 'gzip, deflate' - url.headers['Accept-Language'] = 'zh-Hans-CN;q=1, en-US;q=0.9' - url.headers['Connection'] = 'close' - url.headers['Host'] = 'mobile.ximalaya.com' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 iting/6.6.45 kdtunion_iting/1.0 iting(main)/6.6.45/ios_1' - chavy.get(url, (error, response, data) => { - try { - chavy.log(`❕ ${cookieName} browseapp - response: ${JSON.stringify(response)}`) - signinfo.browseapp = JSON.parse(data) - resolve() - } catch (e) { - chavy.msg(cookieName, `每日浏览: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} browseapp - 每日浏览: ${e}`) - chavy.log(`❌ ${cookieName} browseapp - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function getinfo() { - return new Promise((resolve, reject) => { - const url = {url: `https://m.ximalaya.com/starwar/lottery/check-in/record`, headers: {Cookie: VAL_signcookie}} - url.headers['Accept'] = `application/json, text/plain, */*` - url.headers['Accept-Encoding'] = `gzip, deflate, br` - url.headers['Accept-Language'] = `zh-cn` - url.headers['Connection'] = `keep-alive` - url.headers['Content-Type'] = `application/json;charset=utf-8` - url.headers['Host'] = `m.ximalaya.com` - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 iting/6.6.45 kdtunion_iting/1.0 iting(main)/6.6.45/ios_1' - chavy.get(url, (error, response, data) => { - try { - signinfo.info = JSON.parse(data) - resolve() - } catch (e) { - chavy.msg(cookieName, `获取签到信息: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} getinfo - 获取签到信息失败: ${e}`) - chavy.log(`❌ ${cookieName} getinfo - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function getacc() { - return new Promise((resolve, reject) => { - const url = {url: `https://m.ximalaya.com/starwar/task/listen/account`, headers: {Cookie: VAL_signcookie}} - url.headers['Accept'] = `application/json, text/plain, */*` - url.headers['Accept-Encoding'] = `gzip, deflate, br` - url.headers['Accept-Language'] = `zh-cn` - url.headers['Connection'] = `keep-alive` - url.headers['Content-Type'] = `application/json;charset=utf-8` - url.headers['Host'] = `m.ximalaya.com` - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 iting/6.6.45 kdtunion_iting/1.0 iting(main)/6.6.45/ios_1' - chavy.get(url, (error, response, data) => { - try { - signinfo.acc = JSON.parse(data) - resolve() - } catch (e) { - chavy.msg(cookieName, `获取账号信息: 失败`, `说明: ${e}`) - chavy.log(`❌ ${cookieName} getacc - 获取账号信息失败: ${e}`) - chavy.log(`❌ ${cookieName} getacc - response: ${JSON.stringify(response)}`) - resolve() - } - }) - }) -} - -function showmsg() { - let subTitle = '' - let detail = '' - if (signinfo.info.isTickedToday == false) { - if (signinfo.signapp == 'true') { - subTitle = '签到: 成功' - detail = `共签: ${signinfo.info.totalCheckedCounts + 1}天, 积分: ${signinfo.acc.data.score}(+${signinfo.info.awardAmount})` - } else { - subTitle = '签到: 失败' - detail = `说明: ${signinfo.signapp}` - } - } else { - subTitle = `签到: 重复` - detail = `共签: ${signinfo.info.totalCheckedCounts}天, 积分: ${signinfo.acc.data.score}(+${signinfo.info.awardAmount})` - } - - if (signinfo.browseapp) { - if (signinfo.browseapp.ret == 0 && signinfo.browseapp.data && signinfo.browseapp.data.awards) { - if (signinfo.browseapp.data.awards) subTitle += `, 每日浏览: 成功 (${signinfo.browseapp.data.awards})` - else subTitle += ', 每日浏览: 重复' - } else { - subTitle += ', 每日浏览: 失败' - } - } - chavy.msg(cookieName, subTitle, detail) -} - -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} -} diff --git a/Scripts/SignIn/Yanxuan/README.md b/Scripts/SignIn/Yanxuan/README.md deleted file mode 100644 index 0723ab9..0000000 --- a/Scripts/SignIn/Yanxuan/README.md +++ /dev/null @@ -1,100 +0,0 @@ -# 网易严选 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> 2020.1.11 QuanX 在`190`版本开始, 获取 Cookie 方式需要从`script-response-body`改为`script-request-header` - -> 2020.1.22 签到脚本会导致账号异常, 请停止使用 - -## 配置 (Surge) - -```properties -[MITM] -*.you.163.com - -[Script] -http-request ^https:\/\/m\.you\.163\.com\/xhr\/points\/index\.json script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/yanxuan/yanxuan.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/yanxuan/yanxuan.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -*.you.163.com - -[rewrite_local] -# 189及以前版本 -^https:\/\/m\.you\.163\.com\/xhr\/points\/index\.json url script-response-body yanxuan.cookie.js -# 190及以后版本 -^https:\/\/m\.you\.163\.com\/xhr\/points\/index\.json url script-request-header yanxuan.cookie.js - - - -[task_local] -1 0 * * * yanxuan.js -``` - -## 说明 - -1. 先把`*.you.163.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`yanxuan.cookie.js`和`yanxuan.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP, 访问下`个人`>`每日签到`(右上角) -4. 系统提示: `获取Cookie: 成功` (如果不提示获取成功, 尝试杀进程再进`个人`>`每日签到`) -5. 最后就可以把第 1 条脚本注释掉了 - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/Yanxuan/yanxuan.cookie.js b/Scripts/SignIn/Yanxuan/yanxuan.cookie.js deleted file mode 100644 index d719776..0000000 --- a/Scripts/SignIn/Yanxuan/yanxuan.cookie.js +++ /dev/null @@ -1,73 +0,0 @@ -const cookieName = '网易严选' -const cookieKey = 'chavy_cookie_yanxuan' -const tokenKey = 'chavy_token_yanxuan' -const chavy = init() -const cookieVal = $request.headers['Cookie'] -if (cookieVal.indexOf('yx_csrf') > 0) { - if (chavy.setdata(cookieVal, cookieKey)) { - chavy.msg(`${cookieName}`, '获取Cookie: 成功', '') - chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`) - } -} else { - chavy.msg(`${cookieName}`, '获取Cookie: 失败', `请确保在已登录状态下获取Cookie`) - chavy.log(`[${cookieName}] ${subTitle}, cookie: ${cookieVal}`) -} - -const queryparam = $request.url.split('?')[1] -if (queryparam) { - const params = {} - for (param of $request.url.split('?')[1].split('&')) { - params[param.split('=')[0]] = param.split('=')[1] - } - const token = JSON.stringify(params) - if (params['csrf_token'] && chavy.setdata(token, tokenKey)) { - chavy.msg(`${cookieName}`, '获取Token: 成功', '') - chavy.log(`[${cookieName}] 获取Token: 成功, token: ${token}`) - } -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/Yanxuan/yanxuan.js b/Scripts/SignIn/Yanxuan/yanxuan.js deleted file mode 100644 index 974ddd1..0000000 --- a/Scripts/SignIn/Yanxuan/yanxuan.js +++ /dev/null @@ -1,97 +0,0 @@ -const cookieName = '网易严选' -const cookieKey = 'chavy_cookie_yanxuan' -const tokenKey = 'chavy_token_yanxuan' -const chavy = init() -let cookieVal = chavy.getdata(cookieKey) -let tokenVal = chavy.getdata(tokenKey) - -sign() - -function sign() { - const title = `${cookieName}` - const subTitle = `签到脚本可能会导致账号异常, 请暂停使用` - const detail = `` - chavy.msg(title, subTitle, detail) -} - -function _sign() { - const token = JSON.parse(tokenVal) - let url = { - url: `https://m.you.163.com/xhr/points/sign.json?csrf_token=${token.csrf_token}`, - headers: {Cookie: cookieVal} - } - url.headers['Accept'] = `application/json, text/javascript, */*; q=0.01` - url.headers['Accept-Encoding'] = `gzip, deflate, br` - url.headers['Origin'] = `https://m.you.163.com` - url.headers['Connection'] = `keep-alive` - url.headers['Host'] = `m.you.163.com` - url.headers['Content-Length'] = `0` - url.headers['User-Agent'] = `Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 yanxuan/5.1.2 device-id/d7af0a77d9d88bd33a8ae5b35e6219ad app-chan-id/AppStore trustId/ios_trustid_3353a5577f9c4677bddec1ca7ac490fb` - url.headers['Referer'] = `https://m.you.163.com/points/index` - url.headers['Accept-Language'] = `zh-cn` - url.headers['X-Requested-With'] = `XMLHttpRequest` - - chavy.post(url, (error, response, data) => { - chavy.log(`${cookieName}, data: ${data}`) - const result = JSON.parse(data) - const title = `${cookieName}` - let subTitle = `` - let detail = `` - if (result.code == '200') { - subTitle = `签到结果: 成功` - detail = `积分: ${result.data.point}` - } else if (result.code == '400') { - subTitle = `签到结果: 成功 (重复签到)` - detail = `说明: ${result.errorCode}` - } else { - subTitle = `签到失败: 未知` - detail = `编码: ${result.code}, 说明: ${result.errorCode}` - } - chavy.msg(title, subTitle, detail) - }) - chavy.done() -} - -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} -} diff --git a/Scripts/SignIn/ZSFC/README.md b/Scripts/SignIn/ZSFC/README.md deleted file mode 100644 index 41486a1..0000000 --- a/Scripts/SignIn/ZSFC/README.md +++ /dev/null @@ -1,103 +0,0 @@ -# 掌上飞车 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 -> 感谢[@danchaw](https://github.com/danchaw) PR -## 配置 (Surge) - -```properties -[MITM] -mwegame.qq.com - -[Script] -http-request ^https:\/\/mwegame\.qq\.com\/ams\/sign\/doSign\/month script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/zsfc/zsfc.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/zsfc/zsfc.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -mwegame.qq.com - -[rewrite_local] - -# [商店版] -^https:\/\/mwegame\.qq\.com\/ams\/sign\/doSign\/month url script-request-header zsfc.js - -# [TestFlight] -^https:\/\/mwegame\.qq\.com\/ams\/sign\/doSign\/month url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/zsfc/zsfc.js - -[task_local] - -# [商店版] -1 0 * * * zsfc.js - -# [TestFlight] -1 0 * * * https://raw.githubusercontent.com/chavyleung/scripts/master/zsfc/zsfc.js -``` - -## 说明 - -1. 先把`mwegame.qq.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`nio.cookie.js`和`nio.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP[掌上飞车](https://apps.apple.com/cn/app/%E6%8E%8C%E4%B8%8A%E9%A3%9E%E8%BD%A6/id1116903233) 然后手动签到 1 次, 系统提示: `首次写入xxxUrl成功🎉,首次写入xxxCookie成功🎉` -4. 最后就可以把第 1 条脚本注释掉了 -5. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) - -[@danchaw](https://github.com/danchaw) diff --git a/Scripts/SignIn/ZSFC/zsfc.js b/Scripts/SignIn/ZSFC/zsfc.js deleted file mode 100644 index dae25bd..0000000 --- a/Scripts/SignIn/ZSFC/zsfc.js +++ /dev/null @@ -1,146 +0,0 @@ -/* -Regex: ^https:\/\/mwegame\.qq\.com\/ams\/sign\/doSign\/month -Host: mwegame.qq.com -*/ -var appName = '掌上飞车' -var speed = init() -var URL = speed.getdata("UrlFC") -var KEY = speed.getdata("CookieFC") - -let isGetCookie = typeof $request !== 'undefined' - -if (isGetCookie) { - getcookie() -} else { - sign() -} - -function getcookie() { - var url = $request.url; - if (url) { - var UrlKeyFC = "UrlFC"; - var UrlValueFC = url; - if (speed.getdata(UrlKeyFC) != (undefined || null)) { - if (speed.getdata(UrlKeyFC) != UrlValueFC) { - var url = speed.setdata(UrlValueFC, UrlKeyFC); - if (!url) { - speed.msg("更新" + appName + "Url失败‼️", "", ""); - } else { - speed.msg("更新" + appName + "Url成功🎉", "", ""); - } - } else { - speed.msg(appName + "Url未变化❗️", "", ""); - } - } else { - var url = speed.setdata(UrlValueFC, UrlKeyFC); - if (!url) { - speed.msg("首次写入" + appName + "Url失败‼️", "", ""); - } else { - speed.msg("首次写入" + appName + "Url成功🎉", "", ""); - } - } - } else { - speed.msg("写入" + appName + "Url失败‼️", "", "配置错误, 无法读取URL, "); - } - if ($request.headers) { - var CookieKeyFC = "CookieFC"; - var CookieValueFC = JSON.stringify($request.headers); - if (speed.getdata(CookieKeyFC) != (undefined || null)) { - if (speed.getdata(CookieKeyFC) != CookieValueFC) { - var cookie = speed.setdata(CookieValueFC, CookieKeyFC); - if (!cookie) { - speed.msg("更新" + appName + "Cookie失败‼️", "", ""); - } else { - speed.msg("更新" + appName + "Cookie成功🎉", "", ""); - } - } else { - speed.msg(appName + "Cookie未变化❗️", "", ""); - } - } else { - var cookie = speed.setdata(CookieValueFC, CookieKeyFC); - if (!cookie) { - speed.msg("首次写入" + appName + "Cookie失败‼️", "", ""); - } else { - speed.msg("首次写入" + appName + "Cookie成功🎉", "", ""); - } - } - } else { - speed.msg("写入" + appName + "Cookie失败‼️", "", "配置错误, 无法读取请求头, "); - } - speed.done() -} - -function sign() { - const url = {url: URL, headers: JSON.parse(KEY)} - speed.get(url, (error, response, data) => { - speed.log(`${appName}, data: ${data}`) - const title = `${appName}` - let subTitle = '' - let detail = '' - const obj = JSON.parse(data) - if (obj.status == 1 && obj.data == 1) { - subTitle = `签到结果: 成功` - } else if (obj.status == 11 && obj.data == false) { - subTitle = `签到结果: 成功(重复)` - detail = `说明: ${obj.message}` - } else { - subTitle = `签到结果: 失败` - detail = `说明: ${obj.message}` - } - speed.msg(title, subTitle, detail) - speed.done() - }) -} - -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)) - } - } - put = (url, cb) => { - if (isSurge()) { - $httpClient.put(url, cb) - } - if (isQuanX()) { - url.method = 'PUT' - $task.fetch(url).then((resp) => cb(null, {}, resp.body)) - } - } - done = (value = {}) => { - $done(value) - } - return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done} -} \ No newline at end of file diff --git a/Scripts/SignIn/ZXHC/README.md b/Scripts/SignIn/ZXHC/README.md deleted file mode 100644 index 0f27a37..0000000 --- a/Scripts/SignIn/ZXHC/README.md +++ /dev/null @@ -1,105 +0,0 @@ -# 智行火车票 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> QuanX 需要: v1.0.6-build195 及以后版本 (TestFlight) - -> 感谢 [@GideonSenku](https://github.com/GideonSenku) Commit - -## 配置 (Surge) - -```properties -[MITM] -m.ctrip.com - -[Script] -http-request ^https:\/\/m\.ctrip\.com/restapi/soa2/14593/json/attendanceDay? script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/zxhc/zxhc.cookie.js, requires-body=true - -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/zxhc/zxhc.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -m.ctrip.com - -[rewrite_local] -#&QuanX -^https:\/\/m\.ctrip\.com/restapi/soa2/14593/json/attendanceDay? url script-request-body chavyleung/zxhc/zxhc.cookie.js -# QuanTF -^https:\/\/m\.ctrip\.com/restapi/soa2/14593/json/attendanceDay? url script-request-body https://raw.githubusercontent.com/chavyleung/scripts/master/zxhc/zxhc.cookie.js - -[task_local] -1 0 * * * zxhc.js - -[task_remote] -1 0 * * * https://raw.githubusercontent.com/chavyleung/scripts/master/zxhc/zxhc.js -``` - -## 说明 - -1. 先把`m.ctrip.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`zxhc.cookie.js`和`zxhc.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP 手动签到一次: 访问下右下角 `个人中心` > `签到` -4. 系统提示: `获取Cookie: 成功` -5. 把获取 Cookie 的脚本注释掉 -6. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) - -[@GideonSenku](https://github.com/GideonSenku) diff --git a/Scripts/SignIn/ZXHC/zxhc.cookie.js b/Scripts/SignIn/ZXHC/zxhc.cookie.js deleted file mode 100644 index 1650e37..0000000 --- a/Scripts/SignIn/ZXHC/zxhc.cookie.js +++ /dev/null @@ -1,62 +0,0 @@ -const cookieName = '智行火车' -const signurlKey = 'senku_signurl_zxhc' -const signheaderKey = 'senku_signheader_zxhc' -const signbodyKey = 'senku_signbody_zxhc' -const senku = init() - -const requrl = $request.url -if ($request && $request.method != 'OPTIONS') { - const signurlVal = requrl - const signheaderVal = JSON.stringify($request.headers) - const signbodyVal = $request.body - if (signurlVal) senku.setdata(signurlVal, signurlKey) - if (signheaderVal) senku.setdata(signheaderVal, signheaderKey) - if (signbodyVal) senku.setdata(signbodyVal, signbodyKey) - senku.msg(cookieName, `获取Cookie: 成功`, ``) -} - -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} -} - -senku.done() diff --git a/Scripts/SignIn/ZXHC/zxhc.js b/Scripts/SignIn/ZXHC/zxhc.js deleted file mode 100644 index 5ad9102..0000000 --- a/Scripts/SignIn/ZXHC/zxhc.js +++ /dev/null @@ -1,77 +0,0 @@ -const cookieName = '智行火车' -const signurlKey = 'senku_signurl_zxhc' -const signheaderKey = 'senku_signheader_zxhc' -const signbodyKey = 'senku_signbody_zxhc' -const senku = init() -const signurlVal = senku.getdata(signurlKey) -const signheaderVal = senku.getdata(signheaderKey) -const signBodyVal = senku.getdata(signbodyKey) - -sign() - -function sign() { - const url = {url: signurlVal, headers: JSON.parse(signheaderVal), body: signBodyVal} - senku.post(url, (error, response, data) => { - senku.log(`${cookieName}, data: ${data}`) - const res = JSON.parse(data) - let subTitle = `` - let detail = `` - if (res.resultCode == 0) { - subTitle = `签到结果: 成功` - detail = `积分: ${res.credit}` - if (res.coupon != null) { - detail += `优惠券:${res.coupon}` - } - } else if (res.resultCode == -1) { - } - { - subTitle = `签到结果: ${res.resultMessage}` - } - senku.msg(cookieName, subTitle, detail) - senku.done() - }) -} - -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} -} diff --git a/Scripts/SignIn/Zaker/README.md b/Scripts/SignIn/Zaker/README.md deleted file mode 100644 index 94e9e80..0000000 --- a/Scripts/SignIn/Zaker/README.md +++ /dev/null @@ -1,104 +0,0 @@ -# ZAKER新闻 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> 感谢[@danchaw](https://github.com/danchaw) PR -## 配置 (Surge) - -```properties -[MITM] -iphone.myzaker.com - -[Script] -http-request ^https:\/\/iphone\.myzaker\.com\/zaker\/sign_in\/\/api\/sign_in\.php script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/zaker/zaker.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/zaker/zaker.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -iphone.myzaker.com - -[rewrite_local] - -# [商店版] -^https:\/\/iphone\.myzaker\.com\/zaker\/sign_in\/\/api\/sign_in\.php url script-request-header zaker.js - -# [TestFlight] -^https:\/\/iphone\.myzaker\.com\/zaker\/sign_in\/\/api\/sign_in\.php url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/zaker/zaker.js - -[task_local] - -# [商店版] -1 0 * * * zaker.js - -# [TestFlight] -1 0 * * * https://raw.githubusercontent.com/chavyleung/scripts/master/zaker/zaker.js -``` - -## 说明 - -1. 先把`iphone.myzaker.com`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`zaker.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP[ZAKER](https://apps.apple.com/cn/app/zaker-%E6%97%B6%E4%BA%8B%E5%A4%B4%E6%9D%A1%E6%96%B0%E9%97%BB/id462149227) 然后手动签到 1 次, 系统提示: `首次写入ZAKER新闻Url成功🎉`和`首次写入ZAKER新闻Cookie成功🎉` -4. 最后就可以把第 1 条脚本注释掉了 -5. 运行一次脚本, 如果提示说明:签到失败, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) - -[@danchaw](https://github.com/danchaw) diff --git a/Scripts/SignIn/Zaker/zaker.js b/Scripts/SignIn/Zaker/zaker.js deleted file mode 100644 index 5ab1434..0000000 --- a/Scripts/SignIn/Zaker/zaker.js +++ /dev/null @@ -1,140 +0,0 @@ -var appName = 'ZAKER新闻' -var zaker = init() -var URL = zaker.getdata("UrlZK") -var KEY = zaker.getdata("CookieZK") - -let isGetCookie = typeof $request !== 'undefined' - -if (isGetCookie) { - getcookie() -} else { - sign() -} - -function getcookie() { - var url = $request.url; - if (url) { - var UrlKeyZK = "UrlZK"; - var UrlValueZK = url; - if (zaker.getdata(UrlKeyZK) != (undefined || null)) { - if (zaker.getdata(UrlKeyZK) != UrlValueZK) { - var url = zaker.setdata(UrlValueZK, UrlKeyZK); - if (!url) { - zaker.msg("更新" + appName + "Url失败‼️", "", ""); - } else { - zaker.msg("更新" + appName + "Url成功🎉", "", ""); - } - } else { - zaker.msg(appName + "Url未变化❗️", "", ""); - } - } else { - var url = zaker.setdata(UrlValueZK, UrlKeyZK); - if (!url) { - zaker.msg("首次写入" + appName + "Url失败‼️", "", ""); - } else { - zaker.msg("首次写入" + appName + "Url成功🎉", "", ""); - } - } - } else { - zaker.msg("写入" + appName + "Url失败‼️", "", "配置错误, 无法读取URL, "); - } - if ($request.headers) { - var CookieKeyZK = "CookieZK"; - var CookieValueZK = JSON.stringify($request.headers); - if (zaker.getdata(CookieKeyZK) != (undefined || null)) { - if (zaker.getdata(CookieKeyZK) != CookieValueZK) { - var cookie = zaker.setdata(CookieValueZK, CookieKeyZK); - if (!cookie) { - zaker.msg("更新" + appName + "Cookie失败‼️", "", ""); - } else { - zaker.msg("更新" + appName + "Cookie成功🎉", "", ""); - } - } else { - zaker.msg(appName + "Cookie未变化❗️", "", ""); - } - } else { - var cookie = zaker.setdata(CookieValueZK, CookieKeyZK); - if (!cookie) { - zaker.msg("首次写入" + appName + "Cookie失败‼️", "", ""); - } else { - zaker.msg("首次写入" + appName + "Cookie成功🎉", "", ""); - } - } - } else { - zaker.msg("写入" + appName + "Cookie失败‼️", "", "配置错误, 无法读取请求头, "); - } - zaker.done() -} - -function sign() { - const url = {url: URL, headers: JSON.parse(KEY)} - zaker.get(url, (error, response, data) => { - zaker.log(`${appName}, data: ${data}`) - const title = `${appName}` - let subTitle = '' - let detail = '' - const result = JSON.parse(data) - if (result.stat == 1) { - subTitle = `签到结果: 成功` - detail = `签到奖励: ${result.data.tips}, 总签到天数: ${result.data.total_day_count}天` - } else { - subTitle = `签到结果: 未知` - detail = `说明: ${result.msg}` - } - zaker.msg(title, subTitle, detail) - zaker.done() - }) -} - -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)) - } - } - put = (url, cb) => { - if (isSurge()) { - $httpClient.put(url, cb) - } - if (isQuanX()) { - url.method = 'PUT' - $task.fetch(url).then((resp) => cb(null, {}, resp.body)) - } - } - done = (value = {}) => { - $done(value) - } - return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done} -} \ No newline at end of file diff --git a/Scripts/SignIn/Zimuzu/README.md b/Scripts/SignIn/Zimuzu/README.md deleted file mode 100644 index 80adba3..0000000 --- a/Scripts/SignIn/Zimuzu/README.md +++ /dev/null @@ -1,117 +0,0 @@ -# 字幕组 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> 2020.1.11 QuanX 在`190`版本开始, 获取 Cookie 方式需要从`script-response-body`改为`script-request-header` - -> 2020.1.28 适配人人影视新域名`http://www.rrys2019.com` - -> 2020.2.8 双端签到 (增加 APP 签到) - -> 2020.2.8 19:40 更新 App 端 Cookie 获取方式 (旧方式容易失效) (需要更新: MITM, 两个脚本, 正则) - -## 配置 (Surge) - -```properties -[MITM] -*.rrys2019.com, ios.zmzapi.com - -[Script] -http-request ^https?:\/\/(www\.)?rrys2019\.com\/?.? script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/zimuzu/zimuzu.cookie.js -http-request ^http:\/\/ios.zmzapi.com\/index.php.*a=(mobile_)?login script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/zimuzu/zimuzu.cookie.js -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/zimuzu/zimuzu.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -*.rrys2019.com, ios.zmzapi.com - -[rewrite_local] -# 189及以前版本 -^https?:\/\/(www\.)?rrys2019\.com\/?.? url script-response-body zimuzu.cookie.js -^http:\/\/ios.zmzapi.com\/index.php.*a=(mobile_)?login url script-response-body zimuzu.cookie.js -# 190及以后版本 -^https?:\/\/(www\.)?rrys2019\.com\/?.? url script-request-header zimuzu.cookie.js -^http:\/\/ios.zmzapi.com\/index.php.*a=(mobile_)?login url script-request-header zimuzu.cookie.js - -[task_local] -1 0 * * * zimuzu.js -``` - -## 说明 (网页) - -1. 先在浏览器登录 `(先登录! 先登录! 先登录!)` -2. 先把`*.rrys2019.com, ios.zmzapi.com`加到`[MITM]` -3. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`zimuzu.cookie.js`和`zimuzu.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -4. 打开浏览器访问: http://www.rrys2019.com -5. 系统提示: `获取Cookie: 成功` -6. 最后就可以把第 1 条脚本注释掉了 - -## 说明 (APP) - -1. 先在浏览器登录 `(先登录! 先登录! 先登录!)` -2. 先把`*.rrys2019.com, ios.zmzapi.com`加到`[MITM]` -3. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`zimuzu.cookie.js`和`zimuzu.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -4. 打开 APP 即可 -5. 系统提示: `获取Cookie: 成功` (如果不提示, 请杀掉 APP 重新打开) -6. 最后就可以把第 1 条脚本注释掉了 - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) diff --git a/Scripts/SignIn/Zimuzu/zimuzu.cookie.js b/Scripts/SignIn/Zimuzu/zimuzu.cookie.js deleted file mode 100644 index 5dbd634..0000000 --- a/Scripts/SignIn/Zimuzu/zimuzu.cookie.js +++ /dev/null @@ -1,75 +0,0 @@ -const cookieName = '字幕组' -const cookieKey = 'chavy_cookie_zimuzu' -const cookieAppKey = 'chavy_cookie_zimuzu_app' -const authUrlAppKey = 'chavy_auth_url_zimuzu_app' -const chavy = init() -if ($request.headers.Host == 'h5.rrhuodong.com') { - const cookieVal = $request.headers['Cookie'] - if (cookieVal) { - if (chavy.setdata(cookieVal, cookieAppKey)) { - chavy.setdata(``, authUrlAppKey) - chavy.msg(`${cookieName} (APP)`, '获取Cookie: 成功', '') - chavy.log(`[${cookieName} (APP)] 获取Cookie: 成功, cookie: ${cookieVal}`) - } - } -} else if ($request.headers.Host == `ios.zmzapi.com` && $request.url.indexOf('accesskey') >= 0) { - if (chavy.setdata($request.url, authUrlAppKey)) { - chavy.setdata(``, cookieAppKey) - chavy.msg(`${cookieName} (APP)`, '获取Cookie: 成功', '') - chavy.log(`[${cookieName} (APP)] 获取Cookie: 成功, cookie: ${$request.url}`) - } -} else { - const cookieVal = $request.headers['Cookie'] - if (cookieVal) { - if (chavy.setdata(cookieVal, cookieKey)) { - chavy.msg(`${cookieName} (网页)`, '获取Cookie: 成功', '') - chavy.log(`[${cookieName} (网页)] 获取Cookie: 成功, cookie: ${cookieVal}`) - } - } -} - -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} -} - -chavy.done() diff --git a/Scripts/SignIn/Zimuzu/zimuzu.js b/Scripts/SignIn/Zimuzu/zimuzu.js deleted file mode 100644 index fb0137c..0000000 --- a/Scripts/SignIn/Zimuzu/zimuzu.js +++ /dev/null @@ -1,123 +0,0 @@ -const $ = new Env('字幕组') -$.VAL_cookie = $.getdata('chavy_cookie_zimuzu') -$.VAL_appurl = $.getdata('chavy_auth_url_zimuzu_app') - -!(async () => { - $.log('', `🔔 ${$.name}, 开始!`, '') - await web() - await app() - await showmsg() -})() - .catch((e) => { - $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '') - }) - .finally(() => { - $.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 结束!`, ''), $.done() - }) - -function web() { - return new Promise((resove) => { - const url = {url: `http://www.rrys2019.com/user/login/getCurUserTopInfo`, headers: {}} - url.headers['Cookie'] = $.VAL_cookie - 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' - $.get(url, (error, response, data) => ($.web = JSON.parse(data, resove()))) - }) -} - -async function app() { - await loginapp() - await refreshapp() - await signapp() -} - -function loginapp() { - return new Promise((resove) => { - const url = {url: $.VAL_appurl, headers: {}} - url.headers['Accept'] = `*/*` - url.headers['Accept-Encoding'] = `gzip;q=1.0, compress;q=0.5` - url.headers['Accept-Language'] = `zh-Hans-CN;q=1.0, en-US;q=0.9` - url.headers['Connection'] = `close` - url.headers['Host'] = `ios.zmzapi.com` - url.headers['Referer'] = `http://h5.rrhuodong.com/mobile/mission/pages/task.html` - url.headers['User-Agent'] = `YYets_swift/2.5.7 (com.yyets.ZiMuZu; build:29; iOS 13.3.1) Alamofire/4.9.1` - $.get(url, (error, response, data) => (($.loginapp = JSON.parse(data)), resove())) - }) -} - -function refreshapp() { - return new Promise((resove) => { - const uid = $.loginapp && $.loginapp.data && $.loginapp.data.uid - const token = $.loginapp && $.loginapp.data && $.loginapp.data.token - const url = { - url: `http://h5.rrhuodong.com/index.php?g=api/mission&m=index&a=login&uid=${uid}&token=${token}`, - headers: {} - } - url.headers['Accept'] = `application/json, text/plain, */*` - url.headers['Accept-Encoding'] = `gzip, deflate` - url.headers['Accept-Language'] = `zh-cn` - url.headers['Connection'] = `close` - url.headers['Host'] = `h5.rrhuodong.com` - url.headers['Referer'] = `http://h5.rrhuodong.com/mobile/mission/pages/task.html` - url.headers['User-Agent'] = `Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148` - $.get(url, (error, response, data) => resove()) - }) -} - -function signapp() { - return new Promise((resove) => { - const url = {url: `http://h5.rrhuodong.com/index.php?g=api/mission&m=clock&a=store&id=2`, headers: {}} - url.headers['Accept'] = `application/json, text/plain, */*` - url.headers['Accept-Encoding'] = `gzip, deflate` - url.headers['Accept-Language'] = `zh-cn` - url.headers['Connection'] = `close` - url.headers['Host'] = `h5.rrhuodong.com` - url.headers['Referer'] = `http://h5.rrhuodong.com/mobile/mission/pages/task.html` - url.headers['User-Agent'] = `Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148` - $.get(url, (error, response, data) => (($.app = JSON.parse(data)), resove())) - }) -} - -function showmsg() { - return new Promise((resove) => { - $.subt = '' - $.desc = '' - // web - $.subt += '网页: ' - if ($.web.status == 1) { - if ($.web.data.new_login) $.subt += '成功' - else $.subt += '成功 (重复)' - $.desc = `人人钻: ${$.web.data.userinfo.point}, 登录天数: ${$.web.data.usercount.cont_login}` - } else if ($.web.status == 4001) { - $.subt += '未登录' - } else { - $.subt += '失败' - } - - // app - $.subt += '; APP: ' - if ($.app.status == 1) $.subt += '成功' - else if ($.app.status == 4005) $.subt += '成功 (重复)' - else if ($.app.status == 1021) $.subt += '未登录' - else $.subt += '失败' - 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)) -} diff --git a/Scripts/SignIn/fandeng/README.md b/Scripts/SignIn/fandeng/README.md deleted file mode 100644 index 854fb8e..0000000 --- a/Scripts/SignIn/fandeng/README.md +++ /dev/null @@ -1,104 +0,0 @@ -# 樊登读书 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -> QuanX 需要: v1.0.6-build195 及以后版本 (TestFlight) - -> 感谢 [@GideonSenku](https://github.com/GideonSenku) Commit - -## 配置 (Surge) - -```properties -[MITM] -api.dushu.io - -[Script] -http-request ^https://api\.dushu\.io/CheckIn script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/fandeng/fandeng.cookie.js, requires-body=true - -cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/fandeng/fandeng.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -api.dushu.io - -[rewrite_local] - -# [商店版] QuanX v1.0.6-build194 及更早版本 -# 不支持 - -# [TestFlight] QuanX v1.0.6-build195 及以后版本 -^https://api\.dushu\.io/CheckIn url script-request-body https://raw.githubusercontent.com/chavyleung/scripts/master/fandeng/fandeng.cookie.js - -[task_local] -1 0 * * * fandeng.js -``` - -## 说明 - -1. 先把`api.dushu.io`加到`[MITM]` -2. 再配置重写规则: - - Surge: 把两条远程脚本放到`[Script]` - - QuanX: 把`fandeng.cookie.js`和`fandeng.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关) -3. 打开 APP 手动签到一次: 访问下右下角 `我的` > `签到` -4. 系统提示: `获取Cookie: 成功` -5. 把获取 Cookie 的脚本注释掉 -6. 运行一次脚本, 如果提示重复签到, 那就算成功了! - -> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie. - -> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次. - -## 常见问题 - -1. 无法写入 Cookie - - - 检查 Surge 系统通知权限放开了没 - - 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴) - -2. 写入 Cookie 成功, 但签到不成功 - - - 看看是不是在登录前就写入 Cookie 了 - - 如果是,请确保在登录成功后,再尝试写入 Cookie - -3. 为什么有时成功有时失败 - - - 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败) - - 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学): - - - `Surge`配置: - - ```properties - # 没有什么是一顿饭解决不了的: - cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次 - # 如果有,那就两顿: - cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次 - # 实在不行,三顿也能接受: - cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次 - - # 再粗暴点,直接: - cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次 - ``` - - - `QuanX`配置: - - ```properties - [task_local] - 1 0 * * * xxx.js # 每天00:01执行一次 - 2 0 * * * xxx.js # 每天00:02执行一次 - 3 0 * * * xxx.js # 每天00:03执行一次 - - */60 * * * * xxx.js # 每60分执行一次 - ``` - -## 感谢 - -[@NobyDa](https://github.com/NobyDa) - -[@lhie1](https://github.com/lhie1) - -[@ConnersHua](https://github.com/ConnersHua) - -[@GideonSenku](https://github.com/GideonSenku) diff --git a/Scripts/SignIn/fandeng/fandeng.cookie.js b/Scripts/SignIn/fandeng/fandeng.cookie.js deleted file mode 100644 index 41b6666..0000000 --- a/Scripts/SignIn/fandeng/fandeng.cookie.js +++ /dev/null @@ -1,65 +0,0 @@ -const cookieName = '樊登读书' -const signurlKey = 'senku_signurl_pandeng' -const signheaderKey = 'senku_signheader_pandeng' -const signbodyKey = 'senku_signbody_pandeng' -const senku = init() - -const requrl = $request.url -if ($request && $request.method != 'OPTIONS') { - const signurlVal = requrl - const signheaderVal = JSON.stringify($request.headers) - const signbodyVal = $request.body - senku.log(`signurlVal:${signurlVal}`) - senku.log(`signheaderVal:${signheaderVal}`) - senku.log(`signbodyVal:${signbodyVal}`) - if (signurlVal) senku.setdata(signurlVal, signurlKey) - if (signheaderVal) senku.setdata(signheaderVal, signheaderKey) - if (signbodyVal) senku.setdata(signbodyVal, signbodyKey) - senku.msg(cookieName, `获取Cookie: 成功`, ``) -} - -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} -} - -senku.done() diff --git a/Scripts/SignIn/fandeng/fandeng.js b/Scripts/SignIn/fandeng/fandeng.js deleted file mode 100644 index 112c358..0000000 --- a/Scripts/SignIn/fandeng/fandeng.js +++ /dev/null @@ -1,72 +0,0 @@ -const cookieName = '樊登读书' -const signurlKey = 'senku_signurl_pandeng' -const signheaderKey = 'senku_signheader_pandeng' -const signbodyKey = 'senku_signbody_pandeng' -const senku = init() -const signurlVal = senku.getdata(signurlKey) -const signheaderVal = senku.getdata(signheaderKey) -const signBodyVal = senku.getdata(signbodyKey) - -sign() - -function sign() { - const url = {url: signurlVal, headers: JSON.parse(signheaderVal), body: signBodyVal} - senku.post(url, (error, response, data) => { - senku.log(`${cookieName}, data: ${data}`) - const res = JSON.parse(data) - let subTitle = `` - let detail = `` - if (res.status == 1) { - subTitle = `签到结果: 成功` - } else { - subTitle = `签到结果: 失败` - detail = `状态: ${res.message}` - } - senku.msg(cookieName, subTitle, detail) - senku.done() - }) -} - -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} -} diff --git a/Scripts/SignIn/tncj/README.md b/Scripts/SignIn/tncj/README.md deleted file mode 100644 index 0152266..0000000 --- a/Scripts/SignIn/tncj/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# 头脑吃鸡 - -> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - -## 配置 (Surge) - -```properties -[MITM] -tncj.hortorgames.com - -[Script] -http-response ^https://tncj.hortorgames.com/chicken/fight/(answer|findQuiz) requires-body=1,max-size=0,script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/tncj/tncj.min.js -``` - -## 配置 (QuanX) - -```properties -[MITM] -tncj.hortorgames.com - -[rewrite_local] -^https://tncj.hortorgames.com/chicken/fight/(answer|findQuiz) url script-response-body tncj.min.js - -``` - -## 感谢 - -[@LeeeMooo](https://github.com/LeeeMooo) diff --git a/Scripts/SignIn/tncj/tncj.min.js b/Scripts/SignIn/tncj/tncj.min.js deleted file mode 100644 index 0fd0591..0000000 --- a/Scripts/SignIn/tncj/tncj.min.js +++ /dev/null @@ -1,1701 +0,0 @@ -/** - * - # 头脑吃鸡 - - > 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可 - - ## 配置 (Surge) - - ```properties - [MITM] - tncj.hortorgames.com - - [Script] - http-response ^https://tncj.hortorgames.com/chicken/fight/(answer|findQuiz) requires-body=1,max-size=0,script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/tncj/tncj.min.js - ``` - - ## 配置 (QuanX) - - ```properties - [MITM] - tncj.hortorgames.com - - [rewrite_local] - ^https://tncj.hortorgames.com/chicken/fight/(answer|findQuiz) url script-response-body tncj.min.js - - ``` - - ## 感谢 - - [@LeeeMooo](https://github.com/LeeeMooo) - - */ -// prettier-ignore -function encrypt(t) { - const e = "6c805e193867e3b9"; - return CryptoJS.AES.encrypt(CryptoJS.enc.Utf8.parse(JSON.stringify(t)), CryptoJS.enc.Utf8.parse(e), { - iv: CryptoJS.enc.Utf8.parse(e), - mode: CryptoJS.mode.CBC, - padding: CryptoJS.pad.Pkcs7 - }).toString() -} - -function decrypt(t) { - const e = "6c805e193867e3b9"; - return JSON.parse(CryptoJS.AES.decrypt(CryptoJS.enc.Base64.stringify(CryptoJS.enc.Base64.parse(t)), CryptoJS.enc.Utf8.parse(e), { - iv: CryptoJS.enc.Utf8.parse(e), - mode: CryptoJS.mode.CBC, - padding: CryptoJS.pad.Pkcs7 - }).toString(CryptoJS.enc.Utf8).toString()) -} - -function init() { - return isSurge = (() => void 0 !== this.$httpClient), isQuanX = (() => void 0 !== this.$task), getdata = (t => isSurge() ? $persistentStore.read(t) : isQuanX() ? $prefs.valueForKey(t) : void 0), setdata = ((t, e) => isSurge() ? $persistentStore.write(t, e) : isQuanX() ? $prefs.setValueForKey(t, e) : void 0), msg = ((t, e, r) => { - isSurge() && $notification.post(t, e, r), isQuanX() && $notify(t, e, r) - }), log = (t => console.log(t)), get = ((t, e) => { - isSurge() && $httpClient.get(t, e), isQuanX() && (t.method = "GET", $task.fetch(t).then(t => e(null, {}, t.body))) - }), post = ((t, e) => { - isSurge() && $httpClient.post(t, e), isQuanX() && (t.method = "POST", $task.fetch(t).then(t => e(null, {}, t.body))) - }), done = ((t = {}) => { - $done(t) - }), { - isSurge: isSurge, - isQuanX: isQuanX, - msg: msg, - log: log, - getdata: getdata, - setdata: setdata, - get: get, - post: post, - done: done - } -} - -!function (t, e) { - "object" == typeof exports ? module.exports = exports = e() : "function" == typeof define && define.amd ? define([], e) : t.CryptoJS = e() -}(this, function () { - var t, e, r, i, n, o, s, a = a || function (t, e) { - var r = Object.create || function () { - function t() { - } - - return function (e) { - var r; - return t.prototype = e, r = new t, t.prototype = null, r - } - }(), i = {}, n = i.lib = {}, o = n.Base = { - extend: function (t) { - var e = r(this); - return t && e.mixIn(t), e.hasOwnProperty("init") && this.init !== e.init || (e.init = function () { - e.$super.init.apply(this, arguments) - }), e.init.prototype = e, e.$super = this, e - }, create: function () { - var t = this.extend(); - return t.init.apply(t, arguments), t - }, init: function () { - }, mixIn: function (t) { - for (var e in t) t.hasOwnProperty(e) && (this[e] = t[e]); - t.hasOwnProperty("toString") && (this.toString = t.toString) - }, clone: function () { - return this.init.prototype.extend(this) - } - }, s = n.WordArray = o.extend({ - init: function (t, r) { - t = this.words = t || [], this.sigBytes = r != e ? r : 4 * t.length - }, toString: function (t) { - return (t || c).stringify(this) - }, concat: function (t) { - var e = this.words, r = t.words, i = this.sigBytes, n = t.sigBytes; - if (this.clamp(), i % 4) for (var o = 0; o < n; o++) { - var s = r[o >>> 2] >>> 24 - o % 4 * 8 & 255; - e[i + o >>> 2] |= s << 24 - (i + o) % 4 * 8 - } else for (o = 0; o < n; o += 4) e[i + o >>> 2] = r[o >>> 2]; - return this.sigBytes += n, this - }, clamp: function () { - var e = this.words, r = this.sigBytes; - e[r >>> 2] &= 4294967295 << 32 - r % 4 * 8, e.length = t.ceil(r / 4) - }, clone: function () { - var t = o.clone.call(this); - return t.words = this.words.slice(0), t - }, random: function (e) { - for (var r, i = [], n = function (e) { - e = e; - var r = 987654321, i = 4294967295; - return function () { - r = 36969 * (65535 & r) + (r >> 16) & i, e = 18e3 * (65535 & e) + (e >> 16) & i; - var n = (r << 16) + e & i; - return n /= 4294967296, n += .5, n * (t.random() > .5 ? 1 : -1) - } - }, o = 0; o < e; o += 4) { - var a = n(4294967296 * (r || t.random())); - r = 987654071 * a(), i.push(4294967296 * a() | 0) - } - return new s.init(i, e) - } - }), a = i.enc = {}, c = a.Hex = { - stringify: function (t) { - for (var e = t.words, r = t.sigBytes, i = [], n = 0; n < r; n++) { - var o = e[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 e = t.length, r = [], i = 0; i < e; i += 2) r[i >>> 3] |= parseInt(t.substr(i, 2), 16) << 24 - i % 8 * 4; - return new s.init(r, e / 2) - } - }, h = a.Latin1 = { - stringify: function (t) { - for (var e = t.words, r = t.sigBytes, i = [], n = 0; n < r; n++) { - var o = e[n >>> 2] >>> 24 - n % 4 * 8 & 255; - i.push(String.fromCharCode(o)) - } - return i.join("") - }, parse: function (t) { - for (var e = t.length, r = [], i = 0; i < e; i++) r[i >>> 2] |= (255 & t.charCodeAt(i)) << 24 - i % 4 * 8; - return new s.init(r, e) - } - }, 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 (e) { - var r = this._data, i = r.words, n = r.sigBytes, o = this.blockSize, a = 4 * o, c = n / a; - c = e ? 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); - r.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 e = this._doFinalize(); - return e - }, blockSize: 16, _createHelper: function (t) { - return function (e, r) { - return new t.init(r).finalize(e) - } - }, _createHmacHelper: function (t) { - return function (e, r) { - return new u.HMAC.init(t, r).finalize(e) - } - } - }), i.algo = {}); - return i - }(Math); - return function () { - function t(t, e, r) { - for (var n = [], o = 0, s = 0; s < e; s++) if (s % 4) { - var a = r[t.charCodeAt(s - 1)] << s % 4 * 2, c = r[t.charCodeAt(s)] >>> 6 - s % 4 * 2; - n[o >>> 2] |= (a | c) << 24 - o % 4 * 8, o++ - } - return i.create(n, o) - } - - var e = a, r = e.lib, i = r.WordArray, n = e.enc; - n.Base64 = { - stringify: function (t) { - var e = t.words, r = t.sigBytes, i = this._map; - t.clamp(); - for (var n = [], o = 0; o < r; o += 3) for (var s = e[o >>> 2] >>> 24 - o % 4 * 8 & 255, a = e[o + 1 >>> 2] >>> 24 - (o + 1) % 4 * 8 & 255, c = e[o + 2 >>> 2] >>> 24 - (o + 2) % 4 * 8 & 255, h = s << 16 | a << 8 | c, l = 0; l < 4 && o + .75 * l < r; 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 (e) { - var r = e.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 = e.indexOf(s); - -1 !== a && (r = a) - } - return t(e, r, n) - }, _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" - } - }(), function (t) { - function e(t, e, r, i, n, o, s) { - var a = t + (e & r | ~e & i) + n + s; - return (a << o | a >>> 32 - o) + e - } - - function r(t, e, r, i, n, o, s) { - var a = t + (e & i | r & ~i) + n + s; - return (a << o | a >>> 32 - o) + e - } - - function i(t, e, r, i, n, o, s) { - var a = t + (e ^ r ^ i) + n + s; - return (a << o | a >>> 32 - o) + e - } - - function n(t, e, r, i, n, o, s) { - var a = t + (r ^ (e | ~i)) + n + s; - return (a << o | a >>> 32 - o) + e - } - - var o = a, s = o.lib, c = s.WordArray, h = s.Hasher, l = o.algo, f = []; - !function () { - for (var e = 0; e < 64; e++) f[e] = 4294967296 * t.abs(t.sin(e + 1)) | 0 - }(); - var u = l.MD5 = h.extend({ - _doReset: function () { - this._hash = new c.init([1732584193, 4023233417, 2562383102, 271733878]) - }, _doProcessBlock: function (t, o) { - for (var s = 0; s < 16; s++) { - var a = o + s, c = t[a]; - t[a] = 16711935 & (c << 8 | c >>> 24) | 4278255360 & (c << 24 | c >>> 8) - } - var h = this._hash.words, l = t[o + 0], u = t[o + 1], d = t[o + 2], p = t[o + 3], v = t[o + 4], - _ = t[o + 5], y = t[o + 6], g = t[o + 7], B = t[o + 8], k = t[o + 9], w = t[o + 10], S = t[o + 11], - m = t[o + 12], x = t[o + 13], b = t[o + 14], C = t[o + 15], z = h[0], H = h[1], A = h[2], D = h[3]; - z = e(z, H, A, D, l, 7, f[0]), D = e(D, z, H, A, u, 12, f[1]), A = e(A, D, z, H, d, 17, f[2]), H = e(H, A, D, z, p, 22, f[3]), z = e(z, H, A, D, v, 7, f[4]), D = e(D, z, H, A, _, 12, f[5]), A = e(A, D, z, H, y, 17, f[6]), H = e(H, A, D, z, g, 22, f[7]), z = e(z, H, A, D, B, 7, f[8]), D = e(D, z, H, A, k, 12, f[9]), A = e(A, D, z, H, w, 17, f[10]), H = e(H, A, D, z, S, 22, f[11]), z = e(z, H, A, D, m, 7, f[12]), D = e(D, z, H, A, x, 12, f[13]), A = e(A, D, z, H, b, 17, f[14]), H = e(H, A, D, z, C, 22, f[15]), z = r(z, H, A, D, u, 5, f[16]), D = r(D, z, H, A, y, 9, f[17]), A = r(A, D, z, H, S, 14, f[18]), H = r(H, A, D, z, l, 20, f[19]), z = r(z, H, A, D, _, 5, f[20]), D = r(D, z, H, A, w, 9, f[21]), A = r(A, D, z, H, C, 14, f[22]), H = r(H, A, D, z, v, 20, f[23]), z = r(z, H, A, D, k, 5, f[24]), D = r(D, z, H, A, b, 9, f[25]), A = r(A, D, z, H, p, 14, f[26]), H = r(H, A, D, z, B, 20, f[27]), z = r(z, H, A, D, x, 5, f[28]), D = r(D, z, H, A, d, 9, f[29]), A = r(A, D, z, H, g, 14, f[30]), H = r(H, A, D, z, m, 20, f[31]), z = i(z, H, A, D, _, 4, f[32]), D = i(D, z, H, A, B, 11, f[33]), A = i(A, D, z, H, S, 16, f[34]), H = i(H, A, D, z, b, 23, f[35]), z = i(z, H, A, D, u, 4, f[36]), D = i(D, z, H, A, v, 11, f[37]), A = i(A, D, z, H, g, 16, f[38]), H = i(H, A, D, z, w, 23, f[39]), z = i(z, H, A, D, x, 4, f[40]), D = i(D, z, H, A, l, 11, f[41]), A = i(A, D, z, H, p, 16, f[42]), H = i(H, A, D, z, y, 23, f[43]), z = i(z, H, A, D, k, 4, f[44]), D = i(D, z, H, A, m, 11, f[45]), A = i(A, D, z, H, C, 16, f[46]), H = i(H, A, D, z, d, 23, f[47]), z = n(z, H, A, D, l, 6, f[48]), D = n(D, z, H, A, g, 10, f[49]), A = n(A, D, z, H, b, 15, f[50]), H = n(H, A, D, z, _, 21, f[51]), z = n(z, H, A, D, m, 6, f[52]), D = n(D, z, H, A, p, 10, f[53]), A = n(A, D, z, H, w, 15, f[54]), H = n(H, A, D, z, u, 21, f[55]), z = n(z, H, A, D, B, 6, f[56]), D = n(D, z, H, A, C, 10, f[57]), A = n(A, D, z, H, y, 15, f[58]), H = n(H, A, D, z, x, 21, f[59]), z = n(z, H, A, D, v, 6, f[60]), D = n(D, z, H, A, S, 10, f[61]), A = n(A, D, z, H, d, 15, f[62]), H = n(H, A, D, z, k, 21, f[63]), h[0] = h[0] + z | 0, h[1] = h[1] + H | 0, h[2] = h[2] + A | 0, h[3] = h[3] + D | 0 - }, _doFinalize: function () { - var e = this._data, r = e.words, i = 8 * this._nDataBytes, n = 8 * e.sigBytes; - r[n >>> 5] |= 128 << 24 - n % 32; - var o = t.floor(i / 4294967296), s = i; - r[15 + (n + 64 >>> 9 << 4)] = 16711935 & (o << 8 | o >>> 24) | 4278255360 & (o << 24 | o >>> 8), r[14 + (n + 64 >>> 9 << 4)] = 16711935 & (s << 8 | s >>> 24) | 4278255360 & (s << 24 | s >>> 8), e.sigBytes = 4 * (r.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 - } - }); - o.MD5 = h._createHelper(u), o.HmacMD5 = h._createHmacHelper(u) - }(Math), t = a, e = t.lib, r = e.WordArray, i = e.Hasher, n = t.algo, o = [], s = n.SHA1 = i.extend({ - _doReset: function () { - this._hash = new r.init([1732584193, 4023233417, 2562383102, 271733878, 3285377520]) - }, _doProcessBlock: function (t, e) { - for (var r = this._hash.words, i = r[0], n = r[1], s = r[2], a = r[3], c = r[4], h = 0; h < 80; h++) { - if (h < 16) o[h] = 0 | t[e + h]; else { - var l = o[h - 3] ^ o[h - 8] ^ o[h - 14] ^ o[h - 16]; - o[h] = l << 1 | l >>> 31 - } - var f = (i << 5 | i >>> 27) + c + o[h]; - f += h < 20 ? 1518500249 + (n & s | ~n & a) : h < 40 ? 1859775393 + (n ^ s ^ a) : h < 60 ? (n & s | n & a | s & a) - 1894007588 : (n ^ s ^ a) - 899497514, c = a, a = s, s = n << 30 | n >>> 2, n = i, i = f - } - r[0] = r[0] + i | 0, r[1] = r[1] + n | 0, r[2] = r[2] + s | 0, r[3] = r[3] + a | 0, r[4] = r[4] + c | 0 - }, _doFinalize: function () { - var t = this._data, e = t.words, r = 8 * this._nDataBytes, i = 8 * t.sigBytes; - return e[i >>> 5] |= 128 << 24 - i % 32, e[14 + (i + 64 >>> 9 << 4)] = Math.floor(r / 4294967296), e[15 + (i + 64 >>> 9 << 4)] = r, t.sigBytes = 4 * e.length, this._process(), this._hash - }, clone: function () { - var t = i.clone.call(this); - return t._hash = this._hash.clone(), t - } - }), t.SHA1 = i._createHelper(s), t.HmacSHA1 = i._createHmacHelper(s), function (t) { - var e = a, r = e.lib, i = r.WordArray, n = r.Hasher, o = e.algo, s = [], c = []; - !function () { - function e(e) { - for (var r = t.sqrt(e), i = 2; i <= r; i++) if (!(e % i)) return !1; - return !0 - } - - function r(t) { - return 4294967296 * (t - (0 | t)) | 0 - } - - for (var i = 2, n = 0; n < 64;) e(i) && (n < 8 && (s[n] = r(t.pow(i, .5))), c[n] = r(t.pow(i, 1 / 3)), n++), i++ - }(); - var h = [], l = o.SHA256 = n.extend({ - _doReset: function () { - this._hash = new i.init(s.slice(0)) - }, _doProcessBlock: function (t, e) { - for (var r = this._hash.words, i = r[0], n = r[1], o = r[2], s = r[3], a = r[4], l = r[5], f = r[6], u = r[7], d = 0; d < 64; d++) { - if (d < 16) h[d] = 0 | t[e + d]; else { - var p = h[d - 15], v = (p << 25 | p >>> 7) ^ (p << 14 | p >>> 18) ^ p >>> 3, _ = h[d - 2], - y = (_ << 15 | _ >>> 17) ^ (_ << 13 | _ >>> 19) ^ _ >>> 10; - h[d] = v + h[d - 7] + y + h[d - 16] - } - var g = a & l ^ ~a & f, B = i & n ^ i & o ^ n & o, - k = (i << 30 | i >>> 2) ^ (i << 19 | i >>> 13) ^ (i << 10 | i >>> 22), - w = (a << 26 | a >>> 6) ^ (a << 21 | a >>> 11) ^ (a << 7 | a >>> 25), - S = u + w + g + c[d] + h[d], m = k + B; - u = f, f = l, l = a, a = s + S | 0, s = o, o = n, n = i, i = S + m | 0 - } - r[0] = r[0] + i | 0, r[1] = r[1] + n | 0, r[2] = r[2] + o | 0, r[3] = r[3] + s | 0, r[4] = r[4] + a | 0, r[5] = r[5] + l | 0, r[6] = r[6] + f | 0, r[7] = r[7] + u | 0 - }, _doFinalize: function () { - var e = this._data, r = e.words, i = 8 * this._nDataBytes, n = 8 * e.sigBytes; - return r[n >>> 5] |= 128 << 24 - n % 32, r[14 + (n + 64 >>> 9 << 4)] = t.floor(i / 4294967296), r[15 + (n + 64 >>> 9 << 4)] = i, e.sigBytes = 4 * r.length, this._process(), this._hash - }, clone: function () { - var t = n.clone.call(this); - return t._hash = this._hash.clone(), t - } - }); - e.SHA256 = n._createHelper(l), e.HmacSHA256 = n._createHmacHelper(l) - }(Math), function () { - function t(t) { - return t << 8 & 4278255360 | t >>> 8 & 16711935 - } - - var e = a, r = e.lib, i = r.WordArray, n = e.enc; - n.Utf16 = n.Utf16BE = { - stringify: function (t) { - for (var e = t.words, r = t.sigBytes, i = [], n = 0; n < r; n += 2) { - var o = e[n >>> 2] >>> 16 - n % 4 * 8 & 65535; - i.push(String.fromCharCode(o)) - } - return i.join("") - }, parse: function (t) { - for (var e = t.length, r = [], n = 0; n < e; n++) r[n >>> 1] |= t.charCodeAt(n) << 16 - n % 2 * 16; - return i.create(r, 2 * e) - } - }, n.Utf16LE = { - stringify: function (e) { - for (var r = e.words, i = e.sigBytes, n = [], o = 0; o < i; o += 2) { - var s = t(r[o >>> 2] >>> 16 - o % 4 * 8 & 65535); - n.push(String.fromCharCode(s)) - } - return n.join("") - }, parse: function (e) { - for (var r = e.length, n = [], o = 0; o < r; o++) n[o >>> 1] |= t(e.charCodeAt(o) << 16 - o % 2 * 16); - return i.create(n, 2 * r) - } - } - }(), function () { - if ("function" == typeof ArrayBuffer) { - var t = a, e = t.lib, r = e.WordArray, i = r.init, n = r.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 e = t.byteLength, r = [], n = 0; n < e; n++) r[n >>> 2] |= t[n] << 24 - n % 4 * 8; - i.call(this, r, e) - } else i.apply(this, arguments) - }; - n.prototype = r - } - }(), function (t) { - function e(t, e, r) { - return t ^ e ^ r - } - - function r(t, e, r) { - return t & e | ~t & r - } - - function i(t, e, r) { - return (t | ~e) ^ r - } - - function n(t, e, r) { - return t & r | e & ~r - } - - function o(t, e, r) { - return t ^ (e | ~r) - } - - function s(t, e) { - return t << e | t >>> 32 - e - } - - var c = a, 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]), - p = 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]), - v = 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, a) { - for (var c = 0; c < 16; c++) { - var h = a + c, l = t[h]; - t[h] = 16711935 & (l << 8 | l >>> 24) | 4278255360 & (l << 24 | l >>> 8) - } - var f, u, B, k, w, S, m, x, b, C, z = this._hash.words, H = y.words, A = g.words, D = d.words, - E = p.words, R = v.words, M = _.words; - S = f = z[0], m = u = z[1], x = B = z[2], b = k = z[3], C = w = z[4]; - var F; - for (c = 0; c < 80; c += 1) F = f + t[a + D[c]] | 0, F += c < 16 ? e(u, B, k) + H[0] : c < 32 ? r(u, B, k) + H[1] : c < 48 ? i(u, B, k) + H[2] : c < 64 ? n(u, B, k) + H[3] : o(u, B, k) + H[4], F |= 0, F = s(F, R[c]), F = F + w | 0, f = w, w = k, k = s(B, 10), B = u, u = F, F = S + t[a + E[c]] | 0, F += c < 16 ? o(m, x, b) + A[0] : c < 32 ? n(m, x, b) + A[1] : c < 48 ? i(m, x, b) + A[2] : c < 64 ? r(m, x, b) + A[3] : e(m, x, b) + A[4], F |= 0, F = s(F, M[c]), F = F + C | 0, S = C, C = b, b = s(x, 10), x = m, m = F; - F = z[1] + B + b | 0, z[1] = z[2] + k + C | 0, z[2] = z[3] + w + 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, e = t.words, r = 8 * this._nDataBytes, i = 8 * t.sigBytes; - e[i >>> 5] |= 128 << 24 - i % 32, e[14 + (i + 64 >>> 9 << 4)] = 16711935 & (r << 8 | r >>> 24) | 4278255360 & (r << 24 | r >>> 8), t.sigBytes = 4 * (e.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 t = a, e = t.lib, r = e.Base, i = t.enc, n = i.Utf8, o = t.algo; - o.HMAC = r.extend({ - init: function (t, e) { - t = this._hasher = new t.init, "string" == typeof e && (e = n.parse(e)); - var r = t.blockSize, i = 4 * r; - e.sigBytes > i && (e = t.finalize(e)), e.clamp(); - for (var o = this._oKey = e.clone(), s = this._iKey = e.clone(), a = o.words, c = s.words, h = 0; h < r; h++) a[h] ^= 1549556828, c[h] ^= 909522486; - o.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 e = this._hasher, r = e.finalize(t); - e.reset(); - var i = e.finalize(this._oKey.clone().concat(r)); - return i - } - }) - }(), function () { - var t = a, e = t.lib, r = e.Base, i = e.WordArray, n = t.algo, o = n.SHA1, s = n.HMAC, c = n.PBKDF2 = r.extend({ - cfg: r.extend({keySize: 4, hasher: o, iterations: 1}), init: function (t) { - this.cfg = this.cfg.extend(t) - }, compute: function (t, e) { - for (var r = this.cfg, n = s.create(r.hasher, t), o = i.create(), a = i.create([1]), c = o.words, h = a.words, l = r.keySize, f = r.iterations; c.length < l;) { - var u = n.update(e).finalize(a); - n.reset(); - for (var d = u.words, p = d.length, v = u, _ = 1; _ < f; _++) { - v = n.finalize(v), n.reset(); - for (var y = v.words, g = 0; g < p; g++) d[g] ^= y[g] - } - o.concat(u), h[0]++ - } - return o.sigBytes = 4 * l, o - } - }); - t.PBKDF2 = function (t, e, r) { - return c.create(r).compute(t, e) - } - }(), function () { - var t = a, e = t.lib, r = e.Base, i = e.WordArray, n = t.algo, o = n.MD5, s = n.EvpKDF = r.extend({ - cfg: r.extend({keySize: 4, hasher: o, iterations: 1}), init: function (t) { - this.cfg = this.cfg.extend(t) - }, compute: function (t, e) { - for (var r = this.cfg, n = r.hasher.create(), o = i.create(), s = o.words, a = r.keySize, c = r.iterations; s.length < a;) { - h && n.update(h); - var h = n.update(t).finalize(e); - n.reset(); - for (var l = 1; l < c; l++) h = n.finalize(h), n.reset(); - o.concat(h) - } - return o.sigBytes = 4 * a, o - } - }); - t.EvpKDF = function (t, e, r) { - return s.create(r).compute(t, e) - } - }(), function () { - var t = a, e = t.lib, r = e.WordArray, i = t.algo, n = i.SHA256, o = i.SHA224 = n.extend({ - _doReset: function () { - this._hash = new r.init([3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, 1694076839, 3204075428]) - }, _doFinalize: function () { - var t = n._doFinalize.call(this); - return t.sigBytes -= 4, t - } - }); - t.SHA224 = n._createHelper(o), t.HmacSHA224 = n._createHmacHelper(o) - }(), function (t) { - var e = a, r = e.lib, i = r.Base, n = r.WordArray, o = e.x64 = {}; - o.Word = i.extend({ - init: function (t, e) { - this.high = t, this.low = e - } - }), o.WordArray = i.extend({ - init: function (e, r) { - e = this.words = e || [], this.sigBytes = r != t ? r : 8 * e.length - }, toX32: function () { - for (var t = this.words, e = t.length, r = [], i = 0; i < e; i++) { - var o = t[i]; - r.push(o.high), r.push(o.low) - } - return n.create(r, this.sigBytes) - }, clone: function () { - for (var t = i.clone.call(this), e = t.words = this.words.slice(0), r = e.length, n = 0; n < r; n++) e[n] = e[n].clone(); - return t - } - }) - }(), function (t) { - var e = a, r = e.lib, i = r.WordArray, n = r.Hasher, o = e.x64, s = o.Word, c = e.algo, h = [], l = [], f = []; - !function () { - for (var t = 1, e = 0, r = 0; r < 24; r++) { - h[t + 5 * e] = (r + 1) * (r + 2) / 2 % 64; - var i = e % 5, n = (2 * t + 3 * e) % 5; - t = i, e = n - } - for (t = 0; t < 5; t++) for (e = 0; e < 5; e++) l[t + 5 * e] = e + (2 * t + 3 * e) % 5 * 5; - for (var o = 1, a = 0; a < 24; a++) { - for (var c = 0, u = 0, d = 0; d < 7; d++) { - if (1 & o) { - var p = (1 << d) - 1; - p < 32 ? u ^= 1 << p : c ^= 1 << p - 32 - } - 128 & o ? o = o << 1 ^ 113 : o <<= 1 - } - f[a] = s.create(c, u) - } - }(); - var u = []; - !function () { - for (var t = 0; t < 25; t++) u[t] = s.create() - }(); - var d = c.SHA3 = n.extend({ - cfg: n.cfg.extend({outputLength: 512}), _doReset: function () { - for (var t = this._state = [], e = 0; e < 25; e++) t[e] = new s.init; - this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32 - }, _doProcessBlock: function (t, e) { - for (var r = this._state, i = this.blockSize / 2, n = 0; n < i; n++) { - var o = t[e + 2 * n], s = t[e + 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 = r[n]; - a.high ^= s, a.low ^= o - } - for (var c = 0; c < 24; c++) { - for (var d = 0; d < 5; d++) { - for (var p = 0, v = 0, _ = 0; _ < 5; _++) { - a = r[d + 5 * _]; - p ^= a.high, v ^= a.low - } - var y = u[d]; - y.high = p, y.low = v - } - for (d = 0; d < 5; d++) { - var g = u[(d + 4) % 5], B = u[(d + 1) % 5], k = B.high, w = B.low; - for (p = g.high ^ (k << 1 | w >>> 31), v = g.low ^ (w << 1 | k >>> 31), _ = 0; _ < 5; _++) { - a = r[d + 5 * _]; - a.high ^= p, a.low ^= v - } - } - for (var S = 1; S < 25; S++) { - a = r[S]; - var m = a.high, x = a.low, b = h[S]; - if (b < 32) p = m << b | x >>> 32 - b, v = x << b | m >>> 32 - b; else p = x << b - 32 | m >>> 64 - b, v = m << b - 32 | x >>> 64 - b; - var C = u[l[S]]; - C.high = p, C.low = v - } - var z = u[0], H = r[0]; - z.high = H.high, z.low = H.low; - for (d = 0; d < 5; d++) for (_ = 0; _ < 5; _++) { - S = d + 5 * _, a = r[S]; - var A = u[S], D = u[(d + 1) % 5 + 5 * _], E = u[(d + 2) % 5 + 5 * _]; - a.high = A.high ^ ~D.high & E.high, a.low = A.low ^ ~D.low & E.low - } - a = r[0]; - var R = f[c]; - a.high ^= R.high, a.low ^= R.low - } - }, _doFinalize: function () { - var e = this._data, r = e.words, n = (this._nDataBytes, 8 * e.sigBytes), o = 32 * this.blockSize; - r[n >>> 5] |= 1 << 24 - n % 32, r[(t.ceil((n + 1) / o) * o >>> 5) - 1] |= 128, e.sigBytes = 4 * r.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 i.init(h, a) - }, clone: function () { - for (var t = n.clone.call(this), e = t._state = this._state.slice(0), r = 0; r < 25; r++) e[r] = e[r].clone(); - return t - } - }); - e.SHA3 = n._createHelper(d), e.HmacSHA3 = n._createHmacHelper(d) - }(Math), function () { - function t() { - return o.create.apply(o, arguments) - } - - var e = a, r = e.lib, i = r.Hasher, n = e.x64, o = n.Word, s = n.WordArray, c = e.algo, - h = [t(1116352408, 3609767458), t(1899447441, 602891725), t(3049323471, 3964484399), t(3921009573, 2173295548), t(961987163, 4081628472), t(1508970993, 3053834265), t(2453635748, 2937671579), t(2870763221, 3664609560), t(3624381080, 2734883394), t(310598401, 1164996542), t(607225278, 1323610764), t(1426881987, 3590304994), t(1925078388, 4068182383), t(2162078206, 991336113), t(2614888103, 633803317), t(3248222580, 3479774868), t(3835390401, 2666613458), t(4022224774, 944711139), t(264347078, 2341262773), t(604807628, 2007800933), t(770255983, 1495990901), t(1249150122, 1856431235), t(1555081692, 3175218132), t(1996064986, 2198950837), t(2554220882, 3999719339), t(2821834349, 766784016), t(2952996808, 2566594879), t(3210313671, 3203337956), t(3336571891, 1034457026), t(3584528711, 2466948901), t(113926993, 3758326383), t(338241895, 168717936), t(666307205, 1188179964), t(773529912, 1546045734), t(1294757372, 1522805485), t(1396182291, 2643833823), t(1695183700, 2343527390), t(1986661051, 1014477480), t(2177026350, 1206759142), t(2456956037, 344077627), t(2730485921, 1290863460), t(2820302411, 3158454273), t(3259730800, 3505952657), t(3345764771, 106217008), t(3516065817, 3606008344), t(3600352804, 1432725776), t(4094571909, 1467031594), t(275423344, 851169720), t(430227734, 3100823752), t(506948616, 1363258195), t(659060556, 3750685593), t(883997877, 3785050280), t(958139571, 3318307427), t(1322822218, 3812723403), t(1537002063, 2003034995), t(1747873779, 3602036899), t(1955562222, 1575990012), t(2024104815, 1125592928), t(2227730452, 2716904306), t(2361852424, 442776044), t(2428436474, 593698344), t(2756734187, 3733110249), t(3204031479, 2999351573), t(3329325298, 3815920427), t(3391569614, 3928383900), t(3515267271, 566280711), t(3940187606, 3454069534), t(4118630271, 4000239992), t(116418474, 1914138554), t(174292421, 2731055270), t(289380356, 3203993006), t(460393269, 320620315), t(685471733, 587496836), t(852142971, 1086792851), t(1017036298, 365543100), t(1126000580, 2618297676), t(1288033470, 3409855158), t(1501505948, 4234509866), t(1607167915, 987167468), t(1816402316, 1246189591)], - l = []; - !function () { - for (var e = 0; e < 80; e++) l[e] = t() - }(); - var f = c.SHA512 = i.extend({ - _doReset: function () { - this._hash = new s.init([new o.init(1779033703, 4089235720), new o.init(3144134277, 2227873595), new o.init(1013904242, 4271175723), new o.init(2773480762, 1595750129), new o.init(1359893119, 2917565137), new o.init(2600822924, 725511199), new o.init(528734635, 4215389547), new o.init(1541459225, 327033209)]) - }, _doProcessBlock: function (t, e) { - for (var r = this._hash.words, i = r[0], n = r[1], o = r[2], s = r[3], a = r[4], c = r[5], f = r[6], u = r[7], d = i.high, p = i.low, v = n.high, _ = n.low, y = o.high, g = o.low, B = s.high, k = s.low, w = a.high, S = a.low, m = c.high, x = c.low, b = f.high, C = f.low, z = u.high, H = u.low, A = d, D = p, E = v, R = _, M = y, F = g, P = B, W = k, O = w, X = S, U = m, J = x, K = b, $ = C, I = z, L = H, j = 0; j < 80; j++) { - var Q = l[j]; - if (j < 16) var N = Q.high = 0 | t[e + 2 * j], T = Q.low = 0 | t[e + 2 * j + 1]; else { - var q = l[j - 15], Z = q.high, G = q.low, - V = (Z >>> 1 | G << 31) ^ (Z >>> 8 | G << 24) ^ Z >>> 7, - Y = (G >>> 1 | Z << 31) ^ (G >>> 8 | Z << 24) ^ (G >>> 7 | Z << 25), tt = l[j - 2], - et = tt.high, rt = tt.low, it = (et >>> 19 | rt << 13) ^ (et << 3 | rt >>> 29) ^ et >>> 6, - nt = (rt >>> 19 | et << 13) ^ (rt << 3 | et >>> 29) ^ (rt >>> 6 | et << 26), ot = l[j - 7], - st = ot.high, at = ot.low, ct = l[j - 16], ht = ct.high, lt = ct.low; - T = Y + at, N = V + st + (T >>> 0 < Y >>> 0 ? 1 : 0), T = T + nt, N = N + it + (T >>> 0 < nt >>> 0 ? 1 : 0), T = T + lt, N = N + ht + (T >>> 0 < lt >>> 0 ? 1 : 0); - Q.high = N, Q.low = T - } - var ft = O & U ^ ~O & K, ut = X & J ^ ~X & $, dt = A & E ^ A & M ^ E & M, - pt = D & R ^ D & F ^ R & F, - vt = (A >>> 28 | D << 4) ^ (A << 30 | D >>> 2) ^ (A << 25 | D >>> 7), - _t = (D >>> 28 | A << 4) ^ (D << 30 | A >>> 2) ^ (D << 25 | A >>> 7), - yt = (O >>> 14 | X << 18) ^ (O >>> 18 | X << 14) ^ (O << 23 | X >>> 9), - gt = (X >>> 14 | O << 18) ^ (X >>> 18 | O << 14) ^ (X << 23 | O >>> 9), Bt = h[j], kt = Bt.high, - wt = Bt.low, St = L + gt, mt = I + yt + (St >>> 0 < L >>> 0 ? 1 : 0), - xt = (St = St + ut, mt = mt + ft + (St >>> 0 < ut >>> 0 ? 1 : 0), St = St + wt, mt = mt + kt + (St >>> 0 < wt >>> 0 ? 1 : 0), St = St + T, mt = mt + N + (St >>> 0 < T >>> 0 ? 1 : 0), _t + pt), - bt = vt + dt + (xt >>> 0 < _t >>> 0 ? 1 : 0); - I = K, L = $, K = U, $ = J, U = O, J = X, X = W + St | 0, O = P + mt + (X >>> 0 < W >>> 0 ? 1 : 0) | 0, P = M, W = F, M = E, F = R, E = A, R = D, D = St + xt | 0, A = mt + bt + (D >>> 0 < St >>> 0 ? 1 : 0) | 0 - } - p = i.low = p + D, i.high = d + A + (p >>> 0 < D >>> 0 ? 1 : 0), _ = n.low = _ + R, n.high = v + E + (_ >>> 0 < R >>> 0 ? 1 : 0), g = o.low = g + F, o.high = y + M + (g >>> 0 < F >>> 0 ? 1 : 0), k = s.low = k + W, s.high = B + P + (k >>> 0 < W >>> 0 ? 1 : 0), S = a.low = S + X, a.high = w + O + (S >>> 0 < X >>> 0 ? 1 : 0), x = c.low = x + J, c.high = m + U + (x >>> 0 < J >>> 0 ? 1 : 0), C = f.low = C + $, f.high = b + K + (C >>> 0 < $ >>> 0 ? 1 : 0), H = u.low = H + L, u.high = z + I + (H >>> 0 < L >>> 0 ? 1 : 0) - }, _doFinalize: function () { - var t = this._data, e = t.words, r = 8 * this._nDataBytes, i = 8 * t.sigBytes; - e[i >>> 5] |= 128 << 24 - i % 32, e[30 + (i + 128 >>> 10 << 5)] = Math.floor(r / 4294967296), e[31 + (i + 128 >>> 10 << 5)] = r, t.sigBytes = 4 * e.length, this._process(); - var n = this._hash.toX32(); - return n - }, clone: function () { - var t = i.clone.call(this); - return t._hash = this._hash.clone(), t - }, blockSize: 32 - }); - e.SHA512 = i._createHelper(f), e.HmacSHA512 = i._createHmacHelper(f) - }(), function () { - var t = a, e = t.x64, r = e.Word, i = e.WordArray, n = t.algo, o = n.SHA512, s = n.SHA384 = o.extend({ - _doReset: function () { - this._hash = new i.init([new r.init(3418070365, 3238371032), new r.init(1654270250, 914150663), new r.init(2438529370, 812702999), new r.init(355462360, 4144912697), new r.init(1731405415, 4290775857), new r.init(2394180231, 1750603025), new r.init(3675008525, 1694076839), new r.init(1203062813, 3204075428)]) - }, _doFinalize: function () { - var t = o._doFinalize.call(this); - return t.sigBytes -= 16, t - } - }); - t.SHA384 = o._createHelper(s), t.HmacSHA384 = o._createHmacHelper(s) - }(), a.lib.Cipher || function (t) { - var e = a, r = e.lib, i = r.Base, n = r.WordArray, o = r.BufferedBlockAlgorithm, s = e.enc, - c = (s.Utf8, s.Base64), h = e.algo, l = h.EvpKDF, f = r.Cipher = o.extend({ - cfg: i.extend(), createEncryptor: function (t, e) { - return this.create(this._ENC_XFORM_MODE, t, e) - }, createDecryptor: function (t, e) { - return this.create(this._DEC_XFORM_MODE, t, e) - }, init: function (t, e, r) { - this.cfg = this.cfg.extend(r), this._xformMode = t, this._key = e, this.reset() - }, reset: function () { - o.reset.call(this), this._doReset() - }, process: function (t) { - return this._append(t), this._process() - }, finalize: function (t) { - t && this._append(t); - var e = this._doFinalize(); - return e - }, keySize: 4, ivSize: 4, _ENC_XFORM_MODE: 1, _DEC_XFORM_MODE: 2, _createHelper: function () { - function t(t) { - return "string" == typeof t ? m : k - } - - return function (e) { - return { - encrypt: function (r, i, n) { - return t(i).encrypt(e, r, i, n) - }, decrypt: function (r, i, n) { - return t(i).decrypt(e, r, i, n) - } - } - } - }() - }), u = (r.StreamCipher = f.extend({ - _doFinalize: function () { - var t = this._process(!0); - return t - }, blockSize: 1 - }), e.mode = {}), d = r.BlockCipherMode = i.extend({ - createEncryptor: function (t, e) { - return this.Encryptor.create(t, e) - }, createDecryptor: function (t, e) { - return this.Decryptor.create(t, e) - }, init: function (t, e) { - this._cipher = t, this._iv = e - } - }), p = u.CBC = function () { - function e(e, r, i) { - var n = this._iv; - if (n) { - var o = n; - this._iv = t - } else o = this._prevBlock; - for (var s = 0; s < i; s++) e[r + s] ^= o[s] - } - - var r = d.extend(); - return r.Encryptor = r.extend({ - processBlock: function (t, r) { - var i = this._cipher, n = i.blockSize; - e.call(this, t, r, n), i.encryptBlock(t, r), this._prevBlock = t.slice(r, r + n) - } - }), r.Decryptor = r.extend({ - processBlock: function (t, r) { - var i = this._cipher, n = i.blockSize, o = t.slice(r, r + n); - i.decryptBlock(t, r), e.call(this, t, r, n), this._prevBlock = o - } - }), r - }(), v = e.pad = {}, _ = v.Pkcs7 = { - pad: function (t, e) { - for (var r = 4 * e, i = r - t.sigBytes % r, o = i << 24 | i << 16 | i << 8 | i, s = [], a = 0; a < i; a += 4) s.push(o); - var c = n.create(s, i); - t.concat(c) - }, unpad: function (t) { - var e = 255 & t.words[t.sigBytes - 1 >>> 2]; - t.sigBytes -= e - } - }, y = (r.BlockCipher = f.extend({ - cfg: f.cfg.extend({mode: p, padding: _}), reset: function () { - f.reset.call(this); - var t = this.cfg, e = t.iv, r = t.mode; - if (this._xformMode == this._ENC_XFORM_MODE) var i = r.createEncryptor; else { - i = r.createDecryptor; - this._minBufferSize = 1 - } - this._mode && this._mode.__creator == i ? this._mode.init(this, e && e.words) : (this._mode = i.call(r, this, e && e.words), this._mode.__creator = i) - }, _doProcessBlock: function (t, e) { - this._mode.processBlock(t, e) - }, _doFinalize: function () { - var t = this.cfg.padding; - if (this._xformMode == this._ENC_XFORM_MODE) { - t.pad(this._data, this.blockSize); - var e = this._process(!0) - } else { - e = this._process(!0); - t.unpad(e) - } - return e - }, blockSize: 4 - }), r.CipherParams = i.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 e = t.ciphertext, r = t.salt; - if (r) var i = n.create([1398893684, 1701076831]).concat(r).concat(e); else i = e; - return i.toString(c) - }, parse: function (t) { - var e = c.parse(t), r = e.words; - if (1398893684 == r[0] && 1701076831 == r[1]) { - var i = n.create(r.slice(2, 4)); - r.splice(0, 4), e.sigBytes -= 16 - } - return y.create({ciphertext: e, salt: i}) - } - }, k = r.SerializableCipher = i.extend({ - cfg: i.extend({format: B}), encrypt: function (t, e, r, i) { - i = this.cfg.extend(i); - var n = t.createEncryptor(r, i), o = n.finalize(e), s = n.cfg; - return y.create({ - ciphertext: o, - key: r, - iv: s.iv, - algorithm: t, - mode: s.mode, - padding: s.padding, - blockSize: t.blockSize, - formatter: i.format - }) - }, decrypt: function (t, e, r, i) { - i = this.cfg.extend(i), e = this._parse(e, i.format); - var n = t.createDecryptor(r, i).finalize(e.ciphertext); - return n - }, _parse: function (t, e) { - return "string" == typeof t ? e.parse(t, this) : t - } - }), w = e.kdf = {}, S = w.OpenSSL = { - execute: function (t, e, r, i) { - i || (i = n.random(8)); - var o = l.create({keySize: e + r}).compute(t, i), s = n.create(o.words.slice(e), 4 * r); - return o.sigBytes = 4 * e, y.create({key: o, iv: s, salt: i}) - } - }, m = r.PasswordBasedCipher = k.extend({ - cfg: k.cfg.extend({kdf: S}), encrypt: function (t, e, r, i) { - i = this.cfg.extend(i); - var n = i.kdf.execute(r, t.keySize, t.ivSize); - i.iv = n.iv; - var o = k.encrypt.call(this, t, e, n.key, i); - return o.mixIn(n), o - }, decrypt: function (t, e, r, i) { - i = this.cfg.extend(i), e = this._parse(e, i.format); - var n = i.kdf.execute(r, t.keySize, t.ivSize, e.salt); - i.iv = n.iv; - var o = k.decrypt.call(this, t, e, n.key, i); - return o - } - }) - }(), a.mode.CFB = function () { - function t(t, e, r, i) { - var n = this._iv; - if (n) { - var o = n.slice(0); - this._iv = void 0 - } else o = this._prevBlock; - i.encryptBlock(o, 0); - for (var s = 0; s < r; s++) t[e + s] ^= o[s] - } - - var e = a.lib.BlockCipherMode.extend(); - return e.Encryptor = e.extend({ - processBlock: function (e, r) { - var i = this._cipher, n = i.blockSize; - t.call(this, e, r, n, i), this._prevBlock = e.slice(r, r + n) - } - }), e.Decryptor = e.extend({ - processBlock: function (e, r) { - var i = this._cipher, n = i.blockSize, o = e.slice(r, r + n); - t.call(this, e, r, n, i), this._prevBlock = o - } - }), e - }(), a.mode.ECB = function () { - var t = a.lib.BlockCipherMode.extend(); - return t.Encryptor = t.extend({ - processBlock: function (t, e) { - this._cipher.encryptBlock(t, e) - } - }), t.Decryptor = t.extend({ - processBlock: function (t, e) { - this._cipher.decryptBlock(t, e) - } - }), t - }(), a.pad.AnsiX923 = { - pad: function (t, e) { - var r = t.sigBytes, i = 4 * e, n = i - r % i, o = r + n - 1; - t.clamp(), t.words[o >>> 2] |= n << 24 - o % 4 * 8, t.sigBytes += n - }, unpad: function (t) { - var e = 255 & t.words[t.sigBytes - 1 >>> 2]; - t.sigBytes -= e - } - }, a.pad.Iso10126 = { - pad: function (t, e) { - var r = 4 * e, i = r - t.sigBytes % r; - t.concat(a.lib.WordArray.random(i - 1)).concat(a.lib.WordArray.create([i << 24], 1)) - }, unpad: function (t) { - var e = 255 & t.words[t.sigBytes - 1 >>> 2]; - t.sigBytes -= e - } - }, a.pad.Iso97971 = { - pad: function (t, e) { - t.concat(a.lib.WordArray.create([2147483648], 1)), a.pad.ZeroPadding.pad(t, e) - }, unpad: function (t) { - a.pad.ZeroPadding.unpad(t), t.sigBytes-- - } - }, a.mode.OFB = function () { - var t = a.lib.BlockCipherMode.extend(), e = t.Encryptor = t.extend({ - processBlock: function (t, e) { - var r = this._cipher, i = r.blockSize, n = this._iv, o = this._keystream; - n && (o = this._keystream = n.slice(0), this._iv = void 0), r.encryptBlock(o, 0); - for (var s = 0; s < i; s++) t[e + s] ^= o[s] - } - }); - return t.Decryptor = e, t - }(), a.pad.NoPadding = { - pad: function () { - }, unpad: function () { - } - }, function (t) { - var e = a, r = e.lib, i = r.CipherParams, n = e.enc, o = n.Hex, s = e.format; - s.Hex = { - stringify: function (t) { - return t.ciphertext.toString(o) - }, parse: function (t) { - var e = o.parse(t); - return i.create({ciphertext: e}) - } - } - }(), function () { - var t = a, e = t.lib, r = e.BlockCipher, i = t.algo, n = [], o = [], s = [], c = [], h = [], l = [], f = [], - u = [], d = [], p = []; - !function () { - for (var t = [], e = 0; e < 256; e++) t[e] = e < 128 ? e << 1 : e << 1 ^ 283; - var r = 0, i = 0; - for (e = 0; e < 256; e++) { - var a = i ^ i << 1 ^ i << 2 ^ i << 3 ^ i << 4; - a = a >>> 8 ^ 255 & a ^ 99, n[r] = a, o[a] = r; - var v = t[r], _ = t[v], y = t[_], g = 257 * t[a] ^ 16843008 * a; - s[r] = g << 24 | g >>> 8, c[r] = g << 16 | g >>> 16, h[r] = g << 8 | g >>> 24, l[r] = g; - g = 16843009 * y ^ 65537 * _ ^ 257 * v ^ 16843008 * r; - f[a] = g << 24 | g >>> 8, u[a] = g << 16 | g >>> 16, d[a] = g << 8 | g >>> 24, p[a] = g, r ? (r = v ^ t[t[t[y ^ v]]], i ^= t[t[i]]) : r = i = 1 - } - }(); - var v = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], _ = i.AES = r.extend({ - _doReset: function () { - if (!this._nRounds || this._keyPriorReset !== this._key) { - for (var t = this._keyPriorReset = this._key, e = t.words, r = t.sigBytes / 4, i = this._nRounds = r + 6, o = 4 * (i + 1), s = this._keySchedule = [], a = 0; a < o; a++) if (a < r) s[a] = e[a]; else { - var c = s[a - 1]; - a % r ? r > 6 && a % r == 4 && (c = n[c >>> 24] << 24 | n[c >>> 16 & 255] << 16 | n[c >>> 8 & 255] << 8 | n[255 & c]) : (c = c << 8 | c >>> 24, c = n[c >>> 24] << 24 | n[c >>> 16 & 255] << 16 | n[c >>> 8 & 255] << 8 | n[255 & c], c ^= v[a / r | 0] << 24), s[a] = s[a - r] ^ c - } - for (var h = this._invKeySchedule = [], l = 0; l < o; l++) { - a = o - l; - if (l % 4) c = s[a]; else c = s[a - 4] - ; - h[l] = l < 4 || a <= 4 ? c : f[n[c >>> 24]] ^ u[n[c >>> 16 & 255]] ^ d[n[c >>> 8 & 255]] ^ p[n[255 & c]] - } - } - }, encryptBlock: function (t, e) { - this._doCryptBlock(t, e, this._keySchedule, s, c, h, l, n) - }, decryptBlock: function (t, e) { - var r = t[e + 1]; - t[e + 1] = t[e + 3], t[e + 3] = r, this._doCryptBlock(t, e, this._invKeySchedule, f, u, d, p, o); - r = t[e + 1]; - t[e + 1] = t[e + 3], t[e + 3] = r - }, _doCryptBlock: function (t, e, r, i, n, o, s, a) { - for (var c = this._nRounds, h = t[e] ^ r[0], l = t[e + 1] ^ r[1], f = t[e + 2] ^ r[2], u = t[e + 3] ^ r[3], d = 4, p = 1; p < c; p++) { - var v = i[h >>> 24] ^ n[l >>> 16 & 255] ^ o[f >>> 8 & 255] ^ s[255 & u] ^ r[d++], - _ = i[l >>> 24] ^ n[f >>> 16 & 255] ^ o[u >>> 8 & 255] ^ s[255 & h] ^ r[d++], - y = i[f >>> 24] ^ n[u >>> 16 & 255] ^ o[h >>> 8 & 255] ^ s[255 & l] ^ r[d++], - g = i[u >>> 24] ^ n[h >>> 16 & 255] ^ o[l >>> 8 & 255] ^ s[255 & f] ^ r[d++]; - h = v, l = _, f = y, u = g - } - v = (a[h >>> 24] << 24 | a[l >>> 16 & 255] << 16 | a[f >>> 8 & 255] << 8 | a[255 & u]) ^ r[d++], _ = (a[l >>> 24] << 24 | a[f >>> 16 & 255] << 16 | a[u >>> 8 & 255] << 8 | a[255 & h]) ^ r[d++], y = (a[f >>> 24] << 24 | a[u >>> 16 & 255] << 16 | a[h >>> 8 & 255] << 8 | a[255 & l]) ^ r[d++], g = (a[u >>> 24] << 24 | a[h >>> 16 & 255] << 16 | a[l >>> 8 & 255] << 8 | a[255 & f]) ^ r[d++]; - t[e] = v, t[e + 1] = _, t[e + 2] = y, t[e + 3] = g - }, keySize: 8 - }); - t.AES = r._createHelper(_) - }(), function () { - function t(t, e) { - var r = (this._lBlock >>> t ^ this._rBlock) & e; - this._rBlock ^= r, this._lBlock ^= r << t - } - - function e(t, e) { - var r = (this._rBlock >>> t ^ this._lBlock) & e; - this._lBlock ^= r, this._rBlock ^= r << t - } - - var r = a, i = r.lib, n = i.WordArray, o = i.BlockCipher, s = r.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 = s.DES = o.extend({ - _doReset: function () { - for (var t = this._key, e = t.words, r = [], i = 0; i < 56; i++) { - var n = c[i] - 1; - r[i] = e[n >>> 5] >>> 31 - n % 32 & 1 - } - for (var o = this._subKeys = [], s = 0; s < 16; s++) { - var a = o[s] = [], f = l[s]; - for (i = 0; i < 24; i++) a[i / 6 | 0] |= r[(h[i] - 1 + f) % 28] << 31 - i % 6, a[4 + (i / 6 | 0)] |= r[28 + (h[i + 24] - 1 + f) % 28] << 31 - i % 6; - a[0] = a[0] << 1 | a[0] >>> 31; - for (i = 1; i < 7; i++) a[i] = a[i] >>> 4 * (i - 1) + 3; - a[7] = a[7] << 5 | a[7] >>> 27 - } - var u = this._invSubKeys = []; - for (i = 0; i < 16; i++) u[i] = o[15 - i] - }, encryptBlock: function (t, e) { - this._doCryptBlock(t, e, this._subKeys) - }, decryptBlock: function (t, e) { - this._doCryptBlock(t, e, this._invSubKeys) - }, _doCryptBlock: function (r, i, n) { - this._lBlock = r[i], this._rBlock = r[i + 1], t.call(this, 4, 252645135), t.call(this, 16, 65535), e.call(this, 2, 858993459), e.call(this, 8, 16711935), t.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, t.call(this, 1, 1431655765), e.call(this, 8, 16711935), e.call(this, 2, 858993459), t.call(this, 16, 65535), t.call(this, 4, 252645135), r[i] = this._lBlock, r[i + 1] = this._rBlock - }, keySize: 2, ivSize: 2, blockSize: 2 - }); - r.DES = o._createHelper(d); - var p = s.TripleDES = o.extend({ - _doReset: function () { - var t = this._key, e = t.words; - this._des1 = d.createEncryptor(n.create(e.slice(0, 2))), this._des2 = d.createEncryptor(n.create(e.slice(2, 4))), this._des3 = d.createEncryptor(n.create(e.slice(4, 6))) - }, encryptBlock: function (t, e) { - this._des1.encryptBlock(t, e), this._des2.decryptBlock(t, e), this._des3.encryptBlock(t, e) - }, decryptBlock: function (t, e) { - this._des3.decryptBlock(t, e), this._des2.encryptBlock(t, e), this._des1.decryptBlock(t, e) - }, keySize: 6, ivSize: 2, blockSize: 2 - }); - r.TripleDES = o._createHelper(p) - }(), function () { - function t() { - for (var t = this._S, e = this._i, r = this._j, i = 0, n = 0; n < 4; n++) { - e = (e + 1) % 256, r = (r + t[e]) % 256; - var o = t[e]; - t[e] = t[r], t[r] = o, i |= t[(t[e] + t[r]) % 256] << 24 - 8 * n - } - return this._i = e, this._j = r, i - } - - var e = a, r = e.lib, i = r.StreamCipher, n = e.algo, o = n.RC4 = i.extend({ - _doReset: function () { - for (var t = this._key, e = t.words, r = t.sigBytes, i = this._S = [], n = 0; n < 256; n++) i[n] = n; - n = 0; - for (var o = 0; n < 256; n++) { - var s = n % r, a = e[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 (e, r) { - e[r] ^= t.call(this) - }, keySize: 8, ivSize: 0 - }); - e.RC4 = i._createHelper(o); - var s = n.RC4Drop = o.extend({ - cfg: o.cfg.extend({drop: 192}), _doReset: function () { - o._doReset.call(this); - for (var e = this.cfg.drop; e > 0; e--) t.call(this) - } - }); - e.RC4Drop = i._createHelper(s) - }(), a.mode.CTRGladman = function () { - function t(t) { - if (255 == (t >> 24 & 255)) { - var e = t >> 16 & 255, r = t >> 8 & 255, i = 255 & t; - 255 === e ? (e = 0, 255 === r ? (r = 0, 255 === i ? i = 0 : ++i) : ++r) : ++e, t = 0, t += e << 16, t += r << 8, t += i - } else t += 1 << 24; - return t - } - - function e(e) { - return 0 === (e[0] = t(e[0])) && (e[1] = t(e[1])), e - } - - var r = a.lib.BlockCipherMode.extend(), i = r.Encryptor = r.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 r.Decryptor = i, r - }(), function () { - function t() { - for (var t = this._X, e = this._C, r = 0; r < 8; r++) s[r] = e[r]; - e[0] = e[0] + 1295307597 + this._b | 0, e[1] = e[1] + 3545052371 + (e[0] >>> 0 < s[0] >>> 0 ? 1 : 0) | 0, e[2] = e[2] + 886263092 + (e[1] >>> 0 < s[1] >>> 0 ? 1 : 0) | 0, e[3] = e[3] + 1295307597 + (e[2] >>> 0 < s[2] >>> 0 ? 1 : 0) | 0, e[4] = e[4] + 3545052371 + (e[3] >>> 0 < s[3] >>> 0 ? 1 : 0) | 0, e[5] = e[5] + 886263092 + (e[4] >>> 0 < s[4] >>> 0 ? 1 : 0) | 0, e[6] = e[6] + 1295307597 + (e[5] >>> 0 < s[5] >>> 0 ? 1 : 0) | 0, e[7] = e[7] + 3545052371 + (e[6] >>> 0 < s[6] >>> 0 ? 1 : 0) | 0, this._b = e[7] >>> 0 < s[7] >>> 0 ? 1 : 0; - for (r = 0; r < 8; r++) { - var i = t[r] + e[r], n = 65535 & i, o = i >>> 16, a = ((n * n >>> 17) + n * o >>> 15) + o * o, - h = ((4294901760 & i) * i | 0) + ((65535 & i) * i | 0); - c[r] = a ^ 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 = a, r = e.lib, i = r.StreamCipher, n = e.algo, o = [], s = [], c = [], h = n.Rabbit = i.extend({ - _doReset: function () { - for (var e = this._key.words, r = this.cfg.iv, i = 0; i < 4; i++) e[i] = 16711935 & (e[i] << 8 | e[i] >>> 24) | 4278255360 & (e[i] << 24 | e[i] >>> 8); - var n = this._X = [e[0], e[3] << 16 | e[2] >>> 16, e[1], e[0] << 16 | e[3] >>> 16, e[2], e[1] << 16 | e[0] >>> 16, e[3], e[2] << 16 | e[1] >>> 16], - o = this._C = [e[2] << 16 | e[2] >>> 16, 4294901760 & e[0] | 65535 & e[1], e[3] << 16 | e[3] >>> 16, 4294901760 & e[1] | 65535 & e[2], e[0] << 16 | e[0] >>> 16, 4294901760 & e[2] | 65535 & e[3], e[1] << 16 | e[1] >>> 16, 4294901760 & e[3] | 65535 & e[0]]; - this._b = 0; - for (i = 0; i < 4; i++) t.call(this); - for (i = 0; i < 8; i++) o[i] ^= n[i + 4 & 7]; - if (r) { - var s = r.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 (i = 0; i < 4; i++) t.call(this) - } - }, _doProcessBlock: function (e, r) { - var i = this._X; - t.call(this), o[0] = i[0] ^ i[5] >>> 16 ^ i[3] << 16, o[1] = i[2] ^ i[7] >>> 16 ^ i[5] << 16, o[2] = i[4] ^ i[1] >>> 16 ^ i[7] << 16, o[3] = i[6] ^ i[3] >>> 16 ^ i[1] << 16; - for (var n = 0; n < 4; n++) o[n] = 16711935 & (o[n] << 8 | o[n] >>> 24) | 4278255360 & (o[n] << 24 | o[n] >>> 8), e[r + n] ^= o[n] - }, blockSize: 4, ivSize: 2 - }); - e.Rabbit = i._createHelper(h) - }(), a.mode.CTR = function () { - var t = a.lib.BlockCipherMode.extend(), e = t.Encryptor = t.extend({ - processBlock: function (t, e) { - var r = this._cipher, i = r.blockSize, n = this._iv, o = this._counter; - n && (o = this._counter = n.slice(0), this._iv = void 0); - var s = o.slice(0); - r.encryptBlock(s, 0), o[i - 1] = o[i - 1] + 1 | 0; - for (var a = 0; a < i; a++) t[e + a] ^= s[a] - } - }); - return t.Decryptor = e, t - }(), function () { - function t() { - for (var t = this._X, e = this._C, r = 0; r < 8; r++) s[r] = e[r]; - e[0] = e[0] + 1295307597 + this._b | 0, e[1] = e[1] + 3545052371 + (e[0] >>> 0 < s[0] >>> 0 ? 1 : 0) | 0, e[2] = e[2] + 886263092 + (e[1] >>> 0 < s[1] >>> 0 ? 1 : 0) | 0, e[3] = e[3] + 1295307597 + (e[2] >>> 0 < s[2] >>> 0 ? 1 : 0) | 0, e[4] = e[4] + 3545052371 + (e[3] >>> 0 < s[3] >>> 0 ? 1 : 0) | 0, e[5] = e[5] + 886263092 + (e[4] >>> 0 < s[4] >>> 0 ? 1 : 0) | 0, e[6] = e[6] + 1295307597 + (e[5] >>> 0 < s[5] >>> 0 ? 1 : 0) | 0, e[7] = e[7] + 3545052371 + (e[6] >>> 0 < s[6] >>> 0 ? 1 : 0) | 0, this._b = e[7] >>> 0 < s[7] >>> 0 ? 1 : 0; - for (r = 0; r < 8; r++) { - var i = t[r] + e[r], n = 65535 & i, o = i >>> 16, a = ((n * n >>> 17) + n * o >>> 15) + o * o, - h = ((4294901760 & i) * i | 0) + ((65535 & i) * i | 0); - c[r] = a ^ 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 = a, r = e.lib, i = r.StreamCipher, n = e.algo, o = [], s = [], c = [], h = n.RabbitLegacy = i.extend({ - _doReset: function () { - var e = this._key.words, r = this.cfg.iv, - i = this._X = [e[0], e[3] << 16 | e[2] >>> 16, e[1], e[0] << 16 | e[3] >>> 16, e[2], e[1] << 16 | e[0] >>> 16, e[3], e[2] << 16 | e[1] >>> 16], - n = this._C = [e[2] << 16 | e[2] >>> 16, 4294901760 & e[0] | 65535 & e[1], e[3] << 16 | e[3] >>> 16, 4294901760 & e[1] | 65535 & e[2], e[0] << 16 | e[0] >>> 16, 4294901760 & e[2] | 65535 & e[3], e[1] << 16 | e[1] >>> 16, 4294901760 & e[3] | 65535 & e[0]]; - this._b = 0; - for (var o = 0; o < 4; o++) t.call(this); - for (o = 0; o < 8; o++) n[o] ^= i[o + 4 & 7]; - if (r) { - var s = r.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 (o = 0; o < 4; o++) t.call(this) - } - }, _doProcessBlock: function (e, r) { - var i = this._X; - t.call(this), o[0] = i[0] ^ i[5] >>> 16 ^ i[3] << 16, o[1] = i[2] ^ i[7] >>> 16 ^ i[5] << 16, o[2] = i[4] ^ i[1] >>> 16 ^ i[7] << 16, o[3] = i[6] ^ i[3] >>> 16 ^ i[1] << 16; - for (var n = 0; n < 4; n++) o[n] = 16711935 & (o[n] << 8 | o[n] >>> 24) | 4278255360 & (o[n] << 24 | o[n] >>> 8), e[r + n] ^= o[n] - }, blockSize: 4, ivSize: 2 - }); - e.RabbitLegacy = i._createHelper(h) - }(), a.pad.ZeroPadding = { - pad: function (t, e) { - var r = 4 * e; - t.clamp(), t.sigBytes += r - (t.sigBytes % r || r) - }, unpad: function (t) { - for (var e = t.words, r = t.sigBytes - 1; !(e[r >>> 2] >>> 24 - r % 4 * 8 & 255);) r--; - t.sigBytes = r + 1 - } - }, a -}); -const chavy = init(); -if ($request.url.match("findQuiz")) { - const t = decrypt($response.body); - if (0 == t.errcode) { - const e = t.data.quiz, r = t.data.answer; - chavy.msg("\u5934\u8111\u5403\u9e21", e, 0 == r ? "\u9519\u8bef \u2b55" : "\u2705 \u6b63\u786e") - } - chavy.done() -} else chavy.done(); \ No newline at end of file