mirror of
https://github.com/9technologygroup/patchmon.net.git
synced 2025-11-21 06:58:20 +00:00
updated agent files
Fixed removal script Fixed agent version checking
This commit is contained in:
@@ -13,6 +13,7 @@ const {
|
||||
const { queueManager, QUEUE_NAMES } = require("../services/automation");
|
||||
const { pushIntegrationToggle, isConnected } = require("../services/agentWs");
|
||||
const agentVersionService = require("../services/agentVersionService");
|
||||
const { compareVersions } = require("../services/automation/shared/utils");
|
||||
|
||||
const router = express.Router();
|
||||
const prisma = getPrismaClient();
|
||||
@@ -209,8 +210,9 @@ router.get("/agent/version", async (req, res) => {
|
||||
const serverVersion = versionMatch[1];
|
||||
const agentVersion = req.query.currentVersion || serverVersion;
|
||||
|
||||
// Simple version comparison (assuming semantic versioning)
|
||||
const hasUpdate = agentVersion !== serverVersion;
|
||||
// Proper semantic version comparison: only update if server version is NEWER
|
||||
const hasUpdate =
|
||||
compareVersions(serverVersion, agentVersion) > 0;
|
||||
|
||||
return res.json({
|
||||
currentVersion: agentVersion,
|
||||
@@ -248,9 +250,10 @@ router.get("/agent/version", async (req, res) => {
|
||||
});
|
||||
}
|
||||
|
||||
// Simple version comparison (assuming semantic versioning)
|
||||
// Proper semantic version comparison: only update if latest version is NEWER
|
||||
const hasUpdate =
|
||||
agentVersion !== latestVersion && latestVersion !== null;
|
||||
latestVersion !== null &&
|
||||
compareVersions(latestVersion, agentVersion) > 0;
|
||||
|
||||
res.json({
|
||||
currentVersion: agentVersion,
|
||||
|
||||
Reference in New Issue
Block a user