Don't guess the server name from the URL

It only uses the default HS URL anywayso just use the default
server name.
This commit is contained in:
David Baker 2022-12-21 09:27:25 +00:00
parent d6b8ecdfd1
commit fd3c0d9fc6

View File

@ -14,14 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import React, { import React, { FC, FormEvent, useCallback, useRef, useState } from "react";
FC,
FormEvent,
useCallback,
useRef,
useState,
useMemo,
} from "react";
import { useHistory, useLocation, Link } from "react-router-dom"; import { useHistory, useLocation, Link } from "react-router-dom";
import { Trans, useTranslation } from "react-i18next"; import { Trans, useTranslation } from "react-i18next";
@ -75,12 +68,6 @@ export const LoginPage: FC = () => {
[login, location, history, homeserver, setClient] [login, location, history, homeserver, setClient]
); );
const homeserverHost = useMemo(() => {
// XXX: This isn't really correct: the server name of an HS may not
// be the same as the hostname of the client API endpoint.
return new URL(homeserver).host;
}, [homeserver]);
return ( return (
<> <>
<div className={styles.container}> <div className={styles.container}>
@ -100,7 +87,7 @@ export const LoginPage: FC = () => {
autoCorrect="off" autoCorrect="off"
autoCapitalize="none" autoCapitalize="none"
prefix="@" prefix="@"
suffix={`:${homeserverHost}`} suffix={`:${Config.defaultServerName()}`}
/> />
</FieldRow> </FieldRow>
<FieldRow> <FieldRow>