create a user and a password for each document that chat apps can use to create document group chats
This commit is contained in:
parent
757127a6ec
commit
0a8c089ee0
@ -17,6 +17,7 @@ return [
|
||||
['name' => 'document#index', 'url' => 'index', 'verb' => 'GET'],
|
||||
['name' => 'document#publicPage', 'url' => '/public', 'verb' => 'GET'],
|
||||
['name' => 'document#create', 'url' => 'ajax/documents/create', 'verb' => 'POST'],
|
||||
['name' => 'document#generate', 'url' => 'ajax/generate.php', 'verb' => 'GET'],
|
||||
|
||||
// WOPI access
|
||||
['name' => 'wopi#checkFileInfo', 'url' => 'wopi/files/{fileId}', 'verb' => 'GET'],
|
||||
|
@ -123,6 +123,16 @@ var odfViewer = {
|
||||
|
||||
$('#app-content #controls').addClass('hidden');
|
||||
$('#app-content').append($iframe);
|
||||
|
||||
$.ajax({type: 'GET', url: OC.filePath('richdocuments', 'ajax', 'generate.php'), data: {id: context.$file.attr('data-id')}, async: false, success: function(result) {
|
||||
if(result.status=="success"){
|
||||
var $chatroom = $('<iframe id="chatroom" data-chatroom-password="'+result.password+'" data-chatroom-title="'+fileName+'" data-chatroom-name="'+result.name+'" hidden />');
|
||||
$('#app-content').append($chatroom);
|
||||
}
|
||||
|
||||
}, error: function(xhr, textStatus, errorThrown){
|
||||
password=errorThrown;
|
||||
}});
|
||||
},
|
||||
|
||||
|
||||
@ -132,6 +142,7 @@ var odfViewer = {
|
||||
}
|
||||
$('#app-content #controls').removeClass('hidden');
|
||||
$('#richdocumentsframe').remove();
|
||||
$('#chatroom').remove();
|
||||
},
|
||||
|
||||
registerFilesMenu: function() {
|
||||
|
@ -251,4 +251,40 @@ class DocumentController extends Controller {
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*/
|
||||
public function generate($id) {
|
||||
if((!empty($id))) {
|
||||
$view = \OC\Files\Filesystem::getView();
|
||||
try {
|
||||
$path = $view->getPath($id);
|
||||
if ($view->is_file($path) && $view->isReadable($path)) {
|
||||
$secret = \OC::$server->getConfig()->getSystemValue("secret");
|
||||
$instanceID = \OC::$server->getConfig()->getSystemValue("instanceid");
|
||||
$chatRoomPassword = hash('sha512', "chatroom-password".$instanceID.$secret.$id);
|
||||
$chatRoomName = hash('sha512', "chatroom-name".$instanceID.$secret.$id);
|
||||
return array(
|
||||
'status' => 'success','password' => $chatRoomPassword,'name' => $chatRoomName
|
||||
);
|
||||
} else {
|
||||
return array(
|
||||
'status' => 'unauthorised'
|
||||
);
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return array(
|
||||
'status' => 'unauthorised'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
return array(
|
||||
'status' => 'no id received'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user