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