MCPcopy Create free account
hub / github.com/chavyleung/scripts / sign

Function sign

ithome/ithome.js:40–68  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38 .finally(() => $.done());
39
40function sign() {
41 return new Promise((resolve) => {
42 const url = {
43 url: getUrl(),
44 headers: {
45 Host: "napi.ithome.com",
46 "User-Agent":
47 "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 ithome/rmsdklevel2/day/7.63",
48 },
49 };
50 $.get(url, (err, resp, data) => {
51 try {
52 const res = JSON.parse(data);
53 if (res.ok === 0) {
54 $.result = res.msg;
55 } else if (res.ok === 1) {
56 $.result = res.title;
57 } else {
58 $.result = "未知签到结果,请查看日志";
59 console.log(data);
60 }
61 } catch (e) {
62 $.logErr(e, resp);
63 } finally {
64 resolve();
65 }
66 });
67 });
68}
69
70function signinfo() {
71 return new Promise((resolve) => {

Callers 1

ithome.jsFile · 0.70

Calls 4

getUrlFunction · 0.85
getMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected