Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Show TXT record alongside A/CNAME

Tim Wilson35421bf446d6
diff --git a/apps/web/ui/domains/domain-configuration.tsx b/apps/web/ui/domains/domain-configuration.tsx
index d17b72ce55..b812a9ec32 100644
--- a/apps/web/ui/domains/domain-configuration.tsx
+++ b/apps/web/ui/domains/domain-configuration.tsx
@@ -12,30 +12,6 @@ export default function DomainConfiguration({
const subdomain = getSubdomain(domainJson.name, domainJson.apexName);
const [recordType, setRecordType] = useState(!!subdomain ? "CNAME" : "A");
- if (data.status === "Pending Verification") {
- const txtVerification = domainJson.verification.find(
- (x: any) => x.type === "TXT",
- );
- return (
- <div>
- <DnsRecord
- instructions={`Please set the following TXT record on <code>${domainJson.apexName}</code> to prove ownership of <code>${domainJson.name}</code>:`}
- records={[
- {
- type: txtVerification.type,
- name: txtVerification.domain.slice(
- 0,
- txtVerification.domain.length - domainJson.apexName.length - 1,
- ),
- value: txtVerification.value,
- },
- ]}
- warning="Warning: if you are using this domain for another site, setting this TXT record will transfer domain ownership away from that site and break it. Please exercise caution when setting this record; make sure that the domain that is shown in the TXT verification value is actually the <b><i>domain you want to use on Dub</i></b> – <b><i>not your production site</i></b>."
- />
- </div>
- );
- }
-
if (data.status === "Conflicting DNS Records") {
return (
<div className="pt-5">
@@ -87,6 +63,11 @@ export default function DomainConfiguration({
);
}
+ const txtVerification =
+ data.status === "Pending Verification"
+ ? domainJson.verification.find((x: any) => x.type === "TXT")
+ : undefined;
+
return (
<div className="pt-2">
<div className="-ml-1.5 border-b border-neutral-200">
@@ -108,7 +89,7 @@ export default function DomainConfiguration({
recordType === "A" ? "apex domain" : "subdomain"
} <code>${
recordType === "A" ? domainJson.apexName : domainJson.name
- }</code>, set the following ${recordType} record on your DNS provider:`}
+ }</code>, set the following ${txtVerification ? "records" : `${recordType} record`} on your DNS provider:`}
records={[
{
type: recordType,
@@ -116,7 +97,26 @@ export default function DomainConfiguration({
value: recordType === "A" ? `76.76.21.21` : `cname.dub.co`,
ttl: "86400",
},
+ ...(txtVerification
+ ? [
+ {
+ type: txtVerification.type,
+ name: txtVerification.domain.slice(
+ 0,
+ txtVerification.domain.length -
+ domainJson.apexName.length -
+ 1,
+ ),
+ value: txtVerification.value,
+ },
+ ]
+ : []),
]}
+ warning={
+ txtVerification
+ ? "Warning: if you are using this domain for another site, setting this TXT record will transfer domain ownership away from that site and break it. Please exercise caution when setting this record; make sure that the domain that is shown in the TXT verification value is actually the <b><i>domain you want to use on Dub</i></b> – <b><i>not your production site</i></b>."
+ : undefined
+ }
/>
</div>
);