Snapcast config via pusher
This commit is contained in:
6
src/js/bootstrap.js
vendored
6
src/js/bootstrap.js
vendored
@ -62,7 +62,8 @@ var initialState = {
|
||||
mute: false,
|
||||
volume: 0,
|
||||
progress: 0,
|
||||
play_state: false
|
||||
play_state: false,
|
||||
uri_schemes: []
|
||||
},
|
||||
pusher: {
|
||||
connected: false,
|
||||
@ -70,7 +71,8 @@ var initialState = {
|
||||
connections: {},
|
||||
version: {
|
||||
current: '0.0.0'
|
||||
}
|
||||
},
|
||||
config: {}
|
||||
},
|
||||
lastfm: {
|
||||
connected: false,
|
||||
|
||||
@ -24,14 +24,20 @@ class Snapcast extends React.Component{
|
||||
}
|
||||
|
||||
componentDidMount(){
|
||||
if (this.props.pusher_connected){
|
||||
if (this.props.pusher_connected && this.props.snapcast_enabled){
|
||||
this.props.pusherActions.getSnapcast();
|
||||
}
|
||||
}
|
||||
|
||||
componentWillReceiveProps(newProps){
|
||||
|
||||
// Just connected
|
||||
if (!this.props.pusher_connected && newProps.pusher_connected){
|
||||
this.props.pusherActions.getSnapcast();
|
||||
|
||||
// Just enabled (well, identified as being enabled)
|
||||
} else if (!this.props.pusher_enabled && newProps.pusher_enabled && newProps.pusher_connected){
|
||||
this.props.pusherActions.getSnapcast();
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,6 +124,7 @@ class Snapcast extends React.Component{
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
return {
|
||||
snapcast_enabled: state.pusher.config.snapcast_enabled,
|
||||
pusher_connected: state.pusher.connected,
|
||||
snapcast_groups: state.pusher.snapcast_groups,
|
||||
snapcast_clients: state.pusher.snapcast_clients
|
||||
|
||||
@ -479,12 +479,12 @@ const PusherMiddleware = (function(){
|
||||
locale: (action.config.locale ? action.config.locale : null),
|
||||
country: (action.config.country ? action.config.country : null),
|
||||
authorization_url: (action.config.spotify_authorization_url ? action.config.spotify_authorization_url : null)
|
||||
}))
|
||||
}));
|
||||
store.dispatch(lastfmActions.set({
|
||||
authorization_url: (action.config.lastfm_authorization_url ? action.config.lastfm_authorization_url : null)
|
||||
}))
|
||||
}));
|
||||
|
||||
next(action )
|
||||
next(action);
|
||||
break
|
||||
|
||||
case 'PUSHER_DEBUG':
|
||||
|
||||
@ -51,6 +51,9 @@ export default function reducer(pusher = {}, action){
|
||||
case 'PUSHER_START_UPGRADE':
|
||||
return Object.assign({}, pusher, { upgrading: true });
|
||||
|
||||
case 'PUSHER_CONFIG':
|
||||
return Object.assign({}, pusher, { config: action.config });
|
||||
|
||||
case 'PUSHER_SNAPCAST':
|
||||
return Object.assign({}, pusher, { snapcast_clients: action.snapcast_clients, snapcast_groups: action.snapcast_groups });
|
||||
|
||||
|
||||
@ -175,9 +175,8 @@ class Debug extends React.Component{
|
||||
<option value='{"method":"get_connections"}'>Get connections</option>
|
||||
<option value='{"method":"get_radio"}'>Get radio</option>
|
||||
<option value='{"method":"get_queue_metadata"}'>Get queue metadata</option>
|
||||
<option value='{"method":"broadcast","data":{"type":"browser_notification","title":"Testing","body":"This is my message"}}'>Broadcast to all clients (browser)</option>
|
||||
<option value='{"method":"broadcast","data":{"type":"notification","notification_type":"info","title":"Testing","content":"This is my message"}}'>Broadcast to all clients (notification)</option>
|
||||
<option value='{"method":"deliver_message","data":{"to":"CONNECTION_ID_HERE","message":{"type":"browser_notification","title":"Testing","body":"This is my message"}}}'>Broadcast to one client</option>
|
||||
<option value='{"method":"broadcast","data":{"method":"notification","params":{"notification":{"type":"info","title":"Testing","content":"This is my message"}}}}'>Broadcast to all clients</option>
|
||||
<option value='{"method":"send_message","data":{"method":"notification","params":{"notification":{"type":"info","title":"Testing","content":"This is my message"}}}}'>Broadcast to one client</option>
|
||||
<option value='{"method":"set_username","data":{"connection_id":"CONNECTION_ID_HERE","username":"NewUsername"}}'>Change username</option>
|
||||
<option value='{"method":"refresh_spotify_token"}'>Refresh Spotify token</option>
|
||||
<option value='{"method":"perform_upgrade"}'>Perform upgrade (beta)</option>
|
||||
|
||||
@ -13,11 +13,6 @@
|
||||
|
||||
.clients {
|
||||
.client {
|
||||
|
||||
&.disconnected {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
& > .inner {
|
||||
padding: 5px 0;
|
||||
border-bottom: 1px solid $grey;
|
||||
@ -58,6 +53,20 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.disconnected {
|
||||
.name {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.controls {
|
||||
.volume-control {
|
||||
.slider .progress {
|
||||
background: $mid_grey;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user