mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1import {Insets, Platform} from 'react-native'
2import {AppBskyActorDefs} from '@atproto/api'
3
4export const LOCAL_DEV_SERVICE =
5 Platform.OS === 'android' ? 'http://10.0.2.2:2583' : 'http://localhost:2583'
6export const STAGING_SERVICE = 'https://staging.bsky.dev'
7export const BSKY_SERVICE = 'https://bsky.social'
8export const PUBLIC_BSKY_SERVICE = 'https://public.api.bsky.app'
9export const DEFAULT_SERVICE = BSKY_SERVICE
10const HELP_DESK_LANG = 'en-us'
11export const HELP_DESK_URL = `https://blueskyweb.zendesk.com/hc/${HELP_DESK_LANG}`
12export const EMBED_SERVICE = 'https://embed.bsky.app'
13export const EMBED_SCRIPT = `${EMBED_SERVICE}/static/embed.js`
14export const BSKY_DOWNLOAD_URL = 'https://bsky.app/download'
15
16const BASE_FEEDBACK_FORM_URL = `${HELP_DESK_URL}/requests/new`
17export function FEEDBACK_FORM_URL({
18 email,
19 handle,
20}: {
21 email?: string
22 handle?: string
23}): string {
24 let str = BASE_FEEDBACK_FORM_URL
25 if (email) {
26 str += `?tf_anonymous_requester_email=${encodeURIComponent(email)}`
27 if (handle) {
28 str += `&tf_17205412673421=${encodeURIComponent(handle)}`
29 }
30 }
31 return str
32}
33
34export const MAX_DISPLAY_NAME = 64
35export const MAX_DESCRIPTION = 256
36
37export const MAX_GRAPHEME_LENGTH = 300
38
39export const MAX_DM_GRAPHEME_LENGTH = 1000
40
41// Recommended is 100 per: https://www.w3.org/WAI/GL/WCAG20/tests/test3.html
42// but increasing limit per user feedback
43export const MAX_ALT_TEXT = 1000
44
45export function IS_TEST_USER(handle?: string) {
46 return handle && handle?.endsWith('.test')
47}
48
49export function IS_PROD_SERVICE(url?: string) {
50 return url && url !== STAGING_SERVICE && !url.startsWith(LOCAL_DEV_SERVICE)
51}
52
53export const PROD_DEFAULT_FEED = (rkey: string) =>
54 `at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.generator/${rkey}`
55
56export const POST_IMG_MAX = {
57 width: 2000,
58 height: 2000,
59 size: 1000000,
60}
61
62export const STAGING_LINK_META_PROXY =
63 'https://cardyb.staging.bsky.dev/v1/extract?url='
64
65export const PROD_LINK_META_PROXY = 'https://cardyb.bsky.app/v1/extract?url='
66
67export function LINK_META_PROXY(serviceUrl: string) {
68 if (IS_PROD_SERVICE(serviceUrl)) {
69 return PROD_LINK_META_PROXY
70 }
71
72 return STAGING_LINK_META_PROXY
73}
74
75export const STATUS_PAGE_URL = 'https://status.bsky.app/'
76
77// Hitslop constants
78export const createHitslop = (size: number): Insets => ({
79 top: size,
80 left: size,
81 bottom: size,
82 right: size,
83})
84export const HITSLOP_10 = createHitslop(10)
85export const HITSLOP_20 = createHitslop(20)
86export const HITSLOP_30 = createHitslop(30)
87export const BACK_HITSLOP = HITSLOP_30
88export const MAX_POST_LINES = 25
89
90export const BSKY_APP_ACCOUNT_DID = 'did:plc:z72i7hdynmk6r22z27h6tvur'
91
92export const BSKY_FEED_OWNER_DIDS = [
93 BSKY_APP_ACCOUNT_DID,
94 'did:plc:vpkhqolt662uhesyj6nxm7ys',
95 'did:plc:q6gjnaw2blty4crticxkmujt',
96]
97
98export const DISCOVER_FEED_URI =
99 'at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.generator/whats-hot'
100export const DISCOVER_SAVED_FEED = {
101 type: 'feed',
102 value: DISCOVER_FEED_URI,
103 pinned: true,
104}
105export const TIMELINE_SAVED_FEED = {
106 type: 'timeline',
107 value: 'following',
108 pinned: true,
109}
110
111export const RECOMMENDED_SAVED_FEEDS: Pick<
112 AppBskyActorDefs.SavedFeed,
113 'type' | 'value' | 'pinned'
114>[] = [DISCOVER_SAVED_FEED, TIMELINE_SAVED_FEED]
115
116export const KNOWN_SHUTDOWN_FEEDS = [
117 'at://did:plc:wqowuobffl66jv3kpsvo7ak4/app.bsky.feed.generator/the-algorithm', // for you by skygaze
118]
119
120export const GIF_SERVICE = 'https://gifs.bsky.app'
121
122export const GIF_SEARCH = (params: string) =>
123 `${GIF_SERVICE}/tenor/v2/search?${params}`
124export const GIF_FEATURED = (params: string) =>
125 `${GIF_SERVICE}/tenor/v2/featured?${params}`