Local endpoints from the get config

This commit is contained in:
Owen
2026-07-16 14:43:45 -04:00
parent 515afc14a5
commit dbfb8e83e8
2 changed files with 8 additions and 12 deletions
@@ -29,7 +29,7 @@ export const handleNewtGetConfigMessage: MessageHandler = async (context) => {
return; return;
} }
const { publicKey, port, chainId } = message.data; const { publicKey, port, localEndpoints, chainId } = message.data;
const siteId = newt.siteId; const siteId = newt.siteId;
// Get the current site data // Get the current site data
@@ -69,7 +69,10 @@ export const handleNewtGetConfigMessage: MessageHandler = async (context) => {
.update(sites) .update(sites)
.set({ .set({
publicKey, publicKey,
listenPort: port listenPort: port,
localEndpoints: localEndpoints
? JSON.stringify(localEndpoints)
: null
}) })
.where(eq(sites.siteId, siteId)) .where(eq(sites.siteId, siteId))
.returning(); .returning();
@@ -48,8 +48,7 @@ export const handleNewtRegisterMessage: MessageHandler = async (context) => {
pingResults, pingResults,
newtVersion, newtVersion,
backwardsCompatible, backwardsCompatible,
chainId, chainId
localEndpoints
} = message.data; } = message.data;
if (!publicKey) { if (!publicKey) {
logger.warn("Public key not provided"); logger.warn("Public key not provided");
@@ -132,10 +131,7 @@ export const handleNewtRegisterMessage: MessageHandler = async (context) => {
.set({ .set({
pubKey: publicKey, pubKey: publicKey,
exitNodeId: exitNodeId, exitNodeId: exitNodeId,
subnet: newSubnet, subnet: newSubnet
localEndpoints: localEndpoints
? JSON.stringify(localEndpoints)
: null
}) })
.where(eq(sites.siteId, siteId)) .where(eq(sites.siteId, siteId))
.returning(); .returning();
@@ -143,10 +139,7 @@ export const handleNewtRegisterMessage: MessageHandler = async (context) => {
await db await db
.update(sites) .update(sites)
.set({ .set({
pubKey: publicKey, pubKey: publicKey
localEndpoints: localEndpoints
? JSON.stringify(localEndpoints)
: null
}) })
.where(eq(sites.siteId, siteId)) .where(eq(sites.siteId, siteId))
.returning(); .returning();