MCPcopy Create free account
hub / github.com/Semporia/Scripts / runScript

Method runScript

jd_pk.js:831–851  ·  view source on GitHub ↗
(t, e)

Source from the content-addressed store, hash-verified

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 {};

Callers

nothing calls this directly

Calls 4

sFunction · 0.70
getdataMethod · 0.45
postMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected