diff --git a/.gitignore b/.gitignore index c1a04234..4dd3a262 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ electron/pub /config.local*.json /src/component-index.js /.tmp +/webpack-stats.json diff --git a/.modernizr.json b/.modernizr.json index 764a320b..9b399034 100644 --- a/.modernizr.json +++ b/.modernizr.json @@ -25,6 +25,9 @@ "test/svg/asimg", "test/svg/filters", + "test/url/parser", + "test/url/urlsearchparams", + "test/cors", "test/iframe/sandbox", "test/json", diff --git a/CHANGELOG.md b/CHANGELOG.md index 49d43a93..1e347052 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,32 @@ +Changes in [1.5.13](https://github.com/vector-im/riot-web/releases/tag/v1.5.13) (2020-03-17) +============================================================================================ +[Full Changelog](https://github.com/vector-im/riot-web/compare/v1.5.13-rc.1...v1.5.13) + + * Upgrade to JS SDK 5.1.1 and React SDK 2.2.3 + +Changes in [1.5.13-rc.1](https://github.com/vector-im/riot-web/releases/tag/v1.5.13-rc.1) (2020-03-11) +====================================================================================================== +[Full Changelog](https://github.com/vector-im/riot-web/compare/v1.5.12...v1.5.13-rc.1) + + * Update from Weblate + [\#12688](https://github.com/vector-im/riot-web/pull/12688) + * Fix Docker image version for develop builds + [\#12670](https://github.com/vector-im/riot-web/pull/12670) + * docker: optimize custom sdk builds + [\#12612](https://github.com/vector-im/riot-web/pull/12612) + * riot-desktop open SSO in browser so user doesn't have to auth twice + [\#12590](https://github.com/vector-im/riot-web/pull/12590) + * Fix SSO flows for electron 8.0.2 by re-breaking will-navigate + [\#12585](https://github.com/vector-im/riot-web/pull/12585) + * index.html: Place noscript on top of the page + [\#12563](https://github.com/vector-im/riot-web/pull/12563) + * Remove will-navigate comment after Electron fix + [\#12561](https://github.com/vector-im/riot-web/pull/12561) + * Update loading test for JS SDK IDB change + [\#12552](https://github.com/vector-im/riot-web/pull/12552) + * Upgrade deps + [\#12528](https://github.com/vector-im/riot-web/pull/12528) + Changes in [1.5.12](https://github.com/vector-im/riot-web/releases/tag/v1.5.12) (2020-03-04) ============================================================================================ [Full Changelog](https://github.com/vector-im/riot-web/compare/v1.5.11...v1.5.12) diff --git a/config.sample.json b/config.sample.json index 69dc3968..b8dc2fbb 100644 --- a/config.sample.json +++ b/config.sample.json @@ -22,7 +22,6 @@ "https://scalar-staging.vector.im/api", "https://scalar-staging.riot.im/scalar/api" ], - "integrations_jitsi_widget_url": "https://scalar.vector.im/api/widgets/jitsi.html", "bug_report_endpoint_url": "https://riot.im/bugreports/submit", "defaultCountryCode": "GB", "showLabsSettings": false, @@ -52,5 +51,9 @@ }, "settingDefaults": { "breadcrumbs": true + }, + "jitsi": { + "preferredDomain": "jitsi.riot.im", + "externalApiUrl": "https://jitsi.riot.im/libs/external_api.min.js" } } diff --git a/docs/config.md b/docs/config.md index d11d8638..40e71361 100644 --- a/docs/config.md +++ b/docs/config.md @@ -84,6 +84,13 @@ For a good example, see https://riot.im/develop/config.json. By default, this is "https://matrix.to" to generate matrix.to (spec) permalinks. Set this to your Riot instance URL if you run an unfederated server (eg: "https://riot.example.org"). +1. `jitsi`: Used to change the default conference options. + 1. `preferredDomain`: The domain name of the preferred Jitsi instance. Defaults + to `jitsi.riot.im`. This is used whenever a user clicks on the voice/video + call buttons - integration managers may use a different domain. + 1. `externalApiUrl`: The URL to the Jitsi Meet API script. This is required + for showing any Jitsi widgets, no matter the source. Defaults to + `https://jitsi.riot.im/libs/external_api.min.js`. Note that `index.html` also has an og:image meta tag that is set to an image hosted on riot.im. This is the image used if links to your copy of Riot diff --git a/docs/shortcuts.md b/docs/shortcuts.md deleted file mode 100644 index bc741e15..00000000 --- a/docs/shortcuts.md +++ /dev/null @@ -1,15 +0,0 @@ -# Keyboard Shortcuts - -The modifier is Ctrl on Windows & Linux and ⌘ on Mac. - -- Ctrl/⌘+m - toggle markdown -- Ctrl/⌘+d - toggle mic mute -- Ctrl/⌘+e - toggle video on/off -- Ctrl/⌘+k - jump to named room -- ↑/↓ - navigate old messages to edit when the composer is in focus -- ↑/↓ - next/prev room when focus in room list -- Alt+↑/↓ - resend previous messages when the composer is in focus -- PageUp/PageDown - scroll timeline up/down -- Ctrl/⌘+Home/End - jump to - start/end of the composer when focused, otherwise jump to timeline start/end -- Ctrl/⌘+` - toggle the top left menu diff --git a/electron_app/package.json b/electron_app/package.json index 418375e8..284a3082 100644 --- a/electron_app/package.json +++ b/electron_app/package.json @@ -2,7 +2,7 @@ "name": "riot-web", "productName": "Riot", "main": "src/electron-main.js", - "version": "1.5.12", + "version": "1.5.13", "description": "A feature-rich client for Matrix.org", "author": "New Vector Ltd.", "dependencies": { diff --git a/electron_app/src/vectormenu.js b/electron_app/src/vectormenu.js index a8f998be..b6e00d50 100644 --- a/electron_app/src/vectormenu.js +++ b/electron_app/src/vectormenu.js @@ -40,6 +40,11 @@ const template = [ { role: 'zoomin', accelerator: 'CommandOrControl+=' }, { role: 'zoomout' }, { type: 'separator' }, + { + label: 'Preferences', + accelerator: 'Command+,', // Mac-only accelerator + click() { global.mainWindow.webContents.send('preferences'); }, + }, { role: 'togglefullscreen' }, { role: 'toggledevtools' }, ], diff --git a/electron_app/yarn.lock b/electron_app/yarn.lock index 4723d3e8..d61172bc 100644 --- a/electron_app/yarn.lock +++ b/electron_app/yarn.lock @@ -500,9 +500,9 @@ minimist@0.0.8: integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= minimist@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" - integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= + version "1.2.2" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.2.tgz#b00a00230a1108c48c169e69a291aafda3aacd63" + integrity sha512-rIqbOrKb8GJmx/5bc2M0QchhUouMXSpd1RTclXsB41JdL+VtnojfaJR+h7F9k18/4kHUsBFgk80Uk+q569vjPA== mkdirp@0.5.1, mkdirp@^0.5.1: version "0.5.1" diff --git a/package.json b/package.json index 02a3a9d4..50f6808e 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "riot-web", "productName": "Riot", "main": "electron_app/src/electron-main.js", - "version": "1.5.12", + "version": "1.5.13", "description": "A feature-rich client for Matrix.org", "author": "New Vector Ltd.", "repository": { @@ -37,11 +37,13 @@ "reskindex:watch-react": "node scripts/yarn-sub.js matrix-react-sdk reskindex:watch", "clean": "rimraf lib webapp electron_app/dist", "build": "yarn clean && yarn build:genfiles && yarn build:compile && yarn build:types && yarn build:bundle", + "build-stats": "yarn clean && yarn build:genfiles && yarn build:compile && yarn build:types && yarn build:bundle-stats", "build:res": "node scripts/copy-res.js", "build:genfiles": "yarn reskindex && yarn build:res", "build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js", "build:compile": "babel -d lib --verbose --extensions \".ts,.js,.tsx\" src", "build:bundle": "cross-env NODE_ENV=production webpack -p --progress --bail --mode production", + "build:bundle-stats": "cross-env NODE_ENV=production webpack -p --progress --bail --mode production --json > webpack-stats.json", "build:electron": "yarn build && yarn install:electron && electron-builder -wml --ia32 --x64", "build:electron:linux": "yarn build && electron-builder -l --x64", "build:electron:macos": "yarn build && electron-builder -m --x64", @@ -63,7 +65,6 @@ "dependencies": { "browser-request": "^0.3.3", "favico.js": "^0.3.10", - "gemini-scrollbar": "github:matrix-org/gemini-scrollbar#91e1e566", "gfm.css": "^1.1.2", "highlight.js": "^9.13.1", "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop", @@ -153,7 +154,7 @@ }, "build": { "appId": "im.riot.app", - "electronVersion": "7.1.12", + "electronVersion": "7.1.14", "files": [ "node_modules/**", "src/**" diff --git a/scripts/docker-write-version.sh b/scripts/docker-write-version.sh index 14368fd4..87014b4f 100644 --- a/scripts/docker-write-version.sh +++ b/scripts/docker-write-version.sh @@ -11,7 +11,7 @@ DIST_VERSION=$TAG # a few SHAs rather than a version. # Docker Hub doesn't always check out the tag and sometimes checks out the branch, so we should look # for an appropriately tagged branch as well (heads/v1.2.3). -if [[ $BRANCH != 'HEAD' && $BRANCH != 'heads/v*' ]] +if [[ $BRANCH != HEAD && ! $BRANCH =~ heads/v.+ ]] then REACT_SHA=$(cd node_modules/matrix-react-sdk; git rev-parse --short=12 HEAD) JSSDK_SHA=$(cd node_modules/matrix-js-sdk; git rev-parse --short=12 HEAD) diff --git a/scripts/redeploy.py b/scripts/redeploy.py index 6e9d29c3..064bbfaa 100755 --- a/scripts/redeploy.py +++ b/scripts/redeploy.py @@ -133,9 +133,9 @@ def on_receive_buildkite_poke(): for artifact in artifacts_array: if re.match(r"dist/.*.tar.gz", artifact['path']): artifact_to_deploy = artifact - if artifact_to_deploy is None: - print("No suitable artifacts found") - return jsonify({}) + if artifact_to_deploy is None: + print("No suitable artifacts found") + return jsonify({}) # double paranoia check: make sure the artifact is on the right org too if required_api_prefix is not None and not artifact_to_deploy['url'].startswith(required_api_prefix): diff --git a/src/i18n/strings/bg.json b/src/i18n/strings/bg.json index 747c4cbe..9232d0ab 100644 --- a/src/i18n/strings/bg.json +++ b/src/i18n/strings/bg.json @@ -21,5 +21,7 @@ "Your Riot is misconfigured": "Riot не е конфигуриран правилно", "Your Riot configuration contains invalid JSON. Please correct the problem and reload the page.": "Riot конфигурацията ви съдържа невалиден JSON. Коригирайте проблема и презаредете страницата.", "The message from the parser is: %(message)s": "Грешката от парсъра е: %(message)s", - "Invalid JSON": "Невалиден JSON" + "Invalid JSON": "Невалиден JSON", + "Open user settings": "Отвори потребителските настройки", + "Go to your browser to complete Sign In": "Отидете в браузъра за да завършите влизането" } diff --git a/src/i18n/strings/cy.json b/src/i18n/strings/cy.json index 8f031b3e..85986d02 100644 --- a/src/i18n/strings/cy.json +++ b/src/i18n/strings/cy.json @@ -21,5 +21,6 @@ "Need help?": "Angen cymorth?", "Chat with Riot Bot": "Sgwrsio gyda Riot Bot", "Explore rooms": "Archwilio Ystafelloedd", - "Room Directory": "Cyfeiriadur Ystafelloedd" + "Room Directory": "Cyfeiriadur Ystafelloedd", + "Go to your browser to complete Sign In": "Ewch i'ch porwr i gwblhau Mewngofnodi" } diff --git a/src/i18n/strings/de_DE.json b/src/i18n/strings/de_DE.json index 82bfe50a..b501e70a 100644 --- a/src/i18n/strings/de_DE.json +++ b/src/i18n/strings/de_DE.json @@ -22,5 +22,6 @@ "Your Riot configuration contains invalid JSON. Please correct the problem and reload the page.": "Deine Riot Konfiguration enthält ungültiges JSON. Bitte korrigiere das Problem und lade die Seite neu.", "The message from the parser is: %(message)s": "Die Nachricht des Parsers ist: %(message)s", "Invalid JSON": "Ungültiges JSON", - "Go to your browser to complete Sign In": "Gehe zu deinem Browser, um die Anmeldung abzuschließen" + "Go to your browser to complete Sign In": "Gehe zu deinem Browser, um die Anmeldung abzuschließen", + "Open user settings": "Öffne Nutzer-Einstellungen" } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 36f19a75..b77de122 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -6,6 +6,7 @@ "Unexpected error preparing the app. See console for details.": "Unexpected error preparing the app. See console for details.", "Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url.": "Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url.", "Invalid configuration: no default server specified.": "Invalid configuration: no default server specified.", + "Open user settings": "Open user settings", "Riot Desktop on %(platformName)s": "Riot Desktop on %(platformName)s", "Go to your browser to complete Sign In": "Go to your browser to complete Sign In", "Unknown device": "Unknown device", diff --git a/src/i18n/strings/eu.json b/src/i18n/strings/eu.json index 77d84539..f8e204c3 100644 --- a/src/i18n/strings/eu.json +++ b/src/i18n/strings/eu.json @@ -22,5 +22,6 @@ "Your Riot configuration contains invalid JSON. Please correct the problem and reload the page.": "Zure Riot konfigurazioak baliogabeko JSON kodea du. Zuzendu arazoa eta kargatu orria berriro.", "The message from the parser is: %(message)s": "Prozesatzailearen mezua hau da: %(message)s", "Invalid JSON": "JSON baliogabea", - "Go to your browser to complete Sign In": "Joan zure nabigatzailera izena ematen bukatzeko" + "Go to your browser to complete Sign In": "Joan zure nabigatzailera izena ematen bukatzeko", + "Open user settings": "Ireki erabiltzailearen ezarpenak" } diff --git a/src/i18n/strings/fr.json b/src/i18n/strings/fr.json index 2ec3a58e..7deba39b 100644 --- a/src/i18n/strings/fr.json +++ b/src/i18n/strings/fr.json @@ -22,5 +22,6 @@ "Your Riot configuration contains invalid JSON. Please correct the problem and reload the page.": "Votre configuration de Riot contient du JSON non valide. Corrigez ce problème et rechargez la page.", "The message from the parser is: %(message)s": "Le message de l’analyseur est : %(message)s", "Invalid JSON": "JSON non valide", - "Go to your browser to complete Sign In": "Utilisez votre navigateur pour terminer la connexion" + "Go to your browser to complete Sign In": "Utilisez votre navigateur pour terminer la connexion", + "Open user settings": "Ouvrir les paramètres utilisateur" } diff --git a/src/i18n/strings/oc.json b/src/i18n/strings/oc.json new file mode 100644 index 00000000..875bd575 --- /dev/null +++ b/src/i18n/strings/oc.json @@ -0,0 +1,22 @@ +{ + "Your Riot configuration contains invalid JSON. Please correct the problem and reload the page.": "Vòstra configuracion Riot conten de JSON invalid. Mercés de corregir lo problèma e d’actualizar la pagina.", + "The message from the parser is: %(message)s": "Lo messatge de l’analisaire es : %(message)s", + "Invalid JSON": "Invalid JSON", + "Your Riot is misconfigured": "Vòstre Riot es mal configurat", + "Unexpected error preparing the app. See console for details.": "Error inesperada en preparant l’aplicacion. Vejatz la consòla pels detalhs.", + "Riot Desktop on %(platformName)s": "Riot Desktop sus %(platformName)s", + "Go to your browser to complete Sign In": "Anatz al navegador per acabar la connexion", + "Unknown device": "Periferic desconegut", + "%(appName)s via %(browserName)s on %(osName)s": "%(appName)s via %(browserName)s sus %(osName)s", + "powered by Matrix": "propulsat per Matrix", + "Custom Server Options": "Opcions de servidor personalizat", + "Dismiss": "Refusar", + "Welcome to Riot.im": "La benvenguda a Riot.im", + "Decentralised, encrypted chat & collaboration powered by [matrix]": "Messatjariá chifrada, descentralizada e collaborativa propulsada per [matrix]", + "Sign In": "Se connectar", + "Create Account": "Crear un compte", + "Need help?": "Besonh d’ajuda ?", + "Chat with Riot Bot": "Charrar amb lo robòt Riot", + "Explore rooms": "Percórrer las salas", + "Room Directory": "Annuari de las sala" +} diff --git a/src/i18n/strings/pt.json b/src/i18n/strings/pt.json index 2e987ad8..e7a5b028 100644 --- a/src/i18n/strings/pt.json +++ b/src/i18n/strings/pt.json @@ -1,25 +1,26 @@ { - "Custom Server Options": "Opções para Servidor Personalizado", + "Custom Server Options": "Opções do Servidor Personalizado", "Dismiss": "Descartar", - "powered by Matrix": "rodando a partir do Matrix", + "powered by Matrix": "powered by Matrix", "%(appName)s via %(browserName)s on %(osName)s": "%(appName)s via %(browserName)s em %(osName)s", - "Riot Desktop on %(platformName)s": "Riot para computadores desktop em %(platformName)s", + "Riot Desktop on %(platformName)s": "Riot Desktop em %(platformName)s", "Unknown device": "Dispositivo desconhecido", "You need to be using HTTPS to place a screen-sharing call.": "Necessita de estar a usar HTTPS para poder iniciar uma chamada com partilha de ecrã.", "Welcome to Riot.im": "Bem-vindo ao Riot.im", - "Decentralised, encrypted chat & collaboration powered by [matrix]": "Chat descentralizado, encriptado & colaborativo alimentado por [matrix]", + "Decentralised, encrypted chat & collaboration powered by [matrix]": "Chat descentralizado, encriptado & colaborativo powered by [matrix]", "Chat with Riot Bot": "Falar com o Bot do Riot", - "Your Riot configuration contains invalid JSON. Please correct the problem and reload the page.": "A sua configuração do RIOT contém JSON inválido. Por favor corriga o erro e recarregue a página.", - "The message from the parser is: %(message)s": "A mensagem do analisador é: %(message)s", + "Your Riot configuration contains invalid JSON. Please correct the problem and reload the page.": "A sua configuração do Riot contém JSON inválido. Por favor corrija o erro e recarregue a página.", + "The message from the parser is: %(message)s": "A mensagem do parser é: %(message)s", "Invalid JSON": "JSON inválido", - "Your Riot is misconfigured": "A sua configuração do RIOT está incorrecta.", + "Your Riot is misconfigured": "Existe um erro na configuração do Riot", "Unexpected error preparing the app. See console for details.": "Erro inesperado na preparação da aplicação. Veja a consola para mais detalhes.", - "Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url.": "Configuração inválida: só pode especificar uma das default_server_config, default_server_name,\nor default_hs_url.", - "Invalid configuration: no default server specified.": "Configuração inválida: não existe especificação de servidor padrão.", - "You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use Riot with an existing Matrix account on a different homeserver.": "Pode usar as opções de custom server, para iniciar sessão noutros servidores Matrix.org, especificando o URL do homeserver diferente. Isto autoriza-lo-á a usar RIOT com a sua conta Matrix num servidor diferente", + "Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url.": "Configuração inválida: só pode especificar uma das default_server_config, default_server_name, ou default_hs_url.", + "Invalid configuration: no default server specified.": "Configuração inválida: servidor padrão não especificado.", + "You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use Riot with an existing Matrix account on a different homeserver.": "Pode usar as opções de servidor personalizado, para iniciar sessão noutros servidores Matrix, especificando o URL do homeserver diferente. Isto autoriza-lo-á a usar Riot com a sua conta Matrix num servidor diferente.", "Sign In": "Iniciar sessão", "Create Account": "Criar conta", "Need help?": "Ajuda?", "Explore rooms": "Explorar rooms", - "Room Directory": "Diretório de rooms" + "Room Directory": "Diretório de rooms", + "Go to your browser to complete Sign In": "Abra o seu navegador para completar o inicio de sessão" } diff --git a/src/i18n/strings/sq.json b/src/i18n/strings/sq.json index 18c8a9cd..b7c435a8 100644 --- a/src/i18n/strings/sq.json +++ b/src/i18n/strings/sq.json @@ -22,5 +22,6 @@ "Your Riot configuration contains invalid JSON. Please correct the problem and reload the page.": "Formësimi juaj i Riot-it përmban JSON. Ju lutemi, ndreqeni problemin dhe ringarkoni faqen.", "The message from the parser is: %(message)s": "Mesazhi prej procesit është: %(message)s", "Invalid JSON": "JSON i pavlefshëm", - "Go to your browser to complete Sign In": "Që të plotësoni Hyrjen, kaloni te shfletuesi juaj" + "Go to your browser to complete Sign In": "Që të plotësoni Hyrjen, kaloni te shfletuesi juaj", + "Open user settings": "Hapni rregullime përdoruesi" } diff --git a/src/i18n/strings/tr.json b/src/i18n/strings/tr.json index 339add2d..07fa305a 100644 --- a/src/i18n/strings/tr.json +++ b/src/i18n/strings/tr.json @@ -21,5 +21,6 @@ "Unexpected error preparing the app. See console for details.": "Uygulamayı hazırlarken beklenmeyen hata oluştu. Lütfen detaylar için konsola bakınız.", "Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url.": "Geçersiz yapılandırma: default_server_config, default_server_name, yada default_hs_url den sadece birisi seçilebilir.", "Invalid configuration: no default server specified.": "Geçersiz yapılandırma: varsayılan sunucu seçilmemiş.", - "The message from the parser is: %(message)s": "Ayrıştırıcıdan gelen mesaj: %(message)s" + "The message from the parser is: %(message)s": "Ayrıştırıcıdan gelen mesaj: %(message)s", + "Go to your browser to complete Sign In": "Oturum açmayı tamamlamak için tarayıcınıza gidin" } diff --git a/src/i18n/strings/zh_Hant.json b/src/i18n/strings/zh_Hant.json index fcb5cf16..eb2a6ba5 100644 --- a/src/i18n/strings/zh_Hant.json +++ b/src/i18n/strings/zh_Hant.json @@ -22,5 +22,6 @@ "Your Riot configuration contains invalid JSON. Please correct the problem and reload the page.": "您的 Riot 包含無效的 JSON。請修正問題並重新整理頁面。", "The message from the parser is: %(message)s": "從解析器而來的訊息為:%(message)s", "Invalid JSON": "無效的 JSON", - "Go to your browser to complete Sign In": "到您的瀏覽器完成登入" + "Go to your browser to complete Sign In": "到您的瀏覽器完成登入", + "Open user settings": "開啟使用者設定" } diff --git a/src/vector/app.js b/src/vector/app.js index da46dffd..6a1635dd 100644 --- a/src/vector/app.js +++ b/src/vector/app.js @@ -39,9 +39,6 @@ import url from 'url'; import {parseQs, parseQsFromFragment} from './url_utils'; -import ElectronPlatform from './platform/ElectronPlatform'; -import WebPlatform from './platform/WebPlatform'; - import {MatrixClientPeg} from 'matrix-react-sdk/src/MatrixClientPeg'; import SettingsStore from "matrix-react-sdk/src/settings/SettingsStore"; import SdkConfig from "matrix-react-sdk/src/SdkConfig"; @@ -50,6 +47,7 @@ import {setTheme} from "matrix-react-sdk/src/theme"; import Olm from 'olm'; import CallHandler from 'matrix-react-sdk/src/CallHandler'; +import {loadConfig, preparePlatform} from "./initial-load"; let lastLocationHashSet = null; @@ -191,35 +189,11 @@ export async function loadApp() { await loadOlm(); // set the platform for react sdk - if (window.ipcRenderer) { - console.log("Using Electron platform"); - const plaf = new ElectronPlatform(); - PlatformPeg.set(plaf); - } else { - console.log("Using Web platform"); - PlatformPeg.set(new WebPlatform()); - } - + preparePlatform(); const platform = PlatformPeg.get(); - let configJson; - let configError; - let configSyntaxError = false; - try { - configJson = await platform.getConfig(); - } catch (e) { - configError = e; - - if (e && e.err && e.err instanceof SyntaxError) { - console.error("SyntaxError loading config:", e); - configSyntaxError = true; - configJson = {}; // to prevent errors between here and loading CSS for the error box - } - } - - // XXX: We call this twice, once here and once in MatrixChat as a prop. We call it here to ensure - // granular settings are loaded correctly and to avoid duplicating the override logic for the theme. - SdkConfig.put(configJson); + // Load the config from the platform + const configInfo = await loadConfig(); // Load language after loading config.json so that settingsDefaults.language can be applied await loadLanguage(); @@ -248,7 +222,7 @@ export async function loadApp() { await setTheme(); // Now that we've loaded the theme (CSS), display the config syntax error if needed. - if (configSyntaxError) { + if (configInfo.configSyntaxError) { const errorMessage = (
@@ -260,7 +234,7 @@ export async function loadApp() {
{_t( "The message from the parser is: %(message)s", - {message: configError.err.message || _t("Invalid JSON")}, + {message: configInfo.configError.err.message || _t("Invalid JSON")}, )}