Phase 3: J-IDs, ownership, roles, guest safety, adaptive detail, download

Backend:
- User.role (user/uploader/staff) with can_upload; uploads and downloads
  gated to uploader+; owners and staff can edit their items
- MediaItem.uploaded_by plus J-<id> identity (serializer, admin,
  scan_files --user, first superuser as default owner)
- API resolves J-<id>, bare numeric ids and MD5s; neighbors and lookup
  return j_ids
- Guest safety: mirror e621's anonymous default blacklist into Redis
  (parses comments, negations and wildcards), flag hidden_from_guests
  and filter lists, details and lookups for anonymous users
- POST /api/online/downloads/ writes an e621 file into the watched
  folder and indexes it for the uploader
- MariaDB + Redis via docker compose (host ports 3307/6380), PyMySQL
  driver shim, Redis cache replacing the file cache; SQLite data
  dumped and loaded into MariaDB

Frontend:
- Single /detail/:itemId route with an adaptive shell: J-<id> renders
  the library item, bare numbers render the e621 post
- Legacy /view/<md5> and /online/view/<id> redirect to canonical URLs
- Cards expose J-IDs; library custom-data editor is read-only for
  non-owners
- Role gating: Upload hidden/blocked for regular users, account shows
  the role, guest hint on the library
This commit is contained in:
2026-09-17 10:16:45 -05:00
parent d6c3f90c1f
commit e5cc63b0cc
36 changed files with 954 additions and 194 deletions
+9
View File
@@ -4,6 +4,10 @@ export interface User {
email: string;
is_staff: boolean;
date_joined: string;
role: "user" | "uploader" | "staff";
can_upload: boolean;
e621_username: string;
e621_configured: boolean;
}
export interface MediaLocation {
@@ -16,6 +20,8 @@ export interface MediaLocation {
export type Rating = "" | "s" | "q" | "e";
export interface MediaItem {
id: number;
j_id: string;
md5: string;
size: number;
rating: Rating;
@@ -24,6 +30,8 @@ export interface MediaItem {
filename: string;
extension: string;
kind: "image" | "video";
uploaded_by: string | null;
uploaded_by_id: number | null;
locations: MediaLocation[];
created_at: string;
updated_at: string;
@@ -56,6 +64,7 @@ export interface SystemStatus {
}
export interface FileNeighbor {
j_id: string;
md5: string;
filename: string;
}