Jump to content




[Question] Would GitHub work with the HTTP api?


9 replies to this topic

#1 digpoe

  • Members
  • 92 posts

Posted 09 November 2012 - 07:36 AM

I would like to know if GitHub raw view would work with the HTTP Api if you are trying to make an update program. Would it? It would be helpful if it did, as I don't want to make a Pastebin account with a password I'd probbably forget.

#2 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 09 November 2012 - 07:39 AM

Yes but you would also need a file to tell you where all the files you need to download are

#3 digpoe

  • Members
  • 92 posts

Posted 09 November 2012 - 07:41 AM

 PixelToast, on 09 November 2012 - 07:39 AM, said:

Yes but you would also need a file to tell you where all the files you need to download are
I meant, if I have a raw view of a file up on GitHub, (it has no formatting to it) would I be able to use it to update a program if it's out of date?

#4 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 09 November 2012 - 07:55 AM

Yes, the https protocol is supported.

#5 digpoe

  • Members
  • 92 posts

Posted 09 November 2012 - 08:04 AM

Ok, thanks. But it seems I am getting errors.... Here's my code: https://raw.github.c...ster/updatetest
I don't get why it doesn't work, it should function fine.
The code i'm using in MC is:
local version =
0
function versioncheck()
	    term.clear()
	    term.setCursorPos(1,1)
	    print("Program loading...")
	    print("Current version: "..version)
	    local updateSite = http.get("https://raw.github.com/DigiTechs/Minecraftstuff/6bcf62fd71421eb5182605068f93c228f78b172b/updatetest")
	    local coding = updateSite.readLine(2)
	    local newVersion = (tonumber(coding))
	    sleep(2)
	    if tonumber(newVersion) > version then
			    print("Newest version is: "..newVersion)
			    print("Update required. Updating now...")
			    local updateSite = http.get("https://raw.github.com/DigiTechs/Minecraftstuff/6bcf62fd71421eb5182605068f93c228f78b172b/updatetest")
			    local siteFile = updateSite.readAll()
			    local writeFile = fs.open(shell.getRunningProgram(),"w")
			    writeFile.write(siteFile)
			    writeFile.close()
			    print("The program will now restart your computer.")
			    sleep(2)
			    os.reboot()
	    end
end


#6 Sammich Lord

    IRC Addict

  • Members
  • 1,212 posts
  • LocationThe Sammich Kingdom

Posted 09 November 2012 - 08:44 AM

Please post a error log. Are you trying to pull a commit or what? Or do you have a folder named "6bcf62fd71421eb5182605068f93c228f78b172b"?

#7 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 09 November 2012 - 08:45 AM

What version of ComputerCraft are you using?

#8 digpoe

  • Members
  • 92 posts

Posted 09 November 2012 - 09:04 AM

 Lyqyd, on 09 November 2012 - 08:45 AM, said:

What version of ComputerCraft are you using?
It's 1.46 according to MultiMC's console.

#9 digpoe

  • Members
  • 92 posts

Posted 09 November 2012 - 09:05 AM

 Human, on 09 November 2012 - 08:44 AM, said:

Please post a error log. Are you trying to pull a commit or what? Or do you have a folder named "6bcf62fd71421eb5182605068f93c228f78b172b"?

I'm getting no errors from the game, it just runs and "does nothing" - The actual link to get to the raw file is https://raw.github.c...172b/updatetest - and I belive the 6bdcf thing is just the commit info.

#10 Kolpa

  • New Members
  • 260 posts
  • LocationGermany

Posted 09 November 2012 - 09:13 AM

https://github.com/K...o%20updater.lua
there ya go

this pretty much downloads everything





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users