routing.py 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. # GNU MediaGoblin -- federated, autonomous media hosting
  2. # Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
  3. #
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU Affero General Public License as published by
  6. # the Free Software Foundation, either version 3 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU Affero General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU Affero General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. from mediagoblin.tools.routing import add_route
  17. # Add user profile
  18. add_route(
  19. "media.api.user",
  20. "/api/user/<string:username>/",
  21. "mediagoblin.api.views:user_endpoint",
  22. match_slash=False
  23. )
  24. add_route(
  25. "mediagoblin.api.user.profile",
  26. "/api/user/<string:username>/profile/",
  27. "mediagoblin.api.views:profile_endpoint",
  28. match_slash=False
  29. )
  30. # Inbox and Outbox (feed)
  31. add_route(
  32. "mediagoblin.api.feed",
  33. "/api/user/<string:username>/feed/",
  34. "mediagoblin.api.views:feed_endpoint",
  35. match_slash=False
  36. )
  37. add_route(
  38. "mediagoblin.api.feed_major",
  39. "/api/user/<string:username>/feed/major/",
  40. "mediagoblin.api.views:feed_major_endpoint",
  41. match_slash=False
  42. )
  43. add_route(
  44. "mediagoblin.api.feed_minor",
  45. "/api/user/<string:username>/feed/minor/",
  46. "mediagoblin.api.views:feed_minor_endpoint",
  47. match_slash=False
  48. )
  49. add_route(
  50. "mediagoblin.api.user.uploads",
  51. "/api/user/<string:username>/uploads/",
  52. "mediagoblin.api.views:uploads_endpoint",
  53. match_slash=False
  54. )
  55. add_route(
  56. "mediagoblin.api.inbox",
  57. "/api/user/<string:username>/inbox/",
  58. "mediagoblin.api.views:inbox_endpoint",
  59. match_slash=False
  60. )
  61. add_route(
  62. "mediagoblin.api.inbox_minor",
  63. "/api/user/<string:username>/inbox/minor/",
  64. "mediagoblin.api.views:inbox_minor_endpoint",
  65. match_slash=False
  66. )
  67. add_route(
  68. "mediagoblin.api.inbox_major",
  69. "/api/user/<string:username>/inbox/major/",
  70. "mediagoblin.api.views:inbox_major_endpoint",
  71. match_slash=False
  72. )
  73. add_route(
  74. "mediagoblin.api.inbox_direct",
  75. "/api/user/<string:username>/inbox/direct/",
  76. "mediagoblin.api.views:inbox_endpoint",
  77. match_slash=False
  78. )
  79. add_route(
  80. "mediagoblin.api.inbox_direct_minor",
  81. "/api/user/<string:username>/inbox/direct/minor/",
  82. "mediagoblin.api.views:inbox_minor_endpoint",
  83. match_slash=False
  84. )
  85. add_route(
  86. "mediagoblin.api.inbox_direct_major",
  87. "/api/user/<string:username>/inbox/direct/major/",
  88. "mediagoblin.api.views:inbox_major_endpoint",
  89. match_slash=False
  90. )
  91. # object endpoints
  92. add_route(
  93. "mediagoblin.api.object",
  94. "/api/<string:object_type>/<string:id>/",
  95. "mediagoblin.api.views:object_endpoint",
  96. match_slash=False
  97. )
  98. add_route(
  99. "mediagoblin.api.object.comments",
  100. "/api/<string:object_type>/<string:id>/comments/",
  101. "mediagoblin.api.views:object_comments",
  102. match_slash=False
  103. )
  104. add_route(
  105. "mediagoblin.webfinger.well-known.host-meta",
  106. "/.well-known/host-meta",
  107. "mediagoblin.api.views:host_meta"
  108. )
  109. add_route(
  110. "mediagoblin.webfinger.well-known.host-meta.json",
  111. "/.well-known/host-meta.json",
  112. "mediagoblin.api.views:host_meta"
  113. )
  114. add_route(
  115. "mediagoblin.webfinger.well-known.webfinger",
  116. "/.well-known/webfinger/",
  117. "mediagoblin.api.views:lrdd_lookup",
  118. match_slash=False
  119. )
  120. add_route(
  121. "mediagoblin.webfinger.whoami",
  122. "/api/whoami/",
  123. "mediagoblin.api.views:whoami",
  124. match_slash=False
  125. )