From 322475fb5c5617ee06cbfef282137a6c9eb7f950 Mon Sep 17 00:00:00 2001 From: Owen Date: Thu, 28 May 2026 17:59:21 -0700 Subject: [PATCH] Fix errors --- server/lib/blueprints/applyBlueprint.ts | 5 ++--- server/lib/blueprints/applyNewtDockerBlueprint.ts | 6 +++--- server/lib/blueprints/proxyResources.ts | 13 ++++++++----- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/server/lib/blueprints/applyBlueprint.ts b/server/lib/blueprints/applyBlueprint.ts index 2f22298fa..12d18f653 100644 --- a/server/lib/blueprints/applyBlueprint.ts +++ b/server/lib/blueprints/applyBlueprint.ts @@ -22,6 +22,7 @@ import { } from "./clientResources"; import { BlueprintSource } from "@server/routers/blueprints/types"; import { stringify as stringifyYaml } from "yaml"; +import { generateName } from "@server/db/names"; import { handleMessagingForUpdatedSiteResource } from "@server/routers/siteResource"; import { rebuildClientAssociationsFromSiteResource } from "../rebuildClientAssociations"; @@ -289,9 +290,7 @@ export async function applyBlueprint({ .insert(blueprints) .values({ orgId, - name: - name ?? - `${faker.word.adjective()}-${faker.word.adjective()}-${faker.word.noun()}`, + name: name ?? generateName(), contents: stringifyYaml(configData), createdAt: Math.floor(Date.now() / 1000), succeeded: blueprintSucceeded, diff --git a/server/lib/blueprints/applyNewtDockerBlueprint.ts b/server/lib/blueprints/applyNewtDockerBlueprint.ts index 66686bcee..93794461c 100644 --- a/server/lib/blueprints/applyNewtDockerBlueprint.ts +++ b/server/lib/blueprints/applyNewtDockerBlueprint.ts @@ -1,7 +1,7 @@ import { sendToClient } from "#dynamic/routers/ws"; import { processContainerLabels } from "./parseDockerContainers"; import { applyBlueprint } from "./applyBlueprint"; -import { ResourceSchema, ClientResourceSchema } from "./types"; +import { PrivateResourceSchema, PublicResourceSchema } from "./types"; import { db, sites } from "@server/db"; import { eq } from "drizzle-orm"; import logger from "@server/logger"; @@ -17,7 +17,7 @@ function filterInvalidResources(blueprint: BlueprintResult): { for (const section of ["proxy-resources", "public-resources"] as const) { const resources = blueprint[section]; for (const [key, value] of Object.entries(resources)) { - const result = ResourceSchema.safeParse(value); + const result = PublicResourceSchema.safeParse(value); if (!result.success) { const errors = result.error.issues .map((i) => `${i.path.join(".")}: ${i.message}`) @@ -34,7 +34,7 @@ function filterInvalidResources(blueprint: BlueprintResult): { for (const section of ["client-resources", "private-resources"] as const) { const resources = blueprint[section]; for (const [key, value] of Object.entries(resources)) { - const result = ClientResourceSchema.safeParse(value); + const result = PrivateResourceSchema.safeParse(value); if (!result.success) { const errors = result.error.issues .map((i) => `${i.path.join(".")}: ${i.message}`) diff --git a/server/lib/blueprints/proxyResources.ts b/server/lib/blueprints/proxyResources.ts index 59d3fbf59..81816d0f4 100644 --- a/server/lib/blueprints/proxyResources.ts +++ b/server/lib/blueprints/proxyResources.ts @@ -45,7 +45,6 @@ import { isValidRegionId } from "@server/db/regions"; import { isLicensedOrSubscribed } from "#dynamic/lib/isLicencedOrSubscribed"; import { fireHealthCheckUnknownAlert } from "@server/lib/alerts"; import { tierMatrix } from "../billing/tierMatrix"; -import { http } from "winston"; export type ProxyResourcesResults = { proxyResource: Resource; @@ -476,10 +475,14 @@ export async function updateProxyResources( .update(resources) .set({ name: resourceData.name || "Unnamed Resource", - protocol: protocol || "tcp", - http: http, - proxyPort: http ? null : resourceData["proxy-port"], - fullDomain: http + proxyPort: ["http", "ssh", "rdp", "vnc"].includes( + resourceData.mode || "" + ) + ? null + : resourceData["proxy-port"], + fullDomain: ["http", "ssh", "rdp", "vnc"].includes( + resourceData.mode || "" + ) ? resourceData["full-domain"] : null, subdomain: domain ? domain.subdomain : null,