forked from sngxpro/AutoSyncScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjddsSign.js
More file actions
228 lines (127 loc) · 4.7 KB
/
jddsSign.js
File metadata and controls
228 lines (127 loc) · 4.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
/*
@𝐗𝐢𝐝𝐍 𝐃𝐃 感谢红鲤鱼大佬
//++++++++++++++++++++++++++++++++-
京东读书 签到可以获得会员和阅读豆
不是会员签到可能只有经验值 自己测试
打开软件签到获取ck 签过到可能获取不到ck
surge:本地
京东读书签到 = type=http-request,pattern=^https:\/\/jdread-api\.jd\.com\/*,requires-body=1,max-size=0,script-path=https://raw.githubusercontent.com/XidNDD/2020scripts/master/jddsSign.js
定时 京东读书签到 = type=cron,cronexp=0 10 0 * * *,script-path=https://raw.githubusercontent.com/XidNDD/2020scripts/master/jddsSign.js
圈x:本地
^https:\/\/jdread-api\.jd\.com\/* url script-request-header https://raw.githubusercontent.com/XidNDD/2020scripts/master/jddsSign.js
定时 0 10 0 * * * https://raw.githubusercontent.com/XidNDD/2020scripts/master/jddsSign.js, tag=京东读书签到, enabled=true
loon:本地
http-request ^https:\/\/jdread-api\.jd\.com\/* script-path=https://raw.githubusercontent.com/XidNDD/2020scripts/master/jddsSign.js, requires-body=true, timeout=10, tag=京东读书签到
定时 cron "0 10 0 * * *" script-path=https://raw.githubusercontent.com/XidNDD/2020scripts/master/jddsSign.js,
MITM= jdread-api.jd.com
*/
const $XidN = XidN();
const logs=0;//设置0关闭日志,1开启日志
//++++++++++++++++++++++++++++++++-
const jingdongdushu="京东读书𝐀𝐏𝐏";
//++++++++++++++++++++++++++++++++
function main()
{
XidN_degin();}
async function XidN_degin()
{
let a0=await XidN_Sign();
log(jingdongdushu,a0,"");
}
function XidN_Sign()
{
return new Promise((resolve, reject) => {
var result1="每日打卡✍🏻";
var result2="";
var jddsurl=$XidN.read("jddsurlname");
var jddshd=$XidN.read("jddshdname");
const llUrl1={
url:jddsurl,
headers:JSON.parse(jddshd),
timeout:60000};
$XidN.post(llUrl1,function(error, response, data) {
if (logs==1)console.log(data)
var obj=JSON.parse(data);
if(obj.result_code==0)
result2="签到✅"+obj.data.daily_award_message+","+obj.data.sign_data.sign_tip_info;
else if(obj.result_code==500)
result2="说明:"+obj.message;
else
result2="签到失败获取cookie";
result2="<"+result1+">"+result2+"\n";
console.log(result2)
resolve(result2);
})
})
}
function XidN_jdck() {
if ($request.headers) {
var urlval = $request.url;
var md_hd=$request.headers;
var md_bd=$request.body;
if(urlval.indexOf("jdread/api/sign?")>=0)
{
var ao= $XidN.write(urlval,"jddsurlname");
var bo= $XidN.write(JSON.stringify(md_hd),"jddshdname");
if (ao==true&&bo==true)
log(jingdongdushu,"[获取签到数据]","✅成功");}
}
}
function log(x,y,z){
$XidN.notify(x,y,z);}
function getRandom(start, end, fixed = 0) {
let differ = end - start
let random = Math.random()
return (start + differ * random).toFixed(fixed)
}
if ($XidN.isRequest) {
XidN_jdck()
$XidN.end()
} else {
main();
$XidN.end()
}
function XidN() {
const isRequest = typeof $request != "undefined"
const isSurge = typeof $httpClient != "undefined"
const isQuanX = typeof $task != "undefined"
const notify = (title, subtitle, message) => {
if (isQuanX) $notify(title, subtitle, message)
if (isSurge) $notification.post(title, subtitle, message)
}
const write = (value, key) => {
if (isQuanX) return $prefs.setValueForKey(value, key)
if (isSurge) return $persistentStore.write(value, key)
}
const read = (key) => {
if (isQuanX) return $prefs.valueForKey(key)
if (isSurge) return $persistentStore.read(key)
}
const get = (options, callback) => {
if (isQuanX) {
if (typeof options == "string") options = { url: options }
options["method"] = "GET"
$task.fetch(options).then(response => {
response["status"] = response.statusCode
callback(null, response, response.body)
}, reason => callback(reason.error, null, null))
}
if (isSurge) $httpClient.get(options, callback)
}
const 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)
}
const end = () => {
if (isQuanX) isRequest ? $done({}) : ""
if (isSurge) isRequest ? $done({}) : $done()
}
return { isRequest, isQuanX, isSurge, notify, write, read, get, post, end }
};