| 1053 | } |
| 1054 | |
| 1055 | runScript(t, e) { |
| 1056 | return new Promise(s => { |
| 1057 | let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); |
| 1058 | i = i ? i.replace(/\n/g, "").trim() : i; |
| 1059 | let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); |
| 1060 | r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; |
| 1061 | const [o, h] = i.split("@"), n = { |
| 1062 | url: `http://${h}/v1/scripting/evaluate`, |
| 1063 | body: {script_text: t, mock_type: "cron", timeout: r}, |
| 1064 | headers: {"X-Key": o, Accept: "*/*"} |
| 1065 | }; |
| 1066 | this.post(n, (t, e, i) => s(i)) |
| 1067 | }).catch(t => this.logErr(t)) |
| 1068 | } |
| 1069 | |
| 1070 | loaddata() { |
| 1071 | if (!this.isNode()) return {}; |