From 6ad049efeba084acc239fdce0f42dea24f3fb193 Mon Sep 17 00:00:00 2001 From: aj Date: Wed, 29 Jan 2020 12:31:19 +0000 Subject: [PATCH] fixed auth process, material settings --- music/auth/auth.py | 4 +- src/js/Index/Index.js | 46 +++++++++--------- src/js/Playlist/New.js | 13 +++-- src/js/Playlist/View/Edit.js | 5 +- src/js/Settings/ChangePassword.js | 79 ++++++++++++++++--------------- src/js/Settings/LastFM.js | 52 ++++++++++---------- src/js/Settings/SettingsRouter.js | 45 +++++++++++++----- src/js/Settings/SpotifyLink.js | 36 ++++++-------- 8 files changed, 155 insertions(+), 125 deletions(-) diff --git a/music/auth/auth.py b/music/auth/auth.py index 5e10df5..520afe3 100644 --- a/music/auth/auth.py +++ b/music/auth/auth.py @@ -114,7 +114,7 @@ def auth(): 'client_id': client_id, 'response_type': 'code', 'scope': 'playlist-modify-public playlist-modify-private playlist-read-private user-read-playback-state user-modify-playback-state user-library-read', - 'redirect_uri': 'https://spotify.sarsoo.xyz/auth/spotify/token' + 'redirect_uri': 'https://music.sarsoo.xyz/auth/spotify/token' } ) @@ -141,7 +141,7 @@ def token(): data = { 'grant_type': 'authorization_code', 'code': code, - 'redirect_uri': 'https://spotify.sarsoo.xyz/auth/spotify/token' + 'redirect_uri': 'https://music.sarsoo.xyz/auth/spotify/token' } req = requests.post('https://accounts.spotify.com/api/token', data=data, headers=headers) diff --git a/src/js/Index/Index.js b/src/js/Index/Index.js index dc7c701..1d14848 100644 --- a/src/js/Index/Index.js +++ b/src/js/Index/Index.js @@ -1,5 +1,7 @@ import React, { Component } from "react"; +import { Card, CardContent, Typography, Grid } from '@material-ui/core'; + class Index extends Component{ constructor(props){ @@ -9,30 +11,26 @@ class Index extends Component{ render(){ return ( - - - - - - - - - - - - - - - -
- Construct spotify playlists from selections of other playlists -
- Group sub-genre playlists -
- Optionally append auto-generated recommendations -
-

Playlists are run multiple times a day -
+
+ + + + + Construct spotify playlists from selections of other playlists + + + Group sub-genre playlists + + + Optionally append auto-generated recommendations + + + Playlists are run multiple times a day + + + + +
); } } diff --git a/src/js/Playlist/New.js b/src/js/Playlist/New.js index e8eaf8b..34cf4a4 100644 --- a/src/js/Playlist/New.js +++ b/src/js/Playlist/New.js @@ -83,13 +83,14 @@ class NewPlaylist extends Component { render(){ return ( +
- + New - + Type - + + value={this.state.name} + className="full-width" /> { this.state.description } @@ -123,6 +127,7 @@ class NewPlaylist extends Component { +
); } diff --git a/src/js/Playlist/View/Edit.js b/src/js/Playlist/View/Edit.js index 6100ead..4745855 100644 --- a/src/js/Playlist/View/Edit.js +++ b/src/js/Playlist/View/Edit.js @@ -125,7 +125,7 @@ export class Edit extends Component{ getPlaylistInfo(){ return axios.get(`/api/playlist?name=${ this.state.name }`); - } + } getPlaylists(){ return axios.get(`/api/playlists`); @@ -168,7 +168,7 @@ export class Edit extends Component{ showMessage(`Error Updating Boundary Value (${error.response.status})`); }); } - + handleRecommendationsSampleChange(sample){ if(sample == ''){ sample = 0; @@ -421,6 +421,7 @@ export class Edit extends Component{ -
- - - - - - - - - - - - - - - - - - - - - - - -

Change Password

Current: + + + + + + Change Password + + +
New: + + +
New Again: + + +
-
- { this.state.error &&

{this.state.errorValue}

} + name="new2" + value={this.state.new2} + className="full-width" /> +
+ { this.state.error && {this.state.errorValue}} + + + + + + + ); } diff --git a/src/js/Settings/LastFM.js b/src/js/Settings/LastFM.js index 88174d1..3f673bd 100644 --- a/src/js/Settings/LastFM.js +++ b/src/js/Settings/LastFM.js @@ -1,6 +1,8 @@ import React, { Component } from "react"; const axios = require('axios'); +import { Card, Button, CardContent, CardActions, Typography, TextField, Grid } from "@material-ui/core"; + import showMessage from "../Toast.js" class LastFM extends Component { @@ -64,30 +66,32 @@ class LastFM extends Component { } render(){ - const table = -
- - - - - - - - - - - - - - - -

Last.fm Username

Username:
-
; + const table = +
+ +
+ + + + Last.fm Username + + + + + + + + + +
+
+
; const loadingMessage =

Loading...

; diff --git a/src/js/Settings/SettingsRouter.js b/src/js/Settings/SettingsRouter.js index d3c3955..ae7fef7 100644 --- a/src/js/Settings/SettingsRouter.js +++ b/src/js/Settings/SettingsRouter.js @@ -1,5 +1,6 @@ import React, { Component } from "react"; -import { BrowserRouter as Route, Link } from "react-router-dom"; +import { Route, Link, Switch } from "react-router-dom"; +import { Paper, Tabs, Tab} from '@material-ui/core'; import ChangePassword from "./ChangePassword.js"; import SpotifyLink from "./SpotifyLink.js"; @@ -7,19 +8,41 @@ import LastFM from "./LastFM.js"; class Settings extends Component { + constructor(props){ + super(props); + this.state = { + tab: 0 + } + this.handleChange = this.handleChange.bind(this); + } + + handleChange(e, newValue){ + this.setState({ + tab: newValue + }); + } + render() { return (
- - - - - - + + + + + + + + + + + +
); } diff --git a/src/js/Settings/SpotifyLink.js b/src/js/Settings/SpotifyLink.js index 41efe8c..7d82a7f 100644 --- a/src/js/Settings/SpotifyLink.js +++ b/src/js/Settings/SpotifyLink.js @@ -1,6 +1,8 @@ import React, { Component } from "react"; const axios = require('axios'); +import { Card, Button, CardContent, CardActions, Typography } from "@material-ui/core"; + import showMessage from "../Toast.js" class SpotifyLink extends Component { @@ -29,25 +31,17 @@ class SpotifyLink extends Component { render(){ const table = - - - - - - - - - - - - - - -

Spotify Link

- Status: { this.state.spotify_linked ? "Linked" : "Unlinked" } -
- { this.state.spotify_linked ? : } -
; +
+ + + Admin Functions + Status: { this.state.spotify_linked ? "Linked" : "Unlinked" } + + + { this.state.spotify_linked ? : } + + +
; const loadingMessage =

Loading...

; @@ -56,11 +50,11 @@ class SpotifyLink extends Component { } function AuthButton(props) { - return Auth; + return ; } function DeAuthButton(props) { - return De-Auth; + return ; } export default SpotifyLink; \ No newline at end of file