mirror of
https://github.com/fosrl/pangolin.git
synced 2026-08-17 09:49:55 +02:00
Makes sure patch works
z#
This commit is contained in:
@@ -416,8 +416,10 @@ export async function updateSiteResource(
|
|||||||
: [];
|
: [];
|
||||||
const existingSiteIds = existingSiteNetworks.map((sn) => sn.siteId);
|
const existingSiteIds = existingSiteNetworks.map((sn) => sn.siteId);
|
||||||
|
|
||||||
let fullDomain: string | null = null;
|
// undefined means "leave unchanged" (partial update); only nulled out
|
||||||
let finalSubdomain: string | null = null;
|
// when the mode is explicitly being changed away from http
|
||||||
|
let fullDomain: string | null | undefined = undefined;
|
||||||
|
let finalSubdomain: string | null | undefined = undefined;
|
||||||
if (domainId) {
|
if (domainId) {
|
||||||
// Validate domain and construct full domain
|
// Validate domain and construct full domain
|
||||||
const domainResult = await validateAndConstructDomain(
|
const domainResult = await validateAndConstructDomain(
|
||||||
@@ -453,6 +455,11 @@ export async function updateSiteResource(
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
} else if (mode !== undefined && mode !== "http") {
|
||||||
|
// mode is explicitly changing away from http, so the resource
|
||||||
|
// can no longer have a domain associated with it
|
||||||
|
fullDomain = null;
|
||||||
|
finalSubdomain = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure the alias is unique within the org if provided
|
// make sure the alias is unique within the org if provided
|
||||||
@@ -521,15 +528,28 @@ export async function updateSiteResource(
|
|||||||
destination: destination,
|
destination: destination,
|
||||||
destinationPort: destinationPort,
|
destinationPort: destinationPort,
|
||||||
enabled: enabled,
|
enabled: enabled,
|
||||||
alias: alias ? alias.trim() : null,
|
alias:
|
||||||
|
alias !== undefined
|
||||||
|
? alias
|
||||||
|
? alias.trim()
|
||||||
|
: null
|
||||||
|
: mode !== undefined &&
|
||||||
|
mode !== "host" &&
|
||||||
|
mode !== "ssh"
|
||||||
|
? null
|
||||||
|
: undefined,
|
||||||
tcpPortRangeString: tcpPortRangeStringAdjusted,
|
tcpPortRangeString: tcpPortRangeStringAdjusted,
|
||||||
udpPortRangeString:
|
udpPortRangeString:
|
||||||
mode == "http" || mode == "ssh"
|
mode == "http" || mode == "ssh"
|
||||||
? ""
|
? ""
|
||||||
: udpPortRangeString,
|
: udpPortRangeString,
|
||||||
disableIcmp:
|
disableIcmp:
|
||||||
disableIcmp ||
|
mode !== undefined
|
||||||
(mode == "http" || mode == "ssh" ? true : false),
|
? disableIcmp ||
|
||||||
|
(mode == "http" || mode == "ssh"
|
||||||
|
? true
|
||||||
|
: false)
|
||||||
|
: disableIcmp,
|
||||||
domainId,
|
domainId,
|
||||||
subdomain: finalSubdomain,
|
subdomain: finalSubdomain,
|
||||||
fullDomain,
|
fullDomain,
|
||||||
|
|||||||
@@ -165,7 +165,6 @@ export function buildCreateSiteResourcePayload(
|
|||||||
siteIds: data.siteIds,
|
siteIds: data.siteIds,
|
||||||
mode: data.mode,
|
mode: data.mode,
|
||||||
destination: isNativeSsh ? undefined : (data.destination ?? undefined),
|
destination: isNativeSsh ? undefined : (data.destination ?? undefined),
|
||||||
enabled: true,
|
|
||||||
...(data.mode === "http" && {
|
...(data.mode === "http" && {
|
||||||
scheme: data.scheme,
|
scheme: data.scheme,
|
||||||
ssl: data.ssl ?? false,
|
ssl: data.ssl ?? false,
|
||||||
|
|||||||
Reference in New Issue
Block a user