MCPcopy Create free account
hub / github.com/ClydeTime/Surge / GetCookie

Function GetCookie

Script/Task/nga.js:71–89  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

69})()
70
71function GetCookie() {
72 if ($request.body.includes("------WebKitForm")) {
73 const cookie = typeof $request.headers["Cookie"]=='undefined' ? $request.headers["cookie"] : $request.headers["Cookie"];
74 const contentType = typeof $request.headers["Content-Type"]=='undefined' ? $request.headers["content-type"] : $request.headers["Content-Type"];
75 const userAgent = typeof $request.headers["User-Agent"]=='undefined' ? $request.headers["user-agent"] : $request.headers["User-Agent"];
76 const body = $request.body;
77 var obj = FormDataToObject(body, contentType);
78 if (obj["__lib"] === "mission" && obj["__act"] === "get_default") {
79 console.log("- 正在获取cookie,请稍后");
80 $.setdata(cookie, name + "_cookie");
81 $.setdata(contentType, name + "_contentType");
82 $.setdata(userAgent, name + "_userAgent");
83 var obj = FormDataToObject(body, contentType);
84 $.setdata(JSON.stringify(obj), name + "_body");
85 $.content = `获取cookie: 成功! `;
86 $.msg(name, "", $.content);
87 }
88 }
89}
90
91async function signNGA(){
92 config.cookie = $.getdata(name + "_cookie");

Callers 1

nga.jsFile · 0.70

Calls 5

FormDataToObjectFunction · 0.85
logMethod · 0.45
setdataMethod · 0.45
stringifyMethod · 0.45
msgMethod · 0.45

Tested by

no test coverage detected