You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

153 lines
7.2 KiB

9 years ago
9 years ago
9 years ago
12 years ago
12 years ago
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Bart Visscher <bartv@thisnet.nl>
  6. * @author Bernhard Posselt <dev@bernhard-posselt.com>
  7. * @author Christoph Wurst <christoph@owncloud.com>
  8. * @author Christopher Schäpers <kondou@ts.unde.re>
  9. * @author Georg Ehrke <oc.list@georgehrke.com>
  10. * @author Joas Schilling <coding@schilljs.com>
  11. * @author John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
  12. * @author Lukas Reschke <lukas@statuscode.ch>
  13. * @author Morris Jobke <hey@morrisjobke.de>
  14. * @author Roeland Jago Douma <roeland@famdouma.nl>
  15. * @author Thomas Müller <thomas.mueller@tmit.eu>
  16. * @author Victor Dubiniuk <dubiniuk@owncloud.com>
  17. * @author Vincent Petry <pvince81@owncloud.com>
  18. *
  19. * @license AGPL-3.0
  20. *
  21. * This code is free software: you can redistribute it and/or modify
  22. * it under the terms of the GNU Affero General Public License, version 3,
  23. * as published by the Free Software Foundation.
  24. *
  25. * This program is distributed in the hope that it will be useful,
  26. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  27. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  28. * GNU Affero General Public License for more details.
  29. *
  30. * You should have received a copy of the GNU Affero General Public License, version 3,
  31. * along with this program. If not, see <http://www.gnu.org/licenses/>
  32. *
  33. */
  34. use OC\Core\Application;
  35. $application = new Application();
  36. $application->registerRoutes($this, [
  37. 'routes' => [
  38. ['name' => 'lost#email', 'url' => '/lostpassword/email', 'verb' => 'POST'],
  39. ['name' => 'lost#resetform', 'url' => '/lostpassword/reset/form/{token}/{userId}', 'verb' => 'GET'],
  40. ['name' => 'lost#setPassword', 'url' => '/lostpassword/set/{token}/{userId}', 'verb' => 'POST'],
  41. ['name' => 'user#getDisplayNames', 'url' => '/displaynames', 'verb' => 'POST'],
  42. ['name' => 'avatar#getAvatar', 'url' => '/avatar/{userId}/{size}', 'verb' => 'GET'],
  43. ['name' => 'avatar#deleteAvatar', 'url' => '/avatar/', 'verb' => 'DELETE'],
  44. ['name' => 'avatar#postCroppedAvatar', 'url' => '/avatar/cropped', 'verb' => 'POST'],
  45. ['name' => 'avatar#getTmpAvatar', 'url' => '/avatar/tmp', 'verb' => 'GET'],
  46. ['name' => 'avatar#postAvatar', 'url' => '/avatar/', 'verb' => 'POST'],
  47. ['name' => 'login#tryLogin', 'url' => '/login', 'verb' => 'POST'],
  48. ['name' => 'login#confirmPassword', 'url' => '/login/confirm', 'verb' => 'POST'],
  49. ['name' => 'login#showLoginForm', 'url' => '/login', 'verb' => 'GET'],
  50. ['name' => 'login#logout', 'url' => '/logout', 'verb' => 'GET'],
  51. ['name' => 'ClientFlowLogin#showAuthPickerPage', 'url' => '/login/flow', 'verb' => 'GET'],
  52. ['name' => 'ClientFlowLogin#redirectPage', 'url' => '/login/flow/redirect', 'verb' => 'GET'],
  53. ['name' => 'ClientFlowLogin#generateAppPassword', 'url' => '/login/flow', 'verb' => 'POST'],
  54. ['name' => 'TwoFactorChallenge#selectChallenge', 'url' => '/login/selectchallenge', 'verb' => 'GET'],
  55. ['name' => 'TwoFactorChallenge#showChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'GET'],
  56. ['name' => 'TwoFactorChallenge#solveChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'POST'],
  57. ['name' => 'OCJS#getConfig', 'url' => '/core/js/oc.js', 'verb' => 'GET'],
  58. ['name' => 'Preview#getPreview', 'url' => '/core/preview', 'verb' => 'GET'],
  59. ['name' => 'Preview#getPreview', 'url' => '/core/preview.png', 'verb' => 'GET'],
  60. ['name' => 'Css#getCss', 'url' => '/css/{appName}/{fileName}', 'verb' => 'GET'],
  61. ['name' => 'Js#getJs', 'url' => '/js/{appName}/{fileName}', 'verb' => 'GET'],
  62. ['name' => 'contactsMenu#index', 'url' => '/contactsmenu/contacts', 'verb' => 'POST'],
  63. ['name' => 'contactsMenu#findOne', 'url' => '/contactsmenu/findOne', 'verb' => 'POST'],
  64. ['name' => 'AutoComplete#get', 'url' => 'autocomplete/get', 'verb' => 'GET'],
  65. ['name' => 'WalledGarden#get', 'url' => '/204', 'verb' => 'GET'],
  66. ],
  67. 'ocs' => [
  68. ['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'],
  69. ['root' => '', 'name' => 'OCS#getConfig', 'url' => '/config', 'verb' => 'GET'],
  70. ['root' => '/person', 'name' => 'OCS#personCheck', 'url' => '/check', 'verb' => 'POST'],
  71. ['root' => '/identityproof', 'name' => 'OCS#getIdentityProof', 'url' => '/key/{cloudId}', 'verb' => 'GET'],
  72. ],
  73. ]);
  74. // Post installation check
  75. /** @var $this OCP\Route\IRouter */
  76. // Core ajax actions
  77. // Search
  78. $this->create('search_ajax_search', '/core/search')
  79. ->actionInclude('core/search/ajax/search.php');
  80. // Routing
  81. $this->create('core_ajax_update', '/core/ajax/update.php')
  82. ->actionInclude('core/ajax/update.php');
  83. // File routes
  84. $this->create('files.viewcontroller.showFile', '/f/{fileid}')->action(function($urlParams) {
  85. $app = new \OCA\Files\AppInfo\Application($urlParams);
  86. $app->dispatch('ViewController', 'index');
  87. });
  88. // Call routes
  89. /**
  90. * @suppress PhanUndeclaredClassConstant
  91. * @suppress PhanUndeclaredClassMethod
  92. */
  93. $this->create('spreed.pagecontroller.showCall', '/call/{token}')->action(function($urlParams) {
  94. if (class_exists(\OCA\Spreed\AppInfo\Application::class, false)) {
  95. $app = new \OCA\Spreed\AppInfo\Application($urlParams);
  96. $app->dispatch('PageController', 'index');
  97. } else {
  98. throw new \OC\HintException('App spreed is not enabled');
  99. }
  100. });
  101. // Sharing routes
  102. $this->create('files_sharing.sharecontroller.showShare', '/s/{token}')->action(function($urlParams) {
  103. if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
  104. $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
  105. $app->dispatch('ShareController', 'showShare');
  106. } else {
  107. throw new \OC\HintException('App file sharing is not enabled');
  108. }
  109. });
  110. $this->create('files_sharing.sharecontroller.authenticate', '/s/{token}/authenticate')->post()->action(function($urlParams) {
  111. if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
  112. $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
  113. $app->dispatch('ShareController', 'authenticate');
  114. } else {
  115. throw new \OC\HintException('App file sharing is not enabled');
  116. }
  117. });
  118. $this->create('files_sharing.sharecontroller.showAuthenticate', '/s/{token}/authenticate')->get()->action(function($urlParams) {
  119. if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
  120. $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
  121. $app->dispatch('ShareController', 'showAuthenticate');
  122. } else {
  123. throw new \OC\HintException('App file sharing is not enabled');
  124. }
  125. });
  126. $this->create('files_sharing.sharecontroller.downloadShare', '/s/{token}/download')->get()->action(function($urlParams) {
  127. if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
  128. $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
  129. $app->dispatch('ShareController', 'downloadShare');
  130. } else {
  131. throw new \OC\HintException('App file sharing is not enabled');
  132. }
  133. });
  134. $this->create('files_sharing.publicpreview.directLink', '/s/{token}/preview')->get()->action(function($urlParams) {
  135. if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
  136. $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
  137. $app->dispatch('PublicPreviewController', 'directLink');
  138. } else {
  139. throw new \OC\HintException('App file sharing is not enabled');
  140. }
  141. });
  142. // used for heartbeat
  143. $this->create('heartbeat', '/heartbeat')->action(function(){
  144. // do nothing
  145. });