diff --git a/config.json b/config.json index c8a5ea6..e7f9eea 100644 --- a/config.json +++ b/config.json @@ -7,5 +7,6 @@ "kde.org", "matrix.org", "chat.mozilla.org" - ] + ], + "allowCustomHomeservers": true } \ No newline at end of file diff --git a/src/app/templates/auth/Auth.jsx b/src/app/templates/auth/Auth.jsx index 33d2152..1f76476 100644 --- a/src/app/templates/auth/Auth.jsx +++ b/src/app/templates/auth/Auth.jsx @@ -93,12 +93,13 @@ function Homeserver({ onChange }) { const result = await (await fetch(configFileUrl, { method: 'GET' })).json(); const selectedHs = result?.defaultHomeserver; const hsList = result?.homeserverList; + const allowCustom = result?.allowCustomHomeservers ?? true; if (!hsList?.length > 0 || selectedHs < 0 || selectedHs >= hsList?.length) { throw new Error(); } - setHs({ selected: hsList[selectedHs], list: hsList }); + setHs({ selected: hsList[selectedHs], list: hsList, allowCustom: allowCustom }); } catch { - setHs({ selected: 'matrix.org', list: ['matrix.org'] }); + setHs({ selected: 'matrix.org', list: ['matrix.org'], allowCustom: true }); } }, []); @@ -106,14 +107,15 @@ function Homeserver({ onChange }) { const { value } = e.target; setProcess({ isLoading: false }); debounce._(async () => { - setHs({ selected: value.trim(), list: hs.list }); + setHs({ ...hs, selected: value.trim() }); }, 700)(); }; return ( <>