| 904 | } |
| 905 | |
| 906 | runScript(t, e) { |
| 907 | return new Promise(s => { |
| 908 | let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); |
| 909 | i = i ? i.replace(/\n/g, "").trim() : i; |
| 910 | let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); |
| 911 | r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; |
| 912 | const [o, h] = i.split("@"), n = { |
| 913 | url: `http://${h}/v1/scripting/evaluate`, |
| 914 | body: {script_text: t, mock_type: "cron", timeout: r}, |
| 915 | headers: {"X-Key": o, Accept: "*/*"} |
| 916 | }; |
| 917 | this.post(n, (t, e, i) => s(i)) |
| 918 | }).catch(t => this.logErr(t)) |
| 919 | } |
| 920 | |
| 921 | loaddata() { |
| 922 | if (!this.isNode()) return {}; |