(data = {
wait: [1000, 2000],
bot: false,
delimiter: '',
o2o: false,
random: false,
once: false,
blacklist: [],
whitelist: []
})
| 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() |
no test coverage detected