Merge pull request #4027 from nextcloud/better-spreed-call-urls

Better spreed call urls
pull/4094/head^2
Robin Appelman 7 years ago committed by GitHub
commit dc5ba95469

@ -2010,11 +2010,13 @@ OC.Util.History = {
* Note: this includes a workaround for IE8/IE9 that uses
* the hash part instead of the search part.
*
* @param params to append to the URL, can be either a string
* @param {Object|string} params to append to the URL, can be either a string
* or a map
* @param {string} [url] URL to be used, otherwise the current URL will be used,
* using the params as query string
* @param {boolean} [replace=false] whether to replace instead of pushing
*/
_pushState: function(params, replace) {
_pushState: function(params, url, replace) {
var strParams;
if (typeof(params) === 'string') {
strParams = params;
@ -2023,7 +2025,7 @@ OC.Util.History = {
strParams = OC.buildQueryString(params);
}
if (window.history.pushState) {
var url = location.pathname + '?' + strParams;
url = url || location.pathname + '?' + strParams;
// Workaround for bug with SVG and window.history.pushState on Firefox < 51
// https://bugzilla.mozilla.org/show_bug.cgi?id=652991
var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
@ -2058,11 +2060,13 @@ OC.Util.History = {
* Note: this includes a workaround for IE8/IE9 that uses
* the hash part instead of the search part.
*
* @param params to append to the URL, can be either a string
* @param {Object|string} params to append to the URL, can be either a string
* or a map
* @param {string} [url] URL to be used, otherwise the current URL will be used,
* using the params as query string
*/
pushState: function(params) {
return this._pushState(params, false);
pushState: function(params, url) {
return this._pushState(params, url, false);
},
/**
@ -2071,11 +2075,13 @@ OC.Util.History = {
* Note: this includes a workaround for IE8/IE9 that uses
* the hash part instead of the search part.
*
* @param params to append to the URL, can be either a string
* @param {Object|string} params to append to the URL, can be either a string
* or a map
* @param {string} [url] URL to be used, otherwise the current URL will be used,
* using the params as query string
*/
replaceState: function(params) {
return this._pushState(params, true);
replaceState: function(params, url) {
return this._pushState(params, url, true);
},
/**

@ -83,22 +83,48 @@ $this->create('files.viewcontroller.showFile', '/f/{fileid}')->action(function($
$app->dispatch('ViewController', 'index');
});
// Call routes
$this->create('spreed.pagecontroller.showCall', '/call/{token}')->action(function($urlParams) {
if (class_exists(\OCA\Spreed\AppInfo\Application::class, false)) {
$app = new \OCA\Spreed\AppInfo\Application($urlParams);
$app->dispatch('PageController', 'index');
} else {
throw new \OC\HintException('App spreed is not enabled');
}
});
// Sharing routes
$this->create('files_sharing.sharecontroller.showShare', '/s/{token}')->action(function($urlParams) {
$app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
$app->dispatch('ShareController', 'showShare');
if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
$app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
$app->dispatch('ShareController', 'showShare');
} else {
throw new \OC\HintException('App file sharing is not enabled');
}
});
$this->create('files_sharing.sharecontroller.authenticate', '/s/{token}/authenticate')->post()->action(function($urlParams) {
$app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
$app->dispatch('ShareController', 'authenticate');
if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
$app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
$app->dispatch('ShareController', 'authenticate');
} else {
throw new \OC\HintException('App file sharing is not enabled');
}
});
$this->create('files_sharing.sharecontroller.showAuthenticate', '/s/{token}/authenticate')->get()->action(function($urlParams) {
$app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
$app->dispatch('ShareController', 'showAuthenticate');
if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
$app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
$app->dispatch('ShareController', 'showAuthenticate');
} else {
throw new \OC\HintException('App file sharing is not enabled');
}
});
$this->create('files_sharing.sharecontroller.downloadShare', '/s/{token}/download')->get()->action(function($urlParams) {
$app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
$app->dispatch('ShareController', 'downloadShare');
if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
$app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
$app->dispatch('ShareController', 'downloadShare');
} else {
throw new \OC\HintException('App file sharing is not enabled');
}
});
// used for heartbeat

Loading…
Cancel
Save