From 4552888f8b5a7be5bfc7f5ecaa1a845015d48637 Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Fri, 19 May 2017 20:55:11 +0000 Subject: [PATCH] some fancy remote shell related stuff. it works in the background now. currently breaks all stable builds. --- modules/applications/autoluash.lua | 1 + modules/applications/luash.lua | 4 +++- .../applications/{evproxy-client.lua => nshc.lua} | 5 ++--- modules/applications/{evproxy-srv.lua => nshd.lua} | 13 +++++++------ 4 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 modules/applications/autoluash.lua rename modules/applications/{evproxy-client.lua => nshc.lua} (77%) rename modules/applications/{evproxy-srv.lua => nshd.lua} (57%) diff --git a/modules/applications/autoluash.lua b/modules/applications/autoluash.lua new file mode 100644 index 0000000..4b2e155 --- /dev/null +++ b/modules/applications/autoluash.lua @@ -0,0 +1 @@ +luash() diff --git a/modules/applications/luash.lua b/modules/applications/luash.lua index 13113fe..8099f66 100644 --- a/modules/applications/luash.lua +++ b/modules/applications/luash.lua @@ -1,7 +1,9 @@ +function luash(si) s("lua shell",function() print(_VERSION) while true do write("> ") print(pcall(load(readln()))) end -end) +end,si) +end diff --git a/modules/applications/evproxy-client.lua b/modules/applications/nshc.lua similarity index 77% rename from modules/applications/evproxy-client.lua rename to modules/applications/nshc.lua index c08f668..f97e039 100644 --- a/modules/applications/evproxy-client.lua +++ b/modules/applications/nshc.lua @@ -5,13 +5,12 @@ function nshc(evPP,nid) local V,msg=false,tostring(ev[4]) if ev[3] == evPP and ev[2] == nid then if msg:sub(1,3) == "dis" then - h("display",msg:sub(4)) + write(msg:sub(4)) end end - elseif ev[1] == "key_down" then + elseif ev[1] == "key" and ev[2] == tT[cT][3].sI then ns(nid,evPP,"key"..tostring(ev[3])) end C.yield() end end - diff --git a/modules/applications/evproxy-srv.lua b/modules/applications/nshd.lua similarity index 57% rename from modules/applications/evproxy-srv.lua rename to modules/applications/nshd.lua index f567b09..51cdb90 100644 --- a/modules/applications/evproxy-srv.lua +++ b/modules/applications/nshd.lua @@ -1,20 +1,21 @@ -evPP,tEPs="nsh",{} -s("netsh daemon",function() +function nshd(evPP,tEPs,sI) +s("netsh daemon",function() print(pcall(function() while true do if ev[1] == "net_msg" then local V,msg=false,tostring(ev[4]) for k,v in ipairs(tEPs) do if ev[2] == v then V=true end end if ev[3] == evPP and V then if msg:sub(1,3) == "key" then - h("key_down",ev[2],tonumber(msg:sub(4)),0) + h("key",tT[cT][3].sI,tonumber(msg:sub(4)),0) end end - elseif ev[1] == "display" then + elseif ev[1] == "display" and ev[3] == tT[cT][3].sI then for k,v in ipairs(tEPs) do ns(v,evPP,"dis"..tostring(ev[2])) end end C.yield() end -end) - +end)) end,{["sI"]=sI}) +luash({["sI"]=sI}) +end