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/utils.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/lib/api/feed/utils.ts (limited to 'src/lib/api/feed/utils.ts') diff --git a/src/lib/api/feed/utils.ts b/src/lib/api/feed/utils.ts new file mode 100644 index 000000000..50162ed2a --- /dev/null +++ b/src/lib/api/feed/utils.ts @@ -0,0 +1,21 @@ +import {AtUri} from '@atproto/api' + +import {BSKY_FEED_OWNER_DIDS} from '#/lib/constants' +import {UsePreferencesQueryResponse} from '#/state/queries/preferences' + +export function createBskyTopicsHeader(userInterests?: string) { + return { + 'X-Bsky-Topics': userInterests || '', + } +} + +export function aggregateUserInterests( + preferences?: UsePreferencesQueryResponse, +) { + return preferences?.interests?.tags?.join(',') || '' +} + +export function isBlueskyOwnedFeed(feedUri: string) { + const uri = new AtUri(feedUri) + return BSKY_FEED_OWNER_DIDS.includes(uri.host) +} -- cgit 1.4.1