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,