From a4e34537cee8e12a022238f054bee4fe22cc7325 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Mon, 29 Apr 2024 16:04:35 -0500 Subject: Send Bluesky feeds and suggested follows more data (#3695) * WIP * Fix constructors * Clean up * Tweak * Rm extra assignment * Narrow down the argument --------- Co-authored-by: Dan Abramov --- src/lib/api/feed/custom.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/lib/api/feed/custom.ts') diff --git a/src/lib/api/feed/custom.ts b/src/lib/api/feed/custom.ts index 75182c41f..87e45ceba 100644 --- a/src/lib/api/feed/custom.ts +++ b/src/lib/api/feed/custom.ts @@ -7,20 +7,25 @@ import { import {getContentLanguages} from '#/state/preferences/languages' import {FeedAPI, FeedAPIResponse} from './types' +import {createBskyTopicsHeader, isBlueskyOwnedFeed} from './utils' export class CustomFeedAPI implements FeedAPI { getAgent: () => BskyAgent params: GetCustomFeed.QueryParams + userInterests?: string constructor({ getAgent, feedParams, + userInterests, }: { getAgent: () => BskyAgent feedParams: GetCustomFeed.QueryParams + userInterests?: string }) { this.getAgent = getAgent this.params = feedParams + this.userInterests = userInterests } async peekLatest(): Promise { @@ -44,6 +49,8 @@ export class CustomFeedAPI implements FeedAPI { }): Promise { const contentLangs = getContentLanguages().join(',') const agent = this.getAgent() + const isBlueskyOwned = isBlueskyOwnedFeed(this.params.feed) + const res = agent.session ? await this.getAgent().app.bsky.feed.getFeed( { @@ -53,6 +60,9 @@ export class CustomFeedAPI implements FeedAPI { }, { headers: { + ...(isBlueskyOwned + ? createBskyTopicsHeader(this.userInterests) + : {}), 'Accept-Language': contentLangs, }, }, -- cgit 1.4.1