mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-11-03 02:26:43 +09:00
Sync v1 POSTs the whole payload in one request, so it is capped by the panel's 100MB MAX_CONTENT_LENGTH and a drop at 99% means starting over. v2 makes every request one 8 MiB chunk, which lifts the cap and makes a retry cost only what was actually lost. - POST /push/<kind>/init: describes the transfer, reaps stale ones, and returns the offsets already confirmed for an identical payload — that array IS resume. - PUT /push/<kind>/chunk: per-chunk sha256, idempotent re-sends, marker written after the bytes so a crash costs one chunk, not a corrupt file. - POST /push/<kind>/finish: verifies the whole-file sha256, THEN runs the processing. Missing chunks are a 409 with the received set (resumable); a hash mismatch discards. Because processing only ever runs on verified bytes, an abandoned transfer cannot leave half-applied state. - push/code and push/db v1 now delegate to _install_code/_import_db, so v1 and v2 share exactly one processing path and the safe-extract policy stays mandatory in both. - Pulls accept ?session= and serve with conditional=True, giving Range / If-Range. The session pins one materialized export: pull/db and pull/code build their payload per request, and ranges taken from two different mysqldump/tar runs would assemble into neither. No session = v1 export-and-delete, unchanged. A transfer is a directory under the temp dir with per-chunk marker files rather than a shared JSON list, so concurrent chunk writes need no lock. Transfer ids are validated against uuid4().hex before touching a path. FEATURES gains 'sync-v2'; older clients keep the v1 routes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>