diff --git a/src/pages/settings/servers/index.tsx b/src/pages/settings/servers/index.tsx index 4279d26..7746551 100644 --- a/src/pages/settings/servers/index.tsx +++ b/src/pages/settings/servers/index.tsx @@ -22,7 +22,7 @@ import { } from '../../../utils/file-servers.ts' import { useAppSelector } from '../../../hooks' import { useDidMount } from '../../../hooks' -import { isValidUrl } from '../../../utils' +import { isValidUrl, MAXIMUM_BLOSSOMS_LENGTH } from '../../../utils' import axios from 'axios' import { cloneDeep } from 'lodash' @@ -75,6 +75,12 @@ export const ServersPage = () => { return } + if (Object.keys(blossomServersMap).length === MAXIMUM_BLOSSOMS_LENGTH) { + return toast.warning( + `You can only add a maximum of ${MAXIMUM_BLOSSOMS_LENGTH} blossom servers.` + ) + } + const serverURL = `${protocol}${newServerURL?.trim().replace(protocol, '')}` if (!serverURL) return diff --git a/src/utils/const.ts b/src/utils/const.ts index 426909a..3111ad5 100644 --- a/src/utils/const.ts +++ b/src/utils/const.ts @@ -27,6 +27,8 @@ export const DEFAULT_LOOK_UP_RELAY_LIST = [ 'wss://purplepag.es' ] +export const MAXIMUM_BLOSSOMS_LENGTH = 3 + // Uses the https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types list // Updated on 2024/08/22 export const MOST_COMMON_MEDIA_TYPES = new Map([