优化跨盘秒传

This commit is contained in:
King committed 2026-07-30 15:18:10 +08:00
1 parent b814ac6d43
commit 4cffa98fb5
163 files changed
+405 -138

No files matched your search

+37 -16
View File
@@ -18,10 +18,10 @@ func (h *Handler) crossTransferRoutes(w http.ResponseWriter, r *http.Request) {
}
type crossTransferScanReq struct {
SourceAccountID int64 `json:"source_account_id"`
SourceParentID string `json:"source_parent_id"`
Method string `json:"method"`
SourceDisplayPath string `json:"source_display_path"`
SourceAccountID int64 `json:"source_account_id"`
SourceParentID string `json:"source_parent_id"`
Method string `json:"method"`
SourceDisplayPath string `json:"source_display_path"`
}
func (h *Handler) crossTransferScan(w http.ResponseWriter, r *http.Request) {
@@ -41,6 +41,27 @@ func (h *Handler) crossTransferScan(w http.ResponseWriter, r *http.Request) {
writeOK(w, result)
}
func (h *Handler) crossTransferScanStream(w http.ResponseWriter, r *http.Request) {
if !ensureServiceReady(w, h.crossTransfer != nil) {
return
}
var req crossTransferScanReq
if err := decodeJSON(r, &req); err != nil {
writeErr(w, err)
return
}
h.streamCrossTransferNDJSON(w, r, func(emit func(crosstransfer.StreamEvent) error) error {
return h.crossTransfer.ScanSourceStream(
r.Context(),
req.SourceAccountID,
req.SourceParentID,
req.Method,
req.SourceDisplayPath,
emit,
)
})
}
type crossTransferProbeFile struct {
SourceFileID string `json:"source_file_id"`
RelPath string `json:"rel_path"`
@@ -91,18 +112,18 @@ type crossTransferTransferFile struct {
}
type crossTransferExecuteReq struct {
SourceAccountID int64 `json:"source_account_id"`
SourceAccountName string `json:"source_account_name"`
SourceDriverType string `json:"source_driver_type"`
TargetAccountID int64 `json:"target_account_id"`
TargetAccountName string `json:"target_account_name"`
TargetDriverType string `json:"target_driver_type"`
TargetParentID string `json:"target_parent_id"`
TargetDisplayPath string `json:"target_display_path"`
Method string `json:"method"`
Files []crossTransferTransferFile `json:"files"`
Conflict string `json:"conflict"`
Fallback bool `json:"fallback"`
SourceAccountID int64 `json:"source_account_id"`
SourceAccountName string `json:"source_account_name"`
SourceDriverType string `json:"source_driver_type"`
TargetAccountID int64 `json:"target_account_id"`
TargetAccountName string `json:"target_account_name"`
TargetDriverType string `json:"target_driver_type"`
TargetParentID string `json:"target_parent_id"`
TargetDisplayPath string `json:"target_display_path"`
Method string `json:"method"`
Files []crossTransferTransferFile `json:"files"`
Conflict string `json:"conflict"`
Fallback bool `json:"fallback"`
}
func (h *Handler) crossTransferExecute(w http.ResponseWriter, r *http.Request) {
+2 -1
View File
@@ -25,9 +25,9 @@ import (
"litepan/internal/crosstransfer"
"litepan/internal/domain"
"litepan/internal/embyproxy"
"litepan/internal/fnosproxy"
"litepan/internal/favorites"
"litepan/internal/file"
"litepan/internal/fnosproxy"
"litepan/internal/fusemount"
"litepan/internal/logx"
"litepan/internal/mediaorganize"
@@ -171,6 +171,7 @@ func NewRouter(d Deps) http.Handler {
r.Route("/cross-transfer", func(r chi.Router) {
r.Get("/routes", h.crossTransferRoutes)
r.Post("/scan", h.crossTransferScan)
r.Post("/scan/stream", h.crossTransferScanStream)
r.Post("/probe", h.crossTransferProbe)
r.Post("/execute", h.crossTransferExecute)
r.Get("/relay/tasks", h.crossTransferRelayTasks)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loaded 100 of 163 files, more files were not shown because too many files have changed in this diff. Show more