MCPcopy Create free account
hub / github.com/Script-Hub-Org/Script-Hub / runScript

Method runScript

env/env.js:108–123  ·  view source on GitHub ↗
(t, e)

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 4

sClass · 0.70
getdataMethod · 0.45
postMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected