Move newt version

This commit is contained in:
Owen 2025-08-15 12:24:54 -07:00
parent 825bff5d60
commit 2fea091e1f
No known key found for this signature in database
GPG key ID: 8271FDFFD9E0CCBD

View file

@ -64,16 +64,6 @@ export const handleNewtRegisterMessage: MessageHandler = async (context) => {
exitNodeId = bestPingResult.exitNodeId;
}
if (newtVersion) {
// update the newt version in the database
await db
.update(newts)
.set({
version: newtVersion as string
})
.where(eq(newts.newtId, newt.newtId));
}
const [oldSite] = await db
.select()
.from(sites)
@ -160,6 +150,16 @@ export const handleNewtRegisterMessage: MessageHandler = async (context) => {
allowedIps: [siteSubnet]
});
if (newtVersion && newtVersion !== newt.version) {
// update the newt version in the database
await db
.update(newts)
.set({
version: newtVersion as string
})
.where(eq(newts.newtId, newt.newtId));
}
// Improved version
const allResources = await db.transaction(async (tx) => {
// First get all resources for the site