Don't repackage the ValidatedDiscoveryConfig

It's usable as-is, and we can add things to it when we need to (ie: integrations).
This commit is contained in:
Travis Ralston 2019-04-17 21:44:52 -06:00
parent c8caf6797d
commit e7bf643d8b

View file

@ -494,30 +494,13 @@ async function verifyServerConfig() {
} }
const validatedConfig = AutoDiscoveryUtils.buildValidatedConfigFromDiscovery(serverName, result); const validatedConfig = AutoDiscoveryUtils.buildValidatedConfigFromDiscovery(serverName, result);
// Just in case we ever have to debug this
console.log("Using homeserver config:", validatedConfig); console.log("Using homeserver config:", validatedConfig);
// Build our own discovery result for distribution within the app
const configResult = {
"m.homeserver": {
"base_url": validatedConfig.hsUrl,
"server_name": validatedConfig.hsName,
"server_name_different": validatedConfig.hsNameIsDifferent,
},
"m.identity_server": {
"base_url": validatedConfig.isUrl,
"enabled": validatedConfig.identityEnabled,
},
};
// Copy over any other keys that may be of interest
for (const key of Object.keys(result)) {
if (key === "m.homeserver" || key === "m.identity_server") continue;
configResult[key] = JSON.parse(JSON.stringify(result[key])); // deep clone
}
// Add the newly built config to the actual config for use by the app // Add the newly built config to the actual config for use by the app
console.log("Updating SdkConfig with validated discovery information"); console.log("Updating SdkConfig with validated discovery information");
SdkConfig.add({"validated_discovery_config": configResult}); SdkConfig.add({"validated_discovery_config": validatedConfig});
return SdkConfig.get(); return SdkConfig.get();
} }