Merge branch 'dev' of https://github.com/fosrl/pangolin into dev

This commit is contained in:
miloschwartz
2026-04-26 10:23:36 -07:00
31 changed files with 946 additions and 77 deletions

View File

@@ -37,6 +37,7 @@ export type GetAlertRuleResponse = {
| "health_check_toggle"
| "resource_healthy"
| "resource_unhealthy"
| "resource_degraded"
| "resource_toggle";
enabled: boolean;
cooldownSeconds: number;
@@ -94,6 +95,7 @@ export type AlertEventType =
| "health_check_toggle"
| "resource_healthy"
| "resource_unhealthy"
| "resource_degraded"
| "resource_toggle";
// ---------------------------------------------------------------------------

View File

@@ -138,6 +138,7 @@ export type ResourceWithTargets = {
domainId: string | null;
niceId: string;
headerAuthId: number | null;
wildcard: boolean;
targets: Array<{
targetId: number;
ip: string;
@@ -171,6 +172,7 @@ function queryResourcesBase() {
enabled: resources.enabled,
domainId: resources.domainId,
niceId: resources.niceId,
wildcard: resources.wildcard,
headerAuthId: resourceHeaderAuth.headerAuthId,
headerAuthExtendedCompatibilityId:
resourceHeaderAuthExtendedCompatibility.headerAuthExtendedCompatibilityId,
@@ -453,6 +455,7 @@ export async function listResources(
http: row.http,
protocol: row.protocol,
proxyPort: row.proxyPort,
wildcard: row.wildcard,
enabled: row.enabled,
domainId: row.domainId,
headerAuthId: row.headerAuthId,

View File

@@ -10,6 +10,7 @@ import logger from "@server/logger";
import { fromError } from "zod-validation-error";
import { addPeer } from "../gerbil/peers";
import { addTargets } from "../newt/targets";
import { fireHealthCheckUnknownAlert } from "#dynamic/lib/alerts";
import { pickPort } from "./helpers";
import { isTargetValid } from "@server/lib/validators";
import { OpenAPITags, registry } from "@server/openApi";
@@ -225,6 +226,11 @@ export async function updateTarget(
hcHealthValue = undefined;
}
const isDisablingHc =
(parsedBody.data.hcEnabled === false ||
parsedBody.data.hcEnabled === null) &&
existingHc.hcEnabled === true;
const [updatedHc] = await db
.update(targetHealthCheck)
.set({
@@ -250,6 +256,15 @@ export async function updateTarget(
.where(eq(targetHealthCheck.targetId, targetId))
.returning();
if (isDisablingHc) {
await fireHealthCheckUnknownAlert(
resource.orgId,
existingHc.targetHealthCheckId,
existingHc.name,
updatedHc.targetId
);
}
if (site.pubKey) {
if (site.type == "wireguard") {
await addPeer(site.exitNodeId!, {