mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-14 10:36:58 +01:00
After tinkering with this for about 2 hours, I'm reasonably sure this ever worked. This feature was added by me in haste and poked by by the occasional contributor, and it suffered from neglect. * Removed the requirement for signature generation in favour of simply requiring BasicAuth or a valid session id. * Fixed a number of bugs in the form itself that would have ensured that the form never accepted anything. * Documented it all properly so now (hopefully) people will have less trouble figuring it out in the future.
54 lines
1.5 KiB
Python
54 lines
1.5 KiB
Python
from django.conf import settings
|
|
from django.conf.urls import url, static, include
|
|
from django.contrib import admin
|
|
from django.views.decorators.csrf import csrf_exempt
|
|
|
|
from rest_framework.routers import DefaultRouter
|
|
|
|
from documents.views import (
|
|
FetchView, PushView,
|
|
CorrespondentViewSet, TagViewSet, DocumentViewSet, LogViewSet
|
|
)
|
|
from reminders.views import ReminderViewSet
|
|
|
|
router = DefaultRouter()
|
|
router.register(r"correspondents", CorrespondentViewSet)
|
|
router.register(r"documents", DocumentViewSet)
|
|
router.register(r"logs", LogViewSet)
|
|
router.register(r"reminders", ReminderViewSet)
|
|
router.register(r"tags", TagViewSet)
|
|
|
|
urlpatterns = [
|
|
|
|
# API
|
|
url(
|
|
r"^api/auth/",
|
|
include('rest_framework.urls', namespace="rest_framework")
|
|
),
|
|
url(r"^api/", include(router.urls, namespace="drf")),
|
|
|
|
# File downloads
|
|
url(
|
|
r"^fetch/(?P<kind>doc|thumb)/(?P<pk>\d+)$",
|
|
FetchView.as_view(),
|
|
name="fetch"
|
|
),
|
|
|
|
# The Django admin
|
|
url(r"admin/", admin.site.urls),
|
|
url(r"", admin.site.urls), # This is going away
|
|
|
|
] + static.static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
|
|
|
if settings.SHARED_SECRET:
|
|
urlpatterns.insert(
|
|
0,
|
|
url(r"^push$", csrf_exempt(PushView.as_view()), name="push")
|
|
)
|
|
|
|
# Text in each page's <h1> (and above login form).
|
|
admin.site.site_header = 'Paperless'
|
|
# Text at the end of each page's <title>.
|
|
admin.site.site_title = 'Paperless'
|
|
# Text at the top of the admin index page.
|
|
admin.site.index_title = 'Paperless administration'
|