Add slashes to end of app links in Welcome (fixes #224)
Signed-off-by: Marquis Kurt <software@marquiskurt.net>
This commit is contained in:
parent
4e8a372234
commit
d3729ee76f
|
@ -392,9 +392,8 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
|
||||||
this.setState({ user: newUser });
|
this.setState({ user: newUser });
|
||||||
return "https://" + newUser.split("@")[1];
|
return "https://" + newUser.split("@")[1];
|
||||||
} else {
|
} else {
|
||||||
let newUser = `${user}@${
|
let newUser = `${user}@${this.state.registerBase ?? "mastodon.online"
|
||||||
this.state.registerBase ?? "mastodon.online"
|
}`;
|
||||||
}`;
|
|
||||||
this.setState({ user: newUser });
|
this.setState({ user: newUser });
|
||||||
return (
|
return (
|
||||||
"https://" + (this.state.registerBase ?? "mastodon.online")
|
"https://" + (this.state.registerBase ?? "mastodon.online")
|
||||||
|
@ -404,9 +403,8 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
|
||||||
|
|
||||||
// Otherwise, treat them as if they're from the server
|
// Otherwise, treat them as if they're from the server
|
||||||
else {
|
else {
|
||||||
let newUser = `${user}@${
|
let newUser = `${user}@${this.state.registerBase ?? "mastodon.online"
|
||||||
this.state.registerBase ?? "mastodon.online"
|
}`;
|
||||||
}`;
|
|
||||||
this.setState({ user: newUser });
|
this.setState({ user: newUser });
|
||||||
return "https://" + (this.state.registerBase ?? "mastodon.online");
|
return "https://" + (this.state.registerBase ?? "mastodon.online");
|
||||||
}
|
}
|
||||||
|
@ -513,7 +511,7 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
|
||||||
authorizeEmergencyLogin() {
|
authorizeEmergencyLogin() {
|
||||||
let redirAddress =
|
let redirAddress =
|
||||||
this.state.defaultRedirectAddress === "desktop"
|
this.state.defaultRedirectAddress === "desktop"
|
||||||
? "hyperspace://hyperspace/app"
|
? "hyperspace://hyperspace/app/"
|
||||||
: this.state.defaultRedirectAddress;
|
: this.state.defaultRedirectAddress;
|
||||||
window.location.href = `${redirAddress}/?code=${this.state.authCode}#/`;
|
window.location.href = `${redirAddress}/?code=${this.state.authCode}#/`;
|
||||||
}
|
}
|
||||||
|
@ -565,7 +563,7 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
|
||||||
axios
|
axios
|
||||||
.get(
|
.get(
|
||||||
"https://instances.social/api/1.0/instances/show?name=" +
|
"https://instances.social/api/1.0/instances/show?name=" +
|
||||||
baseUrl,
|
baseUrl,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${instancesBearerKey}`,
|
Authorization: `Bearer ${instancesBearerKey}`,
|
||||||
|
@ -635,9 +633,9 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
|
||||||
|
|
||||||
let redirectUrl: string | undefined =
|
let redirectUrl: string | undefined =
|
||||||
this.state.emergencyMode ||
|
this.state.emergencyMode ||
|
||||||
clientLoginSession.authUrl.includes(
|
clientLoginSession.authUrl.includes(
|
||||||
"urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob"
|
"urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob"
|
||||||
)
|
)
|
||||||
? undefined
|
? undefined
|
||||||
: getRedirectAddress(conf.location);
|
: getRedirectAddress(conf.location);
|
||||||
|
|
||||||
|
@ -660,8 +658,7 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
|
||||||
})
|
})
|
||||||
.catch((err: Error) => {
|
.catch((err: Error) => {
|
||||||
this.props.enqueueSnackbar(
|
this.props.enqueueSnackbar(
|
||||||
`Couldn't authorize ${
|
`Couldn't authorize ${this.state.brandName ?? "Hyperspace"
|
||||||
this.state.brandName ?? "Hyperspace"
|
|
||||||
}: ${err.name}`,
|
}: ${err.name}`,
|
||||||
{ variant: "error" }
|
{ variant: "error" }
|
||||||
);
|
);
|
||||||
|
@ -678,10 +675,10 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
|
||||||
redirectToApp() {
|
redirectToApp() {
|
||||||
window.location.href =
|
window.location.href =
|
||||||
window.location.protocol === "hyperspace:"
|
window.location.protocol === "hyperspace:"
|
||||||
? "hyperspace://hyperspace/app"
|
? "hyperspace://hyperspace/app/"
|
||||||
: this.state.redirectAddressIsDynamic
|
: this.state.redirectAddressIsDynamic
|
||||||
? `https://${window.location.host}/#/`
|
? `https://${window.location.host}/#/`
|
||||||
: this.state.defaultRedirectAddress + "/#/";
|
: this.state.defaultRedirectAddress + "/#/";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -977,9 +974,8 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
|
||||||
<div
|
<div
|
||||||
className={classes.root}
|
className={classes.root}
|
||||||
style={{
|
style={{
|
||||||
backgroundImage: `url(${
|
backgroundImage: `url(${this.state.backgroundUrl ?? "background.png"
|
||||||
this.state.backgroundUrl ?? "background.png"
|
})`,
|
||||||
})`,
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Paper className={classes.paper}>
|
<Paper className={classes.paper}>
|
||||||
|
@ -993,17 +989,17 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
|
||||||
{this.state.authorizing
|
{this.state.authorizing
|
||||||
? this.showAuthorizationLoader()
|
? this.showAuthorizationLoader()
|
||||||
: this.state.proceedToGetCode
|
: this.state.proceedToGetCode
|
||||||
? this.showLoginAuth()
|
? this.showLoginAuth()
|
||||||
: getAccountRegistry().length > 0 &&
|
: getAccountRegistry().length > 0 &&
|
||||||
!this.state.willAddAccount
|
!this.state.willAddAccount
|
||||||
? this.showMultiAccount()
|
? this.showMultiAccount()
|
||||||
: this.showLanding()}
|
: this.showLanding()}
|
||||||
</Fade>
|
</Fade>
|
||||||
<br />
|
<br />
|
||||||
<Typography variant="caption">
|
<Typography variant="caption">
|
||||||
© {new Date().getFullYear()}{" "}
|
© {new Date().getFullYear()}{" "}
|
||||||
{this.state.brandName &&
|
{this.state.brandName &&
|
||||||
this.state.brandName !== "Hyperspace"
|
this.state.brandName !== "Hyperspace"
|
||||||
? `${this.state.brandName} developers and the `
|
? `${this.state.brandName} developers and the `
|
||||||
: ""}{" "}
|
: ""}{" "}
|
||||||
<Link
|
<Link
|
||||||
|
@ -1058,7 +1054,7 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
|
||||||
{this.state.brandName ?? "Hypersapce"} v.
|
{this.state.brandName ?? "Hypersapce"} v.
|
||||||
{this.state.version}{" "}
|
{this.state.version}{" "}
|
||||||
{this.state.brandName &&
|
{this.state.brandName &&
|
||||||
this.state.brandName !== "Hyperspace"
|
this.state.brandName !== "Hyperspace"
|
||||||
? "(Hyperspace-like)"
|
? "(Hyperspace-like)"
|
||||||
: null}
|
: null}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
Loading…
Reference in New Issue