a tool for shared writing and social publishing

don't sync bsky likes of brid.gy posts

+15 -1
+15 -1
app/api/inngest/functions/sync_bsky_likes.ts
··· 1 1 import { inngest } from "../client"; 2 2 import { supabaseServerClient } from "supabase/serverClient"; 3 - import { AtpAgent } from "@atproto/api"; 3 + import { AtpAgent, AtUri } from "@atproto/api"; 4 + import { idResolver } from "app/(home-pages)/reader/idResolver"; 4 5 5 6 const TOTAL_ITERATIONS = 144; // 36 hours at 15-minute intervals 6 7 ··· 12 13 { event: "appview/sync-bsky-likes" }, 13 14 async ({ event, step }) => { 14 15 const { document_uri, bsky_post_uri } = event.data; 16 + 17 + const isBridgy = await step.run("check-bridgy", async () => { 18 + const did = new AtUri(bsky_post_uri).host; 19 + const doc = await idResolver.did.resolve(did); 20 + const handle = doc?.alsoKnownAs 21 + ?.find((a) => a.startsWith("at://")) 22 + ?.replace("at://", ""); 23 + return handle?.includes("brid.gy") ?? false; 24 + }); 25 + 26 + if (isBridgy) { 27 + return { skipped: true, reason: "brid.gy post" }; 28 + } 15 29 16 30 const agent = new AtpAgent({ service: "https://public.api.bsky.app" }); 17 31