diff --git a/web/avatars/avatar-hooks.react.js b/web/avatars/avatar-hooks.react.js --- a/web/avatars/avatar-hooks.react.js +++ b/web/avatars/avatar-hooks.react.js @@ -8,7 +8,7 @@ } from 'lib/actions/upload-actions.js'; import type { UpdateUserAvatarRequest } from 'lib/types/avatar-types.js'; import { useLegacyAshoatKeyserverCall } from 'lib/utils/action-utils.js'; -import { ashoatKeyserverID } from 'lib/utils/validation-utils.js'; +import { authoritativeKeyserverID } from 'lib/utils/authoritative-keyserver.js'; import { encryptFile } from '../media/encryption-utils.js'; import { generateThumbHash } from '../media/image-utils.js'; @@ -68,7 +68,7 @@ loop: false, thumbHash, }, - keyserverOrThreadID: ashoatKeyserverID, + keyserverOrThreadID: authoritativeKeyserverID, callbacks: {}, }); diff --git a/web/calendar/entry.react.js b/web/calendar/entry.react.js --- a/web/calendar/entry.react.js +++ b/web/calendar/entry.react.js @@ -37,6 +37,7 @@ import type { ResolvedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { Dispatch } from 'lib/types/redux-types.js'; import { threadPermissions } from 'lib/types/thread-permission-types.js'; +import { authoritativeKeyserverID } from 'lib/utils/authoritative-keyserver.js'; import { dateString } from 'lib/utils/date-utils.js'; import { useResolvedThreadInfo } from 'lib/utils/entity-helpers.js'; import { ServerError } from 'lib/utils/errors.js'; @@ -45,7 +46,6 @@ type DispatchActionPromise, } from 'lib/utils/redux-promise-utils.js'; import { useDispatch } from 'lib/utils/redux-utils.js'; -import { ashoatKeyserverID } from 'lib/utils/validation-utils.js'; import css from './calendar.css'; import LoadingIndicator from '../loading-indicator.react.js'; @@ -472,7 +472,9 @@ !!(state.currentUserInfo && !state.currentUserInfo.anonymous && true), ); const calendarQuery = useSelector(nonThreadCalendarQuery); - const connection = useSelector(connectionSelector(ashoatKeyserverID)); + const connection = useSelector( + connectionSelector(authoritativeKeyserverID), + ); invariant(connection, 'keyserver missing from keyserverStore'); const online = connection.status === 'connected'; const callCreateEntry = useCreateEntry(); diff --git a/web/push-notif/badge-handler.react.js b/web/push-notif/badge-handler.react.js --- a/web/push-notif/badge-handler.react.js +++ b/web/push-notif/badge-handler.react.js @@ -5,14 +5,14 @@ import { connectionSelector } from 'lib/selectors/keyserver-selectors.js'; import { unreadCount } from 'lib/selectors/thread-selectors.js'; import type { ConnectionInfo } from 'lib/types/socket-types.js'; -import { ashoatKeyserverID } from 'lib/utils/validation-utils.js'; +import { authoritativeKeyserverID } from 'lib/utils/authoritative-keyserver.js'; import electron from '../electron.js'; import { useSelector } from '../redux/redux-utils.js'; import getTitle from '../title/getTitle.js'; function useBadgeHandler() { - const connection = useSelector(connectionSelector(ashoatKeyserverID)); + const connection = useSelector(connectionSelector(authoritativeKeyserverID)); const prevConnection = React.useRef(); const boundUnreadCount = useSelector(unreadCount); diff --git a/web/push-notif/push-notifs-handler.js b/web/push-notif/push-notifs-handler.js --- a/web/push-notif/push-notifs-handler.js +++ b/web/push-notif/push-notifs-handler.js @@ -8,6 +8,7 @@ } from 'lib/actions/device-actions.js'; import { useModalContext } from 'lib/components/modal-provider.react.js'; import { isLoggedIn } from 'lib/selectors/user-selectors.js'; +import { authoritativeKeyserverID } from 'lib/utils/authoritative-keyserver.js'; import { convertNonPendingIDToNewSchema } from 'lib/utils/migration-utils.js'; import { shouldSkipPushPermissionAlert, @@ -15,7 +16,6 @@ } from 'lib/utils/push-alerts.js'; import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; import { useDispatch } from 'lib/utils/redux-utils.js'; -import { ashoatKeyserverID } from 'lib/utils/validation-utils.js'; import { decryptDesktopNotification } from './notif-crypto-utils.js'; import { @@ -73,7 +73,7 @@ ({ threadID }: { +threadID: string }) => { const convertedThreadID = convertNonPendingIDToNewSchema( threadID, - ashoatKeyserverID, + authoritativeKeyserverID, ); const payload = { diff --git a/web/push-notif/service-worker.js b/web/push-notif/service-worker.js --- a/web/push-notif/service-worker.js +++ b/web/push-notif/service-worker.js @@ -6,8 +6,8 @@ PlainTextWebNotification, WebNotification, } from 'lib/types/notif-types.js'; +import { authoritativeKeyserverID } from 'lib/utils/authoritative-keyserver.js'; import { convertNonPendingIDToNewSchema } from 'lib/utils/migration-utils.js'; -import { ashoatKeyserverID } from 'lib/utils/validation-utils.js'; import { decryptWebNotification, @@ -150,7 +150,7 @@ if (!event.notification.data.isError) { threadID = convertNonPendingIDToNewSchema( event.notification.data.threadID, - ashoatKeyserverID, + authoritativeKeyserverID, ); } diff --git a/web/redux/action-types.js b/web/redux/action-types.js --- a/web/redux/action-types.js +++ b/web/redux/action-types.js @@ -7,9 +7,9 @@ WebInitialKeyserverInfo, ClientWebInitialReduxStateResponse, } from 'lib/types/redux-types.js'; +import { authoritativeKeyserverID } from 'lib/utils/authoritative-keyserver.js'; import { useKeyserverCall } from 'lib/utils/keyserver-call.js'; import type { URLInfo } from 'lib/utils/url-utils.js'; -import { ashoatKeyserverID } from 'lib/utils/validation-utils.js'; import type { ExcludedData, @@ -54,7 +54,7 @@ // for adding a new keyserver more extensive. However, for the time being // we need to add this check below so that we aren't trying to make calls // to nonexistant keyservers that are in our keyserver store. - if (keyserverID !== ashoatKeyserverID) { + if (keyserverID !== authoritativeKeyserverID) { continue; } const clientUpdatesCurrentAsOf = allUpdatesCurrentAsOf[keyserverID]; @@ -89,7 +89,7 @@ pushApiPublicKey, commServicesAccessToken, navInfo, - } = responses[ashoatKeyserverID]; + } = responses[authoritativeKeyserverID]; const dataLoaded = currentUserInfo && !currentUserInfo.anonymous; const actualizedCalendarQuery = { diff --git a/web/redux/default-state.js b/web/redux/default-state.js --- a/web/redux/default-state.js +++ b/web/redux/default-state.js @@ -4,8 +4,8 @@ import { defaultCalendarFilters } from 'lib/types/filter-types.js'; import { defaultKeyserverInfo } from 'lib/types/keyserver-types.js'; import { defaultGlobalThemeInfo } from 'lib/types/theme-types.js'; +import { authoritativeKeyserverID } from 'lib/utils/authoritative-keyserver.js'; import { defaultNotifPermissionAlertInfo } from 'lib/utils/push-alerts.js'; -import { ashoatKeyserverID } from 'lib/utils/validation-utils.js'; import type { AppState } from './redux-setup.js'; @@ -35,7 +35,7 @@ messages: {}, threads: {}, local: {}, - currentAsOf: { [ashoatKeyserverID]: 0 }, + currentAsOf: { [authoritativeKeyserverID]: 0 }, }, windowActive: true, pushApiPublicKey: null, @@ -71,7 +71,7 @@ communityPickerStore: { chat: null, calendar: null }, keyserverStore: { keyserverInfos: { - [ashoatKeyserverID]: defaultKeyserverInfo(keyserverURL), + [authoritativeKeyserverID]: defaultKeyserverInfo(keyserverURL), }, }, threadActivityStore: {}, diff --git a/web/redux/initial-state-gate.js b/web/redux/initial-state-gate.js --- a/web/redux/initial-state-gate.js +++ b/web/redux/initial-state-gate.js @@ -10,11 +10,11 @@ import { canUseDatabaseOnWeb } from 'lib/shared/web-database.js'; import type { RawThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { LegacyRawThreadInfo } from 'lib/types/thread-types.js'; +import { authoritativeKeyserverID } from 'lib/utils/authoritative-keyserver.js'; import { convertIDToNewSchema } from 'lib/utils/migration-utils.js'; import { entries } from 'lib/utils/objects.js'; import { useDispatch } from 'lib/utils/redux-utils.js'; import { infoFromURL } from 'lib/utils/url-utils.js'; -import { ashoatKeyserverID } from 'lib/utils/validation-utils.js'; import { setInitialReduxState, @@ -59,7 +59,10 @@ if (urlInfo.thread) { urlInfo = { ...urlInfo, - thread: convertIDToNewSchema(urlInfo.thread, ashoatKeyserverID), + thread: convertIDToNewSchema( + urlInfo.thread, + authoritativeKeyserverID, + ), }; } const clientDBStore = await getClientDBStore(); diff --git a/web/redux/persist.js b/web/redux/persist.js --- a/web/redux/persist.js +++ b/web/redux/persist.js @@ -19,6 +19,7 @@ import { cookieTypes } from 'lib/types/session-types.js'; import { defaultConnectionInfo } from 'lib/types/socket-types.js'; import { defaultGlobalThemeInfo } from 'lib/types/theme-types.js'; +import { authoritativeKeyserverID } from 'lib/utils/authoritative-keyserver.js'; import { parseCookies } from 'lib/utils/cookie-utils.js'; import { isDev } from 'lib/utils/dev-utils.js'; import { wipeKeyserverStore } from 'lib/utils/keyserver-store-utils.js'; @@ -28,7 +29,6 @@ } from 'lib/utils/migration-utils.js'; import { entries } from 'lib/utils/objects.js'; import { resetUserSpecificState } from 'lib/utils/reducers-utils.js'; -import { ashoatKeyserverID } from 'lib/utils/validation-utils.js'; import commReduxStorageEngine from './comm-redux-storage-engine.js'; import { defaultWebState } from './default-state.js'; @@ -124,8 +124,8 @@ ...keyserverStore, keyserverInfos: { ...keyserverStore.keyserverInfos, - [ashoatKeyserverID]: { - ...keyserverStore.keyserverInfos[ashoatKeyserverID], + [authoritativeKeyserverID]: { + ...keyserverStore.keyserverInfos[authoritativeKeyserverID], lastCommunicatedPlatformDetails, }, }, @@ -183,8 +183,8 @@ ...state.keyserverStore, keyserverInfos: { ...state.keyserverStore.keyserverInfos, - [ashoatKeyserverID]: { - ...state.keyserverStore.keyserverInfos[ashoatKeyserverID], + [authoritativeKeyserverID]: { + ...state.keyserverStore.keyserverInfos[authoritativeKeyserverID], cookie, }, }, @@ -201,8 +201,8 @@ ...state.keyserverStore, keyserverInfos: { ...state.keyserverStore.keyserverInfos, - [ashoatKeyserverID]: { - ...state.keyserverStore.keyserverInfos[ashoatKeyserverID], + [authoritativeKeyserverID]: { + ...state.keyserverStore.keyserverInfos[authoritativeKeyserverID], urlPrefix: keyserverURL, }, },