Backend: - DownloadTask model + background thread runner: streams the file with progress (%, bytes, speed) and a cancel flag, then indexes it, names it J-<id>.<ext> and applies the e621 metadata - DownloadTaskViewSet (create/retrieve/cancel) replaces the synchronous endpoint; the status footer's worker counts now reflect download jobs - Client download proxy (/api/online/file/) streams an e621 original to the browser with Content-Disposition: attachment, restricted to the configured e621 CDN hosts so it cannot be used as an open proxy Frontend: - Online detail: progress bar with percentage, transferred size, speed and cancel while downloading; success links to the new J-ID - New 'Download to client' button available to everyone (guests too)
16 lines
568 B
Python
16 lines
568 B
Python
from django.urls import include, path
|
|
from rest_framework.routers import DefaultRouter
|
|
|
|
from .uploads import TempUploadViewSet
|
|
from .views import ClientDownloadView, DownloadTaskViewSet, MediaItemViewSet
|
|
|
|
router = DefaultRouter()
|
|
router.register("files", MediaItemViewSet, basename="file")
|
|
router.register("uploads", TempUploadViewSet, basename="upload")
|
|
router.register("online/downloads", DownloadTaskViewSet, basename="download")
|
|
|
|
urlpatterns = [
|
|
path("", include(router.urls)),
|
|
path("online/file/", ClientDownloadView.as_view(), name="client_download"),
|
|
]
|