Page MenuHomePhabricator

D10993.diff
No OneTemporary

D10993.diff

diff --git a/lib/utils/config.js b/lib/utils/config.js
--- a/lib/utils/config.js
+++ b/lib/utils/config.js
@@ -26,6 +26,7 @@
+setSessionIDOnRequest: boolean,
+calendarRangeInactivityLimit: ?number,
+platformDetails: PlatformDetails,
+ +authoritativeKeyserverID: string,
};
let registeredConfig: ?Config = null;
diff --git a/native/authoritative-keyserver.js b/native/authoritative-keyserver.js
new file mode 100644
--- /dev/null
+++ b/native/authoritative-keyserver.js
@@ -0,0 +1,19 @@
+// @flow
+
+import { ashoatKeyserverID } from 'lib/utils/validation-utils.js';
+
+function getAuthoritativeKeyserverID(): string {
+ try {
+ const {
+ authoritativeKeyserverID: keyserverID,
+ // $FlowExpectedError: file might not exist
+ } = require('./facts/authoritative_keyserver.json');
+ return keyserverID;
+ } catch {
+ return ashoatKeyserverID;
+ }
+}
+
+const authoritativeKeyserverID: string = getAuthoritativeKeyserverID();
+
+export { authoritativeKeyserverID };
diff --git a/native/config.js b/native/config.js
--- a/native/config.js
+++ b/native/config.js
@@ -5,6 +5,7 @@
import { registerConfig } from 'lib/utils/config.js';
import { resolveKeyserverSessionInvalidationUsingNativeCredentials } from './account/legacy-recover-keyserver-session.js';
+import { authoritativeKeyserverID } from './authoritative-keyserver.js';
import { persistConfig, codeVersion } from './redux/persist.js';
registerConfig({
@@ -16,4 +17,5 @@
codeVersion,
stateVersion: persistConfig.version,
},
+ authoritativeKeyserverID,
});
diff --git a/web/app.react.js b/web/app.react.js
--- a/web/app.react.js
+++ b/web/app.react.js
@@ -38,6 +38,7 @@
import QrCodeLogin from './account/qr-code-login.react.js';
import AppThemeWrapper from './app-theme-wrapper.react.js';
+import { authoritativeKeyserverID } from './authoritative-keyserver.js';
import WebEditThreadAvatarProvider from './avatars/web-edit-thread-avatar-provider.react.js';
import Calendar from './calendar/calendar.react.js';
import Chat from './chat/chat.react.js';
@@ -102,6 +103,7 @@
stateVersion: persistConfig.version,
...desktopDetails,
},
+ authoritativeKeyserverID,
});
const versionBroadcast = new BroadcastChannel('comm_version');
diff --git a/web/authoritative-keyserver.js b/web/authoritative-keyserver.js
new file mode 100644
--- /dev/null
+++ b/web/authoritative-keyserver.js
@@ -0,0 +1,8 @@
+// @flow
+
+import { ashoatKeyserverID } from 'lib/utils/validation-utils.js';
+
+const authoritativeKeyserverID: string =
+ process.env.AUTHORITATIVE_KEYSERVER_ID ?? ashoatKeyserverID;
+
+export { authoritativeKeyserverID };
diff --git a/web/webpack.config.cjs b/web/webpack.config.cjs
--- a/web/webpack.config.cjs
+++ b/web/webpack.config.cjs
@@ -13,7 +13,7 @@
async function getConfig(configName) {
const { getCommConfig } = await import(
- '../keyserver/dist/lib/utils/comm-config.js'
+ 'keyserver/dist/lib/utils/comm-config.js'
);
return await getCommConfig(configName);
}
@@ -194,7 +194,18 @@
const identitySocketAddr = JSON.stringify(
identityServiceConfig?.identitySocketAddr,
);
- const envVars = { IDENTITY_SOCKET_ADDR: identitySocketAddr };
+ const authoritativeKeyserverIDConfig = await getConfig({
+ folder: 'facts',
+ name: 'authoritative_keyserver',
+ });
+ const authoritativeKeyserverID = JSON.stringify(
+ authoritativeKeyserverIDConfig?.authoritativeKeyserverID,
+ );
+
+ const envVars = {
+ IDENTITY_SOCKET_ADDR: identitySocketAddr,
+ AUTHORITATIVE_KEYSERVER_ID: authoritativeKeyserverID,
+ };
const browserConfigPromise = env.prod
? createProdBrowserConfig(baseProdBrowserConfig, babelConfig, envVars)
: createDevBrowserConfig(baseDevBrowserConfig, babelConfig, envVars);

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 28, 5:07 PM (21 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2591735
Default Alt Text
D10993.diff (3 KB)

Event Timeline