| 222 | }) |
| 223 | } |
| 224 | runScript(t, e) { |
| 225 | return new Promise(s => { |
| 226 | let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); |
| 227 | i = i ? i.replace(/\n/g, "").trim() : i; |
| 228 | let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); |
| 229 | r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; |
| 230 | const [o, h] = i.split("@"), n = { |
| 231 | url: `http://${h}/v1/scripting/evaluate`, |
| 232 | body: { |
| 233 | script_text: t, |
| 234 | mock_type: "cron", |
| 235 | timeout: r |
| 236 | }, |
| 237 | headers: { |
| 238 | "X-Key": o, |
| 239 | Accept: "*/*" |
| 240 | } |
| 241 | }; |
| 242 | this.post(n, (t, e, i) => s(i)) |
| 243 | }).catch(t => this.logErr(t)) |
| 244 | } |
| 245 | loaddata() { |
| 246 | if (!this.isNode()) return {}; { |
| 247 | this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); |