From 79ddff1cbd9e6ef9d7820da0bed8f7eb2d7a9e2d Mon Sep 17 00:00:00 2001 From: DanyLE Date: Thu, 1 Jun 2023 12:24:34 +0200 Subject: [PATCH] libantosdk: linux worker is renamed to backend, linux-exec job renamed to cmd-exec, add lua-exec job for backend lua script execution --- Blogger/build.json | 6 ++- Blogger/build/release/Blogger.zip | Bin 15605 -> 15605 bytes libantosdk/README.md | 1 + libantosdk/build/debug/README.md | 1 + .../{linux.worker.js => backend.worker.js} | 36 ++++++++++++------ libantosdk/build/debug/package.json | 2 +- libantosdk/build/release/libantosdk.zip | Bin 947550 -> 947658 bytes .../{linux.worker.js => backend.worker.js} | 36 ++++++++++++------ libantosdk/package.json | 2 +- libantosdk/project.json | 8 ---- 10 files changed, 58 insertions(+), 34 deletions(-) rename libantosdk/build/debug/core/{linux.worker.js => backend.worker.js} (71%) rename libantosdk/core/{linux.worker.js => backend.worker.js} (71%) delete mode 100644 libantosdk/project.json diff --git a/Blogger/build.json b/Blogger/build.json index d204b72..d7c2208 100644 --- a/Blogger/build.json +++ b/Blogger/build.json @@ -19,8 +19,10 @@ ], "jobs": [ { - "name": "ts-import", - "data": ["sdk://core/ts/core.d.ts", "sdk://core/ts/jquery.d.ts","sdk://core/ts/antos.d.ts"] + "name": "ts-antos-sdk", + "data": { + "version": "2.0.x" + } }, { "name": "ts-compile", diff --git a/Blogger/build/release/Blogger.zip b/Blogger/build/release/Blogger.zip index 2d6568b9df2030dc083186551bfc0f3b2bc2c63e..231996c952bfdf0f9c29db9222de8b69dce75d59 100644 GIT binary patch delta 250 zcmexb`L&WKz?+$ci-CcGgP|mGBagl$Q%T}xTS%Bv?lY|fZRGc+r|Mz It+nw00O;pR9smFU delta 279 zcmexb`L&WKz?+$ci-CcGgP|y4Bagl$Q*pv(TSRF+Ei;t2jR|z?+dtgaP8B;)H!+ERPnwQDS0X-~tM90NsfI zkK`vCT8n_)HF<%R43n19 { - if(!this.job.data.pwd) - { - this.job.data.pwd = this.job.root; - } // send the command const cmd = { path: path, - parameters: { - action: "exec", - args: this.job.data - } + parameters: params }; socket.send(JSON.stringify(cmd)); }; @@ -71,4 +82,7 @@ class LinuxJob extends AntOSDKBaseJob { } } -API.jobhandle["linux-exec"] = LinuxJob; \ No newline at end of file + + +API.jobhandle["cmd-exec"] = BackendJob; +API.jobhandle["lua-exec"] = BackendJob; \ No newline at end of file diff --git a/libantosdk/build/debug/package.json b/libantosdk/build/debug/package.json index f59997d..828f9c1 100644 --- a/libantosdk/build/debug/package.json +++ b/libantosdk/build/debug/package.json @@ -7,7 +7,7 @@ "author": "Xuan Sang LE", "email": "mrsang@iohub.dev" }, - "version": "0.1.0-b", + "version": "0.1.1-b", "category": "Development", "iconclass": "fa fa-cog", "mimes": [ diff --git a/libantosdk/build/release/libantosdk.zip b/libantosdk/build/release/libantosdk.zip index 2c7b0d81bcdf5253440c1ccb4d8d0843673b18cf..79ef70c174540b1347963c3fbdb0491b92306ce2 100644 GIT binary patch delta 2461 zcmZ`)2|Sc*7k_8QzRaWu*%?cW$x<>@XoQPlEZ342jNJ@oOB+L7Tjf$>$d;`lN?E#+ zWpZ`9`mCdJBkq-aBQ;XinCp9I(pBBx_xyhU-#PE|p65KvIp=>y-(b3?G17P^n2-bj z0Ac{dgLOx`RTKuwx(Mm(5MjYoU9NZ{gaP$nd6{Ytx%oi>AVLTL#K9Hr2W)I{2hgOT z!ydy?gGQU;#%?QA?ocN&qe}1}yb`SqQ@0xOfZvLOURpHXDa5TTDqFhv&KuAECy$zk z(J1o^$U6UqOb=$i<4$KJ%c>2TTh-!d^jKV>q^D}7+(kL@ne-gZ@X%M5Y9kET6It(@ zSzA8cm2V6+xs`F#!(y1Ydssy4?UHSlWQMYXy#%on$el>gRr{lA{t&gx6*a|b(EI&1 z1^@c_m7m;$>}K24J*v8w6HBFD=yuHzCV#wMybCEo=5&?Sz;+u+^@YtP!otFw!ZUUw z%=6Ri1AKav{|AC3^IT$& zyIOte*~#$jyurS`_tR6;2vxZeS(@}04}f?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6l<4%g>bPm*LhgF~iJJc1>6Xmf?Y9d}?9EsS29;o! zQt9UMYkh2r(V}u6^HT78{3*4_TQ+5`rYzO?F89W6A!RC3iw0-p;DIzvQiY(HzbK}6CJ$Who# z-Wdr41p^I35QY#8VHg+~A}~Z@h`|tVkaq^X`1VjjEVy44cElejMF;?}MFD^qTz)&N zRS1fqfxDUf!QuW+6#K>(*5ktS0YtA8`Pn2Ze=1hTy^&kr6uv{DuRi(m;g+7>O_4W9RMX z*je+7sAxd|7}^5>k~<;5lAZ)KMh8{+nP^9)PZ+^b4VnS~_>ES#4CGG-6}J-)wZJzC z>{EkAX&}GHWz*qv!Cv-~lpNH=0LApSllpy6+wr!h^>v4XY8ap_|MIU`0bqC3VQE4K z3SfY$e68ezl(yfJ5Wpn-3$}aZ&Z@f)O~G29sRJPxpaL@41_`M!Ky`lDOgKzr-4P^I zK!>$HCru;{R8SNmBEPiUxB&g{5(gcIH4r$+Ck|BE<{HF=&jO`RP<|Y!A>s%#W-Dep GQ~w2|3Yl*J diff --git a/libantosdk/core/linux.worker.js b/libantosdk/core/backend.worker.js similarity index 71% rename from libantosdk/core/linux.worker.js rename to libantosdk/core/backend.worker.js index 41a0396..7d4b9ed 100644 --- a/libantosdk/core/linux.worker.js +++ b/libantosdk/core/backend.worker.js @@ -1,4 +1,4 @@ -class LinuxJob extends AntOSDKBaseJob { +class BackendJob extends AntOSDKBaseJob { constructor(data) { super(data); @@ -6,7 +6,7 @@ class LinuxJob extends AntOSDKBaseJob { execute() { switch (this.job.cmd) { - case 'linux-exec': + case 'cmd-exec': /** * Execute a linux command with the * help of a server side lua API @@ -14,6 +14,9 @@ class LinuxJob extends AntOSDKBaseJob { */ this.exec(); break; + case 'lua-exec': + this.xlua(this.job.data.path, this.job.data.params); + break; default: const err_msg = `Unkown job ${this.job.cmd}`; this.log_error(err_msg); @@ -24,6 +27,21 @@ class LinuxJob extends AntOSDKBaseJob { exec() { const path = "pkg://libantosdk/core/lua/api.lua".abspath(this.job.root); + if(!this.job.data.pwd) + { + this.job.data.pwd = this.job.root; + } + const params = { + action: "exec", + args: this.job.data + }; + this.xlua(path, params); + } + + + + xlua(path, params) + { const url = API.REST.replace("http","ws") + "/system/apigateway?ws=1"; try{ const socket = new WebSocket(url); @@ -37,17 +55,10 @@ class LinuxJob extends AntOSDKBaseJob { this.result("Done"); }; socket.onopen = (e) => { - if(!this.job.data.pwd) - { - this.job.data.pwd = this.job.root; - } // send the command const cmd = { path: path, - parameters: { - action: "exec", - args: this.job.data - } + parameters: params }; socket.send(JSON.stringify(cmd)); }; @@ -71,4 +82,7 @@ class LinuxJob extends AntOSDKBaseJob { } } -API.jobhandle["linux-exec"] = LinuxJob; \ No newline at end of file + + +API.jobhandle["cmd-exec"] = BackendJob; +API.jobhandle["lua-exec"] = BackendJob; \ No newline at end of file diff --git a/libantosdk/package.json b/libantosdk/package.json index f59997d..828f9c1 100644 --- a/libantosdk/package.json +++ b/libantosdk/package.json @@ -7,7 +7,7 @@ "author": "Xuan Sang LE", "email": "mrsang@iohub.dev" }, - "version": "0.1.0-b", + "version": "0.1.1-b", "category": "Development", "iconclass": "fa fa-cog", "mimes": [ diff --git a/libantosdk/project.json b/libantosdk/project.json deleted file mode 100644 index c9a38b7..0000000 --- a/libantosdk/project.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "libantosdk", - "css": ["main.css"], - "javascripts": [], - "coffees": [], - "ts": ["ts/main.ts", "ts/app.ts"], - "copies": ["core","package.json","scheme.html", "README.md"] -} \ No newline at end of file