Add crud for browser targets

This commit is contained in:
Owen
2026-05-15 14:07:48 -07:00
parent 00e1675f7b
commit 75b5afd544
20 changed files with 934 additions and 27 deletions

View File

@@ -18,6 +18,7 @@ import logger from "@server/logger";
import { initPeerAddHandshake, updatePeer } from "../olm/peers";
import { eq, and } from "drizzle-orm";
import config from "@server/lib/config";
import { decrypt } from "@server/lib/crypto";
import {
formatEndpoint,
generateSubnetProxyTargetV2,
@@ -311,12 +312,17 @@ export async function buildTargetConfigurationForNewtClient(
(target) => target !== null
);
const browserGatewayTargets = allBrowserGatewayTargets.map((t) => ({
id: t.browserGatewayTargetId,
type: t.type,
destination: t.destination,
destinationPort: t.destinationPort
}));
const serverSecret = config.getRawConfig().server.secret!;
const browserGatewayTargets = allBrowserGatewayTargets.map((t) => {
const decryptAuthToken = decrypt(t.authToken, serverSecret);
return {
id: t.browserGatewayTargetId,
type: t.type,
destination: t.destination,
destinationPort: t.destinationPort,
authToken: decryptAuthToken
};
});
return {
validHealthCheckTargets,