Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("top")
- if not fs.exists("browserid") then
- print("pls enter Server Browserid")
- serverid = tonumber(read())
- local fileHandle = fs.open ("browserid", 'w')
- fileHandle.write (textutils.serialize (serverid))
- fileHandle.close()
- end
- if fs.exists("browserid") then
- local fileopen = fs.open ("browserid", 'r')
- servid = textutils.unserialize (fileopen.readAll())
- fileopen.close()
- term.clear()
- term.setCursorPos(8,8)
- print("Enter Website:")
- term.setCursorPos(24, 8)
- website = read()
- if website == "exit" then
- shell.run("reboot")
- else
- rednet.send(servid,website)
- if fs.exists(website) then
- term.clear()
- term.setCursorPos(1, 1)
- shell.run(website)
- error()
- end
- if website == "" then
- shell.run(shell.getRunningProgram())
- end
- if not fs.exists(tostring(website)) then
- code = 1
- function load()
- while true do
- local id, message = rednet.receive()
- if message == "Wbn" then
- term.clear()
- print("Website not found ")
- sleep(1)
- shell.run(shell.getRunningProgram())
- end
- if message == "Wbn" == false then
- print("Website found!")
- sleep(1)
- function installer()
- shell.run(message)
- end
- function clearer()
- for i =0,5 do
- sleep(0.1)
- term.clear()
- term.setCursorPos(1, 1)
- end
- end
- parallel.waitForAll(clearer,installer)
- clearer()
- shell.run(website)
- error()
- end
- if not fs.exists(website) then
- term.clear()
- print("Failed to connect to website")
- sleep(1)
- shell.run(shell.getRunningProgram())
- end
- end
- if fs.exists(tostring(website)) then
- shell.run(website)
- error()
- end
- end
- end
- function connection()
- while true do
- if code >= 1 then
- code = code + 1
- if code >30 then
- term.clear()
- term.setCursorPos(1, 1)
- print("Server is down or exitst")
- sleep(1)
- shell.run(shell.getRunningProgram())
- code = 0
- end
- end
- end
- end
- end
- parallel.waitForAll(load,connection)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement