| 749 | } |
| 750 | |
| 751 | runScript(t, e) { |
| 752 | return new Promise(s => { |
| 753 | let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); |
| 754 | i = i ? i.replace(/\n/g, "").trim() : i; |
| 755 | let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); |
| 756 | r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; |
| 757 | const [o, h] = i.split("@"), n = { |
| 758 | url: `http://${h}/v1/scripting/evaluate`, |
| 759 | body: {script_text: t, mock_type: "cron", timeout: r}, |
| 760 | headers: {"X-Key": o, Accept: "*/*"} |
| 761 | }; |
| 762 | this.post(n, (t, e, i) => s(i)) |
| 763 | }).catch(t => this.logErr(t)) |
| 764 | } |
| 765 | |
| 766 | loaddata() { |
| 767 | if (!this.isNode()) return {}; |