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 = 2880000 // estimate as of 11/26/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 'did:plc:3jpt2mvvsumj2r7eqk4gzzjz': true, // esb.lol
33 'did:plc:vjug55kidv6sye7ykr5faxxn': true, // emilyliu.me
34}
35
36const BASE_FEEDBACK_FORM_URL = `${HELP_DESK_URL}/requests/new`
37export function FEEDBACK_FORM_URL({
38 email,
39 handle,
40}: {
41 email?: string
42 handle?: string
43}): string {
44 let str = BASE_FEEDBACK_FORM_URL
45 if (email) {
46 str += `?tf_anonymous_requester_email=${encodeURIComponent(email)}`
47 if (handle) {
48 str += `&tf_17205412673421=${encodeURIComponent(handle)}`
49 }
50 }
51 return str
52}
53
54export const MAX_DISPLAY_NAME = 64
55export const MAX_DESCRIPTION = 256
56
57export const MAX_GRAPHEME_LENGTH = 300
58
59export const MAX_DM_GRAPHEME_LENGTH = 1000
60
61// Recommended is 100 per: https://www.w3.org/WAI/GL/WCAG20/tests/test3.html
62// but increasing limit per user feedback
63export const MAX_ALT_TEXT = 2000
64
65export function IS_TEST_USER(handle?: string) {
66 return handle && handle?.endsWith('.test')
67}
68
69export function IS_PROD_SERVICE(url?: string) {
70 return url && url !== STAGING_SERVICE && !url.startsWith(LOCAL_DEV_SERVICE)
71}
72
73export const PROD_DEFAULT_FEED = (rkey: string) =>
74 `at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.generator/${rkey}`
75
76export const POST_IMG_MAX = {
77 width: 2000,
78 height: 2000,
79 size: 1000000,
80}
81
82export const STAGING_LINK_META_PROXY =
83 'https://cardyb.staging.bsky.dev/v1/extract?url='
84
85export const PROD_LINK_META_PROXY = 'https://cardyb.bsky.app/v1/extract?url='
86
87export function LINK_META_PROXY(serviceUrl: string) {
88 if (IS_PROD_SERVICE(serviceUrl)) {
89 return PROD_LINK_META_PROXY
90 }
91
92 return STAGING_LINK_META_PROXY
93}
94
95export const STATUS_PAGE_URL = 'https://status.bsky.app/'
96
97// Hitslop constants
98export const createHitslop = (size: number): Insets => ({
99 top: size,
100 left: size,
101 bottom: size,
102 right: size,
103})
104export const HITSLOP_10 = createHitslop(10)
105export const HITSLOP_20 = createHitslop(20)
106export const HITSLOP_30 = createHitslop(30)
107export const POST_CTRL_HITSLOP = {top: 5, bottom: 10, left: 10, right: 10}
108export const LANG_DROPDOWN_HITSLOP = {top: 10, bottom: 10, left: 4, right: 4}
109export const BACK_HITSLOP = HITSLOP_30
110export const MAX_POST_LINES = 25
111
112export const BSKY_APP_ACCOUNT_DID = 'did:plc:z72i7hdynmk6r22z27h6tvur'
113
114export const BSKY_FEED_OWNER_DIDS = [
115 BSKY_APP_ACCOUNT_DID,
116 'did:plc:vpkhqolt662uhesyj6nxm7ys',
117 'did:plc:q6gjnaw2blty4crticxkmujt',
118]
119
120export const DISCOVER_FEED_URI =
121 'at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.generator/whats-hot'
122export const DISCOVER_SAVED_FEED = {
123 type: 'feed',
124 value: DISCOVER_FEED_URI,
125 pinned: true,
126}
127export const TIMELINE_SAVED_FEED = {
128 type: 'timeline',
129 value: 'following',
130 pinned: true,
131}
132
133export const RECOMMENDED_SAVED_FEEDS: Pick<
134 AppBskyActorDefs.SavedFeed,
135 'type' | 'value' | 'pinned'
136>[] = [DISCOVER_SAVED_FEED, TIMELINE_SAVED_FEED]
137
138export const KNOWN_SHUTDOWN_FEEDS = [
139 'at://did:plc:wqowuobffl66jv3kpsvo7ak4/app.bsky.feed.generator/the-algorithm', // for you by skygaze
140]
141
142export const GIF_SERVICE = 'https://gifs.bsky.app'
143
144export const GIF_SEARCH = (params: string) =>
145 `${GIF_SERVICE}/tenor/v2/search?${params}`
146export const GIF_FEATURED = (params: string) =>
147 `${GIF_SERVICE}/tenor/v2/featured?${params}`
148
149export const MAX_LABELERS = 20
150
151export const VIDEO_SERVICE = 'https://video.bsky.app'
152export const VIDEO_SERVICE_DID = 'did:web:video.bsky.app'
153
154export const SUPPORTED_MIME_TYPES = [
155 'video/mp4',
156 'video/mpeg',
157 'video/webm',
158 'video/quicktime',
159 'image/gif',
160] as const
161
162export type SupportedMimeTypes = (typeof SUPPORTED_MIME_TYPES)[number]