From 9e435a24f25cdd84b8ee608f1d1832d8640dcc40 Mon Sep 17 00:00:00 2001 From: "xan.lol" Date: Tue, 7 Apr 2026 17:23:49 -0700 Subject: [PATCH] fix: feed services recieving the wrong atproto proxy did --- src/state/feed-feedback.tsx | 11 ++++++----- src/state/session/agent.ts | 6 ++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/state/feed-feedback.tsx b/src/state/feed-feedback.tsx index 15c12e732..328844242 100644 --- a/src/state/feed-feedback.tsx +++ b/src/state/feed-feedback.tsx @@ -75,6 +75,10 @@ export function useFeedFeedback( const isDiscover = isDiscoverFeed(feed?.feedDescriptor) const acceptsInteractions = Boolean(isDiscover || feed?.acceptsInteractions) const proxyDid = feed?.view?.did + const feedAgent = useMemo( + () => (proxyDid ? agent.withProxy('bsky_fg', proxyDid) : null), + [agent, proxyDid], + ) const enabled = Boolean(feed) && Boolean(proxyDid) && acceptsInteractions && hasSession @@ -151,14 +155,11 @@ export function useFeedFeedback( } // Send to the feed - agent.app.bsky.feed + feedAgent?.app.bsky.feed .sendInteractions( {interactions: interactionsToSend, feed: feed?.uri}, { encoding: 'application/json', - headers: { - 'atproto-proxy': `${proxyDid}#bsky_fg`, - }, }, ) .catch(() => {}) // ignore upstream errors @@ -172,7 +173,7 @@ export function useFeedFeedback( ) throttledFlushAggregatedStats() logger.debug('flushed') - }, [agent, throttledFlushAggregatedStats, proxyDid, enabled, feed]) + }, [feedAgent, throttledFlushAggregatedStats, enabled, feed]) const sendToFeed = useMemo( () => diff --git a/src/state/session/agent.ts b/src/state/session/agent.ts index 981a02e23..4065a9a03 100644 --- a/src/state/session/agent.ts +++ b/src/state/session/agent.ts @@ -368,6 +368,12 @@ class BskyAppAgent extends BskyAgent { persistSessionHandler: ((event: AtpSessionEvent) => void) | undefined = undefined + clone(): this { + // `withProxy()` calls `clone()`. Since this class subclasses `BskyAgent`, + // we must provide our own clone implementation. + return this.copyInto(new BskyAgent(this.sessionManager) as this) + } + constructor({service}: {service: string}) { super({ service, -- 2.51.2