SHOW:
|
|
- or go back to the newest paste.
| 1 | - | local function printUsage() |
| 1 | + | local program = [[ |
| 2 | - | print( "Usages:" ) |
| 2 | + | os.pullEvent = os.pullEventRaw |
| 3 | - | print( "pastebin put <filename>" ) |
| 3 | + | redstone.setOutput("back", true)
|
| 4 | - | print( "pastebin get <code> <filename>" ) |
| 4 | + | while true do |
| 5 | term.clear() | |
| 6 | - | local tArgs = { ... }
|
| 6 | + | term.setCursorPos(1, 1) |
| 7 | - | if #tArgs < 2 then |
| 7 | + | print("Password?")
|
| 8 | - | printUsage() |
| 8 | + | if read("*") == password then
|
| 9 | - | return |
| 9 | + | redstone.setOutput("back", false)
|
| 10 | sleep(2) | |
| 11 | - | local sCommand = tArgs[1] |
| 11 | + | redstone.setOutput("back", true)
|
| 12 | - | if sCommand == "put" then |
| 12 | + | end |
| 13 | - | -- Upload a file to pastebin.com |
| 13 | + | end |
| 14 | - | -- Determine file to upload |
| 14 | + | ]] |
| 15 | - | local sFile = tArgs[2] |
| 15 | + | |
| 16 | - | local sPath = shell.resolve( sFile ) |
| 16 | + | print("Password?")
|
| 17 | - | if not fs.exists( sPath ) or fs.isDir( sPath ) then |
| 17 | + | local password = read() |
| 18 | - | print( "No such file" ) |
| 18 | + | |
| 19 | - | return |
| 19 | + | if response then |
| 20 | local file = fs.open("startup.lua", "w")
| |
| 21 | - | write("Enter paste name: ")
|
| 21 | + | file.write("local password = \""..password.."\"\n"..program)
|
| 22 | - | sName = read() |
| 22 | + | file.close() |
| 23 | end | |
| 24 | - | -- Read in the file |
| 24 | + | |
| 25 | - | if sName == "" then local sName = fs.getName( sPath ) end |
| 25 | + | -- Finish |
| 26 | - | local file = fs.open( sPath, "r" ) |
| 26 | + | os.reboot() |