mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1import {AtUri} from '@atproto/api'
2
3import {BSKY_FEED_OWNER_DIDS} from '#/lib/constants'
4import {isWeb} from '#/platform/detection'
5import {type UsePreferencesQueryResponse} from '#/state/queries/preferences'
6
7let debugTopics = ''
8if (isWeb && typeof window !== 'undefined') {
9 const params = new URLSearchParams(window.location.search)
10 debugTopics = params.get('debug_topics') ?? ''
11}
12
13export function createBskyTopicsHeader(userInterests?: string) {
14 return {
15 'X-Bsky-Topics': debugTopics || userInterests || '',
16 }
17}
18
19export function aggregateUserInterests(
20 preferences?: UsePreferencesQueryResponse,
21) {
22 return preferences?.interests?.tags?.join(',') || ''
23}
24
25export function isBlueskyOwnedFeed(feedUri: string) {
26 const uri = new AtUri(feedUri)
27 return BSKY_FEED_OWNER_DIDS.includes(uri.host)
28}