| 873 | } |
| 874 | |
| 875 | runScript(t, e) { |
| 876 | return new Promise(s => { |
| 877 | let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); |
| 878 | i = i ? i.replace(/\n/g, "").trim() : i; |
| 879 | let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); |
| 880 | r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; |
| 881 | const [o, h] = i.split("@"), n = { |
| 882 | url: `http://${h}/v1/scripting/evaluate`, |
| 883 | body: {script_text: t, mock_type: "cron", timeout: r}, |
| 884 | headers: {"X-Key": o, Accept: "*/*"} |
| 885 | }; |
| 886 | this.post(n, (t, e, i) => s(i)) |
| 887 | }).catch(t => this.logErr(t)) |
| 888 | } |
| 889 | |
| 890 | loaddata() { |
| 891 | if (!this.isNode()) return {}; |