summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2024-03-30 21:36:54 +0000
committerubq323 <ubq323@ubq323.website>2024-03-30 21:36:54 +0000
commitf11436da830937a579e5171a465f2cae39350278 (patch)
tree5e305ee68001700734f475ac6c77d243c027c874
parent4d5d6c4cb4b523f218941dc43f0aacf5074c4dc8 (diff)
listener script
-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")