MCPcopy Create free account
hub / github.com/6dylan6/jdm / run

Method run

function/magic.js:115–239  ·  view source on GitHub ↗
(data = {
        wait: [1000, 2000],
        bot: false,
        delimiter: '',
        o2o: false,
        random: false,
        once: false,
        blacklist: [],
        whitelist: []
    })

Source from the content-addressed store, hash-verified

113 }
114
115 async run(data = {
116 wait: [1000, 2000],
117 bot: false,
118 delimiter: '',
119 o2o: false,
120 random: false,
121 once: false,
122 blacklist: [],
123 whitelist: []
124 }) {
125 console.log('运行参数:', data);
126 this.filename = process.argv[1];
127 console.log(`${this.now()} ${this.name} ${this.filename} 开始运行...`);
128 this.start = this.timestamp();
129 let accounts = "";
130 if (__dirname.includes("magic")) {
131 accounts = this.readFileSync(
132 '/home/magic/Work/wools/doc/account.json')
133 } else {
134 if (fs.existsSync('utils/account.json')) {
135 accounts = this.readFileSync('utils/account.json')
136 } else {
137 accounts = this.readFileSync('account.json')
138 }
139 }
140 accounts ? JSON.parse(accounts).forEach(
141 o => this.accounts[o.pt_pin] = o.remarks) : ''
142 await this.config()
143 if (data?.delimiter) {
144 this.delimiter = data?.delimiter
145 }
146 if (data?.bot) {
147 this.bot = data.bot;
148 }
149
150 console.log('原始ck长度', cookies.length)
151 if (data?.blacklist?.length > 0) {
152 for (const cki of this.__as(data.blacklist)) {
153 delete cookies[cki - 1];
154 }
155 }
156 this.delBlackCK()
157 console.log('排除黑名单后ck长度', cookies.length)
158 if (data?.whitelist?.length > 0) {
159 let cks = []
160 for (const cki of this.__as(data.whitelist)) {
161 if (cki - 1 < cookies.length) {
162 cks.push(cookies[cki - 1])
163 }
164 }
165 cookies = cks;
166 }
167 console.log('设置白名单后ck长度', cookies.length)
168
169 if (data?.random) {
170 cookies = this.randomArray(cookies)
171 }
172 await this.verify()

Callers 2

jd_yqhy.pyFile · 0.45
signapi.pyFile · 0.45

Calls 15

logMethod · 0.95
nowMethod · 0.95
timestampMethod · 0.95
readFileSyncMethod · 0.95
configMethod · 0.95
__asMethod · 0.95
delBlackCKMethod · 0.95
randomArrayMethod · 0.95
verifyMethod · 0.95
beforeMethod · 0.95
waitMethod · 0.95
logicMethod · 0.95

Tested by

no test coverage detected