about summary refs log tree commit diff
path: root/src/lib/api/feed/utils.ts
diff options
context:
space:
mode:
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)
+}