| 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 | |
| 17 | from mediagoblin.tools.routing import add_route |
| 18 | |
| 19 | # Add user profile |
| 20 | add_route( |
| 21 | "media.api.user", |
| 22 | "/api/user/<string:username>/", |
| 23 | "mediagoblin.api.views:user_endpoint", |
| 24 | match_slash=False |
| 25 | ) |
| 26 | |
| 27 | add_route( |
| 28 | "mediagoblin.api.user.profile", |
| 29 | "/api/user/<string:username>/profile/", |
| 30 | "mediagoblin.api.views:profile_endpoint", |
| 31 | match_slash=False |
| 32 | ) |
| 33 | |
| 34 | # Inbox and Outbox (feed) |
| 35 | add_route( |
| 36 | "mediagoblin.api.feed", |
| 37 | "/api/user/<string:username>/feed/", |
| 38 | "mediagoblin.api.views:feed_endpoint", |
| 39 | match_slash=False |
| 40 | ) |
| 41 | |
| 42 | add_route( |
| 43 | "mediagoblin.api.feed_major", |
| 44 | "/api/user/<string:username>/feed/major/", |
| 45 | "mediagoblin.api.views:feed_major_endpoint", |
| 46 | match_slash=False |
| 47 | ) |
| 48 | |
| 49 | add_route( |
| 50 | "mediagoblin.api.feed_minor", |
| 51 | "/api/user/<string:username>/feed/minor/", |
| 52 | "mediagoblin.api.views:feed_minor_endpoint", |
| 53 | match_slash=False |
| 54 | ) |
| 55 | |
| 56 | add_route( |
| 57 | "mediagoblin.api.user.uploads", |
| 58 | "/api/user/<string:username>/uploads/", |
| 59 | "mediagoblin.api.views:uploads_endpoint", |
| 60 | match_slash=False |
| 61 | ) |
| 62 | |
| 63 | add_route( |
| 64 | "mediagoblin.api.inbox", |
| 65 | "/api/user/<string:username>/inbox/", |
| 66 | "mediagoblin.api.views:inbox_endpoint", |
| 67 | match_slash=False |
| 68 | ) |
| 69 | |
| 70 | add_route( |
| 71 | "mediagoblin.api.inbox_minor", |
| 72 | "/api/user/<string:username>/inbox/minor/", |
| 73 | "mediagoblin.api.views:inbox_minor_endpoint", |
| 74 | match_slash=False |
| 75 | ) |
| 76 | |
| 77 | add_route( |
| 78 | "mediagoblin.api.inbox_major", |
| 79 | "/api/user/<string:username>/inbox/major/", |
| 80 | "mediagoblin.api.views:inbox_major_endpoint", |
| 81 | match_slash=False |
| 82 | ) |
| 83 | |
| 84 | add_route( |
| 85 | "mediagoblin.api.inbox_direct", |
| 86 | "/api/user/<string:username>/inbox/direct/", |
| 87 | "mediagoblin.api.views:inbox_endpoint", |
| 88 | match_slash=False |
| 89 | ) |
| 90 | |
| 91 | add_route( |
| 92 | "mediagoblin.api.inbox_direct_minor", |
| 93 | "/api/user/<string:username>/inbox/direct/minor/", |
| 94 | "mediagoblin.api.views:inbox_minor_endpoint", |
| 95 | match_slash=False |
| 96 | ) |
| 97 | |
| 98 | add_route( |
| 99 | "mediagoblin.api.inbox_direct_major", |
| 100 | "/api/user/<string:username>/inbox/direct/major/", |
| 101 | "mediagoblin.api.views:inbox_major_endpoint", |
| 102 | match_slash=False |
| 103 | ) |
| 104 | |
| 105 | # object endpoints |
| 106 | add_route( |
| 107 | "mediagoblin.api.object", |
| 108 | "/api/<string:object_type>/<string:id>/", |
| 109 | "mediagoblin.api.views:object_endpoint", |
| 110 | match_slash=False |
| 111 | ) |
| 112 | |
| 113 | add_route( |
| 114 | "mediagoblin.api.object.comments", |
| 115 | "/api/<string:object_type>/<string:id>/comments/", |
| 116 | "mediagoblin.api.views:object_comments", |
| 117 | match_slash=False |
| 118 | ) |
| 119 | |
| 120 | add_route( |
| 121 | "mediagoblin.webfinger.well-known.host-meta", |
| 122 | "/.well-known/host-meta", |
| 123 | "mediagoblin.api.views:host_meta" |
| 124 | ) |
| 125 | |
| 126 | add_route( |
| 127 | "mediagoblin.webfinger.well-known.host-meta.json", |
| 128 | "/.well-known/host-meta.json", |
| 129 | "mediagoblin.api.views:host_meta" |
| 130 | ) |
| 131 | |
| 132 | add_route( |
| 133 | "mediagoblin.webfinger.well-known.webfinger", |
| 134 | "/.well-known/webfinger/", |
| 135 | "mediagoblin.api.views:lrdd_lookup", |
| 136 | match_slash=False |
| 137 | ) |
| 138 | |
| 139 | add_route( |
| 140 | "mediagoblin.webfinger.whoami", |
| 141 | "/api/whoami/", |
| 142 | "mediagoblin.api.views:whoami", |
| 143 | match_slash=False |
| 144 | ) |