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