Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function openRednet()
- local listOfSides = rs.getSides()
- local listofPossibles = {}
- local counter1 = 0
- while true do
- counter1 = counter1 +1
- if peripheral.isPresent(tostring(listOfSides[counter1])) and peripheral.getType(listOfSides[counter1]) == "modem" then
- table.insert(listofPossibles,tostring(listOfSides[counter1]))
- end
- if counter1 == 6 and table.maxn(listofPossibles) == 0 then
- print("no wifi present")
- return nil
- end
- if counter1 == 6 and table.maxn(listofPossibles) ~= 0 then
- rednet.open(listofPossibles[1])
- return listofPossibles[1]
- end
- end
- end
- modemOn = openRednet()
- local homepage = "home";
- local website = "home";
- local nw = "";
- local idd = os.computerID()
- local port1 = idd * 32
- local port2 = 0
- local port3 = port2 / 32
- local needport = 0
- local function cPrint(text)
- local x,y = term.getSize()
- local x2,y2 = term.getCursorPos()
- term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
- print(text)
- end
- function home()
- print("Welkom op Firefox Browser!")
- print("Een website kan gehost worden in het CC Datacenter!")
- print(" ")
- print("Modem is verplicht voor firefox om te kunnen functioneren.")
- needport = 0
- end
- function newsite2()
- cPrint("Firefox Site Manager")
- print("")
- print("Mensen kunnen naar deze site gaan via www." ..nw.. ".nl")
- print("Om te bewerken ga je naar www." ..nw.. ".nl/editor")
- print("Jouw poort is " ..port1)
- needport = 0
- end
- function drawEditor()
- print("Welkom op de site-editor! Typ wat tekst en het zal weergeven worden als mensen verbinding maken.")
- print("---")
- line1 = read()
- line2 = read()
- line3 = read()
- line4 = read()
- line5 = read()
- rednet.send(id, line1)
- rednet.send(id, line2)
- rednet.send(id, line3)
- rednet.send(id, line4)
- rednet.send(id, line5)
- print("---")
- print("Saved!")
- sleep(1)
- website = homepage
- drawScreen()
- end
- function loadwebpage()
- rednet.broadcast(website)
- print("Connecting...")
- id, message = rednet.receive()
- term.clear()
- term.setCursorPos(1,1)
- cPrint("Firefox Browser 1.0")
- cPrint("http://"..website)
- print("")
- if message == "epanst" then
- drawEditor()
- else
- print(message)
- id, message = rednet.receive()
- print(message)
- id, message = rednet.receive()
- print(message)
- id, message = rednet.receive()
- print(message)
- id, message = rednet.receive()
- print(message)
- print("")
- write("URL:")
- address = io.read()
- website = address
- drawScreen()
- end
- end
- function drawScreen()
- term.clear()
- term.setCursorPos(1,1)
- cPrint("Firefox Browser 1.0")
- cPrint("http://"..website)
- print("")
- if website == "home" then
- home()
- end
- print("")
- write("URL:")
- address = io.read()
- website = address
- needport = 1
- if website == "home" then
- drawScreen()
- else
- loadwebpage()
- end
- end
- drawScreen()
Advertisement
Add Comment
Please, Sign In to add comment