View difference between Paste ID: Q9eXCRxV and bnjhJfiP
SHOW: | | - or go back to the newest paste.
1
term.setBackgroundColor(colors.white)
2
term.clear()
3
4
-- Sistemo le funzioni per tutto
5
function header(text, color)
6
  term.setBackgroundColor(colors[color])
7
  term.setTextColor(colors.white)
8
  term.setCursorPos(1, 1)
9
  print(text)
10
end
11
12
function button(x, y, text, color, bkcolor)
13
  term.setBackgroundColor(colors[bkcolor])
14
  term.setTextColor(colors[color])
15
  term.setCursorPos(x, y)
16
  print(text)
17
end
18
19
function update(url)
20
  shell.run("rm startup")
21
  shell.run("pastebin get "..url.." startup")
22
  shell.run("reboot")
23
end
24
25
function bkText(text, col, bkcol)
26
   term.setBackgroundColor(colors[bkcol])
27
   term.setTextColor(colors[col])
28
   print(text)
29
end
30
31
function text(text, color)
32
  term.setBackgroundColor(colors.white)
33
  term.setTextColor(colors[color])
34
  print(text)
35
end
36
37
function n(col)
38
  term.setBackgroundColor(colors.white)
39
  term.setTextColor(colors[col])
40
end
41
42
function popupPos(aa)
43
  term.setCursorPos(5, aa)
44
end
45
46
function popup(text, text1, text2, text3, text4, text5) --TEXT = MAX 15 - MM = MAX 15
47
  drawFilledBox(5, 2, 27, 9, colours.grey)
48
  term.setTextColor(colors.white)
49
  term.setCursorPos(5, 2)
50
  print("|---------------------|")
51
  term.setCursorPos(5, 3)
52
  print(text)
53
  popupPos(4)
54
  print(text1)
55
  popupPos(5)
56
  print(text2)
57
  popupPos(6)
58
  print(text3)
59
  popupPos(7)
60
  print(text4)
61
  popupPos(8)
62
  print(text5)
63
  term.setCursorPos(5, 9)
64
  print("|---------------------|")
65
end
66
67
local function drawPixelInternal(xPos, yPos)
68
    term.setCursorPos(xPos, yPos)
69
    term.write(" ")
70
end
71
72
local tColourLookup = {}
73
for n = 1, 16 do
74
    tColourLookup[string.byte("0123456789abcdef", n, n)] = 2 ^ (n - 1)
75
end
76
77
function drawFilledBox(startX, startY, endX, endY, nColour)
78
    if type(startX) ~= "number" or type(startX) ~= "number" or type(endX) ~=
79
        "number" or type(endY) ~= "number" or
80
        (nColour ~= nil and type(nColour) ~= "number") then
81
        error("Expected startX, startY, endX, endY, colour", 2)
82
    end
83
 
84
    startX = math.floor(startX)
85
    startY = math.floor(startY)
86
    endX = math.floor(endX)
87
    endY = math.floor(endY)
88
 
89
    if nColour then term.setBackgroundColor(nColour) end
90
    if startX == endX and startY == endY then
91
        drawPixelInternal(startX, startY)
92
        return
93
    end
94
 
95
    local minX = math.min(startX, endX)
96
    if minX == startX then
97
        minY = startY
98
        maxX = endX
99
        maxY = endY
100
    else
101
        minY = endY
102
        maxX = startX
103
        maxY = startY
104
    end
105
 
106
    for x = minX, maxX do for y = minY, maxY do drawPixelInternal(x, y) end end
107
end
108
109
if fs.exists(".settings") == false then
110
   v = 5
111
else
112
  shell.run(".settings")
113
  v = 0
114
  rednet.open(side)
115
end
116
117
while true do
118
if v == 0 then
119
120-
  button(15, 11, " REIMPOSTA GAUGLE ", "white", "orange") 
120+
121
header("                     GAUGLE                  [INFO]", "blue")
122
123
  text("\n\nBenvenuto su GAUGLE!\nIn questo browser potrai cercare roba bella!", "black")
124
  button(15, 7, "  CERCA QUALCOSA  ", "white", "green")
125
  button(15, 9, "  AGGIORNA GAUGLE ", "white", "orange")  
126
  button(15, 11, "   IMPOSTAZIONI   ", "white", "orange") 
127-
  shell.run("pastebin get 7Pdn3tqd startup")
127+
128
local event, tasto, x, y = os.pullEvent("mouse_click")
129
if y == 7 and x > 15 and x < 33 then
130
  v = 1
131
elseif y == 9 and x > 15 and x < 33 then
132-
  v = 5
132+
  v = 100
133
elseif y == 1 and x > 45 then
134
  v = 3
135
elseif y == 11 and x > 14 and x < 33 then
136
  v = 49
137
else
138
  shell.run("startup")
139
end
140
elseif v == 1 then
141
  term.setBackgroundColor(colors.white)
142
  term.clear()
143
  header("                     GAUGLE                        ", "blue")
144
  term.setCursorPos(10, 6)
145
  text("Vai al sito:", "black")
146
  term.setCursorPos(10, 7)
147
  url = read()
148
if url == "gaugle://info" then
149
   v = 3
150
elseif url == "gaugle://mail?rtoken=rednet_TEXT_833jdjdu_B" then
151
  v = 10
152
else
153
  v = 2
154
end
155-
  rednet.send(modem, url)
155+
156-
  local ip, msg, ptrc = rednet.receive()
156+
157
 
158
  
159-
  if msg == "ERROR_404" then
159+
  rednet.send(modem, "search()"..url)
160
  local ip, msg, ptrc = rednet.receive(3)
161
  
162
163
  if msg == nil then
164
  term.setBackgroundColor(colors.white)
165
  term.clear()
166
  header("[HOME]                GAUGLE             [RESEARCH]", "blue")
167
  text("http://"..url, "gray")
168
  text("\nERRORE 404 - Pagina non trovata", "red")
169
  else
170
  term.setBackgroundColor(colors.white)
171
  term.clear()
172
  header("[HOME]                GAUGLE             [RESEARCH]", "blue")
173
  text("http://"..url, "gray")
174
  text("\n"..msg, "black")
175
  end
176-
       drawFilledBox(5, 7, 37, 10, colours.grey)
176+
177-
       term.setCursorPos(6, 8)
177+
178-
       bkText("Cerca qualcosa:", "white", "gray")
178+
179-
       drawFilledBox(6, 9, 35, 9, colours.blue)
179+
180-
       term.setCursorPos(6, 9)
180+
       drawFilledBox(8, 2, 40, 2, colours.white)
181
       term.setCursorPos(8, 2)
182-
       if url == "gaugle://info" then
182+
       term.setTextColor(colors.gray)
183-
           v = 3
183+
184-
       else
184+
       v = 2
185-
           v = 2
185+
    elseif y == 2 then
186-
       end
186+
       term.setCursorPos(8, 2)
187-
       term.clear()
187+
       term.setTextColor(colors.gray)
188
       url = read()
189
       v = 2
190
    end
191
  elseif v == 3 then
192
   term.setBackgroundColor(colors.white)
193
   term.clear()
194-
   text("\n\nGAUUUGLE!\n\nMade by: FoxWorn3365\nVersion: v1.0.3E [RELASE 05]\n\nConfiguration Information:\nType: WIRELESS_2.0\nModem IP: 144.91.97."..modem.."\nModem side: "..side, "black")
194+
195
   text("gaugle://info", "gray")
196
   text("\n\nGAUUUGLE!\n\nMade by: FoxWorn3365\nVersion: v1.9 [Working on Firewall and Responsive]\nType: Default (UP-TO-DATE) GOOD!\n\nConfiguration Information:\nType: WIRELESS_2.0\nModem IP: 144.91.97."..modem.."\nModem side: "..side, "black")
197
   local event, button, x, y = os.pullEvent("mouse_click")
198
   if y == 1 and x < 10 then
199
      v = 0
200
    end
201
 elseif v == 5 then
202
   term.setBackgroundColor(colors.white)
203
   term.clear()
204
   header("[INST]                GAUGLE                       ", "blue")
205
   text("\n\nInstallazione di GAUGLE", "black")
206
   text("\nInserisci l'ID del Modem WIFI:", "black")
207
   local mdwifi = read()
208
   text("\n\nPerfetto, ora inserisci il lato dove e' presente il wm:", "black")
209
   local mdside = read()
210
   local f = fs.open(".settings", "w")
211
   f.writeLine("modem = "..mdwifi) 
212
   f.writeLine("side = '"..mdside.."'")
213
   f.close()
214
   -- Confermo la creazione
215
   shell.run("startup")
216
 elseif v == 10 then
217
     term.setBackgroundColor(colors.white)
218
     term.clear()
219
     header("[HOME]                GAUGLE             [  MAIL  ]", "blue")
220
     text("gaugle://mail", "gray")
221
     text("\nBenvenuto nella casella MAIL di GAUGLE!", "black")
222
     button(15, 6, " INVIA UNA EMAIL ", "white", "blue")
223
     button(15, 8, "  LE TUE EMAIL   ", "white", "blue")
224
     local event, button, x, y = os.pullEvent("mouse_click")
225
        if y == 6 and x > 15 and x < 32 then
226
            v = 15
227
         elseif y == 8 and x > 15 and x < 32 then
228
            v = 12
229
         elseif y == 1 and x < 7 then
230
            v = 0
231
         end
232
  elseif v == 15 then
233
        term.setBackgroundColor(colors.white)
234
        term.clear()
235
        header("[HOME]                GAUGLE             [  MAIL  ]", "blue")
236
        text("gaugle://mail#send", "gray")
237
        text("\n\nInvia un'email!", "black")
238
        text("\n\nInserisci il destinatario:", "blue")
239
        term.setCursorPos(3, 9)
240
        print("@mail.com")
241
        term.setCursorPos(1, 9)
242
        to = read()
243
        print(to)
244
        text("\n\nInserisci il Messaggio:", "blue")
245
        mam = read()
246
        print(mam)
247
        text("Inviato "..mam.." a "..to.."@mail.com", "green")
248
        rednet.send(to, mam)
249
        os.pullEvent("mouse_click")
250
        v = 10
251-
     
251+
  elseif v == 49 then
252
        term.setBackgroundColor(colors.white)
253
        term.clear()
254
        header("[HOME]                GAUGLE         [Impostazioni]", "blue")
255
        text("gaugle://settings", "gray")
256
        text("\n\nImpostazioni di Gauugle:", "black")
257
        button(15, 8, " Impostazioni di Rete ", "white", "orange") 
258
        button(15, 10, " Impostazioni Firewall ", "white", "orange") 
259
        button(15, 12, " Centro Assistenza ", "white", "red") 
260
        local event, bt, x, y = os.pullEvent("mouse_click")
261
        if y == 8 then
262
          v = 5
263
        elseif y == 10 then
264
          v = 51
265
        elseif y == 1 then
266
          v = 0
267
        end   
268
  elseif v == 50 then
269
        term.setBackgroundColor(colors.white)
270
        term.clear()
271
        header("[HOME]                GAUGLE             [FireWall]", "blue")
272
        text("gaugle://firewallManager", "gray")
273
        text("\nImpostazioni dei FireWall:", "black")
274
        rednet.send(modem, "firewall()sus")
275
        ma = {}
276
        lo, msg, ptrc = rednet.receive(5)
277
        if msg == nil then
278
        print("Al momento non ci sono porte aperte...")
279
        else
280
        open = textutils.unserialize(msg)
281
        nan = 1
282
        for v, d in pairs(open) do
283
          ma[nan] = {d, "ATTIVA"}
284
          print("> Porta: "..d.." | Status: APERTA\n")
285
          local x, y = term.getCursorPos()
286
          button(x + 35, y - 2, " CHIUDI ", "white", "red")
287
          term.setBackgroundColor(colors.white)
288
          term.setTextColor(colors.black)
289
          nan = nan + 1
290
          sleep(0.1)
291
        end
292
        end
293
        local event, t, x, y = os.pullEvent("mouse_click")
294
        if y == 1 then
295
        v = 0
296
        elseif y > 4 and y <= nan + 4 then
297
           doa = ma[y - 4]
298
           rednet.send(modem, "remove()"..doa[1])
299
           v = 51
300
        end
301
  elseif v == 51 then
302
        term.setBackgroundColor(colors.white)
303
        term.clear()
304
        header("[HOME]                GAUGLE             [FireWall]", "blue")
305
        text("gaugle://firewall", "gray")
306
        text("\nGestisci i FireWall", "black")
307
        button(15, 6, " Visualizza le Porte Aperte ", "white", "orange")
308
        button(15, 8, " Apri una Nuova Porta ", "white", "orange")
309
        local event, t, x, y = os.pullEvent("mouse_click")
310
        if y == 6 then
311
         v = 50
312
        elseif y == 8 then
313
         v = 52
314
        elseif y == 1 then
315
         v = 0
316
        end
317
  elseif v == 52 then
318
        term.setBackgroundColor(colors.white)
319
        term.clear()
320
        header("[HOME]                GAUGLE             [FireWall]", "blue")
321
        text("gaugle://firewallOpenDoor", "gray")
322
        text("\nApri una porta dal Firewall", "black")
323
        text("\n\n\nInserisci la porta da aprire (01 - 128)", "black")
324
        porta = read()
325
        if tonumber(porta) > 128 then
326
           text("NUMERO TROPPO GRANDE! MASSIMO 128!", "red")
327
           sleep(2)
328
           v = 52
329
        else
330
        rednet.send(modem, "add()"..porta)
331
        v = 51
332
        end
333
  elseif v == 100 then
334
        term.setBackgroundColor(colors.white)
335
        term.clear()
336
        header("[HOME]                GAUGLE             [ Update ]", "blue")
337
        text("gaugle://update", "gray")
338
        text("\nScegli una versione di gaugle:", "black")
339
        button(10, 7, " GAUGLE! Default ", "white", "orange")
340
        button(10, 9, " GAUGLE! ResponsiveTM ", "white", "yellow")
341
        button(10, 11, " GAUGLE! Legacy (No Gaugle Modem) ", "white", "yellow")
342
        button(10, 13, " GAUGLE! Plug-in UP! ", "white", "red")
343
        text("Sconsigliato! FORTEMENTE!!!", "gray")
344
        local event, bt, x, y = os.pullEvent("mouse_click")
345
        if y == 7 then
346
          update("Q9eXCRxV")
347
        elseif y == 9 then
348
          update("9unTEcAt")
349
        elseif y == 11 then
350
          update(" NO sus")
351
        elseif y == 13 then
352
          update(" quite susu")
353
        elseif y == 1 then
354
          v = 0
355
        end
356
end
357
end
358
 
359