routes.php 5.3 KB

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