Add slashes to end of app links in Welcome (fixes #224)

Signed-off-by: Marquis Kurt <software@marquiskurt.net>
This commit is contained in:
Marquis Kurt 2020-10-03 11:33:00 -04:00
parent 4e8a372234
commit d3729ee76f
No known key found for this signature in database
GPG Key ID: 725636D259F5402D
1 changed files with 22 additions and 26 deletions

View File

@ -392,8 +392,7 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
this.setState({ user: newUser });
return "https://" + newUser.split("@")[1];
} else {
let newUser = `${user}@${
this.state.registerBase ?? "mastodon.online"
let newUser = `${user}@${this.state.registerBase ?? "mastodon.online"
}`;
this.setState({ user: newUser });
return (
@ -404,8 +403,7 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
// Otherwise, treat them as if they're from the server
else {
let newUser = `${user}@${
this.state.registerBase ?? "mastodon.online"
let newUser = `${user}@${this.state.registerBase ?? "mastodon.online"
}`;
this.setState({ user: newUser });
return "https://" + (this.state.registerBase ?? "mastodon.online");
@ -513,7 +511,7 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
authorizeEmergencyLogin() {
let redirAddress =
this.state.defaultRedirectAddress === "desktop"
? "hyperspace://hyperspace/app"
? "hyperspace://hyperspace/app/"
: this.state.defaultRedirectAddress;
window.location.href = `${redirAddress}/?code=${this.state.authCode}#/`;
}
@ -660,8 +658,7 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
})
.catch((err: Error) => {
this.props.enqueueSnackbar(
`Couldn't authorize ${
this.state.brandName ?? "Hyperspace"
`Couldn't authorize ${this.state.brandName ?? "Hyperspace"
}: ${err.name}`,
{ variant: "error" }
);
@ -678,7 +675,7 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
redirectToApp() {
window.location.href =
window.location.protocol === "hyperspace:"
? "hyperspace://hyperspace/app"
? "hyperspace://hyperspace/app/"
: this.state.redirectAddressIsDynamic
? `https://${window.location.host}/#/`
: this.state.defaultRedirectAddress + "/#/";
@ -977,8 +974,7 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
<div
className={classes.root}
style={{
backgroundImage: `url(${
this.state.backgroundUrl ?? "background.png"
backgroundImage: `url(${this.state.backgroundUrl ?? "background.png"
})`,
}}
>