mirror of
https://github.com/fosrl/pangolin.git
synced 2026-01-29 06:10:47 +00:00
Merge branch 'dev' of github.com:fosrl/pangolin into dev
This commit is contained in:
@@ -210,6 +210,11 @@ export default function Page() {
|
||||
<SettingsSectionForm>
|
||||
<Form {...form}>
|
||||
<form
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") {
|
||||
e.preventDefault(); // block default enter refresh
|
||||
}
|
||||
}}
|
||||
className="space-y-4"
|
||||
id="create-site-form"
|
||||
>
|
||||
|
||||
@@ -448,6 +448,11 @@ export default function Page() {
|
||||
<SettingsSectionForm>
|
||||
<Form {...form}>
|
||||
<form
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") {
|
||||
e.preventDefault(); // block default enter refresh
|
||||
}
|
||||
}}
|
||||
className="space-y-4"
|
||||
id="create-client-form"
|
||||
>
|
||||
|
||||
@@ -91,6 +91,8 @@ import { DockerManager, DockerState } from "@app/lib/docker";
|
||||
import { parseHostTarget } from "@app/lib/parseHostTarget";
|
||||
import { toASCII, toUnicode } from 'punycode';
|
||||
import { DomainRow } from "../../../../../components/DomainsTable";
|
||||
import { finalizeSubdomainSanitize } from "@app/lib/subdomain-utils";
|
||||
|
||||
|
||||
const baseResourceFormSchema = z.object({
|
||||
name: z.string().min(1).max(255),
|
||||
@@ -366,10 +368,17 @@ export default function Page() {
|
||||
http: baseData.http
|
||||
};
|
||||
|
||||
let sanitizedSubdomain: string | undefined;
|
||||
|
||||
if (isHttp) {
|
||||
const httpData = httpForm.getValues();
|
||||
|
||||
sanitizedSubdomain = httpData.subdomain
|
||||
? finalizeSubdomainSanitize(httpData.subdomain)
|
||||
: undefined;
|
||||
|
||||
Object.assign(payload, {
|
||||
subdomain: httpData.subdomain ? toASCII(httpData.subdomain) : undefined,
|
||||
subdomain: sanitizedSubdomain ? toASCII(sanitizedSubdomain) : undefined,
|
||||
domainId: httpData.domainId,
|
||||
protocol: "tcp"
|
||||
});
|
||||
@@ -401,6 +410,10 @@ export default function Page() {
|
||||
const id = res.data.data.resourceId;
|
||||
setResourceId(id);
|
||||
|
||||
toast({
|
||||
description: `Subdomain: ${sanitizedSubdomain}`,
|
||||
});
|
||||
|
||||
// Create targets if any exist
|
||||
if (targets.length > 0) {
|
||||
try {
|
||||
@@ -755,19 +768,29 @@ export default function Page() {
|
||||
defaultValue={row.original.ip}
|
||||
className="min-w-[150px]"
|
||||
onBlur={(e) => {
|
||||
const parsed = parseHostTarget(e.target.value);
|
||||
const input = e.target.value.trim();
|
||||
const hasProtocol = /^(https?|h2c):\/\//.test(input);
|
||||
const hasPort = /:\d+(?:\/|$)/.test(input);
|
||||
|
||||
if (parsed) {
|
||||
updateTarget(row.original.targetId, {
|
||||
...row.original,
|
||||
method: parsed.protocol,
|
||||
ip: parsed.host,
|
||||
port: parsed.port ? Number(parsed.port) : undefined,
|
||||
});
|
||||
if (hasProtocol || hasPort) {
|
||||
const parsed = parseHostTarget(input);
|
||||
if (parsed) {
|
||||
updateTarget(row.original.targetId, {
|
||||
...row.original,
|
||||
method: hasProtocol ? parsed.protocol : row.original.method,
|
||||
ip: parsed.host,
|
||||
port: hasPort ? parsed.port : row.original.port
|
||||
});
|
||||
} else {
|
||||
updateTarget(row.original.targetId, {
|
||||
...row.original,
|
||||
ip: input
|
||||
});
|
||||
}
|
||||
} else {
|
||||
updateTarget(row.original.targetId, {
|
||||
...row.original,
|
||||
ip: e.target.value,
|
||||
ip: input
|
||||
});
|
||||
}
|
||||
}}
|
||||
@@ -869,6 +892,11 @@ export default function Page() {
|
||||
<SettingsSectionForm>
|
||||
<Form {...baseForm}>
|
||||
<form
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") {
|
||||
e.preventDefault(); // block default enter refresh
|
||||
}
|
||||
}}
|
||||
className="space-y-4"
|
||||
id="base-resource-form"
|
||||
>
|
||||
@@ -981,6 +1009,11 @@ export default function Page() {
|
||||
<SettingsSectionForm>
|
||||
<Form {...tcpUdpForm}>
|
||||
<form
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") {
|
||||
e.preventDefault(); // block default enter refresh
|
||||
}
|
||||
}}
|
||||
className="space-y-4"
|
||||
id="tcp-udp-settings-form"
|
||||
>
|
||||
@@ -1329,11 +1362,21 @@ export default function Page() {
|
||||
id="ip"
|
||||
{...field}
|
||||
onBlur={(e) => {
|
||||
const parsed = parseHostTarget(e.target.value);
|
||||
if (parsed) {
|
||||
addTargetForm.setValue("method", parsed.protocol);
|
||||
addTargetForm.setValue("ip", parsed.host);
|
||||
addTargetForm.setValue("port", parsed.port);
|
||||
const input = e.target.value.trim();
|
||||
const hasProtocol = /^(https?|h2c):\/\//.test(input);
|
||||
const hasPort = /:\d+(?:\/|$)/.test(input);
|
||||
|
||||
if (hasProtocol || hasPort) {
|
||||
const parsed = parseHostTarget(input);
|
||||
if (parsed) {
|
||||
if (hasProtocol || !addTargetForm.getValues("method")) {
|
||||
addTargetForm.setValue("method", parsed.protocol);
|
||||
}
|
||||
addTargetForm.setValue("ip", parsed.host);
|
||||
if (hasPort || !addTargetForm.getValues("port")) {
|
||||
addTargetForm.setValue("port", parsed.port);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
field.onBlur();
|
||||
}
|
||||
|
||||
@@ -643,6 +643,11 @@ WantedBy=default.target`
|
||||
<SettingsSectionForm>
|
||||
<Form {...form}>
|
||||
<form
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") {
|
||||
e.preventDefault(); // block default enter refresh
|
||||
}
|
||||
}}
|
||||
className="space-y-4"
|
||||
id="create-site-form"
|
||||
>
|
||||
|
||||
@@ -200,6 +200,11 @@ export default function Page() {
|
||||
<SettingsSectionForm>
|
||||
<Form {...form}>
|
||||
<form
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") {
|
||||
e.preventDefault(); // block default enter refresh
|
||||
}
|
||||
}}
|
||||
className="space-y-4"
|
||||
id="create-site-form"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user