2021-03-08 16:49:10 +00:00
|
|
|
""" url routing for the app and api """
|
2020-01-28 19:45:27 +00:00
|
|
|
from django.conf.urls.static import static
|
2020-09-21 17:25:26 +00:00
|
|
|
from django.contrib import admin
|
2020-01-29 19:45:19 +00:00
|
|
|
from django.urls import path, re_path
|
2021-03-29 21:12:15 +00:00
|
|
|
from django.views.generic.base import TemplateView
|
2021-01-20 22:15:15 +00:00
|
|
|
|
2021-03-13 18:58:54 +00:00
|
|
|
from bookwyrm import settings, views
|
2020-12-31 01:36:35 +00:00
|
|
|
from bookwyrm.utils import regex
|
2020-01-28 19:45:27 +00:00
|
|
|
|
2021-09-18 04:39:18 +00:00
|
|
|
USER_PATH = rf"^user/(?P<username>{regex.USERNAME})"
|
|
|
|
LOCAL_USER_PATH = rf"^user/(?P<username>{regex.LOCALNAME})"
|
2020-09-17 20:02:52 +00:00
|
|
|
|
2020-10-17 02:13:18 +00:00
|
|
|
status_types = [
|
2021-03-08 17:48:25 +00:00
|
|
|
"status",
|
|
|
|
"review",
|
|
|
|
"reviewrating",
|
|
|
|
"comment",
|
|
|
|
"quotation",
|
|
|
|
"boost",
|
|
|
|
"generatednote",
|
2020-10-17 02:13:18 +00:00
|
|
|
]
|
2021-09-18 04:39:18 +00:00
|
|
|
|
2021-09-20 23:44:59 +00:00
|
|
|
STATUS_TYPES_STRING = "|".join(status_types)
|
|
|
|
STATUS_PATH = rf"{USER_PATH}/({STATUS_TYPES_STRING})/(?P<status_id>\d+)"
|
2020-09-17 20:02:52 +00:00
|
|
|
|
2021-06-18 21:12:56 +00:00
|
|
|
BOOK_PATH = r"^book/(?P<book_id>\d+)"
|
2020-01-25 06:32:41 +00:00
|
|
|
|
2021-08-05 00:53:44 +00:00
|
|
|
STREAMS = "|".join(s["key"] for s in settings.STREAMS)
|
2021-08-05 00:25:31 +00:00
|
|
|
|
2020-01-25 06:32:41 +00:00
|
|
|
urlpatterns = [
|
2021-03-08 16:49:10 +00:00
|
|
|
path("admin/", admin.site.urls),
|
2021-03-29 21:12:15 +00:00
|
|
|
path(
|
|
|
|
"robots.txt",
|
|
|
|
TemplateView.as_view(template_name="robots.txt", content_type="text/plain"),
|
|
|
|
),
|
2020-01-28 08:44:51 +00:00
|
|
|
# federation endpoints
|
2021-03-08 16:49:10 +00:00
|
|
|
re_path(r"^inbox/?$", views.Inbox.as_view()),
|
2021-09-18 04:39:18 +00:00
|
|
|
re_path(rf"{LOCAL_USER_PATH}/inbox/?$", views.Inbox.as_view()),
|
|
|
|
re_path(rf"{LOCAL_USER_PATH}/outbox/?$", views.Outbox.as_view()),
|
2021-03-29 21:36:24 +00:00
|
|
|
re_path(r"^\.well-known/webfinger/?$", views.webfinger),
|
|
|
|
re_path(r"^\.well-known/nodeinfo/?$", views.nodeinfo_pointer),
|
|
|
|
re_path(r"^\.well-known/host-meta/?$", views.host_meta),
|
2021-03-13 18:58:54 +00:00
|
|
|
re_path(r"^nodeinfo/2\.0/?$", views.nodeinfo),
|
|
|
|
re_path(r"^api/v1/instance/?$", views.instance_info),
|
|
|
|
re_path(r"^api/v1/instance/peers/?$", views.peers),
|
2021-09-10 23:47:59 +00:00
|
|
|
re_path(r"^opensearch.xml$", views.opensearch, name="opensearch"),
|
2021-01-19 00:32:02 +00:00
|
|
|
# polling updates
|
2021-03-23 19:52:38 +00:00
|
|
|
re_path("^api/updates/notifications/?$", views.get_notification_count),
|
|
|
|
re_path("^api/updates/stream/(?P<stream>[a-z]+)/?$", views.get_unread_status_count),
|
2021-01-12 16:19:08 +00:00
|
|
|
# authentication
|
2021-04-29 20:21:35 +00:00
|
|
|
re_path(r"^login/?$", views.Login.as_view(), name="login"),
|
2021-08-06 23:24:57 +00:00
|
|
|
re_path(r"^login/(?P<confirmed>confirmed)?$", views.Login.as_view(), name="login"),
|
2021-03-08 16:49:10 +00:00
|
|
|
re_path(r"^register/?$", views.Register.as_view()),
|
2021-08-06 23:24:57 +00:00
|
|
|
re_path(r"confirm-email/?$", views.ConfirmEmail.as_view(), name="confirm-email"),
|
|
|
|
re_path(
|
|
|
|
r"confirm-email/(?P<code>[A-Za-z0-9]+)/?$",
|
|
|
|
views.ConfirmEmailCode.as_view(),
|
|
|
|
name="confirm-email-code",
|
|
|
|
),
|
2021-09-27 17:17:16 +00:00
|
|
|
re_path(r"^resend-link/?$", views.resend_link, name="resend-link"),
|
2021-05-04 16:34:16 +00:00
|
|
|
re_path(r"^logout/?$", views.Logout.as_view(), name="logout"),
|
|
|
|
re_path(
|
|
|
|
r"^password-reset/?$",
|
|
|
|
views.PasswordResetRequest.as_view(),
|
|
|
|
name="password-reset",
|
|
|
|
),
|
2021-03-08 16:49:10 +00:00
|
|
|
re_path(
|
|
|
|
r"^password-reset/(?P<code>[A-Za-z0-9]+)/?$", views.PasswordReset.as_view()
|
|
|
|
),
|
2021-01-29 23:38:42 +00:00
|
|
|
# admin
|
2021-09-11 14:20:40 +00:00
|
|
|
re_path(
|
|
|
|
r"^settings/dashboard/?$", views.Dashboard.as_view(), name="settings-dashboard"
|
|
|
|
),
|
2021-04-19 22:40:51 +00:00
|
|
|
re_path(r"^settings/site-settings/?$", views.Site.as_view(), name="settings-site"),
|
2021-05-19 21:55:01 +00:00
|
|
|
re_path(
|
|
|
|
r"^settings/announcements/?$",
|
|
|
|
views.Announcements.as_view(),
|
|
|
|
name="settings-announcements",
|
|
|
|
),
|
|
|
|
re_path(
|
2021-05-20 19:08:12 +00:00
|
|
|
r"^settings/announcements/(?P<announcement_id>\d+)/?$",
|
2021-05-20 15:09:35 +00:00
|
|
|
views.Announcement.as_view(),
|
2021-05-19 21:55:01 +00:00
|
|
|
name="settings-announcements",
|
|
|
|
),
|
2021-05-20 19:08:12 +00:00
|
|
|
re_path(
|
|
|
|
r"^settings/announcements/(?P<announcement_id>\d+)/delete/?$",
|
|
|
|
views.delete_announcement,
|
|
|
|
name="settings-announcements-delete",
|
|
|
|
),
|
2021-03-21 18:43:14 +00:00
|
|
|
re_path(
|
2021-04-19 22:40:51 +00:00
|
|
|
r"^settings/email-preview/?$",
|
2021-09-11 01:50:31 +00:00
|
|
|
views.admin.site.email_preview,
|
2021-03-21 18:43:14 +00:00
|
|
|
name="settings-email-preview",
|
|
|
|
),
|
2021-04-19 22:40:51 +00:00
|
|
|
re_path(
|
|
|
|
r"^settings/users/?$", views.UserAdminList.as_view(), name="settings-users"
|
|
|
|
),
|
|
|
|
re_path(
|
|
|
|
r"^settings/users/(?P<user>\d+)/?$",
|
|
|
|
views.UserAdmin.as_view(),
|
2021-04-19 22:51:39 +00:00
|
|
|
name="settings-user",
|
2021-04-19 22:40:51 +00:00
|
|
|
),
|
2021-03-08 16:49:10 +00:00
|
|
|
re_path(
|
2021-09-11 21:41:52 +00:00
|
|
|
r"^settings/federation/(?P<status>(federated|blocked))?/?$",
|
2021-03-28 19:34:55 +00:00
|
|
|
views.Federation.as_view(),
|
|
|
|
name="settings-federation",
|
|
|
|
),
|
|
|
|
re_path(
|
|
|
|
r"^settings/federation/(?P<server>\d+)/?$",
|
|
|
|
views.FederatedServer.as_view(),
|
|
|
|
name="settings-federated-server",
|
2021-03-08 16:49:10 +00:00
|
|
|
),
|
2021-04-11 17:36:40 +00:00
|
|
|
re_path(
|
|
|
|
r"^settings/federation/(?P<server>\d+)/block?$",
|
2021-09-11 01:50:31 +00:00
|
|
|
views.block_server,
|
2021-04-11 17:36:40 +00:00
|
|
|
name="settings-federated-server-block",
|
|
|
|
),
|
2021-04-10 18:06:28 +00:00
|
|
|
re_path(
|
|
|
|
r"^settings/federation/(?P<server>\d+)/unblock?$",
|
2021-09-11 01:50:31 +00:00
|
|
|
views.unblock_server,
|
2021-04-10 18:06:28 +00:00
|
|
|
name="settings-federated-server-unblock",
|
|
|
|
),
|
2021-04-07 20:06:29 +00:00
|
|
|
re_path(
|
2021-04-10 17:09:36 +00:00
|
|
|
r"^settings/federation/add/?$",
|
|
|
|
views.AddFederatedServer.as_view(),
|
|
|
|
name="settings-add-federated-server",
|
2021-04-07 20:17:51 +00:00
|
|
|
),
|
2021-04-12 21:23:51 +00:00
|
|
|
re_path(
|
|
|
|
r"^settings/federation/import/?$",
|
|
|
|
views.ImportServerBlocklist.as_view(),
|
|
|
|
name="settings-import-blocklist",
|
|
|
|
),
|
2021-03-08 16:49:10 +00:00
|
|
|
re_path(
|
|
|
|
r"^settings/invites/?$", views.ManageInvites.as_view(), name="settings-invites"
|
|
|
|
),
|
2021-03-21 02:39:08 +00:00
|
|
|
re_path(
|
|
|
|
r"^settings/requests/?$",
|
|
|
|
views.ManageInviteRequests.as_view(),
|
|
|
|
name="settings-invite-requests",
|
|
|
|
),
|
2021-03-21 03:15:50 +00:00
|
|
|
re_path(
|
|
|
|
r"^settings/requests/ignore?$",
|
|
|
|
views.ignore_invite_request,
|
|
|
|
name="settings-invite-requests-ignore",
|
|
|
|
),
|
2021-03-21 02:14:41 +00:00
|
|
|
re_path(
|
|
|
|
r"^invite-request/?$", views.InviteRequest.as_view(), name="invite-request"
|
|
|
|
),
|
2021-03-08 16:49:10 +00:00
|
|
|
re_path(r"^invite/(?P<code>[A-Za-z0-9]+)/?$", views.Invite.as_view()),
|
2021-09-08 21:39:43 +00:00
|
|
|
re_path(
|
|
|
|
r"^settings/email-blocklist/?$",
|
|
|
|
views.EmailBlocklist.as_view(),
|
|
|
|
name="settings-email-blocks",
|
|
|
|
),
|
2021-09-08 23:24:13 +00:00
|
|
|
re_path(
|
|
|
|
r"^settings/email-blocks/(?P<domain_id>\d+)/delete/?$",
|
|
|
|
views.EmailBlocklist.as_view(),
|
|
|
|
name="settings-email-blocks-delete",
|
|
|
|
),
|
2021-09-17 19:59:16 +00:00
|
|
|
re_path(
|
|
|
|
r"^settings/ip-blocklist/?$",
|
|
|
|
views.IPBlocklist.as_view(),
|
|
|
|
name="settings-ip-blocks",
|
|
|
|
),
|
|
|
|
re_path(
|
|
|
|
r"^settings/ip-blocks/(?P<block_id>\d+)/delete/?$",
|
|
|
|
views.IPBlocklist.as_view(),
|
|
|
|
name="settings-ip-blocks-delete",
|
|
|
|
),
|
2021-03-08 23:49:44 +00:00
|
|
|
# moderation
|
|
|
|
re_path(r"^settings/reports/?$", views.Reports.as_view(), name="settings-reports"),
|
|
|
|
re_path(
|
2021-03-09 02:36:34 +00:00
|
|
|
r"^settings/reports/(?P<report_id>\d+)/?$",
|
2021-03-08 23:49:44 +00:00
|
|
|
views.Report.as_view(),
|
|
|
|
name="settings-report",
|
|
|
|
),
|
2021-03-12 19:13:53 +00:00
|
|
|
re_path(
|
2021-04-19 22:51:39 +00:00
|
|
|
r"^settings/reports/(?P<user_id>\d+)/suspend/?$",
|
|
|
|
views.suspend_user,
|
|
|
|
name="settings-report-suspend",
|
2021-03-12 19:13:53 +00:00
|
|
|
),
|
2021-09-08 23:47:12 +00:00
|
|
|
re_path(
|
|
|
|
r"^settings/reports/(?P<user_id>\d+)/unsuspend/?$",
|
|
|
|
views.unsuspend_user,
|
|
|
|
name="settings-report-unsuspend",
|
|
|
|
),
|
2021-09-09 00:21:45 +00:00
|
|
|
re_path(
|
|
|
|
r"^settings/reports/(?P<user_id>\d+)/delete/?$",
|
|
|
|
views.moderator_delete_user,
|
|
|
|
name="settings-delete-user",
|
|
|
|
),
|
2021-03-12 18:22:03 +00:00
|
|
|
re_path(
|
|
|
|
r"^settings/reports/(?P<report_id>\d+)/resolve/?$",
|
|
|
|
views.resolve_report,
|
|
|
|
name="settings-report-resolve",
|
|
|
|
),
|
2021-03-09 02:36:34 +00:00
|
|
|
re_path(r"^report/?$", views.make_report, name="report"),
|
2021-01-13 20:03:27 +00:00
|
|
|
# landing pages
|
2021-03-21 18:43:14 +00:00
|
|
|
re_path(r"^about/?$", views.About.as_view(), name="about"),
|
|
|
|
path("", views.Home.as_view(), name="landing"),
|
2021-08-08 15:07:20 +00:00
|
|
|
re_path(r"^discover/?$", views.Discover.as_view(), name="discover"),
|
2021-05-04 16:34:16 +00:00
|
|
|
re_path(r"^notifications/?$", views.Notifications.as_view(), name="notifications"),
|
2021-05-07 20:55:41 +00:00
|
|
|
re_path(
|
|
|
|
r"^notifications/(?P<notification_type>mentions)/?$",
|
|
|
|
views.Notifications.as_view(),
|
|
|
|
name="notifications",
|
|
|
|
),
|
2021-03-21 23:37:52 +00:00
|
|
|
re_path(r"^directory/?", views.Directory.as_view(), name="directory"),
|
2021-03-31 20:56:26 +00:00
|
|
|
# Get started
|
2021-03-31 21:53:00 +00:00
|
|
|
re_path(
|
2021-04-01 16:22:43 +00:00
|
|
|
r"^get-started/profile/?$",
|
2021-03-31 21:53:00 +00:00
|
|
|
views.GetStartedProfile.as_view(),
|
|
|
|
name="get-started-profile",
|
|
|
|
),
|
|
|
|
re_path(
|
|
|
|
r"^get-started/books/?$",
|
|
|
|
views.GetStartedBooks.as_view(),
|
|
|
|
name="get-started-books",
|
|
|
|
),
|
|
|
|
re_path(
|
|
|
|
r"^get-started/users/?$",
|
|
|
|
views.GetStartedUsers.as_view(),
|
|
|
|
name="get-started-users",
|
|
|
|
),
|
2021-01-29 18:25:31 +00:00
|
|
|
# feeds
|
2021-09-18 04:39:18 +00:00
|
|
|
re_path(rf"^(?P<tab>{STREAMS})/?$", views.Feed.as_view()),
|
2021-03-12 18:37:52 +00:00
|
|
|
re_path(
|
|
|
|
r"^direct-messages/?$", views.DirectMessage.as_view(), name="direct-messages"
|
|
|
|
),
|
2021-03-08 16:49:10 +00:00
|
|
|
re_path(
|
2021-09-18 04:39:18 +00:00
|
|
|
rf"^direct-messages/(?P<username>{regex.USERNAME})?$",
|
2021-03-08 16:49:10 +00:00
|
|
|
views.DirectMessage.as_view(),
|
2021-03-12 18:37:52 +00:00
|
|
|
name="direct-messages-user",
|
2021-03-08 16:49:10 +00:00
|
|
|
),
|
2021-01-13 20:03:27 +00:00
|
|
|
# search
|
2021-09-16 17:44:33 +00:00
|
|
|
re_path(r"^search.json/?$", views.Search.as_view(), name="search"),
|
2021-09-30 18:06:12 +00:00
|
|
|
re_path(r"^search/?$", views.Search.as_view(), name="search"),
|
2021-01-12 19:28:03 +00:00
|
|
|
# imports
|
2021-05-04 16:34:16 +00:00
|
|
|
re_path(r"^import/?$", views.Import.as_view(), name="import"),
|
|
|
|
re_path(r"^import/(\d+)/?$", views.ImportStatus.as_view(), name="import-status"),
|
2020-03-14 00:57:36 +00:00
|
|
|
# users
|
2021-09-18 04:39:18 +00:00
|
|
|
re_path(rf"{USER_PATH}\.json$", views.User.as_view()),
|
|
|
|
re_path(rf"{USER_PATH}/?$", views.User.as_view(), name="user-feed"),
|
|
|
|
re_path(rf"{USER_PATH}/rss/?$", views.rss_feed.RssFeed(), name="user-rss"),
|
2021-03-08 16:49:10 +00:00
|
|
|
re_path(
|
2021-09-18 04:39:18 +00:00
|
|
|
rf"{USER_PATH}/followers(.json)?/?$",
|
2021-03-08 16:49:10 +00:00
|
|
|
views.Followers.as_view(),
|
|
|
|
name="user-followers",
|
|
|
|
),
|
|
|
|
re_path(
|
2021-09-18 04:39:18 +00:00
|
|
|
rf"{USER_PATH}/following(.json)?/?$",
|
2021-03-08 16:49:10 +00:00
|
|
|
views.Following.as_view(),
|
|
|
|
name="user-following",
|
|
|
|
),
|
2021-09-08 17:02:06 +00:00
|
|
|
re_path(r"^hide-suggestions/?$", views.hide_suggestions, name="hide-suggestions"),
|
2021-01-31 05:33:41 +00:00
|
|
|
# lists
|
2021-09-18 04:39:18 +00:00
|
|
|
re_path(rf"{USER_PATH}/lists/?$", views.UserLists.as_view(), name="user-lists"),
|
2021-03-08 16:49:10 +00:00
|
|
|
re_path(r"^list/?$", views.Lists.as_view(), name="lists"),
|
2021-08-23 22:07:38 +00:00
|
|
|
re_path(r"^list/saved/?$", views.SavedLists.as_view(), name="saved-lists"),
|
2021-03-08 16:49:10 +00:00
|
|
|
re_path(r"^list/(?P<list_id>\d+)(.json)?/?$", views.List.as_view(), name="list"),
|
2021-09-06 17:38:37 +00:00
|
|
|
re_path(r"^list/delete/(?P<list_id>\d+)/?$", views.delete_list, name="delete-list"),
|
2021-03-15 22:33:05 +00:00
|
|
|
re_path(r"^list/add-book/?$", views.list.add_book, name="list-add-book"),
|
2021-03-08 16:49:10 +00:00
|
|
|
re_path(
|
|
|
|
r"^list/(?P<list_id>\d+)/remove/?$",
|
|
|
|
views.list.remove_book,
|
|
|
|
name="list-remove-book",
|
|
|
|
),
|
2021-04-08 16:05:21 +00:00
|
|
|
re_path(
|
|
|
|
r"^list-item/(?P<list_item_id>\d+)/set-position$",
|
|
|
|
views.list.set_book_position,
|
|
|
|
name="list-set-book-position",
|
|
|
|
),
|
2021-03-08 16:49:10 +00:00
|
|
|
re_path(
|
|
|
|
r"^list/(?P<list_id>\d+)/curate/?$", views.Curate.as_view(), name="list-curate"
|
|
|
|
),
|
2021-08-23 22:33:49 +00:00
|
|
|
re_path(r"^save-list/(?P<list_id>\d+)/?$", views.save_list, name="list-save"),
|
|
|
|
re_path(r"^unsave-list/(?P<list_id>\d+)/?$", views.unsave_list, name="list-unsave"),
|
2021-06-08 18:23:53 +00:00
|
|
|
# User books
|
2021-09-18 04:39:18 +00:00
|
|
|
re_path(rf"{USER_PATH}/books/?$", views.Shelf.as_view(), name="user-shelves"),
|
2021-03-31 16:34:16 +00:00
|
|
|
re_path(
|
2021-09-27 22:57:22 +00:00
|
|
|
rf"^{USER_PATH}/(shelf|books)/(?P<shelf_identifier>[\w-]+)(.json)?/?$",
|
2021-03-31 16:34:16 +00:00
|
|
|
views.Shelf.as_view(),
|
|
|
|
name="shelf",
|
|
|
|
),
|
|
|
|
re_path(
|
2021-09-18 04:39:18 +00:00
|
|
|
rf"^{LOCAL_USER_PATH}/(books|shelf)/(?P<shelf_identifier>[\w-]+)(.json)?/?$",
|
2021-03-31 16:34:16 +00:00
|
|
|
views.Shelf.as_view(),
|
2021-03-31 16:54:52 +00:00
|
|
|
name="shelf",
|
2021-03-31 16:34:16 +00:00
|
|
|
),
|
|
|
|
re_path(r"^create-shelf/?$", views.create_shelf, name="shelf-create"),
|
|
|
|
re_path(r"^delete-shelf/(?P<shelf_id>\d+)?$", views.delete_shelf),
|
|
|
|
re_path(r"^shelve/?$", views.shelve),
|
|
|
|
re_path(r"^unshelve/?$", views.unshelve),
|
|
|
|
# goals
|
|
|
|
re_path(
|
2021-09-22 19:16:51 +00:00
|
|
|
rf"{LOCAL_USER_PATH}/goal/(?P<year>\d+)/?$",
|
2021-03-31 16:34:16 +00:00
|
|
|
views.Goal.as_view(),
|
|
|
|
name="user-goal",
|
|
|
|
),
|
|
|
|
re_path(r"^hide-goal/?$", views.hide_goal, name="hide-goal"),
|
2021-01-29 17:28:00 +00:00
|
|
|
# preferences
|
2021-03-08 16:49:10 +00:00
|
|
|
re_path(r"^preferences/profile/?$", views.EditUser.as_view(), name="prefs-profile"),
|
2021-04-30 13:43:43 +00:00
|
|
|
re_path(
|
|
|
|
r"^preferences/password/?$",
|
|
|
|
views.ChangePassword.as_view(),
|
|
|
|
name="prefs-password",
|
|
|
|
),
|
2021-06-14 17:44:25 +00:00
|
|
|
re_path(r"^preferences/delete/?$", views.DeleteUser.as_view(), name="prefs-delete"),
|
2021-05-04 16:34:16 +00:00
|
|
|
re_path(r"^preferences/block/?$", views.Block.as_view(), name="prefs-block"),
|
2021-03-08 16:49:10 +00:00
|
|
|
re_path(r"^block/(?P<user_id>\d+)/?$", views.Block.as_view()),
|
|
|
|
re_path(r"^unblock/(?P<user_id>\d+)/?$", views.unblock),
|
2020-03-14 00:57:36 +00:00
|
|
|
# statuses
|
2021-09-18 04:39:18 +00:00
|
|
|
re_path(rf"{STATUS_PATH}(.json)?/?$", views.Status.as_view(), name="status"),
|
|
|
|
re_path(rf"{STATUS_PATH}/activity/?$", views.Status.as_view(), name="status"),
|
2021-04-03 19:38:12 +00:00
|
|
|
re_path(
|
2021-09-18 04:39:18 +00:00
|
|
|
rf"{STATUS_PATH}/replies(.json)?/?$", views.Replies.as_view(), name="replies"
|
2021-04-03 19:38:12 +00:00
|
|
|
),
|
2021-04-03 21:32:34 +00:00
|
|
|
re_path(
|
|
|
|
r"^post/?$",
|
|
|
|
views.CreateStatus.as_view(),
|
|
|
|
name="create-status",
|
|
|
|
),
|
2021-04-03 19:38:12 +00:00
|
|
|
re_path(
|
|
|
|
r"^post/(?P<status_type>\w+)/?$",
|
|
|
|
views.CreateStatus.as_view(),
|
|
|
|
name="create-status",
|
|
|
|
),
|
|
|
|
re_path(
|
|
|
|
r"^delete-status/(?P<status_id>\d+)/?$",
|
|
|
|
views.DeleteStatus.as_view(),
|
|
|
|
name="delete-status",
|
|
|
|
),
|
|
|
|
re_path(
|
|
|
|
r"^redraft-status/(?P<status_id>\d+)/?$",
|
|
|
|
views.DeleteAndRedraft.as_view(),
|
|
|
|
name="redraft",
|
|
|
|
),
|
2021-01-12 21:47:00 +00:00
|
|
|
# interact
|
2021-08-23 20:15:35 +00:00
|
|
|
re_path(r"^favorite/(?P<status_id>\d+)/?$", views.Favorite.as_view(), name="fav"),
|
|
|
|
re_path(
|
|
|
|
r"^unfavorite/(?P<status_id>\d+)/?$", views.Unfavorite.as_view(), name="unfav"
|
|
|
|
),
|
2021-03-08 16:49:10 +00:00
|
|
|
re_path(r"^boost/(?P<status_id>\d+)/?$", views.Boost.as_view()),
|
|
|
|
re_path(r"^unboost/(?P<status_id>\d+)/?$", views.Unboost.as_view()),
|
2020-03-14 00:57:36 +00:00
|
|
|
# books
|
2021-09-18 04:39:18 +00:00
|
|
|
re_path(rf"{BOOK_PATH}(.json)?/?$", views.Book.as_view(), name="book"),
|
2021-04-23 20:46:22 +00:00
|
|
|
re_path(
|
2021-09-18 04:39:18 +00:00
|
|
|
rf"{BOOK_PATH}/(?P<user_statuses>review|comment|quote)/?$",
|
2021-04-23 20:46:22 +00:00
|
|
|
views.Book.as_view(),
|
|
|
|
name="book-user-statuses",
|
|
|
|
),
|
2021-09-18 04:39:18 +00:00
|
|
|
re_path(rf"{BOOK_PATH}/edit/?$", views.EditBook.as_view(), name="edit-book"),
|
|
|
|
re_path(rf"{BOOK_PATH}/confirm/?$", views.ConfirmEditBook.as_view()),
|
2021-05-03 18:20:43 +00:00
|
|
|
re_path(r"^create-book/?$", views.EditBook.as_view(), name="create-book"),
|
2021-03-08 18:10:30 +00:00
|
|
|
re_path(r"^create-book/confirm?$", views.ConfirmEditBook.as_view()),
|
2021-09-18 04:39:18 +00:00
|
|
|
re_path(rf"{BOOK_PATH}/editions(.json)?/?$", views.Editions.as_view()),
|
2021-03-18 17:03:53 +00:00
|
|
|
re_path(
|
|
|
|
r"^upload-cover/(?P<book_id>\d+)/?$", views.upload_cover, name="upload-cover"
|
|
|
|
),
|
2021-03-08 16:49:10 +00:00
|
|
|
re_path(r"^add-description/(?P<book_id>\d+)/?$", views.add_description),
|
|
|
|
re_path(r"^resolve-book/?$", views.resolve_book),
|
|
|
|
re_path(r"^switch-edition/?$", views.switch_edition),
|
2021-03-01 20:09:21 +00:00
|
|
|
# isbn
|
2021-03-08 16:49:10 +00:00
|
|
|
re_path(r"^isbn/(?P<isbn>\d+)(.json)?/?$", views.Isbn.as_view()),
|
2021-01-13 17:54:35 +00:00
|
|
|
# author
|
2021-03-08 16:49:10 +00:00
|
|
|
re_path(r"^author/(?P<author_id>\d+)(.json)?/?$", views.Author.as_view()),
|
|
|
|
re_path(r"^author/(?P<author_id>\d+)/edit/?$", views.EditAuthor.as_view()),
|
2021-01-13 20:33:48 +00:00
|
|
|
# reading progress
|
2021-03-21 00:18:18 +00:00
|
|
|
re_path(r"^edit-readthrough/?$", views.edit_readthrough, name="edit-readthrough"),
|
2021-03-08 16:49:10 +00:00
|
|
|
re_path(r"^delete-readthrough/?$", views.delete_readthrough),
|
|
|
|
re_path(r"^create-readthrough/?$", views.create_readthrough),
|
|
|
|
re_path(r"^delete-progressupdate/?$", views.delete_progressupdate),
|
2021-06-08 18:23:53 +00:00
|
|
|
# shelve actions
|
2021-09-29 17:59:36 +00:00
|
|
|
re_path(
|
|
|
|
r"^reading-status/update/(?P<book_id>\d+)/?$",
|
|
|
|
views.update_progress,
|
|
|
|
name="reading-status-update",
|
|
|
|
),
|
2021-06-08 18:43:30 +00:00
|
|
|
re_path(
|
2021-06-09 17:36:52 +00:00
|
|
|
r"^reading-status/(?P<status>want|start|finish)/(?P<book_id>\d+)/?$",
|
|
|
|
views.ReadingStatus.as_view(),
|
|
|
|
name="reading-status",
|
2021-06-08 18:43:30 +00:00
|
|
|
),
|
2021-01-13 20:33:48 +00:00
|
|
|
# following
|
2021-03-13 22:48:15 +00:00
|
|
|
re_path(r"^follow/?$", views.follow, name="follow"),
|
|
|
|
re_path(r"^unfollow/?$", views.unfollow, name="unfollow"),
|
2021-03-08 16:49:10 +00:00
|
|
|
re_path(r"^accept-follow-request/?$", views.accept_follow_request),
|
|
|
|
re_path(r"^delete-follow-request/?$", views.delete_follow_request),
|
2020-01-28 06:49:56 +00:00
|
|
|
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|