bookwyrm/fedireads/urls.py

41 lines
1.7 KiB
Python
Raw Normal View History

2020-01-28 19:45:27 +00:00
''' url routing for the app and api '''
from django.conf.urls.static import static
2020-01-25 06:32:41 +00:00
from django.contrib import admin
2020-01-29 19:45:19 +00:00
from django.urls import path, re_path
2020-01-28 19:45:27 +00:00
from fedireads import incoming, outgoing, views, settings
2020-01-28 19:45:27 +00:00
2020-01-25 06:32:41 +00:00
urlpatterns = [
path('admin/', admin.site.urls),
2020-01-28 08:44:51 +00:00
# federation endpoints
2020-01-29 19:45:19 +00: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),
re_path(r'^.well-known/webfinger/?$', incoming.webfinger),
# TODO: re_path(r'^.well-known/host-meta/?$', incoming.host_meta),
2020-01-28 08:44:51 +00:00
# ui views
2020-01-29 20:07:20 +00:00
path(r'', views.home),
2020-01-29 19:45:19 +00: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
re_path(r'^user/(?P<username>[\w@\.]+)/?$', views.user_profile),
re_path(r'^user/(?P<username>\w+)/edit/?$', views.user_profile_edit),
re_path(r'^work/(?P<book_identifier>\w+)/?$', views.book_page),
2020-01-28 03:57:17 +00:00
2020-01-28 08:44:51 +00:00
# internal action endpoints
2020-01-29 19:45:19 +00:00
re_path(r'^review/?$', views.review),
2020-01-29 20:24:50 +00:00
re_path(r'^shelve/(?P<shelf_id>[\w_-]+)/(?P<book_id>\d+)/?$', views.shelve),
2020-01-29 19:45:19 +00:00
re_path(r'^follow/?$', views.follow),
re_path(r'^unfollow/?$', views.unfollow),
re_path(r'^search/?$', views.search),
re_path(r'^edit_profile/?$', views.edit_profile),
2020-01-28 03:57:17 +00:00
2020-01-28 06:49:56 +00:00
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)