Start a loopback HTTP server inside a script. A local web app, Python process,
or AI model can move the mouse and press keys. Net.Listen binds to
127.0.0.1, not the LAN. Permission-gated by the modeline. Hardware output
ships through Rebind Link; every example here also runs in software mode.
-- rebind: min_sdk=3.0.0
-- rebind: name=HTTP Bridge
-- rebind: permission=net
local server = nil
function OnStart()
server = Net.Listen(8080, function(req)
local cmd = JSON.Parse(req.body)
HID.Move(cmd.dx, cmd.dy)
if cmd.click then
Run(function() HID.Press("Mouse1", 20) end)
end
return { status = 200, body = "ok" }
end)
end
function OnStop()
if server then server:Stop() end
end