add link to docs for tcp/udp

This commit is contained in:
Milo Schwartz 2025-01-30 10:55:57 -05:00
parent 61e6fb3126
commit 1bad0c538b
No known key found for this signature in database

View file

@ -60,6 +60,8 @@ import {
SelectValue
} from "@app/components/ui/select";
import { subdomainSchema } from "@server/schemas/subdomainSchema";
import Link from "next/link";
import { SquareArrowOutUpRight } from "lucide-react";
const createResourceFormSchema = z
.object({
@ -68,18 +70,23 @@ const createResourceFormSchema = z
siteId: z.number(),
http: z.boolean(),
protocol: z.string(),
proxyPort: z.number().optional(),
proxyPort: z.number().optional()
})
.refine(
(data) => {
if (!data.http) {
return z.number().int().min(1).max(65535).safeParse(data.proxyPort).success;
return z
.number()
.int()
.min(1)
.max(65535)
.safeParse(data.proxyPort).success;
}
return true;
},
{
message: "Invalid port number",
path: ["proxyPort"],
path: ["proxyPort"]
}
)
.refine(
@ -91,7 +98,7 @@ const createResourceFormSchema = z
},
{
message: "Invalid subdomain",
path: ["subdomain"],
path: ["subdomain"]
}
);
@ -295,6 +302,20 @@ export default function CreateResourceForm({
/>
)}
{!form.watch("http") && (
<Link
className="text-sm text-primary flex items-center gap-1"
href="https://docs.fossorial.io/Getting%20Started/tcp-udp"
target="_blank"
rel="noopener noreferrer"
>
<span>
Learn how to use set up TCP/UDP resources
</span>
<SquareArrowOutUpRight size={14} />
</Link>
)}
{!form.watch("http") && (
<>
<FormField