takahe/takahe/urls.py

107 wiersze
3.4 KiB
Python
Czysty Zwykły widok Historia

2022-11-17 15:21:42 +00:00
import re
from django.conf import settings as djsettings
from django.contrib import admin as djadmin
2022-11-17 15:21:42 +00:00
from django.urls import path, re_path
from django.views.static import serve
2022-11-05 20:17:27 +00:00
2022-11-18 01:52:00 +00:00
from activities.views import posts, search, timelines
2022-11-05 20:17:27 +00:00
from core import views as core
from stator import views as stator
from users.views import activitypub, admin, auth, identity, settings
2022-11-05 20:17:27 +00:00
urlpatterns = [
path("", core.homepage),
2022-11-16 13:53:39 +00:00
path("manifest.json", core.AppManifest.as_view()),
2022-11-13 23:14:38 +00:00
# Activity views
2022-11-18 01:52:00 +00:00
path("notifications/", timelines.Notifications.as_view(), name="notifications"),
path("local/", timelines.Local.as_view(), name="local"),
path("federated/", timelines.Federated.as_view(), name="federated"),
path("search/", search.Search.as_view(), name="search"),
2022-11-17 04:12:28 +00:00
path(
"settings/",
settings.SettingsRoot.as_view(),
name="settings",
),
2022-11-17 15:21:42 +00:00
path(
"settings/profile/",
settings.ProfilePage.as_view(),
name="settings_profile",
),
path(
"settings/interface/",
settings.InterfacePage.as_view(),
name="settings_interface",
),
path(
"admin/",
admin.AdminRoot.as_view(),
name="admin",
),
path(
"admin/basic/",
admin.BasicPage.as_view(),
name="admin_basic",
),
path(
"admin/domains/",
admin.DomainsPage.as_view(),
name="admin_domains",
),
path(
"admin/domains/create/",
admin.DomainCreatePage.as_view(),
name="admin_domains_create",
),
path(
"admin/domains/<domain>/",
admin.DomainEditPage.as_view(),
),
path(
"admin/domains/<domain>/delete/",
admin.DomainDeletePage.as_view(),
),
path(
"admin/users/",
admin.UsersPage.as_view(),
name="admin_users",
),
path(
"admin/identities/",
admin.IdentitiesPage.as_view(),
name="admin_identities",
2022-11-17 04:12:28 +00:00
),
2022-11-05 20:17:27 +00:00
# Identity views
path("@<handle>/", identity.ViewIdentity.as_view()),
2022-11-13 04:14:21 +00:00
path("@<handle>/actor/", activitypub.Actor.as_view()),
path("@<handle>/actor/inbox/", activitypub.Inbox.as_view()),
path("@<handle>/action/", identity.ActionIdentity.as_view()),
# Posts
2022-11-18 01:52:00 +00:00
path("compose/", posts.Compose.as_view(), name="compose"),
2022-11-16 13:53:39 +00:00
path("@<handle>/posts/<int:post_id>/", posts.Individual.as_view()),
path("@<handle>/posts/<int:post_id>/like/", posts.Like.as_view()),
path("@<handle>/posts/<int:post_id>/unlike/", posts.Like.as_view(undo=True)),
path("@<handle>/posts/<int:post_id>/boost/", posts.Boost.as_view()),
path("@<handle>/posts/<int:post_id>/unboost/", posts.Boost.as_view(undo=True)),
# Authentication
path("auth/login/", auth.Login.as_view()),
path("auth/logout/", auth.Logout.as_view()),
2022-11-05 20:17:27 +00:00
# Identity selection
2022-11-06 02:10:39 +00:00
path("@<handle>/activate/", identity.ActivateIdentity.as_view()),
2022-11-05 20:17:27 +00:00
path("identity/select/", identity.SelectIdentity.as_view()),
path("identity/create/", identity.CreateIdentity.as_view()),
# Well-known endpoints
2022-11-13 04:14:21 +00:00
path(".well-known/webfinger", activitypub.Webfinger.as_view()),
path(".well-known/host-meta", activitypub.HostMeta.as_view()),
2022-11-06 04:49:25 +00:00
# Task runner
path(".stator/runner/", stator.RequestRunner.as_view()),
2022-11-05 20:17:27 +00:00
# Django admin
path("djadmin/", djadmin.site.urls),
2022-11-17 15:21:42 +00:00
# Media files
re_path(
r"^%s(?P<path>.*)$" % re.escape(djsettings.MEDIA_URL.lstrip("/")),
serve,
kwargs={"document_root": djsettings.MEDIA_ROOT},
),
2022-11-05 20:17:27 +00:00
]