| 2192 | } |
| 2193 | |
| 2194 | runScript(t, e) { |
| 2195 | return new Promise(s => { |
| 2196 | let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); |
| 2197 | i = i ? i.replace(/\n/g, "").trim() : i; |
| 2198 | let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); |
| 2199 | r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; |
| 2200 | 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: "*/*"}}; |
| 2201 | this.post(n, (t, e, i) => s(i)) |
| 2202 | }).catch(t => this.logErr(t)) |
| 2203 | } |
| 2204 | |
| 2205 | loaddata() { |
| 2206 | if (!this.isNode()) return {}; |