| 829 | } |
| 830 | |
| 831 | runScript(t, e) { |
| 832 | return new Promise(s => { |
| 833 | let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); |
| 834 | i = i ? i.replace(/\n/g, "").trim() : i; |
| 835 | let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); |
| 836 | r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; |
| 837 | const [o, h] = i.split("@"), a = { |
| 838 | url: `http://${h}/v1/scripting/evaluate`, |
| 839 | body: { |
| 840 | script_text: t, |
| 841 | mock_type: "cron", |
| 842 | timeout: r |
| 843 | }, |
| 844 | headers: { |
| 845 | "X-Key": o, |
| 846 | Accept: "*/*" |
| 847 | } |
| 848 | }; |
| 849 | this.post(a, (t, e, i) => s(i)) |
| 850 | }).catch(t => this.logErr(t)) |
| 851 | } |
| 852 | |
| 853 | loaddata() { |
| 854 | if (!this.isNode()) return {}; |