├── .gitignore
├── README.md
├── qx
├── jd-half-mh.json
└── longzhuzhu.boxjs.json
└── rewrite
├── naicha.conf
└── naicha.cookie.js
/.gitignore:
--------------------------------------------------------------------------------
1 | /qx-src
2 | /qx/jdCookie.js
3 | /qx/sendNotify.js
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## 龙猪猪
2 |
3 | 1. 龙猪猪, 命名来自龙傲天(霹雳布袋戏虚拟人物
4 | )
5 | 2. 【人物简介】: 游历江湖的剑客,性格单纯、粗线条,但有时又会展现惊人的推理能力。剑随风剑法高超,一心想扬名天下,却不可得,机缘之下巧遇蝴蝶君,被吐槽没有特色,而且对布袋戏的“成名公式”一无所知。于是恍然大悟,缠着蝴蝶君,要他教导如何建立自己的特色,以及在江湖成名的方法,两人一搭一唱。
6 |
7 | * 称号:唯吾无敌龙傲天
8 | * 本名:剑随风
9 | * 实力:可抗衡北域第一刀者蝴蝶君
10 | * 擅长:推论
11 | * 兵器:随风剑
12 | * 诗号:前不见古人, 后不见来者, 念天地之悠悠, 独怆然而涕下
13 |
14 |
15 | ## 免责声明
16 |
17 | 1. 此仓储脚本仅用于学习研究,不保证其合法性、准确性、有效性,请根据情况自行判断,本人对此不承担任何保证责任。
18 |
19 | 2. 由于此仓储脚本仅用于学习研究,您必须在下载后 24 小时内将所有内容从您的计算机或手机或任何存储设备中完全删除,若违反规定引起任何事件本人对此均不负责。
20 |
21 | 3. 请勿将此仓储脚本用于任何商业或非法目的,若违反规定请自行对此负责。
22 |
23 | 4. 此仓储脚本涉及应用与本人无关,本人对因此引起的任何隐私泄漏或其他后果不承担任何责任。
24 |
25 | 5. 本人对任何脚本引发的问题概不负责,包括但不限于由脚本错误引起的任何损失和损害。
26 |
27 | 6. 如果任何单位或个人认为此仓储脚本可能涉嫌侵犯其权利,应及时通知并提供身份证明,所有权证明,我们将在收到认证文件确认后删除此仓储脚本。
28 |
29 | 7. 所有直接或间接使用、查看此仓储脚本的人均应该仔细阅读此声明。本人保留随时更改或补充此声明的权利。一旦您使用或复制了此仓储脚本,即视为您已接受此免责声明。
30 | .com/5230432/116405315-17884500-a862-11eb-84a9-003e4aeb14a5.png)
31 |
--------------------------------------------------------------------------------
/qx/jd-half-mh.json:
--------------------------------------------------------------------------------
1 | https://anmp.jd.com/babelDiy/Zeus/3wfrf9tDhmq79Tj2YHbEGCwdCJK7/index.html
--------------------------------------------------------------------------------
/qx/longzhuzhu.boxjs.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": "longzhuzhu.app.sub",
3 | "name": "龙猪猪 应用订阅",
4 | "author": "@longzhuzhu",
5 | "icon": "https://avatars.githubusercontent.com/u/5230432?s=400&u=b9f8f4631312cb0b2321564a2baf3df37436935f&v=4",
6 | "repo": "https://github.com/longzhuzhu/nianyu",
7 | "apps": [
8 | {
9 | "id": "jdLiveRain",
10 | "name": "京豆雨",
11 | "keys": [
12 | "RAIN_NOTIFY_CONTROL",
13 | "SUPER_RAIN_RRA",
14 | "HALF_RAIN_RRA"
15 | ],
16 | "settings": [
17 | {
18 | "id": "RAIN_NOTIFY_CONTROL",
19 | "name": "京豆雨通知",
20 | "val": "true",
21 | "type": "radios",
22 | "desc": "默认发送通知",
23 | "items": [{
24 | "key": "true",
25 | "label": "通知"
26 | }, {
27 | "key": "false",
28 | "label": "不通知"
29 | }]
30 | },
31 | {
32 | "id": "SUPER_RAIN_RRA",
33 | "name": "整点京豆雨RRA",
34 | "val": "",
35 | "type": "text",
36 | "desc": "整点京豆雨RRA, 默认无需填写, 脚本从远程配置获取。多个ID英文分号间隔;"
37 | },
38 | {
39 | "id": "HALF_RAIN_RRA",
40 | "name": "半点京豆雨RRA",
41 | "val": "",
42 | "type": "text",
43 | "desc": "半点京豆雨RRA, 默认无需填写, 脚本从远程配置获取。多个ID英文分号间隔;"
44 | }
45 | ],
46 | "icons": [
47 | "https://raw.githubusercontent.com/58xinian/icon/master/jd_bean_home.png",
48 | "https://raw.githubusercontent.com/58xinian/icon/master/jd_bean_home.png"
49 | ],
50 | "author": "@longzhuzhu",
51 | "repo": "https://github.com/longzhuzhu/nianyu",
52 | "script": "https://github.com/longzhuzhu/nianyu/main/qx/jd_super_redrain.js",
53 | "descs_html": [
54 | "龙猪猪 作者仓库:【https://github.com/longzhuzhu/nianyu】",
55 | "龙猪猪 电报频道:【https://t.me/longzhuzhu】"
56 | ]
57 | }
58 | ]
59 | }
60 |
--------------------------------------------------------------------------------
/rewrite/naicha.conf:
--------------------------------------------------------------------------------
1 | hostname = api.m.jd.com
2 |
3 | # 东哥奶茶 https://api.m.jd.com/client.action?functionId=getSecondWalletInfo
4 | ^https:\/\/api\.m\.jd\.com\/client\.action.*functionId=getSecondWalletInfo url script-request-header https://raw.githubusercontent.com/longzhuzhu/nianyu/main/rewrite/naicha.cookie.js
5 |
--------------------------------------------------------------------------------
/rewrite/naicha.cookie.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 添加域名(一般都有)
3 | * hostname = api.m.jd.com
4 | *
5 | * 添加重写
6 | *
7 | * ^https:\/\/api\.m\.jd\.com\/client\.action url script-request-body https://raw.githubusercontent.com/longzhuzhu/nianyu/main/rewrite/naicha.cookie.js
8 | *
9 | * api.m.jd.com
10 | * @type {string}
11 | */
12 |
13 | var TITLE = "龙龙CK"
14 | $ = new Env(TITLE);
15 |
16 | var hostMap = {
17 | // https://api.m.jd.com/client.action?functionId=getSecondWalletInfo
18 | "api.m.jd.com": {
19 | appKey: "jd",
20 | name: "京东"
21 | }
22 | }
23 |
24 |
25 | !(async() => {
26 | try {
27 | if ($request && $request.headers) {
28 | await getCookie()
29 | } else {
30 | $.msg(TITLE, "", `${app.name} 未获取到Cookie`);
31 | }
32 | } finally {
33 | $.done()
34 | }
35 | })()
36 |
37 |
38 | async function getCookie() {
39 | let app = getApp();
40 |
41 | if (app == null || app === undefined) {
42 | console.log(`未匹配到域名${host}`);
43 | return
44 | }
45 |
46 | doParams(app);
47 | }
48 |
49 |
50 | function getApp() {
51 | let headers = $request.headers
52 | let url = $request.url
53 | let host = headers["Host"] || headers["host"]
54 | console.log(`host: ${host}, url=${url}`);
55 | let match = hostMap[host];
56 |
57 | if(match) {
58 | let appKey = hostMap[host].appKey;
59 | console.log(`[naicha] match appKey=${appKey}, host=${host}`);
60 | return hostMap[host];
61 | }else {
62 | console.log(`[naicha] no match appKey~`);
63 | return null;
64 | }
65 |
66 | }
67 |
68 | function doJdParams() {
69 | var cookie = $request.headers["Cookie"] || $request.headers["cookie"];
70 | if (cookie.match(/(wskey=.+?)/)) {
71 | cookie = cookie.match(/wskey=.+?;/);
72 | }else{
73 | return [];
74 | }
75 |
76 | if (cookie == null || cookie == undefined || cookie == '') {
77 | return []
78 | }
79 |
80 | $.msg(TITLE, "", `🐶🐶东哥☕️☕️奶茶~ \n${cookie}`);
81 |
82 | }
83 |
84 | function doParams(app) {
85 | let params = []
86 | if (app.appKey == 'jd') {
87 | params = doJdParams();
88 | }
89 |
90 | return params;
91 | }
92 |
93 |
94 |
95 | // prettier-ignore
96 | function Env(t, e) {
97 | class s {
98 | constructor(t) {
99 | this.env = t
100 | }
101 |
102 | send(t, e = "GET") {
103 | t = "string" == typeof t ? {url: t} : t;
104 | let s = this.get;
105 | return "POST" === e && (s = this.post), new Promise((e, i)=> {
106 | s.call(this, t, (t, s, o)=> {
107 | t ? i(t) : e(s)
108 | })
109 | })
110 | }
111 |
112 | get(t) {
113 | return this.send.call(this.env, t)
114 | }
115 |
116 | post(t) {
117 | return this.send.call(this.env, t, "POST")
118 | }
119 | }
120 | return new class {
121 | constructor(t, e) {
122 | this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`)
123 | }
124 |
125 | isNode() {
126 | return "undefined" != typeof module && !!module.exports
127 | }
128 |
129 | isQuanX() {
130 | return "undefined" != typeof $task
131 | }
132 |
133 | isSurge() {
134 | return "undefined" != typeof $httpClient && "undefined" == typeof $loon
135 | }
136 |
137 | isLoon() {
138 | return "undefined" != typeof $loon
139 | }
140 |
141 | toObj(t, e = null) {
142 | try {
143 | return JSON.parse(t)
144 | } catch{return e}
145 | }
146 |
147 | toStr(t, e = null) {
148 | try {
149 | return JSON.stringify(t)
150 | } catch{return e}
151 | }
152 |
153 | getjson(t, e) {
154 | let s = e;
155 | const i = this.getdata(t);
156 | if (i)try {
157 | s = JSON.parse(this.getdata(t))
158 | } catch{}
159 | return s
160 | }
161 |
162 | setjson(t, e) {
163 | try {
164 | return this.setdata(JSON.stringify(t), e)
165 | } catch{return
166 | !1
167 | }
168 | }
169 |
170 | getScript(t) {
171 | return new Promise(e=> {
172 | this.get({url: t}, (t, s, i)=>e(i))
173 | })
174 | }
175 |
176 | runScript(t, e) {
177 | return new Promise(s=> {
178 | let i = this.getdata("@chavy_boxjs_userCfgs.httpapi");
179 | i = i ? i.replace(/\n/g, "").trim() : i;
180 | let o = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");
181 | o = o ? 1 * o : 20, o = e && e.timeout ? e.timeout : o;
182 | const [r,h]=i.split("@"), a = {
183 | url: `http://${h}/v1/scripting/evaluate`,
184 | body: {script_text: t, mock_type: "cron", timeout: o},
185 | headers: {"X-Key": r, Accept: "*/*"}
186 | };
187 | this.post(a, (t, e, i)=>s(i))
188 | }).catch(t=>this.logErr(t))
189 | }
190 |
191 | loaddata() {
192 | if (!this.isNode())return {};
193 | {
194 | this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
195 | 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);
196 | if (!s && !i)return {};
197 | {
198 | const i = s ? t : e;
199 | try {
200 | return JSON.parse(this.fs.readFileSync(i))
201 | } catch (t) {
202 | return {}
203 | }
204 | }
205 | }
206 | }
207 |
208 | writedata() {
209 | if (this.isNode()) {
210 | this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
211 | 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), o = JSON.stringify(this.data);
212 | s ? this.fs.writeFileSync(t, o) : i ? this.fs.writeFileSync(e, o) : this.fs.writeFileSync(t, o)
213 | }
214 | }
215 |
216 | lodash_get(t, e, s) {
217 | const i = e.replace(/\[(\d+)\]/g, ".$1").split(".");
218 | let o = t;
219 | for (const t of i)if (o = Object(o)[t], void 0 === o)return s;
220 | return o
221 | }
222 |
223 | lodash_set(t, e, s) {
224 | 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)
225 | }
226 |
227 | getdata(t) {
228 | let e = this.getval(t);
229 | if (/^@/.test(t)) {
230 | const [,s,i]=/^@(.*?)\.(.*?)$/.exec(t), o = s ? this.getval(s) : "";
231 | if (o)try {
232 | const t = JSON.parse(o);
233 | e = t ? this.lodash_get(t, i, "") : e
234 | } catch (t) {
235 | e = ""
236 | }
237 | }
238 | return e
239 | }
240 |
241 | setdata(t, e) {
242 | let s = !1;
243 | if (/^@/.test(e)) {
244 | const [,i,o]=/^@(.*?)\.(.*?)$/.exec(e), r = this.getval(i), h = i ? "null" === r ? null : r || "{}" : "{}";
245 | try {
246 | const e = JSON.parse(h);
247 | this.lodash_set(e, o, t), s = this.setval(JSON.stringify(e), i)
248 | } catch (e) {
249 | const r = {};
250 | this.lodash_set(r, o, t), s = this.setval(JSON.stringify(r), i)
251 | }
252 | } else s = this.setval(t, e);
253 | return s
254 | }
255 |
256 | getval(t) {
257 | 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
258 | }
259 |
260 | setval(t, e) {
261 | 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
262 | }
263 |
264 | initGotEnv(t) {
265 | 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))
266 | }
267 |
268 | get(t, e = (()=> {
269 | })) {
270 | t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? $httpClient.get(t, (t, s, i)=> {
271 | !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i)
272 | }) : this.isQuanX() ? $task.fetch(t).then(t=> {
273 | const {statusCode:s, statusCode:i, headers:o, body:r}=t;
274 | e(null, {status: s, statusCode: i, headers: o, body: r}, r)
275 | }, t=>e(t)) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e)=> {
276 | try {
277 | const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();
278 | this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar
279 | } catch (t) {
280 | this.logErr(t)
281 | }
282 | }).then(t=> {
283 | const {statusCode:s, statusCode:i, headers:o, body:r}=t;
284 | e(null, {status: s, statusCode: i, headers: o, body: r}, r)
285 | }, t=>e(t)))
286 | }
287 |
288 | post(t, e = (()=> {
289 | })) {
290 | 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())$httpClient.post(t, (t, s, i)=> {
291 | !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i)
292 | }); else if (this.isQuanX())t.method = "POST", $task.fetch(t).then(t=> {
293 | const {statusCode:s, statusCode:i, headers:o, body:r}=t;
294 | e(null, {status: s, statusCode: i, headers: o, body: r}, r)
295 | }, t=>e(t)); else if (this.isNode()) {
296 | this.initGotEnv(t);
297 | const {url:s, ...i}=t;
298 | this.got.post(s, i).then(t=> {
299 | const {statusCode:s, statusCode:i, headers:o, body:r}=t;
300 | e(null, {status: s, statusCode: i, headers: o, body: r}, r)
301 | }, t=>e(t))
302 | }
303 | }
304 |
305 | time(t) {
306 | let e = {
307 | "M+": (new Date).getMonth() + 1,
308 | "d+": (new Date).getDate(),
309 | "H+": (new Date).getHours(),
310 | "m+": (new Date).getMinutes(),
311 | "s+": (new Date).getSeconds(),
312 | "q+": Math.floor(((new Date).getMonth() + 3) / 3),
313 | S: (new Date).getMilliseconds()
314 | };
315 | /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length)));
316 | 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)));
317 | return t
318 | }
319 |
320 | msg(e = t, s = "", i = "", o) {
321 | const r = t=> {
322 | if (!t || !this.isLoon() && this.isSurge())return t;
323 | if ("string" == typeof t)return this.isLoon() ? t : this.isQuanX() ? {"open-url": t} : void 0;
324 | if ("object" == typeof t) {
325 | if (this.isLoon()) {
326 | let e = t.openUrl || t["open-url"], s = t.mediaUrl || t["media-url"];
327 | return {openUrl: e, mediaUrl: s}
328 | }
329 | if (this.isQuanX()) {
330 | let e = t["open-url"] || t.openUrl, s = t["media-url"] || t.mediaUrl;
331 | return {"open-url": e, "media-url": s}
332 | }
333 | }
334 | };
335 | this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, r(o)) : this.isQuanX() && $notify(e, s, i, r(o)));
336 | let h = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];
337 | h.push(e), s && h.push(s), i && h.push(i), console.log(h.join("\n")), this.logs = this.logs.concat(h)
338 | }
339 |
340 | log(...t) {
341 | t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator))
342 | }
343 |
344 | logErr(t, e) {
345 | const s = !this.isSurge() && !this.isQuanX() && !this.isLoon();
346 | s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t)
347 | }
348 |
349 | wait(t) {
350 | return new Promise(e=>setTimeout(e, t))
351 | }
352 |
353 | done(t = {}) {
354 | const e = (new Date).getTime(), s = (e - this.startTime) / 1e3;
355 | this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t)
356 | }
357 | }(t, e)
358 | }
359 |
--------------------------------------------------------------------------------