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 Lukas Reschke <lukas@owncloud.com>
  8. * @author Morris Jobke <hey@morrisjobke.de>
  9. * @author Roeland Jago Douma <roeland@famdouma.nl>
  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) 2015, 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. ]
  44. ]);
  45. // Post installation check
  46. /** @var $this OCP\Route\IRouter */
  47. // Core ajax actions
  48. // Search
  49. $this->create('search_ajax_search', '/core/search')
  50. ->actionInclude('core/search/ajax/search.php');
  51. // AppConfig
  52. $this->create('core_ajax_appconfig', '/core/ajax/appconfig.php')
  53. ->actionInclude('core/ajax/appconfig.php');
  54. // Share
  55. $this->create('core_ajax_share', '/core/ajax/share.php')
  56. ->actionInclude('core/ajax/share.php');
  57. // Tags
  58. $this->create('core_tags_tags', '/tags/{type}')
  59. ->get()
  60. ->action('OC\Core\Tags\Controller', 'getTags')
  61. ->requirements(array('type'));
  62. $this->create('core_tags_favorites', '/tags/{type}/favorites')
  63. ->get()
  64. ->action('OC\Core\Tags\Controller', 'getFavorites')
  65. ->requirements(array('type'));
  66. $this->create('core_tags_ids_for_tag', '/tags/{type}/ids')
  67. ->get()
  68. ->action('OC\Core\Tags\Controller', 'getIdsForTag')
  69. ->requirements(array('type'));
  70. $this->create('core_tags_favorite', '/tags/{type}/favorite/{id}/')
  71. ->post()
  72. ->action('OC\Core\Tags\Controller', 'favorite')
  73. ->requirements(array('type', 'id'));
  74. $this->create('core_tags_unfavorite', '/tags/{type}/unfavorite/{id}/')
  75. ->post()
  76. ->action('OC\Core\Tags\Controller', 'unFavorite')
  77. ->requirements(array('type', 'id'));
  78. $this->create('core_tags_tag', '/tags/{type}/tag/{id}/')
  79. ->post()
  80. ->action('OC\Core\Tags\Controller', 'tagAs')
  81. ->requirements(array('type', 'id'));
  82. $this->create('core_tags_untag', '/tags/{type}/untag/{id}/')
  83. ->post()
  84. ->action('OC\Core\Tags\Controller', 'unTag')
  85. ->requirements(array('type', 'id'));
  86. $this->create('core_tags_add', '/tags/{type}/add')
  87. ->post()
  88. ->action('OC\Core\Tags\Controller', 'addTag')
  89. ->requirements(array('type'));
  90. $this->create('core_tags_delete', '/tags/{type}/delete')
  91. ->post()
  92. ->action('OC\Core\Tags\Controller', 'deleteTags')
  93. ->requirements(array('type'));
  94. // oC JS config
  95. $this->create('js_config', '/core/js/oc.js')
  96. ->actionInclude('core/js/config.php');
  97. // Routing
  98. $this->create('core_ajax_preview', '/core/preview')
  99. ->actionInclude('core/ajax/preview.php');
  100. $this->create('core_ajax_preview', '/core/preview.png')
  101. ->actionInclude('core/ajax/preview.php');
  102. $this->create('core_ajax_update', '/core/ajax/update.php')
  103. ->actionInclude('core/ajax/update.php');
  104. // Sharing routes
  105. $this->create('files_sharing.sharecontroller.showShare', '/s/{token}')->action(function($urlParams) {
  106. $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
  107. $app->dispatch('ShareController', 'showShare');
  108. });
  109. $this->create('files_sharing.sharecontroller.authenticate', '/s/{token}/authenticate')->post()->action(function($urlParams) {
  110. $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
  111. $app->dispatch('ShareController', 'authenticate');
  112. });
  113. $this->create('files_sharing.sharecontroller.showAuthenticate', '/s/{token}/authenticate')->get()->action(function($urlParams) {
  114. $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
  115. $app->dispatch('ShareController', 'showAuthenticate');
  116. });
  117. $this->create('files_sharing.sharecontroller.downloadShare', '/s/{token}/download')->get()->action(function($urlParams) {
  118. $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
  119. $app->dispatch('ShareController', 'downloadShare');
  120. });
  121. // used for heartbeat
  122. $this->create('heartbeat', '/heartbeat')->action(function(){
  123. // do nothing
  124. });