MCPcopy Create free account
hub / github.com/Semporia/Scripts / init

Method init

MovementFaker.js:48–83  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46 }
47
48 async init() {
49 try {
50 console.time('MovementFaker');
51 process.chdir(__dirname);
52 const html = await MovementFaker.httpGet(URL);
53 const script = REG_SCRIPT.exec(html);
54
55 if (script) {
56 const [, scriptUrl, filename] = script;
57 const jsContent = await this.getJSContent(filename, scriptUrl);
58 const fnMock = new Function;
59 const ctx = {
60 window: { addEventListener: fnMock },
61 document: {
62 addEventListener: fnMock,
63 removeEventListener: fnMock,
64 cookie: this.cookie,
65 },
66 navigator: { userAgent: this.ua },
67 };
68
69 vm.createContext(ctx);
70 vm.runInContext(jsContent, ctx);
71 smashUtils = ctx.window.smashUtils;
72 smashUtils.init(DATA);
73
74 // console.log(ctx);
75 }
76
77 // console.log(html);
78 // console.log(script[1],script[2]);
79 console.timeEnd('MovementFaker');
80 } catch (e) {
81 console.log(e)
82 }
83 }
84
85 async getJSContent(cacheKey, url) {
86 try {

Callers 13

runMethod · 0.95
jd_joy_reward.jsFile · 0.45
jd_joy.jsFile · 0.45
jd_dreamFactory.jsFile · 0.45
jd_speed_sign.jsFile · 0.45
jd_jxnc.jsFile · 0.45
jd_jxmc.jsFile · 0.45
jd_joy_feedPets.jsFile · 0.45
jd_cfd.jsFile · 0.45
jd_cfd_loop.jsFile · 0.45

Calls 4

getJSContentMethod · 0.95
timeMethod · 0.45
httpGetMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected