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.

placeholder data

Steven Tey0be96c5160ae
diff --git a/apps/web/app/wellknown/[domain]/[file]/route.ts b/apps/web/app/wellknown/[domain]/[file]/route.ts
index 254e3f5857..b926e5f0c4 100644
--- a/apps/web/app/wellknown/[domain]/[file]/route.ts
+++ b/apps/web/app/wellknown/[domain]/[file]/route.ts
@@ -1,10 +1,35 @@
import { NextRequest, NextResponse } from "next/server";
+const supportedFiles = ["apple-app-site-association", "assetlinks.json"];
+
export async function GET(
_req: NextRequest,
{ params }: { params: { domain: string; file: string } },
) {
- console.log({ params });
+ const { domain, file } = params;
+ if (!supportedFiles.includes(file)) {
+ return NextResponse.json({ error: "File not supported" }, { status: 400 });
+ }
+ const json = await getJson({ domain, file });
+ return NextResponse.json(json);
+}
- return NextResponse.json(params);
+async function getJson({ domain, file }: { domain: string; file: string }) {
+ if (file === "apple-app-site-association") {
+ return {
+ applinks: {
+ apps: [],
+ details: [],
+ },
+ };
+ } else if (file === "assetlinks.json") {
+ return {
+ relation: ["delegate_permission/common.handle_all_urls"],
+ target: {
+ namespace: "android_app",
+ package_name: "com.example.app",
+ sha256_cert_fingerprints: ["fingerprint1", "fingerprint2"],
+ },
+ };
+ }
}