Advertisement
Marlingaming

Wired Network File Browser

Jul 8th, 2022
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. local URL = -1
  2. local User = "guest"
  3. local Connections = {}
  4. local Modem = peripheral.find("modem")
  5. local NetVersion = "1.0.0"
  6.  
  7.  
  8. function Clear()
  9. term.clear()
  10. term.setCursorPos(1,1)
  11. end
  12.  
  13. function DisplayFiles()
  14. Clear()
  15. print("URL: "..URL)
  16.  
  17. end
  18.  
  19. function Menu()
  20. Clear()
  21. print("NetVersion: "..NetVersion)
  22. print("==Connections==")
  23. local n = 1
  24. while true do
  25. for i = 1, #Connections do
  26. if n == i then print(">"..Connections[i]) else print(Connections[i]) end
  27. end
  28. if n == #Connections + 1 then print("> Logout") else print("Logout") end
  29. local event, key = os.pullEvent("key")
  30. if key == keys.s then
  31. if n == #Connections + 1 then n = 1 else n = n + 1 end
  32. elseif key == keys.w then
  33. if n == 1 then n = #Connections + 1 else n = n - 1 end
  34. elseif key == keys.enter then
  35. break
  36. end
  37. end
  38. if n == #Connections + 1 then
  39. Login()
  40. else
  41. URL = Connections[n]
  42. DisplayFiles()
  43. end
  44. end
  45.  
  46. function Login()
  47. Clear()
  48. print("NetVersion: "..NetVersion)
  49. print("Username:")
  50. local input
  51. repeat
  52. local event, a = os.pullEvent("key")
  53. input = read()
  54. until key == keys.enter
  55. User = input
  56. Menu()
  57. end
  58.  
  59. function GetConnections()
  60. Connections = Modem.getNamesRemote()
  61. end
  62.  
  63. GetConnections()
  64. Login()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement