|
|
|
@ -1129,7 +1129,6 @@ post '/create' => sub { |
|
|
|
|
# Create a session for this user, but don't set a role for now |
|
|
|
|
$self->login; |
|
|
|
|
my $json = { |
|
|
|
|
status => 'error', |
|
|
|
|
err => 'ERROR_OCCURRED', |
|
|
|
|
msg => $self->l('ERROR_OCCURRED'), |
|
|
|
|
room => $name |
|
|
|
@ -1151,7 +1150,6 @@ post '/create' => sub { |
|
|
|
|
$json->{msg} = $self->l('ERROR_OCCURRED'); |
|
|
|
|
return $self->render(json => $json, status => 500); |
|
|
|
|
} |
|
|
|
|
$json->{status} = 'success'; |
|
|
|
|
$json->{err} = ''; |
|
|
|
|
$self->session($name => {role => 'owner'}); |
|
|
|
|
$self->associate_key_to_room( |
|
|
|
@ -1239,8 +1237,8 @@ any '/api' => sub { |
|
|
|
|
if ($err || !$req->{action} || !$req->{param}){ |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'error', |
|
|
|
|
msg => $err |
|
|
|
|
msg => $err, |
|
|
|
|
err => $err |
|
|
|
|
}, |
|
|
|
|
status => 503 |
|
|
|
|
); |
|
|
|
@ -1250,7 +1248,6 @@ any '/api' => sub { |
|
|
|
|
if (!grep { $req->{param}->{language} eq $_ } @supported_lang){ |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'error', |
|
|
|
|
msg => $self->l('UNSUPPORTED_LANG'), |
|
|
|
|
err => 'UNSUPPORTED_LANG' |
|
|
|
|
}, |
|
|
|
@ -1259,9 +1256,7 @@ any '/api' => sub { |
|
|
|
|
} |
|
|
|
|
$self->session(language => $req->{param}->{language}); |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'success', |
|
|
|
|
} |
|
|
|
|
json => {} |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1276,7 +1271,6 @@ any '/api' => sub { |
|
|
|
|
if (!$res){ |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'error', |
|
|
|
|
msg => $self->l('NOT_ALLOWED'), |
|
|
|
|
err => 'NOT_ALLOWED' |
|
|
|
|
}, |
|
|
|
@ -1295,7 +1289,6 @@ any '/api' => sub { |
|
|
|
|
} |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'success', |
|
|
|
|
rooms => $rooms |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
@ -1304,7 +1297,6 @@ any '/api' => sub { |
|
|
|
|
if (!$req->{param}->{room}){ |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'error', |
|
|
|
|
msg => $self->l('ERROR_ROOM_NAME_MISSING'), |
|
|
|
|
err => 'ERROR_ROOM_NAME_MISSING' |
|
|
|
|
}, |
|
|
|
@ -1316,7 +1308,6 @@ any '/api' => sub { |
|
|
|
|
if (!$room){ |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'error', |
|
|
|
|
msg => sprintf($self->l('ERROR_ROOM_s_DOESNT_EXIST'), $req->{param}->{room}), |
|
|
|
|
err => 'ERROR_ROOM_DOESNT_EXIST' |
|
|
|
|
}, |
|
|
|
@ -1331,7 +1322,6 @@ any '/api' => sub { |
|
|
|
|
if (!$self->valid_email($addr) && $addr ne ''){ |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'error', |
|
|
|
|
msg => $self->l('ERROR_MAIL_INVALID'), |
|
|
|
|
err => 'ERROR_MAIL_INVALID' |
|
|
|
|
}, |
|
|
|
@ -1357,7 +1347,6 @@ any '/api' => sub { |
|
|
|
|
if (!$token || !$sent){ |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'error', |
|
|
|
|
msg => $self->l('ERROR_OCCURRED'), |
|
|
|
|
err => 'ERROR_OCCURRED' |
|
|
|
|
}, |
|
|
|
@ -1368,7 +1357,6 @@ any '/api' => sub { |
|
|
|
|
} |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'success', |
|
|
|
|
msg => sprintf($self->l('INVITE_SENT_TO_s'), join("\n", @$rcpts)), |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
@ -1380,7 +1368,6 @@ any '/api' => sub { |
|
|
|
|
my $m = ($req->{action} eq 'lock_room') ? 'ROOM_LOCKED' : 'ROOM_UNLOCKED'; |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'success', |
|
|
|
|
msg => $self->l($m), |
|
|
|
|
err => $m |
|
|
|
|
} |
|
|
|
@ -1390,7 +1377,6 @@ any '/api' => sub { |
|
|
|
|
json => { |
|
|
|
|
msg => $self->l('ERROR_OCCURRED'), |
|
|
|
|
err => 'ERROR_OCCURRED', |
|
|
|
|
status => 'error' |
|
|
|
|
}, |
|
|
|
|
status => 503 |
|
|
|
|
); |
|
|
|
@ -1424,7 +1410,6 @@ any '/api' => sub { |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
msg => $msg, |
|
|
|
|
status => 'success' |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
@ -1447,14 +1432,12 @@ any '/api' => sub { |
|
|
|
|
if ($self->modify_room($room) && $self->update_email_notifications($room->{name},$req->{param}->{emails})){ |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'success', |
|
|
|
|
msg => $self->l('ROOM_CONFIG_UPDATED') |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'error', |
|
|
|
|
msg => $self->l('ERROR_OCCURRED'), |
|
|
|
|
err => 'ERROR_OCCURRED' |
|
|
|
|
}, |
|
|
|
@ -1469,7 +1452,6 @@ any '/api' => sub { |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
msg => $self->l(($req->{param}->{password}) ? 'PASSWORD_PROTECT_SET' : 'PASSWORD_PROTECT_UNSET'), |
|
|
|
|
status => 'success' |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
@ -1477,7 +1459,6 @@ any '/api' => sub { |
|
|
|
|
json => { |
|
|
|
|
msg => $self->('ERROR_OCCURRED'), |
|
|
|
|
err => 'ERROR_OCCURRED', |
|
|
|
|
status => 'error' |
|
|
|
|
}, |
|
|
|
|
status => 503 |
|
|
|
|
); |
|
|
|
@ -1486,7 +1467,6 @@ any '/api' => sub { |
|
|
|
|
if (grep { $req->{param}->{room} eq $_ } (split /[,;]/, $config->{'rooms.common_names'})){ |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'error', |
|
|
|
|
msg => $self->l('ERROR_COMMON_ROOM_NAME'), |
|
|
|
|
err => 'ERROR_COMMON_ROOM_NAME' |
|
|
|
|
}, |
|
|
|
@ -1499,7 +1479,6 @@ any '/api' => sub { |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
msg => $self->l(($req->{param}->{password}) ? 'ROOM_NOW_RESERVED' : 'ROOM_NO_MORE_RESERVED'), |
|
|
|
|
status => 'success' |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
@ -1507,7 +1486,6 @@ any '/api' => sub { |
|
|
|
|
json => { |
|
|
|
|
msg => $self->('ERROR_OCCURRED'), |
|
|
|
|
err => 'ERROR_OCCURRED', |
|
|
|
|
status => 'error' |
|
|
|
|
}, |
|
|
|
|
status => 503 |
|
|
|
|
); |
|
|
|
@ -1518,7 +1496,6 @@ any '/api' => sub { |
|
|
|
|
if ($self->modify_room($room)){ |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'success', |
|
|
|
|
msg => $self->l(($set eq 'on') ? 'ROOM_NOW_PERSISTENT' : 'ROOM_NO_MORE_PERSISTENT') |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
@ -1527,7 +1504,6 @@ any '/api' => sub { |
|
|
|
|
json => { |
|
|
|
|
msg => $self->l('ERROR_OCCURRED'), |
|
|
|
|
err => 'ERROR_OCCURRED', |
|
|
|
|
status => 'error' |
|
|
|
|
}, |
|
|
|
|
status => 503 |
|
|
|
|
); |
|
|
|
@ -1539,7 +1515,6 @@ any '/api' => sub { |
|
|
|
|
if ($self->modify_room($room)){ |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'success', |
|
|
|
|
msg => $self->l(($set eq 'on') ? 'FORCE_DISPLAY_NAME' : 'NAME_WONT_BE_ASKED') |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
@ -1548,7 +1523,6 @@ any '/api' => sub { |
|
|
|
|
json => { |
|
|
|
|
msg => $self->l('ERROR_OCCURRED'), |
|
|
|
|
err => 'ERROR_OCCURRED', |
|
|
|
|
status => 'error' |
|
|
|
|
}, |
|
|
|
|
status => 503 |
|
|
|
|
); |
|
|
|
@ -1562,7 +1536,6 @@ any '/api' => sub { |
|
|
|
|
json => { |
|
|
|
|
msg => $self->l('ERROR_MAIL_INVALID'), |
|
|
|
|
err => 'ERROR_MAIL_INVALID', |
|
|
|
|
status => 'error' |
|
|
|
|
}, |
|
|
|
|
status => 400 |
|
|
|
|
); |
|
|
|
@ -1570,7 +1543,6 @@ any '/api' => sub { |
|
|
|
|
elsif ($set eq 'on' && $self->add_notification($room->{name},$email)){ |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'success', |
|
|
|
|
msg => sprintf($self->l('s_WILL_BE_NOTIFIED'), $email) |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
@ -1578,7 +1550,6 @@ any '/api' => sub { |
|
|
|
|
elsif ($set eq 'off' && $self->remove_notification($room->{name},$email)){ |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'success', |
|
|
|
|
msg => sprintf($self->l('s_WONT_BE_NOTIFIED_ANYMORE'), $email) |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
@ -1587,7 +1558,6 @@ any '/api' => sub { |
|
|
|
|
json => { |
|
|
|
|
msg => $self->l('ERROR_OCCURRED'), |
|
|
|
|
err => 'ERROR_OCCURRED', |
|
|
|
|
status => 'error' |
|
|
|
|
}, |
|
|
|
|
status => 503 |
|
|
|
|
); |
|
|
|
@ -1604,7 +1574,6 @@ any '/api' => sub { |
|
|
|
|
); |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'success', |
|
|
|
|
msg => $self->l('AUTH_SUCCESS') |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
@ -1613,7 +1582,6 @@ any '/api' => sub { |
|
|
|
|
elsif ($room->{owner_password}){ |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'error', |
|
|
|
|
msg => $self->l('WRONG_PASSWORD'), |
|
|
|
|
err => 'WRONG_PASSWORD' |
|
|
|
|
}, |
|
|
|
@ -1625,7 +1593,6 @@ any '/api' => sub { |
|
|
|
|
json => { |
|
|
|
|
msg => $self->l('NOT_ALLOWED'), |
|
|
|
|
err => 'NOT_ALLOWED', |
|
|
|
|
status => 'error' |
|
|
|
|
}, |
|
|
|
|
status => 403 |
|
|
|
|
); |
|
|
|
@ -1640,7 +1607,6 @@ any '/api' => sub { |
|
|
|
|
ask_for_name => ($room->{ask_for_name}) ? 'yes' : 'no', |
|
|
|
|
persistent => ($room->{persistent}) ? 'yes' : 'no', |
|
|
|
|
notif => $self->get_notification($room->{name}), |
|
|
|
|
status => 'success' |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
@ -1667,7 +1633,6 @@ any '/api' => sub { |
|
|
|
|
if (!$res){ |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'error', |
|
|
|
|
msg => $self->l('ERROR_OCCURRED'), |
|
|
|
|
err => 'ERROR_OCCURRED' |
|
|
|
|
}, |
|
|
|
@ -1683,7 +1648,6 @@ any '/api' => sub { |
|
|
|
|
locked => ($room->{locked}) ? 'yes' : 'no', |
|
|
|
|
ask_for_name => ($room->{ask_for_name}) ? 'yes' : 'no', |
|
|
|
|
notif => $self->get_notification($room->{name}), |
|
|
|
|
status => 'success' |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
@ -1712,7 +1676,6 @@ any '/api' => sub { |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
role => $role, |
|
|
|
|
status => 'success' |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
@ -1734,9 +1697,7 @@ any '/api' => sub { |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'success' |
|
|
|
|
} |
|
|
|
|
json => {} |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
# Promote a participant to be owner of a room |
|
|
|
@ -1745,7 +1706,6 @@ any '/api' => sub { |
|
|
|
|
if (!$peer_id){ |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'error', |
|
|
|
|
msg => $self->l('ERROR_PEER_ID_MISSING'), |
|
|
|
|
err => 'ERROR_PEER_ID_MISSING' |
|
|
|
|
}, |
|
|
|
@ -1755,14 +1715,12 @@ any '/api' => sub { |
|
|
|
|
elsif ($self->promote_peer({room => $room->{name}, peer_id => $peer_id})){ |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'success', |
|
|
|
|
msg => $self->l('PEER_PROMOTED') |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'error', |
|
|
|
|
msg => $self->l('ERROR_OCCURRED'), |
|
|
|
|
err => 'ERROR_OCCURRED' |
|
|
|
|
}, |
|
|
|
@ -1776,7 +1734,6 @@ any '/api' => sub { |
|
|
|
|
$self->create_etherpad_session($room->{name}))){ |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'success', |
|
|
|
|
msg => $self->l('DATA_WIPED') |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
@ -1785,7 +1742,6 @@ any '/api' => sub { |
|
|
|
|
json => { |
|
|
|
|
msg => $self->l('ERROR_OCCURRED'), |
|
|
|
|
err => 'ERROR_OCCURRED', |
|
|
|
|
status => 'error' |
|
|
|
|
}, |
|
|
|
|
status => 503 |
|
|
|
|
); |
|
|
|
@ -1795,7 +1751,6 @@ any '/api' => sub { |
|
|
|
|
if ($self->create_etherpad_session($room->{name})){ |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
status => 'success', |
|
|
|
|
msg => $self->l('SESSION_CREATED') |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
@ -1804,7 +1759,6 @@ any '/api' => sub { |
|
|
|
|
json => { |
|
|
|
|
msg => $self->l('ERROR_OCCURRED'), |
|
|
|
|
err => 'ERROR_OCCURRED', |
|
|
|
|
status => 'error' |
|
|
|
|
}, |
|
|
|
|
styaus => 503 |
|
|
|
|
); |
|
|
|
@ -1815,7 +1769,6 @@ any '/api' => sub { |
|
|
|
|
return $self->render( |
|
|
|
|
json => { |
|
|
|
|
msg => $self->l('ROOM_DELETED'), |
|
|
|
|
status => 'success' |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
@ -1823,7 +1776,6 @@ any '/api' => sub { |
|
|
|
|
json => { |
|
|
|
|
msg => $self->l('ERROR_OCCURRED'), |
|
|
|
|
err => 'ERROR_OCCURRED', |
|
|
|
|
status => 'error' |
|
|
|
|
}, |
|
|
|
|
status => 503 |
|
|
|
|
); |
|
|
|
|