View difference between Paste ID: W5nJwhGq and Y320Z2K0
SHOW: | | - or go back to the newest paste.
1
local homepage = "home";
2
local website = "home";
3
local nw = "";
4
local idd = os.computerID()
5
local port1 = idd * 32
6
local port2 = 0
7
local port3 = port2 / 32
8
local needport = 0
9
rednet.open("right")
10
rednet.open("left")
11
rednet.open("front")
12
rednet.open("back")
13
local function cPrint(text)
14
local x,y = term.getSize()
15
local x2,y2 = term.getCursorPos()
16
term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
17
print(text)
18
end
19
function home()
20
print("Welcome to RedNet explorer! This requires you to have a wireless modem on your computer. This is the default homepage. A homepage option might be added in 1.3")
21
print("Host a website at:                ")
22
print("www.newsite.com!            ")
23
print("   -ComputerCraftFan11    ")
24
needport = 0
25
end
26
function newsite()
27
	if fs.exists("rns") then
28
		shell.run("rns")
29
	else
30-
		shell.run("pastebin", "get", "RLx6Lh36", "rns")
30+
		shell.run("pastebin", "get", "gcPf1FiK", "rns")
31
		shell.run("rns")
32
	end
33
end
34
function newsite2()
35
cPrint("Rednet Site Manager")
36
print("")
37
print("People can connect to this site by going to www." ..nw.. ".com")
38
print("You can edit this site by going to www." ..nw.. ".com/editor")
39
print("Your port is " ..port1)
40
needport = 0
41
end
42
function drawEditor()
43
print("Welcome to the site editor! Enter some text and it will be displayed when people connect.")
44
print("---")
45
line1 = read()
46
line2 = read()
47
line3 = read()
48
line4 = read()
49
line5 = read()
50
rednet.send(id, "Editor " ..website)
51
rednet.send(id, line1)
52
rednet.send(id, line2)
53
rednet.send(id, line3)
54
rednet.send(id, line4)
55
rednet.send(id, line5)
56
print("---")
57
print("Saved!")
58
sleep(1)
59
website = homepage
60
drawScreen()
61
end
62
function loadwebpage()
63
rednet.broadcast(website)
64
print("Connecting...")
65
id, message  = rednet.receive()
66
term.clear()
67
term.setCursorPos(1,1)
68
cPrint("Rednet Explorer 1.3")
69
70
cPrint("rdnt://"..website)
71
print("")
72
if message == "epanst" then
73
  drawEditor()
74
else
75
  print(message)
76
  id, message  = rednet.receive()
77
  print(message)
78
  id, message  = rednet.receive()
79
  print(message)
80
  id, message  = rednet.receive()
81
  print(message)
82
  id, message  = rednet.receive()
83
  print(message)
84
85
  print("")
86
87
  write("Goto:")
88
  address = io.read()
89
  website = address
90
  drawScreen()
91
end
92
end
93
function drawScreen()
94
term.clear()
95
term.setCursorPos(1,1)
96
cPrint("Rednet Explorer 1.3")
97
98
cPrint("rdnt://"..website)
99
print("")
100
101
if website == "home" then
102
  home()
103
elseif website == "www.newsite.com" then
104
  newsite()
105
end
106
107
108
print("")
109
110
write("Goto:")
111
address = io.read()
112
website = address
113
needport = 1
114
if website == "home" then
115
  drawScreen()
116
elseif website == "www.newsite.com" then
117
  drawScreen()
118
else
119
  loadwebpage()
120
end
121
end
122
drawScreen()