diff --git a/lib/shared/keyserver-utils.js b/lib/shared/keyserver-utils.js --- a/lib/shared/keyserver-utils.js +++ b/lib/shared/keyserver-utils.js @@ -6,14 +6,29 @@ useGetVersion, getVersionActionTypes, } from '../actions/device-actions.js'; +import { urlPrefixSelector } from '../selectors/keyserver-selectors.js'; import { useDispatchActionPromise } from '../utils/action-utils.js'; +import { useSelector } from '../utils/redux-utils.js'; +import { ashoatKeyserverID } from '../utils/validation-utils.js'; function useIsKeyserverURLValid(keyserverURL?: string): () => Promise { + const ashoatKeyserverUrl = useSelector(urlPrefixSelector(ashoatKeyserverID)); + const serverCallParamOverride = React.useMemo(() => { if (!keyserverURL) { return undefined; } + if (keyserverURL === ashoatKeyserverUrl) { + return { + keyserverInfos: { + [(ashoatKeyserverID: string)]: { + urlPrefix: keyserverURL, + }, + }, + }; + } + return { keyserverInfos: { [(keyserverURL: string)]: { @@ -21,7 +36,7 @@ }, }, }; - }, [keyserverURL]); + }, [keyserverURL, ashoatKeyserverUrl]); const getVersionCall = useGetVersion(serverCallParamOverride);