nopCommerce icon indicating copy to clipboard operation
nopCommerce copied to clipboard

Improvement to plugin versioning/updating

Open danFbach opened this issue 11 months ago • 1 comments

The issue I have, as a maintainer of a nop store, is that I have plugins from various third party sources and the only way to know if a publisher has released a new build is to manually go to their website, download the most recent version, compare the build numbers...it's very inconvenient, tedious and is ripe for improvement. If an average user is trying to maintain a store, handling plugins is challenging.

GetCurrentVersionURI

  • Possibly as a part of the IPlugin interface, add a property of string GetCurrentVersionURI()
  • If the developer provided the URL, the endpoint would return a standardized response like...
{
    "plugins":{
        "Shipping.USPS":{
            "4.7": null, //unsupported version, same as version omitted completely
            "4.6": {
                "version": "1.234.456.789",
                "auto": "https://download.com/Shipping_USPS/4_6/Shipping.USPS.zip",
                "manual": "https://download.com/Shipping_USPS/4_6/"
            },
            "4.5": {
                "version": "1.234.4.2",
                "auto": "https://download.com/Shipping_USPS/4_5/Shipping.USPS.zip",
                "manual": "https://download.com/Shipping_USPS/4_5/"
            }, 
            "4.4": {
                "version": "1.222.1",
                "auto": "https://download.com/Shipping_USPS/4_4/Shipping.USPS.zip",
                "manual": "https://download.com/Shipping_USPS/4_4/"
            },
            "4.3": null, 
        },
        "Shipping.UPS" :{          
            "4.7": null, 
            "4.6": {
                "version": "1.212.456.789",
                "auto": null, //auto update url not provided, but can still show an update notification and manual link
                "manual": "https://download.com/Shipping_UPS/4_6/",
            },
            "4.5": {
                "version": "1.211.4.2",
                "auto": null,
                "manual": "https://download.com/Shipping_UPS/4_5/",
            },
            "4.4": {
                "version": "1.211.4.2",
                "download": null,
                "manual": "https://download.com/Shipping_UPS/4_4/",
            },
            "4.3": null,
        }
    }
}

Given this example, all of a developer's plugins, and all previous and future nop versions could be handled with one endpoint per provider. A Scheduled Task would be run, grabbing all UpdateUrls to check the assembly versions provided by the developer against the running assembly versions. If done right, the stores entire plugin catalog could be checked in just a couple of requests in many cases. If plugins are found to be out-of-date, display a message on the dashboard similar to the The store has some error(s) or warning(s). message like Some plugins have updates available. Visit 'Local plugins' to review updates.. Take user admin to the local plugins page, add a filter for Update available or something.

If no auto URL is provided, show the provided manual url so the user can retrieve the update manually. To be used when the download behind a login screen. If the response provided by the developer included an auto url, nop could, upon user request, fetch the update itself and apply it. Although some security may need to be added, like a hash of the zip file included in JSON similar to how linux repos handle validation...or something to that effect.

If developers provided all of the information in JSON example, you could even stage a store for version upgrades more easily. In one shot, you could see what plugins have updates available for the nop version you're planning to upgrade to, and if the plugins have the auto property, the new version of the plugins could be automatically installed immediately after nop itself has been upgraded.

Of course, this would require developers to opt-in, but I think most would want to. I think one of nop's biggest drawbacks is the technical knowledge needed to manage and maintain a store, and I think this feature could reduce some of that.

I would be happy to contribute to building such a feature.

danFbach avatar Jul 12 '23 20:07 danFbach

This would be awesome! I agree it's a pain to always go out and check the marketplace and see if a plugin was updated.

cklenk avatar Sep 08 '23 14:09 cklenk