Merge pull request #1204 from ryanblenis/plugin-admin

Fix plugin version compare for new semver numbers
This commit is contained in:
Ylian Saint-Hilaire 2020-04-20 10:54:50 -07:00 committed by GitHub
commit 0b4e6312d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -274,9 +274,8 @@ module.exports.pluginHandler = function (parent) {
}) })
}; };
// MeshCentral doesn't adhere to semantic versioning (due to the -<alpha_char> at the end of the version) // MeshCentral now adheres to semver, drop the -<alpha> off the version number for later versions for comparing plugins prior to this change
// Convert 1.2.3-a to 1.2.3-3 where the letter is converted to a number. obj.versionToNumber = function(ver) { var x = ver.split('-'); if (x.length != 2) return ver; return x[0]; }
obj.versionToNumber = function(ver) { var x = ver.split('-'); if (x.length != 2) return ver; x[1] = x[1].toLowerCase().charCodeAt(0) - 96; return x.join('.'); }
// Check if the current version of MeshCentral is at least the minimal required. // Check if the current version of MeshCentral is at least the minimal required.
obj.versionCompare = function(current, minimal) { obj.versionCompare = function(current, minimal) {