summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--listener.dat1
-rw-r--r--listener.lua19
2 files changed, 20 insertions, 0 deletions
diff --git a/listener.dat b/listener.dat
new file mode 100644
index 0000000..66f8dcd
--- /dev/null
+++ b/listener.dat
@@ -0,0 +1 @@
+dep pm
diff --git a/listener.lua b/listener.lua
new file mode 100644
index 0000000..efb3eef
--- /dev/null
+++ b/listener.lua
@@ -0,0 +1,19 @@
+local pm = require'pm'
+
+local ws = assert(http.websocket("wss://citrons.xyz/ws-echo/rebecca"))
+function main()
+ while true do
+ local msg = ws.receive()
+ local parsed = assert(textutils.unserializeJSON(msg))
+ if parsed.msg then
+ print("got msg",parsed.msg)
+ -- more sophisticated cmds later, maybe
+ local pkgname = parsed.msg
+ pm.dl(pkgname)
+ multishell.run(pkgname..'.lua')
+ end
+ end
+end
+
+pcall(main)
+print("all done")