This commit is contained in:
Marius Blüm 2017-03-27 16:32:45 +02:00
commit 690aec26bb
2 changed files with 49 additions and 17 deletions

View File

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

View File

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