diff --git a/appinfo/routes.php b/appinfo/routes.php index 5a19618a059..aea286b3b7c 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -30,20 +30,25 @@ ], ], 'ocs' => [ + /** + * Signaling + */ [ 'name' => 'Signaling#signaling', - 'url' => '/api/{apiVersion}/signaling', + 'url' => '/api/{apiVersion}/signaling/{token}', 'verb' => 'POST', 'requirements' => [ 'apiVersion' => 'v1', + 'token' => '^[a-z0-9]{4,30}$', ], ], [ 'name' => 'Signaling#pullMessages', - 'url' => '/api/{apiVersion}/signaling', + 'url' => '/api/{apiVersion}/signaling/{token}', 'verb' => 'GET', 'requirements' => [ 'apiVersion' => 'v1', + 'token' => '^[a-z0-9]{4,30}$', ], ], [ @@ -62,6 +67,10 @@ 'apiVersion' => 'v1', ], ], + + /** + * Call + */ [ 'name' => 'Call#getPeersForCall', 'url' => '/api/{apiVersion}/call/{token}', @@ -99,6 +108,9 @@ ], ], + /** + * Chat + */ [ 'name' => 'Chat#receiveMessages', 'url' => '/api/{apiVersion}/chat/{token}', @@ -118,6 +130,9 @@ ], ], + /** + * Room + */ [ 'name' => 'Room#getRooms', 'url' => '/api/{apiVersion}/room', @@ -239,7 +254,7 @@ ], ], [ - 'name' => 'Room#exitRoom', + 'name' => 'Room#leaveRoom', 'url' => '/api/{apiVersion}/room/{token}/participants/active', 'verb' => 'DELETE', 'requirements' => [ @@ -265,6 +280,10 @@ 'token' => '^[a-z0-9]{4,30}$', ], ], + + /** + * Guest + */ [ 'name' => 'Guest#setDisplayName', 'url' => '/api/{apiVersion}/guest/{token}/name', diff --git a/css/style.scss b/css/style.scss index f570fff2990..e9cbcff1936 100644 --- a/css/style.scss +++ b/css/style.scss @@ -1040,7 +1040,7 @@ video { #app-sidebar .participantWithList { overflow-y: auto; /* Add room for the popovermenu on last user */ - padding-bottom: 50px; + padding-bottom: 64px; } /** diff --git a/docs/api-v1.md b/docs/api-v1.md index e00074dc825..009a2e71449 100644 --- a/docs/api-v1.md +++ b/docs/api-v1.md @@ -26,6 +26,8 @@ - [Chat](#chat) * [Receive chat messages of a room](#receive-chat-messages-of-a-room) * [Sending a new chat message](#sending-a-new-chat-message) +- [Guests](#guests) + * [Set display name](#set-display-name) - [Signaling](#signaling) @@ -46,6 +48,21 @@ Base endpoint is: `/ocs/v2.php/apps/spreed/api/v1` * `5` user following a public link +## Capabilities + +### 3.0 (Initial Talk release) +* `audio` - audio is supported +* `video` - video + screensharing is supported +* `chat` - simple text chat is supported + +### 3.1 +* `guest-signaling` - Guests can do signaling via api endpoints +* `empty-group-room` - Group rooms can be created without inviting a Nextcloud user group by default + +### 3.2 +* `guest-display-names` - Display names of guests are stored in the database, can be set via API (not WebRTC only) and are used on returned comments/participants/etc. +* `multi-room-users` - Users can be in multiple rooms at the same time now, therefor signaling now also requires the room/call token on the URL + ## Room management diff --git a/js/app.js b/js/app.js index 2e732c915ac..54279d83813 100644 --- a/js/app.js +++ b/js/app.js @@ -602,7 +602,7 @@ this.token = $('#app').attr('data-token'); $(window).unload(function () { - this.connection.leaveAllCalls(); + this.connection.leaveCurrentRoom(false); this.signaling.disconnect(); }.bind(this)); @@ -638,7 +638,7 @@ } }, startLocalMedia: function(configuration) { - this.connection.showCamera(); + $('.videoView').removeClass('hidden'); this.initAudioVideoSettings(configuration); this.restoreEmptyContent(); }, diff --git a/js/connection.js b/js/connection.js index f6fa10880be..868439acfae 100644 --- a/js/connection.js +++ b/js/connection.js @@ -20,11 +20,8 @@ }); this.app.signaling.on('roomChanged', function() { - this.leaveCurrentCall(false); + this.leaveCurrentRoom(false); }.bind(this)); - - // Todo this blocks multi room support - this.leaveAllCalls(); } OCA.Talk.Connection = Connection; @@ -32,9 +29,6 @@ /** @property {OCA.Talk.Application} app */ app: null, - showCamera: function() { - $('.videoView').removeClass('hidden'); - }, _createCallSuccessHandle: function(ocsResponse) { var token = ocsResponse.ocs.data.token; OC.Util.History.pushState({ @@ -97,12 +91,18 @@ this.app.signaling.joinRoom(token); this.app.syncAndSetActiveRoom(token); }, + leaveCurrentRoom: function(deleter) { + this.app.signaling.leaveCurrentRoom(); + OC.Util.History.pushState({}, OC.generateUrl('/apps/spreed')); + $('#app-content').removeClass('incall'); + this.showRoomDeletedMessage(deleter); + roomsChannel.trigger('leaveCurrentCall'); + }, joinCall: function(token) { if (this.app.signaling.currentCallToken === token) { return; } - this.app.signaling.leaveCurrentCall(); this.app.signaling.joinCall(token); this.app.signaling.syncRooms(); @@ -110,29 +110,11 @@ $('#emptycontent').hide(); }, - leaveCall: function(token) { - if (this.app.signaling.currentCallToken !== token) { - return; - } - + leaveCurrentCall: function() { this.app.signaling.leaveCurrentCall(); this.app.signaling.syncRooms(); $('#app-content').removeClass('incall'); }, - leaveCurrentCall: function(deleter) { - this.app.signaling.leaveCall(); - OC.Util.History.pushState({}, OC.generateUrl('/apps/spreed')); - $('#app-content').removeClass('incall'); - this.showRoomDeletedMessage(deleter); - roomsChannel.trigger('leaveCurrentCall'); - }, - leaveAllCalls: function() { - if (this.app.signaling) { - // We currently only support a single active call. - this.app.signaling.leaveCurrentCall(); - this.app.signaling.leaveCurrentRoom(); - } - }, showRoomDeletedMessage: function(deleter) { if (deleter) { this.app.setEmptyContentMessage( diff --git a/js/models/roomcollection.js b/js/models/roomcollection.js index 0d96e0783dc..65ba16b879b 100644 --- a/js/models/roomcollection.js +++ b/js/models/roomcollection.js @@ -29,7 +29,7 @@ var RoomCollection = Backbone.Collection.extend({ model: OCA.SpreedMe.Models.Room, comparator: function(model) { - return -(model.get('lastPing')); + return [model.get('active') ? -1 : 0, -(model.get('lastPing'))]; }, url: OC.linkToOCS('apps/spreed/api/v1', 2) + 'room', /** diff --git a/js/signaling.js b/js/signaling.js index 70d5a93023b..0e1ffeac1b7 100644 --- a/js/signaling.js +++ b/js/signaling.js @@ -116,10 +116,6 @@ } }; - OCA.Talk.Signaling.Base.prototype.leaveAllCalls = function() { - // Override if necessary. - }; - OCA.Talk.Signaling.Base.prototype.setRoomCollection = function(rooms) { this.roomCollection = rooms; return this.syncRooms(); @@ -302,10 +298,6 @@ OCA.Talk.Signaling.Internal.prototype.disconnect = function() { this.spreedArrayConnection = []; - if (this.source) { - this.source.close(); - this.source = null; - } if (this.sendInterval) { window.clearInterval(this.sendInterval); this.sendInterval = null; @@ -349,7 +341,7 @@ OCA.Talk.Signaling.Internal.prototype._sendMessages = function(messages) { var defer = $.Deferred(); $.ajax({ - url: OC.linkToOCS('apps/spreed/api/v1', 2) + 'signaling', + url: OC.linkToOCS('apps/spreed/api/v1/signaling', 2) + this.currentRoomToken, type: 'POST', data: {messages: JSON.stringify(messages)}, beforeSend: function (request) { @@ -378,7 +370,6 @@ if (token === this.currentRoomToken) { this._stopPingCall(); - this._closeEventSource(); } }; @@ -414,24 +405,6 @@ }.bind(this), 10000); }; - /** - * @private - */ - OCA.Talk.Signaling.Internal.prototype._getCallPeers = function(token) { - var defer = $.Deferred(); - $.ajax({ - beforeSend: function (request) { - request.setRequestHeader('Accept', 'application/json'); - }, - url: OC.linkToOCS('apps/spreed/api/v1/call', 2) + token, - success: function (result) { - var peers = result.ocs.data; - defer.resolve(peers); - } - }); - return defer; - }; - /** * @private */ @@ -444,7 +417,7 @@ // Connect to the messages endpoint and pull for new messages this.pullMessagesRequest = $.ajax({ - url: OC.linkToOCS('apps/spreed/api/v1', 2) + 'signaling', + url: OC.linkToOCS('apps/spreed/api/v1/signaling', 2) + this.currentRoomToken, type: 'GET', dataType: 'json', beforeSend: function (request) { @@ -482,16 +455,6 @@ }); }; - /** - * @private - */ - OCA.Talk.Signaling.Internal.prototype._closeEventSource = function() { - if (this.source) { - this.source.close(); - this.source = null; - } - }; - /** * @private */ @@ -555,9 +518,7 @@ return; } - // FIXME This was trying to call connection.leaveCurrentCall(false); - // FIXME UI is also not updated. But at least it stops pinging the room. - this.leaveCurrentRoom(); + OCA.SpreedMe.app.connection.leaveCurrentRoom(false); }.bind(this)); }; diff --git a/js/views/callinfoview.js b/js/views/callinfoview.js index 093183fab58..e4e5ffa4699 100644 --- a/js/views/callinfoview.js +++ b/js/views/callinfoview.js @@ -291,7 +291,7 @@ }, leaveCall: function() { - OCA.SpreedMe.app.connection.leaveCall(this.model.get('token')); + OCA.SpreedMe.app.connection.leaveCurrentCall(); }, /** diff --git a/js/views/roomlistview.js b/js/views/roomlistview.js index 601df566a8a..936926eeb04 100644 --- a/js/views/roomlistview.js +++ b/js/views/roomlistview.js @@ -43,9 +43,9 @@ '
'+ '