Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- if not http then
- print( "WCON requires http API" )
- print( "Set enableAPI_http to 1 in mod_ComputerCraft.cfg" )
- return
- end
- print("Welcome to WCON installer.")
- print("Do you have an WCON account for this compuer? (Y/N)")
- while ((e1 ~= "y" and e1 ~= "Y") and (e1 ~= "n" and e1 ~= "N")) do
- e1 = read()
- end
- if(e1 == "y" or e1 == "Y") then
- clear()
- print("Your ID:")
- id = read()
- print("Your password:")
- pass = read()
- elseif(e1 == "n" or e1 == "N") then
- print("\nOK! Input your password: ")
- local p = read()
- clear()
- print("Connecting to WCON server...")
- local resp = http.get("http://mindblow.no-ip.org/wcon/api/mkAccount.php?pass="..p)
- if(resp == nil) then
- print("Oops, communicatio fail! Please visit mindblow.no-ip.org/wcon and register computer manually")
- return
- end
- id = resp.readLine()
- pass = resp.readLine()
- print("Done! Your ID is: "..tostring(id).." and password is: "..tostring(pass))
- print("Write it down, it's impossible to get it back!")
- end
- sleep(3)
- print("Installing...")
- print("Making wcon_stuff dir...")
- fs.makeDir("wcon_stuff")
- print("Downloading WCON API...")
- wcon = fs.open("wcon", "w")
- wcon.write("local id = "..id.."\n")
- wcon.write("local password=\""..pass.."\"\n")
- hver = http.get("http://mindblow.no-ip.org/wcon/api/version")
- ver = hver.readLine()
- hver.close()
- wcon.write("local ver = "..ver.."\n")
- file = http.get("http://pastebin.com/raw.php?i="..textutils.urlEncode("RKbavkNe"))
- if file == nil then print("Error!") return end
- wcon.write(file.readAll())
- file.close()
- wcon.close()
- print("Downloading update...")
- update = fs.open("wcon_stuff/update", "w")
- file = http.get("http://pastebin.com/raw.php?i="..textutils.urlEncode("ry12vuie"))
- if file == nil then print("Error!") return end
- update.write(file.readAll())
- file.close()
- update.close()
- print("Downloading launch...")
- launch = fs.open("launch", "w")
- file = http.get("http://pastebin.com/raw.php?i="..textutils.urlEncode("7EaDxV1e"))
- launch.write(file.readAll())
- file.close()
- launch.close()
- print("Downloading update_check...")
- u_check = fs.open("wcon_stuff/update_check", "w")
- file = http.get("http://pastebin.com/raw.php?i="..textutils.urlEncode("D1e06P2r"))
- u_check.write(file.readAll())
- file.close()
- u_check.close()
- print("Done!")
- print("\nDo you want to append update check the end of the startup file? (Y/N)")
- e1 = nil
- while (e1 ~= "y" and e1 ~= "Y" and e1 ~= "n" and e1 ~= "N") do
- e1 = read()
- end
- if(e1 == "y" or e1 == "Y") then
- startup = fs.open("startup", "a")
- startup.write("shell.run(\"wcon_stuff/update_check\")")
- startup.close()
- print("Done! You can always update manually by running \'wcon_stuff/update_check\'")
- elseif(e1 == "n" or e1 == "N") then
- print("OK :(. You can always update by running \'wcon_stuff/update_check\'")
- end
- print("Installation complete!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement