Spotify.access will be checker for full access
This commit is contained in:
@ -15,7 +15,7 @@ class FollowButton extends React.Component{
|
||||
}
|
||||
|
||||
componentDidMount(){
|
||||
if (this.props.spotify_authorized && this.props.uri){
|
||||
if (this.props.spotify_access == 'full' && this.props.uri){
|
||||
this.props.spotifyActions.following(this.props.uri)
|
||||
}
|
||||
}
|
||||
@ -29,7 +29,7 @@ class FollowButton extends React.Component{
|
||||
}
|
||||
|
||||
render(){
|
||||
if (!this.props.spotify_authorized || !this.props.uri){
|
||||
if (this.props.spotify_access !== 'full' || !this.props.uri){
|
||||
return false
|
||||
}
|
||||
|
||||
@ -56,7 +56,8 @@ class FollowButton extends React.Component{
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
return {
|
||||
load_queue: state.ui.load_queue,
|
||||
spotify_authorized: state.spotify.authorized
|
||||
spotify_access: state.spotify.access,
|
||||
spotify_authorized: state.spotify.authorization
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ class Services extends React.Component{
|
||||
var user = null
|
||||
if (this.props.spotify.me && this.props.spotify.authorization && this.props.spotify.authentication_provider == 'http_api'){
|
||||
user = this.props.spotify.me
|
||||
} else if (this.props.spotify.backend_username && this.props.spotify.backend_username){
|
||||
} else if (this.props.spotify.backend_username){
|
||||
if (this.props.core.users && this.props.core.users['spotify:user:'+this.props.spotify.backend_username] !== undefined){
|
||||
user = this.props.core.users['spotify:user:'+this.props.spotify.backend_username]
|
||||
}
|
||||
@ -114,7 +114,7 @@ class Services extends React.Component{
|
||||
}
|
||||
|
||||
renderSendAuthorizationButton(){
|
||||
if (!this.props.spotify.authorized) return null
|
||||
if (!this.props.spotify.authorization) return null
|
||||
|
||||
return (
|
||||
<button onClick={e => this.props.uiActions.openModal('send_authorization', {}) }>
|
||||
@ -128,72 +128,70 @@ class Services extends React.Component{
|
||||
<div>
|
||||
<h4 className="underline">Spotify (access {this.props.spotify.access})</h4>
|
||||
{!this.props.uri_schemes.includes('spotify:') ? <span className="red-text">Mopidy-Spotify not running</span> : null}
|
||||
<form>
|
||||
|
||||
<div className="field">
|
||||
<div className="name">Country</div>
|
||||
<div className="input">
|
||||
<input
|
||||
type="text"
|
||||
onChange={e => this.setState({ spotify_country: e.target.value })}
|
||||
onFocus={e => this.setState({input_in_focus: 'spotify_country'})}
|
||||
onBlur={e => this.setSpotifyConfig() }
|
||||
value={ this.state.spotify_country } />
|
||||
</div>
|
||||
<div className="field">
|
||||
<div className="name">Country</div>
|
||||
<div className="input">
|
||||
<input
|
||||
type="text"
|
||||
onChange={e => this.setState({ spotify_country: e.target.value })}
|
||||
onFocus={e => this.setState({input_in_focus: 'spotify_country'})}
|
||||
onBlur={e => this.setSpotifyConfig() }
|
||||
value={ this.state.spotify_country } />
|
||||
</div>
|
||||
<div className="field">
|
||||
<div className="name">Locale</div>
|
||||
<div className="input">
|
||||
<input
|
||||
type="text"
|
||||
onChange={e => this.setState({ spotify_locale: e.target.value })}
|
||||
onFocus={e => this.setState({input_in_focus: 'spotify_locale'})}
|
||||
onBlur={e => this.setSpotifyConfig() }
|
||||
value={this.state.spotify_locale} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="field">
|
||||
<div className="name">Locale</div>
|
||||
<div className="input">
|
||||
<input
|
||||
type="text"
|
||||
onChange={e => this.setState({ spotify_locale: e.target.value })}
|
||||
onFocus={e => this.setState({input_in_focus: 'spotify_locale'})}
|
||||
onBlur={e => this.setSpotifyConfig() }
|
||||
value={this.state.spotify_locale} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="field radio">
|
||||
<span className="name">Authentication provider</span>
|
||||
<div className="input">
|
||||
<label>
|
||||
<input
|
||||
type="radio"
|
||||
name="spotify_authentication_provider"
|
||||
value="backend"
|
||||
checked={this.props.spotify.authentication_provider == 'backend'}
|
||||
onChange={e => this.setProvider(e.target.value)}
|
||||
/>
|
||||
<span className="label">Mopidy-Spotify</span>
|
||||
</label>
|
||||
<label>
|
||||
<input
|
||||
type="radio"
|
||||
name="spotify_authentication_provider"
|
||||
value="http_api"
|
||||
checked={this.props.spotify.authentication_provider == 'http_api' }
|
||||
onChange={e => this.setProvider(e.target.value)}
|
||||
/>
|
||||
<span className="label">HTTP API</span>
|
||||
</label>
|
||||
<div className="field radio">
|
||||
<span className="name">Authentication provider</span>
|
||||
<div className="input">
|
||||
<label>
|
||||
<input
|
||||
type="radio"
|
||||
name="spotify_authentication_provider"
|
||||
value="backend"
|
||||
checked={this.props.spotify.authentication_provider == 'backend'}
|
||||
onChange={e => this.setProvider(e.target.value)}
|
||||
/>
|
||||
<span className="label">Mopidy-Spotify</span>
|
||||
</label>
|
||||
<label>
|
||||
<input
|
||||
type="radio"
|
||||
name="spotify_authentication_provider"
|
||||
value="http_api"
|
||||
checked={this.props.spotify.authentication_provider == 'http_api' }
|
||||
onChange={e => this.setProvider(e.target.value)}
|
||||
/>
|
||||
<span className="label">HTTP API</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
{this.props.spotify.authentication_provider == 'http_api' ? <div className="field">
|
||||
<div className="name">Authentication</div>
|
||||
<div className="input">
|
||||
<SpotifyAuthenticationFrame />
|
||||
{ this.renderSendAuthorizationButton() }
|
||||
</div>
|
||||
</div> : null}
|
||||
<div className="field current-user">
|
||||
<div className="name">Current user</div>
|
||||
<div className="input">
|
||||
<div className="text">
|
||||
{ this.renderSpotifyUser() }
|
||||
</div>
|
||||
</div>
|
||||
{this.props.spotify.authentication_provider == 'http_api' ? <div className="field">
|
||||
<div className="name">Authentication</div>
|
||||
<div className="input">
|
||||
<SpotifyAuthenticationFrame />
|
||||
{ this.renderSendAuthorizationButton() }
|
||||
</div>
|
||||
</div> : null}
|
||||
<div className="field current-user">
|
||||
<div className="name">Current user</div>
|
||||
<div className="input">
|
||||
<div className="text">
|
||||
{ this.renderSpotifyUser() }
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
spotify_enabled: state.spotify.enabled,
|
||||
spotify_access: state.spotify.access,
|
||||
spotify_connected: state.spotify.connected,
|
||||
spotify_authorized: state.spotify.authorized,
|
||||
spotify_authorized: state.spotify.authorization,
|
||||
dragger: state.ui.dragger
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ class SpotifyAuthenticationFrame extends React.Component{
|
||||
)
|
||||
} else if (this.props.authorized){
|
||||
return (
|
||||
<button className="destructive" onClick={() => this.props.spotifyActions.authorizationRevoked()}>Log out</button>
|
||||
<button className="destructive" onClick={() => this.props.spotifyActions.revokeAuthorization()}>Log out</button>
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
@ -147,7 +147,7 @@ class SpotifyAuthenticationFrame extends React.Component{
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
return {
|
||||
authorization_url: state.spotify.authorization_url,
|
||||
authorized: state.spotify.authorized,
|
||||
authorized: state.spotify.authorization,
|
||||
authorizing: state.spotify.authorizing,
|
||||
refreshing_token: state.spotify.refreshing_token
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user