mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-01 08:16:44 +00:00
Add backward compatability
This commit is contained in:
@@ -7,7 +7,8 @@ import {
|
|||||||
Site,
|
Site,
|
||||||
sites,
|
sites,
|
||||||
clientSites,
|
clientSites,
|
||||||
exitNodes
|
exitNodes,
|
||||||
|
ExitNode
|
||||||
} from "@server/db";
|
} from "@server/db";
|
||||||
import { db } from "@server/db";
|
import { db } from "@server/db";
|
||||||
import { eq, and } from "drizzle-orm";
|
import { eq, and } from "drizzle-orm";
|
||||||
@@ -110,11 +111,20 @@ export async function updateHolePunch(
|
|||||||
.where(eq(clients.clientId, olm.clientId))
|
.where(eq(clients.clientId, olm.clientId))
|
||||||
.returning();
|
.returning();
|
||||||
|
|
||||||
|
let exitNode: ExitNode | undefined;
|
||||||
|
if (publicKey) {
|
||||||
// Get the exit node by public key
|
// Get the exit node by public key
|
||||||
const [exitNode] = await db
|
[exitNode] = await db
|
||||||
.select()
|
.select()
|
||||||
.from(exitNodes)
|
.from(exitNodes)
|
||||||
.where(eq(exitNodes.publicKey, publicKey));
|
.where(eq(exitNodes.publicKey, publicKey));
|
||||||
|
} else {
|
||||||
|
// FOR BACKWARDS COMPATIBILITY IF GERBIL IS STILL =<1.1.0
|
||||||
|
[exitNode] = await db
|
||||||
|
.select()
|
||||||
|
.from(exitNodes)
|
||||||
|
.limit(1)
|
||||||
|
}
|
||||||
|
|
||||||
if (exitNode) {
|
if (exitNode) {
|
||||||
// Get sites that are on this specific exit node and connected to this client
|
// Get sites that are on this specific exit node and connected to this client
|
||||||
|
|||||||
Reference in New Issue
Block a user