View difference between Paste ID: 3ix4eVpM and ZMehU0D9
SHOW: | | - or go back to the newest paste.
1
function cPrint(y, text)
2
  size = term.getSize()
3
  term.setCursorPos(size/2-math.floor(#text/2), y)
4
  write(text)
5
end
6
7
local oldOpen = fs.open
8
local oldDelete = fs.delete
9
local oldMove = fs.move
10
local oldCopy = fs.copy
11
local oldEject = disk.eject
12
13-
  if fileName:sub(1, 3) == "rom" or fileName:sub(1, 5) == "disk2" then
13+
14
  fileName = shell.resolve(fileName)
15
  if fileName:sub(1, 4) == "rom/" or fileName:sub(1, 6) == "disk2/" then
16
    return oldOpen(fileName, mode)
17
  else
18
    return false
19
  end
20
end
21-
  if fileName:sub(1, 5) == "disk2" then
21+
22
fs.delete = function(fileName)
23
  if fileName:sub(1, 6) == "disk2/" then
24
    return oldDelete(fileName)
25
  else
26
    return false
27
  end
28
end
29-
  if fileName:sub(1, 5) == "disk2" then
29+
30
fs.move = function(fileName, destination)
31
  fileName = shell.resolve(fileName)
32
  if fileName:sub(1, 6) == "disk2/" or fileName:sub(1, 4) == "rom/" and destination:sub(1, 6) == "disk2/" then
33
    return oldMove(fileName, destination)
34
  else
35
    return false
36
  end
37-
  if fileName:sub(1, 5) == "disk2" then
37+
38
39
fs.copy = function(fileName, destination)
40
  fileName = shell.resolve(fileName)
41
  if fileName:sub(1, 6) == "disk2/" or fileName:sub(1, 4) == "rom/" and destination:sub(1, 6) == "disk2/" then
42
    return oldCopy(fileName, destination)
43
  else
44
    return false
45
  end
46
end
47
48
disk.eject = function(side)
49-
local timeSite = http.get("http://www.timeapi.org/utc/now?format=%25a%20%25b%20%25d%20%25Y%20%25I:%25M:%25S")
49+
  return false
50-
local time = timeSite.readAll()
50+
51
52
_G.fs.open = fs.open
53
_G.fs.delete = fs.delete
54
_G.fs.move = fs.move
55
_G.fs.copy = fs.copy
56
_G.disk.eject = disk.eject
57
58
term.clear()
59
cPrint(5, "Public Computer Box")
60
cPrint(6, "Step in and press any key")
61
local evt = os.pullEvent("key")
62
63
local time = os.time()
64
if http then
65
  local timeSite = http.get("http://www.timeapi.org/utc/now?format=%25a%20%25b%20%25d%20%25Y%20%25I:%25M:%25S")
66
  time = timeSite.readAll()
67
end
68
local logTable = {"Computer Box login", time}
69
local logString = textutils.serialize(logTable)
70
71
rednet.open("back")
72
rednet.send(118, logString)
73
rednet.close("back")
74
75
term.clear()
76
term.setCursorPos(1,1)
77
print("BoxOS 1.4")