(t, e)
| 146 | } |
| 147 | |
| 148 | function Env(t, e) { |
| 149 | "undefined" != typeof process && JSON.stringify(process.env).indexOf("GIT_HUB") > -1 && process.exit(0); |
| 150 | class s { |
| 151 | constructor(t) { |
| 152 | this.env = t |
| 153 | } |
| 154 | send(t, e = "GET") { |
| 155 | t = "string" == typeof t ? { |
| 156 | url: t |
| 157 | } : t; |
| 158 | let s = this.get; |
| 159 | return "POST" === e && (s = this.post), new Promise((e, i) => { |
| 160 | s.call(this, t, (t, s, r) => { |
| 161 | t ? i(t) : e(s) |
| 162 | }) |
| 163 | }) |
| 164 | } |
| 165 | get(t) { |
| 166 | return this.send.call(this.env, t) |
| 167 | } |
| 168 | post(t) { |
| 169 | return this.send.call(this.env, t, "POST") |
| 170 | } |
| 171 | } |
| 172 | return new class { |
| 173 | constructor(t, e) { |
| 174 | this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `🔔${this.name}, 开始!`) |
| 175 | } |
| 176 | isNode() { |
| 177 | return "undefined" != typeof module && !!module.exports |
| 178 | } |
| 179 | isQuanX() { |
| 180 | return "undefined" != typeof $task |
| 181 | } |
| 182 | isSurge() { |
| 183 | return "undefined" != typeof $httpClient && "undefined" == typeof $loon |
| 184 | } |
| 185 | isLoon() { |
| 186 | return "undefined" != typeof $loon |
| 187 | } |
| 188 | toObj(t, e = null) { |
| 189 | try { |
| 190 | return JSON.parse(t) |
| 191 | } catch (e) { |
| 192 | return e |
| 193 | } |
| 194 | } |
| 195 | toStr(t, e = null) { |
| 196 | try { |
| 197 | return JSON.stringify(t) |
| 198 | } catch (e) { |
| 199 | return e |
| 200 | } |
| 201 | } |
| 202 | getjson(t, e) { |
| 203 | let s = e; |
| 204 | const i = this.getdata(t); |
| 205 | if (i) try { |
nothing calls this directly
no outgoing calls
no test coverage detected