| 106 | }) |
| 107 | } |
| 108 | runScript(t, e) { |
| 109 | return new Promise(s => { |
| 110 | let a = this.getdata('@chavy_boxjs_userCfgs.httpapi') |
| 111 | a = a ? a.replace(/\n/g, '').trim() : a |
| 112 | let r = this.getdata('@chavy_boxjs_userCfgs.httpapi_timeout') |
| 113 | ;(r = r ? 1 * r : 20), (r = e && e.timeout ? e.timeout : r) |
| 114 | const [i, o] = a.split('@'), |
| 115 | n = { |
| 116 | url: `http://${o}/v1/scripting/evaluate`, |
| 117 | body: { script_text: t, mock_type: 'cron', timeout: r }, |
| 118 | headers: { 'X-Key': i, Accept: '*/*' }, |
| 119 | timeout: r, |
| 120 | } |
| 121 | this.post(n, (t, e, a) => s(a)) |
| 122 | }).catch(t => this.logErr(t)) |
| 123 | } |
| 124 | loaddata() { |
| 125 | if (!this.isNode()) return {} |
| 126 | { |