Moving commands out of Snapcast

This commit is contained in:
James Barnsley
2018-10-09 21:39:38 +13:00
parent 9f0961f593
commit fc3f5e2d2f
20 changed files with 11052 additions and 14208 deletions

View File

@ -37,29 +37,6 @@ export function setClientLatency(id, latency){
}
}
export function setClientCommand(id, command){
return {
type: 'SNAPCAST_SET_CLIENT_COMMAND',
id: id,
command: command
}
}
export function sendClientCommand(id, command){
return {
type: 'SNAPCAST_SEND_CLIENT_COMMAND',
id: id,
command: command
}
}
export function clientCommandsUpdated(client_commands){
return {
type: 'SNAPCAST_CLIENT_COMMANDS_UPDATED',
client_commands: client_commands
}
}
export function setClientGroup(id, group_id){
return {
type: 'SNAPCAST_SET_CLIENT_GROUP',

View File

@ -228,37 +228,6 @@ const SnapcastMiddleware = (function(){
);
break
case 'SNAPCAST_SET_CLIENT_COMMAND':
var client_commands_index = Object.assign({}, snapcast.client_commands);
if (client_commands_index[action.id]){
var client_command = Object.assign({}, client_commands_index[action.id], action.command);
} else {
var client_command = action.command;
}
client_commands_index[action.id] = client_command;
store.dispatch(snapcastActions.clientCommandsUpdated(client_commands_index));
next(action);
break
case 'SNAPCAST_SEND_CLIENT_COMMAND':
// Prepare our command
// We try and make it cross-origin compatible
var command = JSON.parse(action.command);
command.crossDomain = true;
command.dataType = "jsonp";
command.success = function(response){
store.dispatch(uiActions.createNotification({type: 'info', content: 'Command sent', description: command.url}));
}
// Actually send the request
$.ajax(command);
break
case 'SNAPCAST_SET_CLIENT_GROUP':
var group = snapcast.groups[action.group_id];

View File

@ -6,9 +6,6 @@ export default function reducer(snapcast = {}, action){
var server = Object.assign({}, action.server);
return Object.assign({}, snapcast, { server: server });
case 'SNAPCAST_CLIENT_COMMANDS_UPDATED':
return Object.assign({}, snapcast, { client_commands: action.client_commands });
case 'SNAPCAST_CLIENTS_LOADED':
if (action.flush){
var clients = {};