From 0716434aa1cac6bf5434bbac0f55e137e6060d21 Mon Sep 17 00:00:00 2001 From: David Langley Date: Fri, 13 Sep 2024 16:59:11 +0100 Subject: [PATCH] Allow hs_url as param on mobile_register --- src/components/structures/MatrixChat.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/structures/MatrixChat.tsx b/src/components/structures/MatrixChat.tsx index a4119382a1..0de3498003 100644 --- a/src/components/structures/MatrixChat.tsx +++ b/src/components/structures/MatrixChat.tsx @@ -961,9 +961,16 @@ export default class MatrixChat extends React.PureComponent { view: Views.REGISTER, }; - // Only honour params if they are all present, otherwise we reset - // HS and IS URLs when switching to registration. - if (params.client_secret && params.session_id && params.hs_url && params.is_url && params.sid) { + if (isMobileRegistration && params.hs_url) { + try { + const config = await AutoDiscoveryUtils.validateServerConfigWithStaticUrls(params.hs_url); + newState.serverConfig = config; + } catch (err) { + logger.warn("Failed to load hs_url param:", params.hs_url); + } + } else if (params.client_secret && params.session_id && params.hs_url && params.is_url && params.sid) { + // Only honour params if they are all present, otherwise we reset + // HS and IS URLs when switching to registration. newState.serverConfig = await AutoDiscoveryUtils.validateServerConfigWithStaticUrls( params.hs_url, params.is_url,