diff options
author | Robin Appelman <robin@icewind.nl> | 2017-03-27 16:21:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-27 16:21:24 +0200 |
commit | dc5ba954693ba95b687c517b1bad895f706c8309 (patch) | |
tree | e5056d979ca43a8e8604812a4ede27dc7ca6d3fd /core | |
parent | fc044caab1813db961281cf0688867640edf7288 (diff) | |
parent | 4174d75f8661ca3a26ef8cdfd48a6f955491fdfe (diff) | |
download | nextcloud-server-dc5ba954693ba95b687c517b1bad895f706c8309.tar.gz nextcloud-server-dc5ba954693ba95b687c517b1bad895f706c8309.zip |
Merge pull request #4027 from nextcloud/better-spreed-call-urls
Better spreed call urls
Diffstat (limited to 'core')
-rw-r--r-- | core/js/js.js | 24 | ||||
-rw-r--r-- | core/routes.php | 42 |
2 files changed, 49 insertions, 17 deletions
diff --git a/core/js/js.js b/core/js/js.js index 8c1a2e157d0..883431b2b02 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -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); }, /** diff --git a/core/routes.php b/core/routes.php index d3356404fd5..7a2d9d750cc 100644 --- a/core/routes.php +++ b/core/routes.php @@ -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 |