feat: maximum of 3 blossom servers
All checks were successful
Open PR on Staging / audit_and_check (pull_request) Successful in 38s

This commit is contained in:
Stixx 2025-01-02 13:31:42 +01:00
parent 18c07556ea
commit 67d33e1aff
2 changed files with 9 additions and 1 deletions

View File

@ -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

View File

@ -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([