mirror of
https://github.com/fosrl/pangolin.git
synced 2026-06-16 20:37:26 +00:00
Support the browser gateways on the remote nodes
This commit is contained in:
@@ -85,7 +85,7 @@ export async function getTraefikConfig(
|
||||
generateLoginPageRouters = false,
|
||||
allowRawResources = true,
|
||||
allowMaintenancePage = true,
|
||||
allowBrowserGatewayResources = true
|
||||
browserGatewayUiUrl: string | null = null
|
||||
): Promise<any> {
|
||||
// Get resources with their targets and sites in a single optimized query
|
||||
// Start from sites on this exit node, then join to targets and resources
|
||||
@@ -317,7 +317,7 @@ export async function getTraefikConfig(
|
||||
BrowserGatewayResourceEntry
|
||||
>();
|
||||
|
||||
if (allowBrowserGatewayResources) {
|
||||
if (browserGatewayUiUrl) {
|
||||
for (const row of resourcesWithTargetsAndSites) {
|
||||
if (!["ssh", "vnc", "rdp"].includes(row.mode)) {
|
||||
continue;
|
||||
@@ -1027,7 +1027,7 @@ export async function getTraefikConfig(
|
||||
}
|
||||
}
|
||||
|
||||
if (allowBrowserGatewayResources) {
|
||||
if (browserGatewayUiUrl) {
|
||||
// Generate Traefik config for browser gateway resources
|
||||
const browserGatewayPort = 39999;
|
||||
for (const [, bgResource] of browserGatewayResourcesMap.entries()) {
|
||||
@@ -1129,10 +1129,6 @@ export async function getTraefikConfig(
|
||||
const entrypointHttps =
|
||||
config.getRawConfig().traefik.https_entrypoint;
|
||||
|
||||
const maintenancePort = config.getRawConfig().server.next_port;
|
||||
const maintenanceHost =
|
||||
config.getRawConfig().server.internal_hostname;
|
||||
|
||||
if (!config_output.http.services)
|
||||
config_output.http.services = {};
|
||||
if (!config_output.http.middlewares)
|
||||
@@ -1144,7 +1140,7 @@ export async function getTraefikConfig(
|
||||
loadBalancer: {
|
||||
servers: [
|
||||
{
|
||||
url: `http://${maintenanceHost}:${maintenancePort}`
|
||||
url: browserGatewayUiUrl
|
||||
}
|
||||
],
|
||||
passHostHeader: true
|
||||
|
||||
@@ -277,6 +277,8 @@ hybridRouter.get(
|
||||
);
|
||||
}
|
||||
|
||||
const browserGatewayUiUrl = config.getRawConfig().app.dashboard_url; // points to the dashboard to serve from there
|
||||
|
||||
try {
|
||||
const traefikConfig = await getTraefikConfig(
|
||||
remoteExitNode.exitNodeId,
|
||||
@@ -285,7 +287,7 @@ hybridRouter.get(
|
||||
false, // Dont include login pages,
|
||||
true, // allow raw resources
|
||||
false, // dont generate maintenance page
|
||||
false // dont generate browser gateway targets
|
||||
browserGatewayUiUrl // generate browser gateway targets
|
||||
);
|
||||
|
||||
return response(res, {
|
||||
|
||||
Reference in New Issue
Block a user