blob: 3ed551595c7c12ca25fbdd3d05aca1497b172219 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import {AtUri} from '@atproto/api'
import {BSKY_FEED_OWNER_DIDS} from '#/lib/constants'
import {isWeb} from '#/platform/detection'
import {type UsePreferencesQueryResponse} from '#/state/queries/preferences'
let debugTopics = ''
if (isWeb && typeof window !== 'undefined') {
const params = new URLSearchParams(window.location.search)
debugTopics = params.get('debug_topics') ?? ''
}
export function createBskyTopicsHeader(userInterests?: string) {
return {
'X-Bsky-Topics': debugTopics || 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)
}
|