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.

add shortDomain.appleAppSiteAssociation check

Steven Tey9826f31cb4da
diff --git a/apps/web/app/app.dub.co/(deeplink)/deeplink/[domain]/[key]/page.tsx b/apps/web/app/app.dub.co/(deeplink)/deeplink/[domain]/[key]/page.tsx
index 6bcf403a0b..6f50389e81 100644
--- a/apps/web/app/app.dub.co/(deeplink)/deeplink/[domain]/[key]/page.tsx
+++ b/apps/web/app/app.dub.co/(deeplink)/deeplink/[domain]/[key]/page.tsx
@@ -25,11 +25,24 @@ export default async function DeepLinkPreviewPage({
select: {
shortLink: true,
url: true,
+ ios: true,
+ shortDomain: {
+ select: {
+ appleAppSiteAssociation: true,
+ },
+ },
},
});
+ // if the link doesn't exist, we redirect to the root domain link
if (!link) {
- redirect("/");
+ redirect(`https://${domain}`);
+ }
+
+ // if the link domain doesn't have an AASA file configured,
+ // we skip the deep link preview and redirect to the link's URL
+ if (!link.shortDomain?.appleAppSiteAssociation) {
+ redirect(link.ios ?? link.url);
}
return (
diff --git a/packages/prisma/schema/domain.prisma b/packages/prisma/schema/domain.prisma
index fdec8d9b8a..428f86511d 100644
--- a/packages/prisma/schema/domain.prisma
+++ b/packages/prisma/schema/domain.prisma
@@ -9,14 +9,14 @@ model Domain {
archived Boolean @default(false)
lastChecked DateTime @default(now())
logo String?
- linkRetentionDays Int? // default is null (links are retained forever)
appleAppSiteAssociation Json?
assetLinks Json?
- projectId String?
- // these attributes will exist on both Link and Domain models
+ linkRetentionDays Int? // default is null (links are retained forever)
+
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
+ projectId String?
project Project? @relation(fields: [projectId], references: [id], onDelete: Cascade)
links Link[]
registeredDomain RegisteredDomain?