bookwyrm-mastodon/fedireads/urls.py

68 lines
2.7 KiB
Python
Raw Normal View History

2020-01-28 14:45:27 -05:00
''' url routing for the app and api '''
from django.conf.urls.static import static
2020-01-25 01:32:41 -05:00
from django.contrib import admin
2020-01-29 14:45:19 -05:00
from django.urls import path, re_path
2020-01-28 14:45:27 -05:00
2020-02-15 14:31:35 -05:00
from fedireads import incoming, outgoing, views, settings, wellknown
2020-01-28 14:45:27 -05:00
2020-01-25 01:32:41 -05:00
urlpatterns = [
path('admin/', admin.site.urls),
2020-01-28 03:44:51 -05:00
# federation endpoints
2020-01-29 14:45:19 -05:00
re_path(r'^inbox/?$', incoming.shared_inbox),
re_path(r'^user/(?P<username>\w+).json/?$', incoming.get_actor),
re_path(r'^user/(?P<username>\w+)/inbox/?$', incoming.inbox),
re_path(r'^user/(?P<username>\w+)/outbox/?$', outgoing.outbox),
re_path(r'^user/(?P<username>\w+)/followers/?$', incoming.get_followers),
re_path(r'^user/(?P<username>\w+)/following/?$', incoming.get_following),
2020-02-15 15:32:40 -05:00
re_path(
2020-02-17 20:53:40 -05:00
r'^user/(?P<username>\w+)/(status|review)/(?P<status_id>\d+)/?$',
2020-02-15 15:32:40 -05:00
incoming.get_status
),
re_path(
2020-02-17 20:53:40 -05:00
r'^user/(?P<username>\w+)/(status|review)/(?P<status_id>\d+)/activity/?$',
2020-02-15 15:32:40 -05:00
incoming.get_status
),
2020-02-18 00:39:08 -05:00
re_path(
r'^user/(?P<username>\w+)/(status|review)/(?P<status_id>\d+)/replies/?$',
incoming.get_replies
),
2020-02-07 18:11:53 -05:00
# TODO: shelves need pages in the UI and for their activitypub Collection
2020-02-15 14:31:35 -05:00
# .well-known endpoints
re_path(r'^.well-known/webfinger/?$', wellknown.webfinger),
2020-02-15 14:40:21 -05:00
re_path(r'^.well-known/nodeinfo/?$', wellknown.nodeinfo_pointer),
re_path(r'^nodeinfo/2\.0/?$', wellknown.nodeinfo),
2020-02-15 14:31:35 -05:00
re_path(r'^api/v1/instance/?$', wellknown.instance_info),
2020-01-29 14:45:19 -05:00
# TODO: re_path(r'^.well-known/host-meta/?$', incoming.host_meta),
2020-01-28 03:44:51 -05:00
# ui views
path('', views.home),
re_path(r'^(?P<tab>home|local|federated)/?$', views.home_tab),
2020-01-29 14:45:19 -05:00
re_path(r'^register/?$', views.register),
re_path(r'^login/?$', views.user_login),
re_path(r'^logout/?$', views.user_logout),
# this endpoint is both ui and fed depending on Accept type
2020-02-19 14:37:02 -05:00
re_path(r'^user/(?P<username>[\w@\.-]+)/?$', views.user_profile),
2020-01-29 14:45:19 -05:00
re_path(r'^user/(?P<username>\w+)/edit/?$', views.user_profile_edit),
2020-02-11 00:09:04 -05:00
re_path(r'^book/(?P<book_identifier>\w+)/?$', views.book_page),
2020-02-11 01:32:03 -05:00
re_path(r'^author/(?P<author_identifier>\w+)/?$', views.author_page),
2020-01-27 22:57:17 -05:00
2020-01-28 03:44:51 -05:00
# internal action endpoints
2020-01-29 14:45:19 -05:00
re_path(r'^review/?$', views.review),
re_path(r'^tag/?$', views.tag),
2020-02-21 01:19:19 -05:00
re_path(r'^untag/?$', views.untag),
2020-02-18 00:39:08 -05:00
re_path(r'^comment/?$', views.comment),
2020-02-19 03:13:06 -05:00
re_path(r'^favorite/(?P<status_id>\d+)/?$', views.favorite),
2020-02-15 17:38:46 -05:00
re_path(
r'^shelve/(?P<username>\w+)/(?P<shelf_id>[\w-]+)/(?P<book_id>\d+)/?$',
views.shelve
),
2020-02-19 14:37:02 -05:00
re_path(r'^follow/(?P<username>[\w@\.-]+)/?$', views.follow),
re_path(r'^unfollow/(?P<username>[\w@\.-]+)/?$', views.unfollow),
2020-01-29 14:45:19 -05:00
re_path(r'^search/?$', views.search),
re_path(r'^edit_profile/?$', views.edit_profile),
2020-01-27 22:57:17 -05:00
2020-01-28 01:49:56 -05:00
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)