Relaying working

This commit is contained in:
Owen 2025-04-11 20:52:45 -04:00
parent e57574ba9c
commit 8398f7b7c0
No known key found for this signature in database
GPG key ID: 8271FDFFD9E0CCBD
2 changed files with 7 additions and 16 deletions

View file

@ -142,7 +142,8 @@ export const handleOlmRegisterMessage: MessageHandler = async (context) => {
siteId: site.siteId,
endpoint: site.endpoint,
publicKey: site.publicKey,
serverIP: site.address
serverIP: site.address,
serverPort: site.listenPort,
});
}

View file

@ -40,22 +40,12 @@ export const handleOlmRelayMessage: MessageHandler = async (context) => {
return;
}
const sitesData = await db
.select()
.from(sites)
.innerJoin(clientSites, eq(sites.siteId, clientSites.siteId))
.where(eq(clientSites.clientId, client.clientId));
const { siteId } = message.data;
let jobs: Array<Promise<void>> = [];
for (const site of sitesData) {
// update the peer on the exit node
const job = updatePeer(site.sites.siteId, client.pubKey, {
endpoint: "" // this removes the endpoint
});
jobs.push(job);
}
await Promise.all(jobs);
// update the peer on the exit node
await updatePeer(siteId, client.pubKey, {
endpoint: "" // this removes the endpoint
});
return;
};