diff --git a/public/src/admin/extend/plugins.js b/public/src/admin/extend/plugins.js index 5c1a1229ca..52c9144360 100644 --- a/public/src/admin/extend/plugins.js +++ b/public/src/admin/extend/plugins.js @@ -35,7 +35,22 @@ define('admin/extend/plugins', function() { Plugins.suggest(pluginID, function(err, payload) { if (!err) { - Plugins.toggleInstall(pluginID, payload.version); + require(['semver'], function(semver) { + if (payload.version !== 'latest') { + Plugins.toggleInstall(pluginID, payload.version); + } else if (payload.version === 'latest') { + bootbox.confirm( + '
No Compatibility Infomation Found
This plugin did not specify a specific version for installation given your NodeBB version. Full compatibility cannot be guaranteed, and may cause your NodeBB to no longer start properly.
In the event that NodeBB cannot boot properly:
' + + '$ ./nodebb reset plugin="' + pluginID + '"
' +
+ 'Continue installation of latest version of this plugin?
' + , function(confirm) { + if (confirm) { + Plugins.toggleInstall(pluginID, 'latest'); + } + }); + } + }); } else { bootbox.confirm('NodeBB could not reach the package manager, proceed with installation of latest version?
No Compatibility Infomation Found
This plugin did not specify a specific version for installation given your NodeBB version. Full compatibility cannot be guaranteed, and may cause your NodeBB to no longer start properly.
In the event that NodeBB cannot boot properly:
' + + '$ ./nodebb reset plugin="' + pluginID + '"
' +
+ 'Continue installation of latest version of this plugin?
' + , function(confirm) { + if (confirm) { + socket.emit('admin.plugins.upgrade', { + id: pluginID, + version: payload.version + }, function(err) { + if (err) { + return app.alertError(err.message); + } + parent.find('.fa-exclamation-triangle').remove(); + parent.find('.currentVersion').text(payload.version); + btn.remove(); + }); + } + }); } else { bootbox.alert('Your version of NodeBB (v' + app.config.version + ') is only cleared to upgrade to v' + payload.version + ' of this plugin. Please update your NodeBB if you wish to install a newer version of this plugin.'); }