feat(downloads): M4 — REST API (enqueue, manage, file-serve, sharing, admin)
routes/downloads.py (require_human; admin_router adds admin_user):
- profiles: list (builtins + own), create/update/delete custom
- enqueue: resolve_source (bare id / watch / youtu.be / shorts URLs -> youtube id; else
raw URL for the generic extractor), profile_id or inline spec or builtin fallback; maps
quota.QuotaExceeded -> 422 speaking message
- list / usage / shared-with-me; rename (display name only); pause/resume/cancel/delete
(ref_count bookkeeping)
- GET /{id}/file: ownership-or-share check, path-traversal guard, range-aware FileResponse
with the user's custom display name (Content-Disposition), bumps last_access
- share/unshare by email + a download_shared notification
- admin: all-jobs, storage dashboard (totals + per-user footprint), per-user quota GET/PUT/DELETE
- cast SUM(bigint) footprints to int for clean numeric JSON
- wired both routers in main.py
Verified via TestClient: full enqueue->download->206 range fetch->share->access-control
(cross-user delete 404); unauth = 401 on user + admin routes; all 15 paths registered.
This commit is contained in:
parent
7148335c09
commit
51158ad9cf
3 changed files with 623 additions and 1 deletions
|
|
@ -31,6 +31,7 @@ from app.routes import (
|
|||
admin,
|
||||
channels,
|
||||
config as config_routes,
|
||||
downloads,
|
||||
feed,
|
||||
health,
|
||||
me,
|
||||
|
|
@ -122,6 +123,8 @@ app.include_router(messages.router)
|
|||
app.include_router(channels.router)
|
||||
app.include_router(playlists.router)
|
||||
app.include_router(saved_views.router)
|
||||
app.include_router(downloads.router)
|
||||
app.include_router(downloads.admin_router)
|
||||
app.include_router(admin.router)
|
||||
app.include_router(config_routes.router)
|
||||
app.include_router(scheduler_routes.router)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue