Advertisement
Guest User

startup

a guest
Aug 10th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 KB | None | 0 0
  1. os.loadAPI("json")
  2. term.clear()
  3. term.setCursorPos(1,1)
  4. local mon = peripheral.wrap("top")
  5. local mag = peripheral.wrap("right")
  6. local hostname = "http://localhost:8080/api/key"
  7.  
  8. write("Username : ")
  9. local username = read()
  10. write("Password : ")
  11. local password = read('*')
  12.  
  13. local res = http.post(hostname .. "?level=2&username="..username.."&password="..password).readAll()
  14.  
  15. local obj = json.decode(res)
  16.  
  17. if (obj.success) then
  18.   print("Inserer la carte")
  19.   mon.write("Inserer la carte")
  20.   mag.beginWrite(obj.key, "Carte banquaire")
  21.  
  22.   local ev, arg = os.pullEvent("mag_write_done")
  23.   mon.clear()
  24.   mon.setCursorPos(1,1)
  25. end
  26.  
  27. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement