Add testnet warning (#880)

* Add testnet warning

* Add watermarks to posts

* Call the test environment the Sandbox
This commit is contained in:
Paul Frazee 2023-06-14 20:00:16 -05:00 committed by GitHub
parent 775b5e6578
commit 3663ee57f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 81 additions and 9 deletions

View file

@ -10,6 +10,22 @@ export const MAX_GRAPHEME_LENGTH = 300
// but increasing limit per user feedback
export const MAX_ALT_TEXT = 1000
export function IS_LOCAL_DEV(url: string) {
return url.includes('localhost')
}
export function IS_STAGING(url: string) {
return !IS_LOCAL_DEV(url) && !IS_PROD(url)
}
export function IS_PROD(url: string) {
// NOTE
// until open federation, "production" is defined as the main server
// this definition will not work once federation is enabled!
// -prf
return url.startsWith('https://bsky.social')
}
export const PROD_TEAM_HANDLES = [
'jay.bsky.social',
'pfrazee.com',
@ -43,14 +59,14 @@ export async function DEFAULT_FEEDS(
serviceUrl: string,
resolveHandle: (name: string) => Promise<string>,
) {
if (serviceUrl.includes('localhost')) {
if (IS_LOCAL_DEV(serviceUrl)) {
// local dev
const aliceDid = await resolveHandle('alice.test')
return {
pinned: [`at://${aliceDid}/app.bsky.feed.generator/alice-favs`],
saved: [`at://${aliceDid}/app.bsky.feed.generator/alice-favs`],
}
} else if (serviceUrl.includes('staging')) {
} else if (IS_STAGING(serviceUrl)) {
// staging
return {
pinned: [STAGING_DEFAULT_FEED('whats-hot')],
@ -90,9 +106,9 @@ export const STAGING_LINK_META_PROXY =
export const PROD_LINK_META_PROXY = 'https://cardyb.bsky.app/v1/extract?url='
export function LINK_META_PROXY(serviceUrl: string) {
if (serviceUrl.includes('localhost')) {
if (IS_LOCAL_DEV(serviceUrl)) {
return STAGING_LINK_META_PROXY
} else if (serviceUrl.includes('staging')) {
} else if (IS_STAGING(serviceUrl)) {
return STAGING_LINK_META_PROXY
} else {
return PROD_LINK_META_PROXY