mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-11-22 12:52:50 +03:00
Fake semantic versioning for MeshCentral version comparison / plugin update compatibility check
This commit is contained in:
parent
bf1e4cc91f
commit
f90fe05fe0
@ -3130,8 +3130,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
}
|
||||
case 'addplugin': {
|
||||
if ((user.siteadmin & 0xFFFFFFFF) == 0 || parent.parent.pluginHandler == null) break; // must be full admin, plugins enabled
|
||||
try {
|
||||
//parent.parent.pluginHandler.addPlugin(command.url)
|
||||
try {
|
||||
parent.parent.pluginHandler.getPluginConfig(command.url)
|
||||
.then(parent.parent.pluginHandler.addPlugin)
|
||||
.then(function(docs){
|
||||
|
@ -263,12 +263,16 @@ module.exports.pluginHandler = function (parent) {
|
||||
});
|
||||
if (curconf == null) reject('Some plugin configs could not be parsed');
|
||||
var s = require('semver');
|
||||
// MeshCentral doesn't adhere to semantic versioning (due to the -<alpha_char> at the end of the version)
|
||||
// Convert the letter to ASCII for a "true" version number comparison
|
||||
var mcCurVer = parent.currentVer.replace(/-(.)$/, (m, p1) => { return p1.charCodeAt(0); });
|
||||
var piCompatVer = newconf.meshCentralCompat.replace(/-(.)$/, (m, p1) => { return p1.charCodeAt(0); });
|
||||
latestRet.push({
|
||||
"id": curconf._id,
|
||||
"installedVersion": curconf.version,
|
||||
"version": newconf.version,
|
||||
"hasUpdate": s.gt(newconf.version, curconf.version),
|
||||
"meshCentralCompat": s.satisfies(s.coerce(parent.currentVer), newconf.meshCentralCompat),
|
||||
"meshCentralCompat": s.satisfies(mcCurVer, piCompatVer),
|
||||
"changelogUrl": curconf.changelogUrl,
|
||||
"status": curconf.status
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user