fix(jaas): Get dynamic branding url from config file

We make the request for dynamic branding as soon as possible so
at the time of the request the config is not yet added to the store.
In order to fix this we get the jass brandingDataUrl &
dynamicBrandingUrl directly from the config.
This commit is contained in:
Vlad Piersec 2021-10-07 09:42:57 +03:00 committed by vp8x8
parent 1bc5ef3516
commit ddcb85a1d8
2 changed files with 6 additions and 5 deletions

View File

@ -27,7 +27,7 @@ export function fetchCustomBrandingData() {
const { customizationReady } = state['features/dynamic-branding'];
if (!customizationReady) {
const url = getDynamicBrandingUrl(state);
const url = await getDynamicBrandingUrl();
if (url) {
try {

View File

@ -1,4 +1,5 @@
// @flow
import { loadConfig } from '../base/lib-jitsi-meet';
/**
* Extracts the fqn part from a path, where fqn represents
@ -17,17 +18,17 @@ export function extractFqnFromPath() {
/**
* Returns the url used for fetching dynamic branding.
*
* @param {Object} state - The state of the app.
* @returns {string}
*/
export function getDynamicBrandingUrl(state: Object) {
const { dynamicBrandingUrl } = state['features/base/config'];
export async function getDynamicBrandingUrl() {
const config = await loadConfig(window.location.href);
const { dynamicBrandingUrl } = config;
if (dynamicBrandingUrl) {
return dynamicBrandingUrl;
}
const baseUrl = state['features/base/config'].brandingDataUrl;
const { brandingDataUrl: baseUrl } = config;
const fqn = extractFqnFromPath();
if (baseUrl && fqn) {