| 199 | } |
| 200 | |
| 201 | runScript(t, e) { |
| 202 | return new Promise(s => { |
| 203 | let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); |
| 204 | i = i ? i.replace(/\n/g, "").trim() : i; |
| 205 | let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); |
| 206 | r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; |
| 207 | const [o, h] = i.split("@"), n = {url: `http://${h}/v1/scripting/evaluate`, body: {script_text: t, mock_type: "cron", timeout: r}, headers: {"X-Key": o, Accept: "*/*"}}; |
| 208 | this.post(n, (t, e, i) => s(i)) |
| 209 | }).catch(t => this.logErr(t)) |
| 210 | } |
| 211 | |
| 212 | loaddata() { |
| 213 | if (!this.isNode()) return {}; |