SHOW:
|
|
- or go back to the newest paste.
| 1 | function os.apullEvent(_sFilter) | |
| 2 | local params = {}
| |
| 3 | params = {os.pullEventRaw(_sFilter)}
| |
| 4 | event = params[1] | |
| 5 | if event == "terminate" then | |
| 6 | print("If you want to see the code PM me on discord: GravityCube#3550")
| |
| 7 | end | |
| 8 | return unpack(params) | |
| 9 | end | |
| 10 | - | sleep(3) |
| 10 | + | sleep(3) |
| 11 | local function get(paste) | |
| 12 | local response = http.get( | |
| 13 | "http://pastebin.com/raw.php?i="..textutils.urlEncode( paste ) | |
| 14 | ) | |
| 15 | ||
| 16 | if response then | |
| 17 | print( "Success." ) | |
| 18 | sleep(0.1) | |
| 19 | ||
| 20 | local sResponse = response.readAll() | |
| 21 | response.close() | |
| 22 | return sResponse | |
| 23 | else | |
| 24 | error( "Failed." ) | |
| 25 | end | |
| 26 | end | |
| 27 | ||
| 28 | function downloadProgram(sCode, sPath) | |
| 29 | if fs.exists( sPath ) then | |
| 30 | print( "Updating(" .. sPath .. ")..." )
| |
| 31 | fs.delete(sPath) | |
| 32 | else | |
| 33 | print( "Downloading(" .. sPath .. ")..." )
| |
| 34 | end | |
| 35 | sleep(0.1) | |
| 36 | ||
| 37 | -- GET the contents from pastebin | |
| 38 | local res = get(sCode) | |
| 39 | if res then | |
| 40 | local file = fs.open( sPath, "w" ) | |
| 41 | file.write( res ) | |
| 42 | file.close() | |
| 43 | end | |
| 44 | end | |
| 45 | ||
| 46 | - | programs = {[1]= {['programName'] = "gcapi", ['pastebin']="0uAaAcrW"}, [2]= {['programName']="start", ['pastebin']="h9XLsqNk"}}
|
| 46 | + | programs = {[1]= {['programName'] = "gcapi", ['pastebin']="0uAaAcrW"},
|
| 47 | - | |
| 47 | + | [2]= {['programName']="start", ['pastebin']="rW9x5QvX"},
|
| 48 | [3]= {['programName'] = "mLink", ['pastebin']="qaYR1mMu"},
| |
| 49 | [4]= {['programName'] = "gameModels", ['pastebin']="C4tTk0sx"},
| |
| 50 | [5]= {['programName'] = "bigMessages", ['pastebin']="UvXyCcWd"},
| |
| 51 | [6]= {['programName'] = "CLKeysAPI", ['pastebin']="SAZmxhJu"},
| |
| 52 | } | |
| 53 | function updateOrDownload() | |
| 54 | for _,data in pairs(programs) do | |
| 55 | downloadProgram(data['pastebin'], data['programName']) | |
| 56 | end | |
| 57 | end | |
| 58 | function clearTerminal() | |
| 59 | term.setCursorPos(1,1) | |
| 60 | term.clear() | |
| 61 | end | |
| 62 | function startProgram() | |
| 63 | clearTerminal() | |
| 64 | print("Started!")
| |
| 65 | shell.run("start")
| |
| 66 | end | |
| 67 | clearTerminal() | |
| 68 | print("Starting...")
| |
| 69 | sleep(0.2) | |
| 70 | if( not pcall(updateOrDownload) ) then | |
| 71 | print("An error has occurred, PM me on discord: GravityCube#3550. Or wait 30 seconds to try again")
| |
| 72 | sleep(30) | |
| 73 | os.reboot() | |
| 74 | end | |
| 75 | ||
| 76 | local ok, err = pcall(startProgram) | |
| 77 | print(err) | |
| 78 | print("An error has occurred, PM me on discord: GravityCube#3550.")
| |
| 79 | ||
| 80 | sleep(10) | |
| 81 | os.reboot() |