mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-06 02:36:38 +00:00
Reorder setting the olm agent and version
This commit is contained in:
@@ -69,21 +69,36 @@ export const handleOlmRegisterMessage: MessageHandler = async (context) => {
|
|||||||
platformFingerprint: fingerprint.platformFingerprint
|
platformFingerprint: fingerprint.platformFingerprint
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await db
|
const hasChanges =
|
||||||
.update(fingerprints)
|
existingFingerprint.username !== fingerprint.username ||
|
||||||
.set({
|
existingFingerprint.hostname !== fingerprint.hostname ||
|
||||||
lastSeen: now,
|
existingFingerprint.platform !== fingerprint.platform ||
|
||||||
username: fingerprint.username,
|
existingFingerprint.osVersion !== fingerprint.osVersion ||
|
||||||
hostname: fingerprint.hostname,
|
existingFingerprint.kernelVersion !==
|
||||||
platform: fingerprint.platform,
|
fingerprint.kernelVersion ||
|
||||||
osVersion: fingerprint.osVersion,
|
existingFingerprint.arch !== fingerprint.arch ||
|
||||||
kernelVersion: fingerprint.kernelVersion,
|
existingFingerprint.deviceModel !== fingerprint.deviceModel ||
|
||||||
arch: fingerprint.arch,
|
existingFingerprint.serialNumber !== fingerprint.serialNumber ||
|
||||||
deviceModel: fingerprint.deviceModel,
|
existingFingerprint.platformFingerprint !==
|
||||||
serialNumber: fingerprint.serialNumber,
|
fingerprint.platformFingerprint;
|
||||||
platformFingerprint: fingerprint.platformFingerprint
|
|
||||||
})
|
if (hasChanges) {
|
||||||
.where(eq(fingerprints.olmId, olm.olmId));
|
await db
|
||||||
|
.update(fingerprints)
|
||||||
|
.set({
|
||||||
|
lastSeen: now,
|
||||||
|
username: fingerprint.username,
|
||||||
|
hostname: fingerprint.hostname,
|
||||||
|
platform: fingerprint.platform,
|
||||||
|
osVersion: fingerprint.osVersion,
|
||||||
|
kernelVersion: fingerprint.kernelVersion,
|
||||||
|
arch: fingerprint.arch,
|
||||||
|
deviceModel: fingerprint.deviceModel,
|
||||||
|
serialNumber: fingerprint.serialNumber,
|
||||||
|
platformFingerprint: fingerprint.platformFingerprint
|
||||||
|
})
|
||||||
|
.where(eq(fingerprints.olmId, olm.olmId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,6 +125,21 @@ export const handleOlmRegisterMessage: MessageHandler = async (context) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
(olmVersion && olm.version !== olmVersion) ||
|
||||||
|
(olmAgent && olm.agent !== olmAgent) ||
|
||||||
|
olm.archived
|
||||||
|
) {
|
||||||
|
await db
|
||||||
|
.update(olms)
|
||||||
|
.set({
|
||||||
|
version: olmVersion,
|
||||||
|
agent: olmAgent,
|
||||||
|
archived: false
|
||||||
|
})
|
||||||
|
.where(eq(olms.olmId, olm.olmId));
|
||||||
|
}
|
||||||
|
|
||||||
const [client] = await db
|
const [client] = await db
|
||||||
.select()
|
.select()
|
||||||
.from(clients)
|
.from(clients)
|
||||||
@@ -237,21 +267,6 @@ export const handleOlmRegisterMessage: MessageHandler = async (context) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
|
||||||
(olmVersion && olm.version !== olmVersion) ||
|
|
||||||
(olmAgent && olm.agent !== olmAgent) ||
|
|
||||||
olm.archived
|
|
||||||
) {
|
|
||||||
await db
|
|
||||||
.update(olms)
|
|
||||||
.set({
|
|
||||||
version: olmVersion,
|
|
||||||
agent: olmAgent,
|
|
||||||
archived: false
|
|
||||||
})
|
|
||||||
.where(eq(olms.olmId, olm.olmId));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (client.pubKey !== publicKey || client.archived) {
|
if (client.pubKey !== publicKey || client.archived) {
|
||||||
logger.info(
|
logger.info(
|
||||||
"Public key mismatch. Updating public key and clearing session info..."
|
"Public key mismatch. Updating public key and clearing session info..."
|
||||||
|
|||||||
Reference in New Issue
Block a user