a tool for shared writing and social publishing
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

add middleware to handle publication domains

+5
+5
middleware.ts
··· 1 + import { AtUri } from "@atproto/syntax"; 1 2 import { createClient } from "@supabase/supabase-js"; 2 3 import { NextRequest, NextResponse } from "next/server"; 3 4 import { Database } from "supabase/database.types"; ··· 28 29 .select("*, custom_domain_routes(*), publication_domains(*)") 29 30 .eq("domain", hostname) 30 31 .single(); 32 + if (routes?.publication_domains[0]) { 33 + let aturi = new AtUri(routes.publication_domains[0].publication); 34 + return NextResponse.rewrite(new URL(`/lish/${aturi.host}`, req.url)); 35 + } 31 36 if (routes) { 32 37 let route = routes.custom_domain_routes.find( 33 38 (r) => r.route === req.nextUrl.pathname,