diff options
Diffstat (limited to 'src/view/lib/strings.ts')
-rw-r--r-- | src/view/lib/strings.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/view/lib/strings.ts b/src/view/lib/strings.ts index 214bb51d6..05b23331f 100644 --- a/src/view/lib/strings.ts +++ b/src/view/lib/strings.ts @@ -1,5 +1,6 @@ import {AtUri} from '../../third-party/uri' import {Entity} from '../../third-party/api/src/client/types/app/bsky/feed/post' +import {PROD_SERVICE} from '../../state' export const MAX_DISPLAY_NAME = 64 export const MAX_DESCRIPTION = 256 @@ -106,3 +107,15 @@ export function cleanError(str: string): string { } return str } + +export function toNiceDomain(url: string): string { + try { + const urlp = new URL(url) + if (`https://${urlp.host}` === PROD_SERVICE) { + return 'Bluesky.Social' + } + return urlp.host + } catch (e) { + return url + } +} |