feat(backups): 主人和管理员可下载单个备份、导出停服世界,字节经一次性票据从导出 Job 流式转给浏览器,备份按 sha256 核对

This commit is contained in:
Lemon-miaow committed 2026-09-28 00:58:42 +08:00
1 parent 34b81ee8fe
commit 5dffadb40d
35 files changed
+4018 -70

No files matched your search

+12
View File
@@ -210,6 +210,18 @@ func (b *deadlineBody) Read(p []byte) (int, error) {
return n, err
}
// takeBodyDeadline lifts withBodyDeadline from a request whose body is read at
// someone else's pace (an export's upload waits for the browser, then moves at
// its speed), and returns the controller the handler bounds it with instead.
func takeBodyDeadline(w http.ResponseWriter, r *http.Request) *http.ResponseController {
if b, ok := r.Body.(*deadlineBody); ok {
r.Body = b.ReadCloser
_ = b.rc.SetReadDeadline(time.Time{})
return b.rc
}
return http.NewResponseController(w)
}
// requireInternal enforces service-token auth for the internal face and stashes
// the caller the token belongs to, which callersOnly checks against the route.
// It never applies Zero Trust (spec §14 red line).