mirror of
https://github.com/fosrl/pangolin.git
synced 2026-08-01 18:20:35 +02:00
Fix types
This commit is contained in:
@@ -197,7 +197,9 @@ export const resources = pgTable(
|
||||
wildcard: boolean("wildcard").notNull().default(false),
|
||||
mode: text("mode")
|
||||
.default("http")
|
||||
.$type<"rdp" | "ssh" | "http" | "vnc" | "inference">()
|
||||
.$type<
|
||||
"rdp" | "ssh" | "http" | "vnc" | "inference" | "tcp" | "udp"
|
||||
>()
|
||||
.notNull(),
|
||||
pamMode: varchar("pamMode", { length: 32 })
|
||||
.$type<"passthrough" | "push">()
|
||||
|
||||
@@ -206,7 +206,7 @@ export const resources = sqliteTable("resources", {
|
||||
wildcard: integer("wildcard", { mode: "boolean" }).notNull().default(false),
|
||||
mode: text("mode")
|
||||
.default("http")
|
||||
.$type<"rdp" | "ssh" | "http" | "vnc" | "inference">()
|
||||
.$type<"rdp" | "ssh" | "http" | "vnc" | "inference" | "tcp" | "udp">()
|
||||
.notNull(), // rdp, ssh, http, vnc, inference
|
||||
pamMode: text("pamMode")
|
||||
.$type<"passthrough" | "push">()
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
domains,
|
||||
exitNodes,
|
||||
loginPage,
|
||||
SiteResource,
|
||||
targetHealthCheck
|
||||
} from "@server/db";
|
||||
import {
|
||||
@@ -359,7 +360,7 @@ export async function getTraefikConfig(
|
||||
let siteResourcesWithFullDomain: {
|
||||
siteResourceId: number;
|
||||
fullDomain: string | null;
|
||||
mode: "http" | "host" | "cidr" | "ssh";
|
||||
mode: SiteResource["mode"];
|
||||
}[] = [];
|
||||
if (
|
||||
build == "enterprise" &&
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { SiteResource } from "@server/db";
|
||||
import { formatEndpoint, parseEndpoint } from "@server/lib/ip";
|
||||
|
||||
export type SiteResourceDestinationInput = {
|
||||
mode: "host" | "cidr" | "http" | "ssh";
|
||||
mode: SiteResource["mode"];
|
||||
destination: string | null;
|
||||
destinationPort: number | null;
|
||||
scheme: "http" | "https" | null;
|
||||
|
||||
@@ -44,11 +44,11 @@ const createResourceParamsSchema = z.strictObject({
|
||||
});
|
||||
|
||||
function resolveModeFromLegacyFields(data: {
|
||||
mode?: "http" | "ssh" | "rdp" | "vnc" | "tcp" | "udp";
|
||||
mode?: "http" | "ssh" | "rdp" | "vnc" | "tcp" | "udp" | "inference";
|
||||
http?: boolean;
|
||||
protocol?: "tcp" | "udp";
|
||||
}): {
|
||||
mode?: "http" | "ssh" | "rdp" | "vnc" | "tcp" | "udp";
|
||||
mode?: "http" | "ssh" | "rdp" | "vnc" | "tcp" | "udp" | "inference";
|
||||
error?: string;
|
||||
} {
|
||||
if (data.mode) {
|
||||
|
||||
@@ -637,11 +637,12 @@ export async function listResources(
|
||||
${resourcePassword.passwordId}
|
||||
)
|
||||
`;
|
||||
const browserGatewayModes = ["http", "ssh", "rdp", "vnc"];
|
||||
const browserGatewayModes = ["http", "ssh", "rdp", "vnc"] as const;
|
||||
|
||||
switch (authState) {
|
||||
case "none":
|
||||
conditions.push(
|
||||
// TODO: Does inference belong here?
|
||||
or(eq(resources.mode, "tcp"), eq(resources.mode, "udp"))
|
||||
);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user