зеркало из https://github.com/nextcloud/spreed.git
Use token instead of id on all urls
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Родитель
0d455abcee
Коммит
772d47cf10
|
@ -88,6 +88,12 @@ return [
|
|||
'verb' => 'GET',
|
||||
'requirements' => ['apiVersion' => 'v1'],
|
||||
],
|
||||
[
|
||||
'name' => 'Room#createRoom',
|
||||
'url' => '/api/{apiVersion}/room',
|
||||
'verb' => 'POST',
|
||||
'requirements' => ['apiVersion' => 'v1'],
|
||||
],
|
||||
[
|
||||
'name' => 'Room#getRoom',
|
||||
'url' => '/api/{apiVersion}/room/{token}',
|
||||
|
@ -97,49 +103,49 @@ return [
|
|||
'token' => '^[a-z0-9]{4,30}$',
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'Room#createRoom',
|
||||
'url' => '/api/{apiVersion}/room',
|
||||
'verb' => 'POST',
|
||||
'requirements' => ['apiVersion' => 'v1'],
|
||||
],
|
||||
[
|
||||
'name' => 'Room#renameRoom',
|
||||
'url' => '/api/{apiVersion}/room/{roomId}',
|
||||
'url' => '/api/{apiVersion}/room/{token}',
|
||||
'verb' => 'PUT',
|
||||
'requirements' => [
|
||||
'apiVersion' => 'v1',
|
||||
'roomId' => '\d+'
|
||||
'token' => '^[a-z0-9]{4,30}$',
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'Room#makePublic',
|
||||
'url' => '/api/{apiVersion}/room/{roomId}/public',
|
||||
'verb' => 'POST',
|
||||
'requirements' => ['apiVersion' => 'v1'],
|
||||
],
|
||||
[
|
||||
'name' => 'Room#makePrivate',
|
||||
'url' => '/api/{apiVersion}/room/{roomId}/public',
|
||||
'verb' => 'DELETE',
|
||||
'requirements' => ['apiVersion' => 'v1'],
|
||||
],
|
||||
[
|
||||
'name' => 'Room#addParticipantToRoom',
|
||||
'url' => '/api/{apiVersion}/room/{roomId}/participants',
|
||||
'url' => '/api/{apiVersion}/room/{token}/public',
|
||||
'verb' => 'POST',
|
||||
'requirements' => [
|
||||
'apiVersion' => 'v1',
|
||||
'roomId' => '\d+'
|
||||
'token' => '^[a-z0-9]{4,30}$',
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'Room#makePrivate',
|
||||
'url' => '/api/{apiVersion}/room/{token}/public',
|
||||
'verb' => 'DELETE',
|
||||
'requirements' => [
|
||||
'apiVersion' => 'v1',
|
||||
'token' => '^[a-z0-9]{4,30}$',
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'Room#addParticipantToRoom',
|
||||
'url' => '/api/{apiVersion}/room/{token}/participants',
|
||||
'verb' => 'POST',
|
||||
'requirements' => [
|
||||
'apiVersion' => 'v1',
|
||||
'token' => '^[a-z0-9]{4,30}$',
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'Room#removeSelfFromRoom',
|
||||
'url' => '/api/{apiVersion}/room/{roomId}/participants/self',
|
||||
'url' => '/api/{apiVersion}/room/{token}/participants/self',
|
||||
'verb' => 'DELETE',
|
||||
'requirements' => [
|
||||
'apiVersion' => 'v1',
|
||||
'roomId' => '\d+'
|
||||
'token' => '^[a-z0-9]{4,30}$',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
|
@ -250,7 +250,7 @@
|
|||
// This should be the only case
|
||||
if ((this.model.get('type') !== ROOM_TYPE_ONE_TO_ONE) && (roomName.length <= 200)) {
|
||||
$.ajax({
|
||||
url: OC.linkToOCS('apps/spreed/api/v1/room', 2) + this.model.get('id'),
|
||||
url: OC.linkToOCS('apps/spreed/api/v1/room', 2) + this.model.get('token'),
|
||||
type: 'PUT',
|
||||
data: 'roomName='+roomName,
|
||||
success: function() {
|
||||
|
@ -265,7 +265,7 @@
|
|||
// This should be the only case
|
||||
if (this.model.get('type') !== ROOM_TYPE_PUBLIC_CALL) {
|
||||
$.ajax({
|
||||
url: OC.linkToOCS('apps/spreed/api/v1/room', 2) + this.model.get('id') + '/public',
|
||||
url: OC.linkToOCS('apps/spreed/api/v1/room', 2) + this.model.get('token') + '/public',
|
||||
type: 'POST',
|
||||
success: function() {
|
||||
app.syncRooms();
|
||||
|
@ -279,7 +279,7 @@
|
|||
// This should be the only case
|
||||
if (this.model.get('type') === ROOM_TYPE_PUBLIC_CALL) {
|
||||
$.ajax({
|
||||
url: OC.linkToOCS('apps/spreed/api/v1/room', 2) + this.model.get('id') + '/public',
|
||||
url: OC.linkToOCS('apps/spreed/api/v1/room', 2) + this.model.get('token') + '/public',
|
||||
type: 'DELETE',
|
||||
success: function() {
|
||||
app.syncRooms();
|
||||
|
@ -298,7 +298,7 @@
|
|||
this.$el.slideUp();
|
||||
|
||||
$.ajax({
|
||||
url: OC.linkToOCS('apps/spreed/api/v1/room', 2) + this.model.get('id') + '/participants/self',
|
||||
url: OC.linkToOCS('apps/spreed/api/v1/room', 2) + this.model.get('token') + '/participants/self',
|
||||
type: 'DELETE'
|
||||
});
|
||||
},
|
||||
|
@ -524,7 +524,7 @@
|
|||
var app = OCA.SpreedMe.app;
|
||||
|
||||
$.post(
|
||||
OC.linkToOCS('apps/spreed/api/v1/room', 2) + _this.model.get('id') + '/participants',
|
||||
OC.linkToOCS('apps/spreed/api/v1/room', 2) + _this.model.get('token') + '/participants',
|
||||
{
|
||||
newParticipant: e.val
|
||||
}
|
||||
|
|
|
@ -347,13 +347,13 @@ class RoomController extends OCSController {
|
|||
/**
|
||||
* @NoAdminRequired
|
||||
*
|
||||
* @param int $roomId
|
||||
* @param string $token
|
||||
* @param string $roomName
|
||||
* @return DataResponse
|
||||
*/
|
||||
public function renameRoom($roomId, $roomName) {
|
||||
public function renameRoom($token, $roomName) {
|
||||
try {
|
||||
$room = $this->manager->getRoomForParticipant($roomId, $this->userId);
|
||||
$room = $this->manager->getRoomForParticipantByToken($token, $this->userId);
|
||||
} catch (RoomNotFoundException $e) {
|
||||
return new DataResponse([], Http::STATUS_NOT_FOUND);
|
||||
}
|
||||
|
@ -371,13 +371,13 @@ class RoomController extends OCSController {
|
|||
/**
|
||||
* @NoAdminRequired
|
||||
*
|
||||
* @param int $roomId
|
||||
* @param string $token
|
||||
* @param string $newParticipant
|
||||
* @return DataResponse
|
||||
*/
|
||||
public function addParticipantToRoom($roomId, $newParticipant) {
|
||||
public function addParticipantToRoom($token, $newParticipant) {
|
||||
try {
|
||||
$room = $this->manager->getRoomForParticipant($roomId, $this->userId);
|
||||
$room = $this->manager->getRoomForParticipantByToken($token, $this->userId);
|
||||
} catch (RoomNotFoundException $e) {
|
||||
return new DataResponse([], Http::STATUS_NOT_FOUND);
|
||||
}
|
||||
|
@ -412,12 +412,12 @@ class RoomController extends OCSController {
|
|||
/**
|
||||
* @NoAdminRequired
|
||||
*
|
||||
* @param int $roomId
|
||||
* @param string $token
|
||||
* @return DataResponse
|
||||
*/
|
||||
public function removeSelfFromRoom($roomId) {
|
||||
public function removeSelfFromRoom($token) {
|
||||
try {
|
||||
$room = $this->manager->getRoomForParticipant($roomId, $this->userId);
|
||||
$room = $this->manager->getRoomForParticipantByToken($token, $this->userId);
|
||||
} catch (RoomNotFoundException $e) {
|
||||
return new DataResponse([], Http::STATUS_NOT_FOUND);
|
||||
}
|
||||
|
@ -435,12 +435,12 @@ class RoomController extends OCSController {
|
|||
/**
|
||||
* @NoAdminRequired
|
||||
*
|
||||
* @param int $roomId
|
||||
* @param string $token
|
||||
* @return DataResponse
|
||||
*/
|
||||
public function makePublic($roomId) {
|
||||
public function makePublic($token) {
|
||||
try {
|
||||
$room = $this->manager->getRoomForParticipant($roomId, $this->userId);
|
||||
$room = $this->manager->getRoomForParticipantByToken($token, $this->userId);
|
||||
} catch (RoomNotFoundException $e) {
|
||||
return new DataResponse([], Http::STATUS_NOT_FOUND);
|
||||
}
|
||||
|
@ -455,12 +455,12 @@ class RoomController extends OCSController {
|
|||
/**
|
||||
* @NoAdminRequired
|
||||
*
|
||||
* @param int $roomId
|
||||
* @param string $token
|
||||
* @return DataResponse
|
||||
*/
|
||||
public function makePrivate($roomId) {
|
||||
public function makePrivate($token) {
|
||||
try {
|
||||
$room = $this->manager->getRoomForParticipant($roomId, $this->userId);
|
||||
$room = $this->manager->getRoomForParticipantByToken($token, $this->userId);
|
||||
} catch (RoomNotFoundException $e) {
|
||||
return new DataResponse([], Http::STATUS_NOT_FOUND);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче