Comment out unnecessary console logs and update getConfig

This commit is contained in:
Marquis Kurt 2020-02-16 14:49:55 -05:00
parent 931244cb5a
commit 33d42991f3
No known key found for this signature in database
GPG Key ID: 725636D259F5402D
8 changed files with 18 additions and 9 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "hyperspace",
"version": "1.1.0-beta2",
"version": "1.1.0-beta4",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -324,7 +324,7 @@ export class AppLayout extends Component<any, IAppLayoutState> {
*/
searchForQuery(what: string) {
what = what.replace(/^#/g, "tag:");
console.log(what);
// console.log(what);
window.location.href = isDesktopApp()
? "hyperspace://hyperspace/app/index.html#/search?query=" + what
: "/#/search?query=" + what;

View File

@ -119,7 +119,7 @@ export class Post extends React.Component<any, IPostState> {
})
.catch((err: Error) => {
this.props.enqueueSnackbar("Couldn't delete post: " + err.name);
console.log(err.message);
console.error(err.message);
});
}
@ -405,7 +405,7 @@ export class Post extends React.Component<any, IPostState> {
emojis.concat(reblogger.emojis);
}
console.log(post);
// console.log(post);
return (
<>

View File

@ -83,7 +83,7 @@ class ActivityPage extends Component<any, IActivityPageState> {
viewLoading: false,
viewErrored: true
});
console.log(err.message);
console.error(err.message);
});
this.client
@ -101,7 +101,7 @@ class ActivityPage extends Component<any, IActivityPageState> {
viewLoading: false,
viewErrored: true
});
console.log(err.message);
console.error(err.message);
});
}

View File

@ -159,7 +159,7 @@ class SearchPage extends Component<any, ISearchPageState> {
viewDidLoad: true,
viewIsLoading: false
});
console.log(this.state.tagResults);
// console.log(this.state.tagResults);
})
.catch((err: Error) => {
this.setState({

View File

@ -170,7 +170,7 @@ class SettingsPage extends Component<any, ISettingsState> {
getConfig().then((result: any) => {
if (result !== undefined) {
let config: Config = result;
console.log(!config.federation.allowPublicPosts);
// console.log(!config.federation.allowPublicPosts);
this.setState({
federated: config.federation.allowPublicPosts
});

View File

@ -74,7 +74,7 @@ class You extends Component<IYouProps, IYouState> {
getAccount() {
let acct = localStorage.getItem("account");
console.log(acct);
// console.log(acct);
if (acct) {
return JSON.parse(acct);
}

View File

@ -136,6 +136,15 @@ export function createUserDefaults() {
export async function getConfig(): Promise<Config | undefined> {
try {
const resp = await axios.get("config.json");
let { location } = resp.data;
if (!location.endsWith("/")) {
console.warn(
"Location does not have a backslash, so Hyperspace has added it automatically."
);
resp.data.location = location + "/";
}
return resp.data as Config;
} catch (err) {
console.error(