7508 posts
Location
Australia
Posted 16 December 2012 - 05:29 AM
Thread Closed in favour of merging to a single, easier to manage, thread and website see signature for more infoSpoiler
Welcome to TheOriginalBIT's APIs!
I am all about learning and teaching, so please if you don't know what something does, or just want to know why I did it this way… just ask :)/>
Hope you enjoy :D/>
For the most part if there is any variables that you need to change it will be towards the top of the program code clearly labelled.
How to use:
Spoiler
Please not that it is self updating. If you do not want this feature enabled turn the doCheck variable towards the bottom of the file to false.
Note that this API also uses os.pullEventRaw() to prevent termination during executing. Perfect for updating your door locking programs or anything that you don't want to terminate :)/>
To use this in your code you must first load it as an API using
os.loadAPI( pathToFile )
if doCheck and isNewerVersion(apiName, apiVersion, apiCheckUrl, nil, showDebug) then
downloadAndInstallUpdate("tester", apiUrl, shell.getRunningProgram(), showDebug)
end
There are 3 functions that this api provides:
First function:
Spoiler
isNewerVersion(progName, installedVersion, versionUrl, pat, debug)
or
isNewerVersion(progName, installedVersion, versionUrl, pat)
this function requires the programs name, the version on the computer, the RAW url for the file containing the latest version (raw git and raw pastebin recommended), the pattern which is used to split the lines if nil is parsed it will default to ":", if debug is true the api will print out some progress messages.
Second function:
Spoiler
downloadAndInstallUpdate(progName, updateUrl, progPath, debug)
or
downloadAndInstallUpdate(progName, updateUrl, progPath)
this function requires the programs name, the RAW url for the file containing the updated program (raw.git and raw pastebin recommended), the programs path, this is recommended to be parsed in using the following code for best compatibility (incase you users dont name or put your program where you want them to)
shell.getRunningProgram()
if debug is true the api will print out some progress messages.
Third function:
Spoiler
This function combines the two previous functions in one call, if there is a new version it will update it.
checkAndUpdate(progName, installedVersion, progListUrl, pat, updateDownloadUrl, progPath, debug)
or
checkAndUpdate(progName, installedVersion, progListUrl, pat, updateDownloadUrl, progPath)
if debug is true the api will print out some progress messages.
If everything is done correctly you are DONE! :D/>
Requirements:
Spoiler
- HTTP API Enabled
- Any ComputerCraft OS
Features:
Spoiler
v2.0- Checks for the latest version of your program from any RAW url! (best results from git or pastebin)
- Can download and update your program for you!
- Self updating if I make bug fixes or add features (can be disabled, read comments)
Next Update:- Nothing planned. Requests?
Changelog:
Spoiler
v2.0- New: Checks for the latest version of your program from any raw url (best results from git or pastebin)
- New: Added an all in one function call
- New: Added ability to enable console progress messages.
- Fixed: Squished a few bugs
v1.0.1- Bug fix: isNewerVersion() now requires third parameter, see "How to use" for more information.
Edited on 24 January 2013 - 11:55 PM
7508 posts
Location
Australia
Posted 16 December 2012 - 06:41 AM
[Update] Critical bug fix that stopped it from checking users pastebin list of programs and versions.
7508 posts
Location
Australia
Posted 16 December 2012 - 02:46 PM
[Update] [Version API] I will be rolling out a new version in a few hours which adds a few new functions and allows for any url (as long as its in RAW format). Please if you wish to use this API come back in a few hours as some changes may break your code :(/>
7508 posts
Location
Australia
Posted 16 December 2012 - 11:44 PM
[Update] [Version API] Added some new features and squished some bugs. if your using version 1.x of this API please update your code. :)/> sorry for any inconvenience.
7508 posts
Location
Australia
Posted 17 December 2012 - 02:57 PM
[NEW!] Screensaver Program/API. Multiple display modes and ability to require login! :D/>
7508 posts
Location
Australia
Posted 18 December 2012 - 01:50 AM
[Update] Bug fixes and feature completion (thought it was already done, oops, thats a testing fail). Login now times out back to the screensaver after 10 seconds of no key presses.
7508 posts
Location
Australia
Posted 18 December 2012 - 05:18 PM
NEW Update for Screensaver API! It is now the most advanced screensaver ever! Don't like my 5 screensaver renders? Think that you can do a better one? Well just put the renderer and updater in your program and then register* it with the API and your done! You can now use your custom one! I'd love to see what you can come up with! So if you think yours is awesome why don't you take a screenshot and post it here, and if I agree I'll add it into the public release (crediting you and your work!)
* More info can be found in the OP under "Usage" and "New! And Awesome!" sections.
1243 posts
Location
Indiana, United States
Posted 19 December 2012 - 09:30 AM
Would you mind not bumping this five times in three days when no one else has posted? Kthx.
7508 posts
Location
Australia
Posted 19 December 2012 - 03:10 PM
Would you mind not bumping this five times in three days when no one else has posted? Kthx.
I'm not commenting to intentionally 'bump' the post. I am commenting whats new and stuff. its not my fault that I program quicker than I expect and release new stuff quickly.
what would you have me do, edit the OP with all the new programs, and then a weeks later when its lower on the page THEN bump it saying about all the updates I did weeks ago? sounds stupid if you ask me!
8543 posts
Posted 26 January 2013 - 04:29 AM
Locked by request.