-
Notifications
You must be signed in to change notification settings - Fork 0
Update Server
!!!EXAMPLE STRUCTURE WITH ALL NEEDED FILES DOWNLOADABLE FROM THIS GITHUB! https://github.com/timfischbach/R-Lib8266/tree/main/UpdateServer !!!
First of all you need to create your folder on your http server. It needs to be public. All files needed for the update will be stored there.
Enter that folder and create a new file called "init" with no ending. Fill it like this:
Save it and close it. Now upload the datareceive.php file from this repository to your folder: https://github.com/timfischbach/R-Lib8266/blob/main/UpdateServer/datareceive.php
Now create a empty file called "datalog.txt". Later, there will be all the data sent by dataTransmission() function. It'll look like this (MAC censored on this screenshot for data safety):
Last step is to add your compiled binary from your program and upload it to the folder. Name it like you declared in the init file and don't forget to add the version to the file name. PLEASE MAKE SURE THAT THE VERSION IS THE SAME AS DECLARED IN YOUR SOURCE CODE OR ELSE IT'LL UPDATELOOP FOREVER!!!
If you did everything right, your filestructure should now look something like this (IGNORE THE BETA FOLDER FOR NOW!):
Congrats! Your update server is now ready to go. Make sure to add the http Link to this folder in your sourcecode.
Like already seen above, you can add a beta folder to have 2 branches to update from. (Function setBetaState() needs to be true, to download from the beta branch).
Create a new folder called beta and open it. Create a init file (like explained above) and upload your binary. I would recommend to name the version differently from the main branch to avoid confusion later in the datalog.txt (like v1.0.0b or 1.0.0beta... it's up to you). It should look like this:
You don't need to change the http Link in your sourcecode!!!! Leave it directed to your main folder like explained above!!! Congrats! Now you got a Update server with 2 branches :)
Dev Mode overrides the Update Check and instantly downloads "firmware.bin" in the dev folder. Useful for projects, which are in production. It is recommended to only enable it by another function or else, it'll download it everytime when performUpdate() is triggered, since there is no version check, so be careful.



