Jump to content
Cyan

Keeping users safe

Recommended Posts

No problems here, but I've got a question that sort of relates.

Is there any appetite to build some sort of mechanism into LCPDFR.com to check for updates to a plugin? (Not to download updates, but to simply check if there is a newer version available, and direct the user to download it themselves)

I am not inclined whatsoever to set up and maintain an external server for something so minor, which is why I have not done anything like this yet. But if I could make a web request on startup that would make an API call to LCPDFR.com, I'd be for it.

Not a high priority at all, since most players check regularly for updates to plugins, and its not something so crucial that people must have an update whenever its released. Maybe something that goes on the list of "things to be added sometime between now and later".

Share this post


Link to post
Share on other sites
6 hours ago, Stealth22 said:

No problems here, but I've got a question that sort of relates.

Is there any appetite to build some sort of mechanism into LCPDFR.com to check for updates to a plugin? (Not to download updates, but to simply check if there is a newer version available, and direct the user to download it themselves)

I am not inclined whatsoever to set up and maintain an external server for something so minor, which is why I have not done anything like this yet. But if I could make a web request on startup that would make an API call to LCPDFR.com, I'd be for it.

Not a high priority at all, since most players check regularly for updates to plugins, and its not something so crucial that people must have an update whenever its released. Maybe something that goes on the list of "things to be added sometime between now and later".

I'm making a lot of changes to the downloads section right now, and that's certainly something that seems small enough to pull off in the next update.

Mikofiticus and Stealth22 like this

Share this post


Link to post
Share on other sites
2 hours ago, Cyan said:

I'm making a lot of changes to the downloads section right now, and that's certainly something that seems small enough to pull off in the next update.

Thanks...like I said, its not a high priority at all. Whenever you have a chance, there's no rush.

Share this post


Link to post
Share on other sites
On 11/11/2015, 8:19:07, Albo1125 said:

My Plugins currently check their version to the version in an xml file from my server. If the version in the xml file is newer, they're notified of an update and are offered to do so. 

I assume this falls within the boundaries of not getting one of those messages at the top of my download pages? 

And if this could be built into the API, even better :) 

Provided that your plugin doesn't download and automatically run or replace executables, that is fine. You can open up a browser tab to go to somewhere to download the new version (your site, or lcpdfr.com, it doesn't really matter).

@Stealth22

I've implemented this to a basic level. You can now query the following URL:
http://www.lcpdfr.com/applications/downloadsng/interface/api.php?do=checkForUpdates&fileId=8082
And it will return a JSON object with version and pageUrl. Version will equal to the current version of the file, exactly as specified in the file manager. pageUrl will equal the URL to the file's page on LCPDFR.com.
If you just want a text string with the latest version, you can call the following URL instead:
http://www.lcpdfr.com/applications/downloadsng/interface/api.php?do=checkForUpdates&fileId=8082&textOnly=1
Note that there may be up to a 30 minute delay between updating the file and the above showing the new version, due to caching.

If anyone else wants to use this, you just have to change the fileId to the ID of the file. You can determine your file ID by the URL of your file. e.g.:
http://www.lcpdfr.com/files/file/8082-code-3-callouts/
The file ID in this case would be 8082.

AlconH, w35, LtFlash and 4 others like this

Share this post


Link to post
Share on other sites

@Cyan - You, sir, are awesome.

That is all.

On 22/11/2015, 09:42:59, Cyan said:

Note that there may be up to a 30 minute delay between updating the file and the above showing the new version, due to caching.

Just a tip for other devs...don't just check to see if the version string = the version of the plugin thats running. You might get a false positive if you update the plugin, and someone runs it before the site cache has been updated.

I'm pretty sure (99.9%) that you can parse the version number (if the format is correct) into a .NET Version object, and then compare it to the version of the plugin that is making the API call. That will definitely tell you if the version on the server is actually newer.

If someone needs me to, I can post a code sample when I have some time.

Albo1125 likes this

Share this post


Link to post
Share on other sites
On 11/25/2015 at 3:21 PM, Stealth22 said:

@Cyan - You, sir, are awesome.

That is all.

Just a tip for other devs...don't just check to see if the version string = the version of the plugin thats running. You might get a false positive if you update the plugin, and someone runs it before the site cache has been updated.

I'm pretty sure (99.9%) that you can parse the version number (if the format is correct) into a .NET Version object, and then compare it to the version of the plugin that is making the API call. That will definitely tell you if the version on the server is actually newer.

If someone needs me to, I can post a code sample when I have some time.

that would be nice for developers like me for posting a code sample as I currently just use a webclient to download a txt file from my server with the latest version in it check the version and compare the version hardcoded into the script to see if it is the latest version or not.(but the hardcoded part is kinda hard to keep up with considering I sometimes forgot to change the hardcoded version to the latest version in the txt file when releasing a new version.)

Share this post


Link to post
Share on other sites
On 13.12.2015 at 5:45 AM, timnboys said:

that would be nice for developers like me for posting a code sample as I currently just use a webclient to download a txt file from my server with the latest version in it check the version and compare the version hardcoded into the script to see if it is the latest version or not.(but the hardcoded part is kinda hard to keep up with considering I sometimes forgot to change the hardcoded version to the latest version in the txt file when releasing a new version.)

You could use reflection to get assembly version, like that :

using System.Reflection;

...

string plug_ver = typeof(YOUR_PLUGIN_CLASS_GOES_HERE).Assembly.GetName().Version;

...

and then convert from string to int or int[] and compare versions

or compare using mentioned by Stealth22 Version object

using System;
using System.Reflection;

...

Version plug_ver = typeof(YOUR_PLUGIN_CLAS_GOES_HERE).Assembly.GetName().Version;

....
(assuming that online_ver is version got from lcpdfr.com)
....
switch(plug_ver.CompareTo(online_ver))
{
   case 0: // versions are the same
    ....  
	break;
   case 1: // plug_ver is later than online_ver
      ...
      break;
   case -1: // plug_ver is earlier than online_ver
      .... // notify about update available
      break;
}

 

Edited by w35
better code
Darkmyre likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×