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'
15export const STARTER_PACK_MAX_SIZE = 150
16
17// HACK
18// Yes, this is exactly what it looks like. It's a hard-coded constant
19// reflecting the number of new users in the last week. We don't have
20// time to add a route to the servers for this so we're just going to hard
21// code and update this number with each release until we can get the
22// server route done.
23// -prf
24export const JOINED_THIS_WEEK = 650000 // estimate as of 10/28/24
25
26export const DISCOVER_DEBUG_DIDS: Record<string, true> = {
27 'did:plc:oisofpd7lj26yvgiivf3lxsi': true, // hailey.at
28 'did:plc:fpruhuo22xkm5o7ttr2ktxdo': true, // danabra.mov
29 'did:plc:p2cp5gopk7mgjegy6wadk3ep': true, // samuel.bsky.team
30 'did:plc:ragtjsm2j2vknwkz3zp4oxrd': true, // pfrazee.com
31 'did:plc:vpkhqolt662uhesyj6nxm7ys': true, // why.bsky.team
32}
33
34const BASE_FEEDBACK_FORM_URL = `${HELP_DESK_URL}/requests/new`
35export function FEEDBACK_FORM_URL({
36 email,
37 handle,
38}: {
39 email?: string
40 handle?: string
41}): string {
42 let str = BASE_FEEDBACK_FORM_URL
43 if (email) {
44 str += `?tf_anonymous_requester_email=${encodeURIComponent(email)}`
45 if (handle) {
46 str += `&tf_17205412673421=${encodeURIComponent(handle)}`
47 }
48 }
49 return str
50}
51
52export const MAX_DISPLAY_NAME = 64
53export const MAX_DESCRIPTION = 256
54
55export const MAX_GRAPHEME_LENGTH = 300
56
57export const MAX_DM_GRAPHEME_LENGTH = 1000
58
59// Recommended is 100 per: https://www.w3.org/WAI/GL/WCAG20/tests/test3.html
60// but increasing limit per user feedback
61export const MAX_ALT_TEXT = 2000
62
63export function IS_TEST_USER(handle?: string) {
64 return handle && handle?.endsWith('.test')
65}
66
67export function IS_PROD_SERVICE(url?: string) {
68 return url && url !== STAGING_SERVICE && !url.startsWith(LOCAL_DEV_SERVICE)
69}
70
71export const PROD_DEFAULT_FEED = (rkey: string) =>
72 `at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.generator/${rkey}`
73
74export const POST_IMG_MAX = {
75 width: 2000,
76 height: 2000,
77 size: 1000000,
78}
79
80export const STAGING_LINK_META_PROXY =
81 'https://cardyb.staging.bsky.dev/v1/extract?url='
82
83export const PROD_LINK_META_PROXY = 'https://cardyb.bsky.app/v1/extract?url='
84
85export function LINK_META_PROXY(serviceUrl: string) {
86 if (IS_PROD_SERVICE(serviceUrl)) {
87 return PROD_LINK_META_PROXY
88 }
89
90 return STAGING_LINK_META_PROXY
91}
92
93export const STATUS_PAGE_URL = 'https://status.bsky.app/'
94
95// Hitslop constants
96export const createHitslop = (size: number): Insets => ({
97 top: size,
98 left: size,
99 bottom: size,
100 right: size,
101})
102export const HITSLOP_10 = createHitslop(10)
103export const HITSLOP_20 = createHitslop(20)
104export const HITSLOP_30 = createHitslop(30)
105export const POST_CTRL_HITSLOP = {top: 5, bottom: 10, left: 10, right: 10}
106export const LANG_DROPDOWN_HITSLOP = {top: 10, bottom: 10, left: 4, right: 4}
107export const BACK_HITSLOP = HITSLOP_30
108export const MAX_POST_LINES = 25
109
110export const BSKY_APP_ACCOUNT_DID = 'did:plc:z72i7hdynmk6r22z27h6tvur'
111
112export const BSKY_FEED_OWNER_DIDS = [
113 BSKY_APP_ACCOUNT_DID,
114 'did:plc:vpkhqolt662uhesyj6nxm7ys',
115 'did:plc:q6gjnaw2blty4crticxkmujt',
116]
117
118export const DISCOVER_FEED_URI =
119 'at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.generator/whats-hot'
120export const DISCOVER_SAVED_FEED = {
121 type: 'feed',
122 value: DISCOVER_FEED_URI,
123 pinned: true,
124}
125export const TIMELINE_SAVED_FEED = {
126 type: 'timeline',
127 value: 'following',
128 pinned: true,
129}
130
131export const RECOMMENDED_SAVED_FEEDS: Pick<
132 AppBskyActorDefs.SavedFeed,
133 'type' | 'value' | 'pinned'
134>[] = [DISCOVER_SAVED_FEED, TIMELINE_SAVED_FEED]
135
136export const KNOWN_SHUTDOWN_FEEDS = [
137 'at://did:plc:wqowuobffl66jv3kpsvo7ak4/app.bsky.feed.generator/the-algorithm', // for you by skygaze
138]
139
140export const GIF_SERVICE = 'https://gifs.bsky.app'
141
142export const GIF_SEARCH = (params: string) =>
143 `${GIF_SERVICE}/tenor/v2/search?${params}`
144export const GIF_FEATURED = (params: string) =>
145 `${GIF_SERVICE}/tenor/v2/featured?${params}`
146
147export const MAX_LABELERS = 20
148
149export const VIDEO_SERVICE = 'https://video.bsky.app'
150export const VIDEO_SERVICE_DID = 'did:web:video.bsky.app'
151
152export const SUPPORTED_MIME_TYPES = [
153 'video/mp4',
154 'video/mpeg',
155 'video/webm',
156 'video/quicktime',
157] as const
158
159export type SupportedMimeTypes = (typeof SUPPORTED_MIME_TYPES)[number]