mirror of
https://github.com/hyperspacedev/hyperspace
synced 2025-01-31 01:29:37 +01:00
Re-organize about and verify instance name with Mastodon server
This commit is contained in:
parent
afac5531af
commit
3bf99531cd
@ -140,44 +140,6 @@ class AboutPage extends Component<any, IAboutPageState> {
|
||||
</ListItemAvatar>
|
||||
<ListItemText primary="App version" secondary={`${this.state? this.state.brandName: "Hyperspace"} v${this.state? this.state.versionNumber: "1.0.x"} ${this.state && this.state.brandName !== "Hyperspace"? "(Hyperspace-like)": ""}`}/>
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
<ListItemAvatar>
|
||||
<Avatar src={this.state.hyperspaceAdmin? this.state.hyperspaceAdmin.avatar_static: ""}>
|
||||
<PersonIcon/>
|
||||
</Avatar>
|
||||
</ListItemAvatar>
|
||||
<ListItemText primary="App provider" secondary={this.state.hyperspaceAdmin && this.state.hyperspaceAdminName? (this.state.hyperspaceAdminName || this.state.hyperspaceAdmin.display_name || "@" + this.state.hyperspaceAdmin.acct): "No provider set in config"}/>
|
||||
<ListItemSecondaryAction>
|
||||
<LinkableIconButton to={`/compose?visibility=${this.state.federated? "public": "private"}&acct=${this.state.hyperspaceAdmin? this.state.hyperspaceAdmin.acct: ""}`}>
|
||||
<ChatIcon/>
|
||||
</LinkableIconButton>
|
||||
<LinkableIconButton to={`/profile/${this.state.hyperspaceAdmin? this.state.hyperspaceAdmin.id: 0}`}>
|
||||
<PersonIcon/>
|
||||
</LinkableIconButton>
|
||||
</ListItemSecondaryAction>
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
<ListItemAvatar>
|
||||
<Avatar>
|
||||
<NetworkCheckIcon/>
|
||||
</Avatar>
|
||||
</ListItemAvatar>
|
||||
<ListItemText primary="Federation status" secondary={`This instance of ${this.state? this.state.brandName: "Hyperspace"} is ${this.state? this.state.federated? "": "not": "unknown"} federated.`}/>
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
<ListItemAvatar>
|
||||
<Avatar>
|
||||
<UpdateIcon/>
|
||||
</Avatar>
|
||||
</ListItemAvatar>
|
||||
<ListItemText primary="Release channel" secondary={
|
||||
this.state?
|
||||
this.state.developer?
|
||||
"Developer":
|
||||
"Release":
|
||||
"Loading..."
|
||||
}/>
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
<ListItemAvatar>
|
||||
<Avatar>
|
||||
@ -210,6 +172,50 @@ class AboutPage extends Component<any, IAboutPageState> {
|
||||
</List>
|
||||
</Paper>
|
||||
<br/>
|
||||
<ListSubheader>Advanced app info</ListSubheader>
|
||||
<Paper className={classes.pageListConstraints}>
|
||||
<List>
|
||||
<ListItem>
|
||||
<ListItemAvatar>
|
||||
<Avatar src={this.state.hyperspaceAdmin? this.state.hyperspaceAdmin.avatar_static: ""}>
|
||||
<PersonIcon/>
|
||||
</Avatar>
|
||||
</ListItemAvatar>
|
||||
<ListItemText primary="App provider" secondary={this.state.hyperspaceAdmin && this.state.hyperspaceAdminName? (this.state.hyperspaceAdminName || this.state.hyperspaceAdmin.display_name || "@" + this.state.hyperspaceAdmin.acct): "No provider set in config"}/>
|
||||
<ListItemSecondaryAction>
|
||||
<LinkableIconButton to={`/compose?visibility=${this.state.federated? "public": "private"}&acct=${this.state.hyperspaceAdmin? this.state.hyperspaceAdmin.acct: ""}`}>
|
||||
<ChatIcon/>
|
||||
</LinkableIconButton>
|
||||
<LinkableIconButton to={`/profile/${this.state.hyperspaceAdmin? this.state.hyperspaceAdmin.id: 0}`}>
|
||||
<PersonIcon/>
|
||||
</LinkableIconButton>
|
||||
</ListItemSecondaryAction>
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
<ListItemAvatar>
|
||||
<Avatar>
|
||||
<NetworkCheckIcon/>
|
||||
</Avatar>
|
||||
</ListItemAvatar>
|
||||
<ListItemText primary="Federation status" secondary={`This instance of ${this.state? this.state.brandName: "Hyperspace"} ${this.state? this.state.federated? "supports": "doesn't support": "might support"} federation.`}/>
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
<ListItemAvatar>
|
||||
<Avatar>
|
||||
<UpdateIcon/>
|
||||
</Avatar>
|
||||
</ListItemAvatar>
|
||||
<ListItemText primary="Release channel" secondary={
|
||||
this.state?
|
||||
this.state.developer?
|
||||
"Developer":
|
||||
"Release":
|
||||
"Loading..."
|
||||
}/>
|
||||
</ListItem>
|
||||
</List>
|
||||
</Paper>
|
||||
<br/>
|
||||
<div>
|
||||
<Typography variant="caption">(C) 2019 {this.state? this.state.brandName: "Hyperspace"} developers. All rights reserved.</Typography>
|
||||
<Typography variant="caption" paragraph>{this.state? this.state.brandName: "Hyperspace"} is made possible by the <Link href={"https://material-ui.com"} target="_blank" rel="noreferrer">Material UI</Link> project, <Link href={"https://www.npmjs.com/package/megalodon"} target="_blank" rel="noreferrer">Megalodon</Link> library, and other <Link href={"https://github.com/hyperspacedev/hyperspace/blob/master/package.json"} target="_blank" rel="noreferrer">open source software</Link>.</Typography>
|
||||
|
@ -6,6 +6,7 @@ import {SaveClientSession} from '../types/SessionData';
|
||||
import { createHyperspaceApp } from '../utilities/login';
|
||||
import {parseUrl} from 'query-string';
|
||||
import { getConfig } from '../utilities/settings';
|
||||
import axios from 'axios';
|
||||
|
||||
interface IWelcomeState {
|
||||
logoUrl?: string;
|
||||
@ -16,6 +17,7 @@ interface IWelcomeState {
|
||||
wantsToLogin: boolean;
|
||||
user: string;
|
||||
userInputError: boolean;
|
||||
userInputErrorMessage: string;
|
||||
clientId?: string;
|
||||
clientSecret?: string;
|
||||
authUrl?: string;
|
||||
@ -35,7 +37,8 @@ class WelcomePage extends Component<any, IWelcomeState> {
|
||||
user: "",
|
||||
userInputError: false,
|
||||
foundSavedLogin: false,
|
||||
authority: false
|
||||
authority: false,
|
||||
userInputErrorMessage: ''
|
||||
}
|
||||
|
||||
getConfig().then((result: any) => {
|
||||
@ -161,7 +164,26 @@ class WelcomePage extends Component<any, IWelcomeState> {
|
||||
}
|
||||
|
||||
checkForErrors() {
|
||||
this.setState({ userInputError: this.state.user === "" })
|
||||
let userInputError = false;
|
||||
let userInputErrorMessage = "";
|
||||
|
||||
if (this.state.user === "") {
|
||||
userInputError = true;
|
||||
userInputErrorMessage = "Field cannot be blank.";
|
||||
this.setState({ userInputError, userInputErrorMessage });
|
||||
} else {
|
||||
if (this.state.user.includes("@")) {
|
||||
let baseUrl = this.state.user.split("@")[1];
|
||||
axios.get("https://" + baseUrl + "/api/v1/timelines/public").catch((err: Error) => {
|
||||
let userInputError = true;
|
||||
let userInputErrorMessage = "Invalid instance name";
|
||||
this.setState({ userInputError, userInputErrorMessage });
|
||||
})
|
||||
} else {
|
||||
this.setState({ userInputError, userInputErrorMessage });
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
readyForAuth() {
|
||||
@ -188,6 +210,9 @@ class WelcomePage extends Component<any, IWelcomeState> {
|
||||
error={this.state.userInputError}
|
||||
onBlur={() => this.checkForErrors()}
|
||||
></TextField>
|
||||
{
|
||||
this.state.userInputError? <Typography color="error">{this.state.userInputErrorMessage}</Typography> : null
|
||||
}
|
||||
{
|
||||
this.state.registerBase? <Typography variant="caption">If you are from <b>{this.state.registerBase? this.state.registerBase: "noinstance"}</b>, sign in with your username.</Typography>: null
|
||||
}
|
||||
@ -260,7 +285,7 @@ class WelcomePage extends Component<any, IWelcomeState> {
|
||||
return (
|
||||
<div className={classes.root} style={{ backgroundImage: `url(${this.state !== null? this.state.backgroundUrl: "background.png"})`}}>
|
||||
<Paper className={classes.paper}>
|
||||
<img className={classes.logo} src={this.state? this.state.logoUrl: "logo.png"}/>
|
||||
<img className={classes.logo} alt={this.state? this.state.brandName: "Hyperspace"} src={this.state? this.state.logoUrl: "logo.png"}/>
|
||||
<br/>
|
||||
<Fade in={true}>
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user