Switch get_peer_role to the new api handler

master
Daniel Berteaud 10 years ago
parent c8a17e7be8
commit 09917e3286
  1. 3
      lib/Vroom/Constants.pm
  2. 9
      public/js/vroom.js
  3. 23
      vroom.pl

@ -168,7 +168,8 @@ use constant API_ACTIONS => {
participant => {
ping => 1,
authenticate => 1,
get_room_info => 1
get_room_info => 1,
get_peer_role => 1
}
};

@ -588,10 +588,15 @@ function initVroom(room) {
// Get the role of a peer
function getPeerRole(id){
$.ajax({
url: rootUrl + 'api',
data: {
action: 'getPeerRole',
req: JSON.stringify({
action: 'get_peer_role',
param: {
room: roomName,
id: id
peer_id: id
}
})
},
error: function(data){
$.notify(locale.ERROR_OCCURRED, 'error');

@ -1465,6 +1465,18 @@ any '/api' => sub {
},
);
}
# Return the role of a peer
elsif ($req->{action} eq 'get_peer_role'){
my $peer_id = $req->{param}->{peer_id};
my $role = $self->get_peer_role({room => $room->{name}, peer_id => $peer_id});
return $self->render(
json => {
role => $role,
status => 'success'
}
);
}
};
# Catch all route: if nothing else match, it's the name of a room
@ -1604,17 +1616,6 @@ post '/*jsapi' => { jsapi => [qw(jsapi admin/jsapi)] } => sub {
},
);
}
# Return the role of a peer
elsif ($action eq 'getPeerRole'){
my $id = $self->param('id');
my $role = $self->get_peer_role({room => $room, peer_id => $id});
return $self->render(
json => {
role => $role,
status => 'success'
}
);
}
# Add a new email for notifications when someone joins
elsif ($action eq 'emailNotification'){
my $email = $self->param('email');

Loading…
Cancel
Save