Support unicode with subdomain sanitized

This commit is contained in:
Pallavi
2025-08-31 22:45:42 +05:30
parent 8a62f12e8b
commit 7d5961cf50
4 changed files with 29 additions and 32 deletions

View File

@@ -55,7 +55,7 @@ import { Globe } from "lucide-react";
import { build } from "@server/build";
import { finalizeSubdomainSanitize } from "@app/lib/subdomain-utils";
import { DomainRow } from "../../../domains/DomainsTable";
import { toUnicode } from "punycode";
import { toASCII, toUnicode } from "punycode";
export default function GeneralForm() {
const [formKey, setFormKey] = useState(0);
@@ -82,7 +82,7 @@ export default function GeneralForm() {
const [loadingPage, setLoadingPage] = useState(true);
const [resourceFullDomain, setResourceFullDomain] = useState(
`${resource.ssl ? "https" : "http"}://${resource.fullDomain}`
`${resource.ssl ? "https" : "http"}://${toUnicode(resource.fullDomain || "")}`
);
const [selectedDomain, setSelectedDomain] = useState<{
domainId: string;
@@ -186,7 +186,7 @@ export default function GeneralForm() {
{
enabled: data.enabled,
name: data.name,
subdomain: data.subdomain,
subdomain: data.subdomain ? toASCII(data.subdomain) : undefined,
domainId: data.domainId,
proxyPort: data.proxyPort,
// ...(!resource.http && {
@@ -478,7 +478,6 @@ export default function GeneralForm() {
setEditDomainOpen(false);
toast({
title: "Domain sanitized",
description: `Final domain: ${sanitizedFullDomain}`,
});
}

View File

@@ -89,7 +89,7 @@ import { isTargetValid } from "@server/lib/validators";
import { ListTargetsResponse } from "@server/routers/target";
import { DockerManager, DockerState } from "@app/lib/docker";
import { parseHostTarget } from "@app/lib/parseHostTarget";
import { toUnicode } from 'punycode';
import { toASCII, toUnicode } from 'punycode';
import { DomainRow } from "../../domains/DomainsTable";
const baseResourceFormSchema = z.object({
@@ -329,7 +329,7 @@ export default function Page() {
if (isHttp) {
const httpData = httpForm.getValues();
Object.assign(payload, {
subdomain: httpData.subdomain,
subdomain: httpData.subdomain ? toASCII(httpData.subdomain) : undefined,
domainId: httpData.domainId,
protocol: "tcp"
});