09-29-2021, 09:14 PM
Got an update system working, happy with how it went except for the last step, sometimes what I think will be the easiest turns out to be the hardest.
A user can check manually for updates or use the auto update feature.
If using auto update it will check my website every hour, later I'll change it to check once a day or something. This is the web page it reads, you can see it only has a number on the page, this is the version.
https://www.robo-tank.ca/app/version.html
All I need to do is upload new files to my server, change the version number on that page and everyone will be alerted.
I put the setting on the System Settings page, if Auto Update is on the "Check for Update" button is hidden.
If an update is available the button changes and a link shows up beside the date. That link in the header also appears when using auto update.
When you're ready to install you click that link and you'll get the popup below.
When it starts everything is done in the backend program, it will download a zip file from www.robo-tank.ca, extract the files to a temporary folder, copy them to their destinations, delete temp files and restarts the Raspberry Pi if necessary.
When it finishes it will prompt and this is the part that really sucks, browser cache. I expected there would be a simple javascript function to clear that but it's been depreciated in Chrome and Edge and only works on Firefox but probably not much longer. Without clearing the cache there's a good chance images won't update or style sheets. Of course there's a way around this but it's messy and will take time so I'll get to that another day.
If a user skips an update or more it will step through them all. There is no backup system yet, I think that will come after initial release.
A user can check manually for updates or use the auto update feature.
If using auto update it will check my website every hour, later I'll change it to check once a day or something. This is the web page it reads, you can see it only has a number on the page, this is the version.
https://www.robo-tank.ca/app/version.html
All I need to do is upload new files to my server, change the version number on that page and everyone will be alerted.
I put the setting on the System Settings page, if Auto Update is on the "Check for Update" button is hidden.
If an update is available the button changes and a link shows up beside the date. That link in the header also appears when using auto update.
When you're ready to install you click that link and you'll get the popup below.
When it starts everything is done in the backend program, it will download a zip file from www.robo-tank.ca, extract the files to a temporary folder, copy them to their destinations, delete temp files and restarts the Raspberry Pi if necessary.
When it finishes it will prompt and this is the part that really sucks, browser cache. I expected there would be a simple javascript function to clear that but it's been depreciated in Chrome and Edge and only works on Firefox but probably not much longer. Without clearing the cache there's a good chance images won't update or style sheets. Of course there's a way around this but it's messy and will take time so I'll get to that another day.
If a user skips an update or more it will step through them all. There is no backup system yet, I think that will come after initial release.