about summary refs log tree commit diff
path: root/src/lib/api/feed/utils.ts
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-04-29 16:04:35 -0500
committerGitHub <noreply@github.com>2024-04-29 22:04:35 +0100
commita4e34537cee8e12a022238f054bee4fe22cc7325 (patch)
treee8ffbb4993441f64e4c112e9b046c566e577d661 /src/lib/api/feed/utils.ts
parentd893fe005d9d43e28b2926f8fed4f13165843d3b (diff)
downloadvoidsky-a4e34537cee8e12a022238f054bee4fe22cc7325.tar.zst
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 <dan.abramov@gmail.com>
Diffstat (limited to 'src/lib/api/feed/utils.ts')
-rw-r--r--src/lib/api/feed/utils.ts21
1 files changed, 21 insertions, 0 deletions
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)
+}