I was wondering how (if possible) to code a program so that it runs like the pastebin program, but it installs from GitHub.
Sorry if this is a noobish question, but I don't have much experience with the http api and GitHub (I only recently started using it)
Getting GitHub files in CC
Started by austinv11, Jan 11 2014 09:56 AM
3 replies to this topic
#1
Posted 11 January 2014 - 09:56 AM
#2
Posted 11 January 2014 - 11:08 AM
Okay I may have fixed it, here's my code (not bug-tested):
But is it possible to upload files?
function gitGet(user, repo, branch, path, toPath)
local dl = http.get("https://raw.github.com/"..user.."/"..repo.."/"..branch.."/"..path)
local file = dl.readAll()
dl.close()
local w = fs.open(toPath,"w")
w.write(file)
w.close()
return true
end
But is it possible to upload files?
#3
Posted 11 January 2014 - 12:45 PM
It is possible to make commits from ComputerCraft if you go through a server-side hosted script to use GitHub's OAuth API to give you access to your own account, then you can post the files in question to the server script. (I think you need the authorization info in a header, at least last time I worked with an OAuth API that was the case.)
Edited by awsmazinggenius, 11 January 2014 - 12:46 PM.
#4
Posted 11 January 2014 - 12:56 PM
awsmazinggenius, on 11 January 2014 - 12:45 PM, said:
It is possible to make commits from ComputerCraft if you go through a server-side hosted script to use GitHub's OAuth API to give you access to your own account, then you can post the files in question to the server script. (I think you need the authorization info in a header, at least last time I worked with an OAuth API that was the case.)
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users











