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.

routes.php 5.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <?php
  2. /**
  3. * @author Bart Visscher <bartv@thisnet.nl>
  4. * @author Bernhard Posselt <dev@bernhard-posselt.com>
  5. * @author Christopher Schäpers <kondou@ts.unde.re>
  6. * @author Georg Ehrke <georg@owncloud.com>
  7. * @author Lukas Reschke <lukas@owncloud.com>
  8. * @author Morris Jobke <hey@morrisjobke.de>
  9. * @author Roeland Jago Douma <rullzer@owncloud.com>
  10. * @author Thomas Müller <thomas.mueller@tmit.eu>
  11. * @author Thomas Tanghus <thomas@tanghus.net>
  12. * @author Victor Dubiniuk <dubiniuk@owncloud.com>
  13. *
  14. * @copyright Copyright (c) 2016, ownCloud, Inc.
  15. * @license AGPL-3.0
  16. *
  17. * This code is free software: you can redistribute it and/or modify
  18. * it under the terms of the GNU Affero General Public License, version 3,
  19. * as published by the Free Software Foundation.
  20. *
  21. * This program is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. * GNU Affero General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU Affero General Public License, version 3,
  27. * along with this program. If not, see <http://www.gnu.org/licenses/>
  28. *
  29. */
  30. use OC\Core\Application;
  31. $application = new Application();
  32. $application->registerRoutes($this, [
  33. 'routes' => [
  34. ['name' => 'lost#email', 'url' => '/lostpassword/email', 'verb' => 'POST'],
  35. ['name' => 'lost#resetform', 'url' => '/lostpassword/reset/form/{token}/{userId}', 'verb' => 'GET'],
  36. ['name' => 'lost#setPassword', 'url' => '/lostpassword/set/{token}/{userId}', 'verb' => 'POST'],
  37. ['name' => 'user#getDisplayNames', 'url' => '/displaynames', 'verb' => 'POST'],
  38. ['name' => 'avatar#getAvatar', 'url' => '/avatar/{userId}/{size}', 'verb' => 'GET'],
  39. ['name' => 'avatar#deleteAvatar', 'url' => '/avatar/', 'verb' => 'DELETE'],
  40. ['name' => 'avatar#postCroppedAvatar', 'url' => '/avatar/cropped', 'verb' => 'POST'],
  41. ['name' => 'avatar#getTmpAvatar', 'url' => '/avatar/tmp', 'verb' => 'GET'],
  42. ['name' => 'avatar#postAvatar', 'url' => '/avatar/', 'verb' => 'POST'],
  43. ['name' => 'login#tryLogin', 'url' => '/login', 'verb' => 'POST'],
  44. ['name' => 'login#showLoginForm', 'url' => '/login', 'verb' => 'GET'],
  45. ['name' => 'login#logout', 'url' => '/logout', 'verb' => 'GET'],
  46. ['name' => 'token#generateToken', 'url' => '/token/generate', 'verb' => 'POST'],
  47. ],
  48. ]);
  49. // Post installation check
  50. /** @var $this OCP\Route\IRouter */
  51. // Core ajax actions
  52. // Search
  53. $this->create('search_ajax_search', '/core/search')
  54. ->actionInclude('core/search/ajax/search.php');
  55. // AppConfig
  56. $this->create('core_ajax_appconfig', '/core/ajax/appconfig.php')
  57. ->actionInclude('core/ajax/appconfig.php');
  58. // Share
  59. $this->create('core_ajax_share', '/core/ajax/share.php')
  60. ->actionInclude('core/ajax/share.php');
  61. // Tags
  62. $this->create('core_tags_tags', '/tags/{type}')
  63. ->get()
  64. ->action('OC\Core\Tags\Controller', 'getTags')
  65. ->requirements(array('type'));
  66. $this->create('core_tags_favorites', '/tags/{type}/favorites')
  67. ->get()
  68. ->action('OC\Core\Tags\Controller', 'getFavorites')
  69. ->requirements(array('type'));
  70. $this->create('core_tags_ids_for_tag', '/tags/{type}/ids')
  71. ->get()
  72. ->action('OC\Core\Tags\Controller', 'getIdsForTag')
  73. ->requirements(array('type'));
  74. $this->create('core_tags_favorite', '/tags/{type}/favorite/{id}/')
  75. ->post()
  76. ->action('OC\Core\Tags\Controller', 'favorite')
  77. ->requirements(array('type', 'id'));
  78. $this->create('core_tags_unfavorite', '/tags/{type}/unfavorite/{id}/')
  79. ->post()
  80. ->action('OC\Core\Tags\Controller', 'unFavorite')
  81. ->requirements(array('type', 'id'));
  82. $this->create('core_tags_tag', '/tags/{type}/tag/{id}/')
  83. ->post()
  84. ->action('OC\Core\Tags\Controller', 'tagAs')
  85. ->requirements(array('type', 'id'));
  86. $this->create('core_tags_untag', '/tags/{type}/untag/{id}/')
  87. ->post()
  88. ->action('OC\Core\Tags\Controller', 'unTag')
  89. ->requirements(array('type', 'id'));
  90. $this->create('core_tags_add', '/tags/{type}/add')
  91. ->post()
  92. ->action('OC\Core\Tags\Controller', 'addTag')
  93. ->requirements(array('type'));
  94. $this->create('core_tags_delete', '/tags/{type}/delete')
  95. ->post()
  96. ->action('OC\Core\Tags\Controller', 'deleteTags')
  97. ->requirements(array('type'));
  98. // oC JS config
  99. $this->create('js_config', '/core/js/oc.js')
  100. ->actionInclude('core/js/config.php');
  101. // Routing
  102. $this->create('core_ajax_preview', '/core/preview')
  103. ->actionInclude('core/ajax/preview.php');
  104. $this->create('core_ajax_preview', '/core/preview.png')
  105. ->actionInclude('core/ajax/preview.php');
  106. $this->create('core_ajax_update', '/core/ajax/update.php')
  107. ->actionInclude('core/ajax/update.php');
  108. // File routes
  109. $this->create('files.viewcontroller.showFile', '/f/{fileId}')->action(function($urlParams) {
  110. $app = new \OCA\Files\AppInfo\Application($urlParams);
  111. $app->dispatch('ViewController', 'showFile');
  112. });
  113. // Sharing routes
  114. $this->create('files_sharing.sharecontroller.showShare', '/s/{token}')->action(function($urlParams) {
  115. $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
  116. $app->dispatch('ShareController', 'showShare');
  117. });
  118. $this->create('files_sharing.sharecontroller.authenticate', '/s/{token}/authenticate')->post()->action(function($urlParams) {
  119. $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
  120. $app->dispatch('ShareController', 'authenticate');
  121. });
  122. $this->create('files_sharing.sharecontroller.showAuthenticate', '/s/{token}/authenticate')->get()->action(function($urlParams) {
  123. $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
  124. $app->dispatch('ShareController', 'showAuthenticate');
  125. });
  126. $this->create('files_sharing.sharecontroller.downloadShare', '/s/{token}/download')->get()->action(function($urlParams) {
  127. $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
  128. $app->dispatch('ShareController', 'downloadShare');
  129. });
  130. // used for heartbeat
  131. $this->create('heartbeat', '/heartbeat')->action(function(){
  132. // do nothing
  133. });