Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bef = "www"
- site = "test"
- ser = "com"
- side = "left"
- def = ""
- web = "print(\"It worked!\")"
- function clear()
- term.clear()
- term.setCursorPos(1, 1)
- end
- function round(num)
- local ln = num - math.floor(num)
- if num > .5 then
- return math.ceil(num)
- else
- return math.floor(num)
- end
- end
- function cprint(txt, line)
- local x, y = term.getSize()
- term.setCursorPos(round(round(x-#txt)/2), line)
- term.write(txt)
- end
- clear()
- cprint("Running webserer for "..bef.."."..site.."."..ser, 1)
- rednet.open("left")
- while true do
- local id, msg = rednet.receive()
- if string.sub(msg, 1, 7) == "BROWSE:" then
- print("Requested: "..id)
- local rst = textutils.unserialize(string.sub(msg, 8))
- print(rst.bef.."."..rest.site.."."..rst.ser)
- if rst.bef == bef or rst.bef == def then
- if rst.site == site and rst.ser == ser then
- print("New connection: "..id)
- rednet.send(id, "BROWSE:"..web)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement