Simplest Way to Implement Server class, server-side?
-
I'm looking to have my plugin phone home to see if there's a newer version of the plugin, and if so what it's name is (so it can be automatically downloaded.)
I started building a mySQL database, and writing and PHP, and stopping, thinking – there's got to be a simpler way to do this, since the Server class handles a lot of stuff?
Hope to post any solution I end up making (if I can).
Thanks and cheers.
EDIT: As I marked this as solved, I'll post my example in a separate thread.
-
@clevername27 The server class can make a GET request to an endpoint on your server. A simple solution is that endpoint can return the version number and download link. I'm actually doing this for Rhapsody - https://codeberg.org/LibreWave/Rhapsody/src/commit/09d6be8dbb3bf31cb790e2d3fbcab8b7a69f0884/Scripts/UpdateChecker.js#L112
Since Rhapsody is hosted on Codeberg I can use their endpoints so I didn't have to do anything server side.
For my instruments it's a bit different as it goes through my website and has to validate license keys, etc. So for that I did have to do some server side stuff, in my case I built it as a Wordpress plugin.
-
@d-healey Thank you for your continued kindness in sharing your work for others to benefit from.
-
-
@d-healey I'm reading about the GIT API. Could you pls tell me if your plugin is using username/password or a token to access your repository?
-
@clevername27 Neither, when the code is open source there's no place to hide credentials. The Codeberg repo is public so I can just access the end point as I could in a web browser.
-
@clevername27 I've worked with some of the smartest people in the industry and what always amazes me is the simplicity of solution.
Do you really need a server, a operation system, a custom mysql database controlled with a php server?
I started using versions.json files for a lot of stuff and try to be as low tech as possible. I would just create a file like this:
{ latest: { version: 1.8, download: 'https://example.com' } old_version: [ { version: 1.7, download: 'https://example.com' }, { version: 1.6, download: 'https://example.com' }, { version: 1.5, download: 'https://example.com' } ] }
You can then create the simplest python or node server serving this or to be even more cheap put it in a GitHub repository and query the raw version of that file.
You can build off that example using GH Actions custom scripts etc but in the core this is the solution that I am using for years.
-
@oskarsh said in Simplest Way to Implement Server class, server-side?:
@clevername27 I've worked with some of the smartest people in the industry and what always amazes me is the simplicity of solution.
Do you really need a server, a operation system, a custom mysql database controlled with a php server?
I started using versions.json files for a lot of stuff and try to be as low tech as possible. I would just create a file like this:
{ latest: { version: 1.8, download: 'https://example.com' } old_version: [ { version: 1.7, download: 'https://example.com' }, { version: 1.6, download: 'https://example.com' }, { version: 1.5, download: 'https://example.com' } ] }
You can then create the simplest python or node server serving this or to be even more cheap put it in a GitHub repository and query the raw version of that file.
You can build off that example using GH Actions custom scripts etc but in the core this is the solution that I am using for years.
@clevername27 yep - this is the way we do it - a simple json file that names the current version, and lists the changes that are included in it...
-
This post is deleted! -
@oskarsh Well said.
-
@Lindon Agreed.
-
I ended up making a custom plugin for WordPress that logs my version data.
The endpoint outputs json with detailed info.And then I display the data on an update panel.
-
@oskarsh said in Simplest Way to Implement Server class, server-side?:
I've worked with some of the smartest people in the industry and what always amazes me is the simplicity of solution.
Edit: "I've worked with some of the most intelligent people in the industry and what always amazes me is the simplicity of solution."