Advertisement
jesusthekiller

update_check

Mar 30th, 2013
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.60 KB | None | 0 0
  1. if not http then
  2.     print( "WCON requires http API" )
  3.     print( "Set enableAPI_http to 1 in mod_ComputerCraft.cfg" )
  4.     return
  5. end
  6.  
  7. os.unloadAPI("wcon")
  8. os.loadAPI("wcon")
  9.  
  10. local r = http.get("http://mindblow.no-ip.org/wcon/api/version")
  11.  
  12. local v = r.readLine()
  13.  
  14. r.close()
  15.  
  16. if(tonumber(v) > wcon.getVersion()) then
  17.     print("Updaiting. . .")
  18.     local id = wcon.getId()
  19.     local pass = wcon.getPassword()
  20.    
  21.     print("Making and downloading WCON API")
  22.  
  23.     wcon = fs.open("wcon/wcon", "w")
  24.     wcon.write("local id = "..id.."\n")
  25.     wcon.write("local password=\""..pass.."\"\n")
  26.  
  27.     wcon.write("local ver = "..v.."\n")
  28.  
  29.     file = http.get("http://pastebin.com/raw.php?i="..textutils.urlEncode("RKbavkNe"))
  30.  
  31.     if file == nil then print("Error!") return end
  32.  
  33.     wcon.write(file.readAll())
  34.  
  35.     file.close()
  36.     wcon.close()
  37.  
  38.     print("Downloading update. . .")
  39.  
  40.     update = fs.open("wcon/update", "w")
  41.  
  42.     file = http.get("http://pastebin.com/raw.php?i="..textutils.urlEncode("ry12vuie"))
  43.  
  44.     if file == nil then print("Error!") return end
  45.  
  46.     update.write(file.readAll())
  47.  
  48.     file.close()
  49.     update.close()
  50.  
  51.     print("Downloading launch. . .")
  52.  
  53.     launch = fs.open("launch", "w")
  54.  
  55.     file = http.get("http://pastebin.com/raw.php?i="..textutils.urlEncode("7EaDxV1e"))
  56.  
  57.     launch.write(file.readAll())
  58.  
  59.     file.close()
  60.     launch.close()
  61.  
  62.     print("Downloading update_check. . .")
  63.  
  64.     u_check = fs.open("wcon/update_check", "w")
  65.  
  66.     file = http.get("http://pastebin.com/raw.php?i="..textutils.urlEncode("D1e06P2r"))
  67.  
  68.     u_check.write(file.readAll())
  69.  
  70.     file.close()
  71.     launch.close()
  72.  
  73.     print("Done!")
  74. else
  75.     print("No WCON update aviawable!")
  76. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement