mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-01 12:06:38 +08:00
feat(organize): separate source dir from destination dir (从源目录整理到目的地目录)
Previously organize only exposed a single 'target dir' that was actually the destination, conflating 源目录 (where files to organize live) with 目的地目录 (where organized files go). Add an explicit source directory: - OrganizeOptions gains SourcePath; DestPath replaces the old TargetPath (destination) for clarity. New organize.source_dir setting + source_path request override; resolveSourceRoot falls back to library path. - OrganizeLibraryWithOptions only organizes media located under the source root, so operators can point at a specific download/staging folder and organize into a distinct destination. - Handler accepts source_path/dest_path (target_path kept as a deprecated alias for the destination, backward compatible). - Settings page splits into 整理源目录(待整理) + 整理目的地目录; Tools organize panel exposes 源目录 + 目的地目录 inputs with clear copy. Defaults are unchanged (source = destination = library path) so existing setups behave identically. Adds a regression test that organize is scoped to the source directory. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
@@ -11,8 +11,13 @@ import (
|
||||
)
|
||||
|
||||
// organizeReq carries optional per-request overrides. 留空则沿用系统设置。
|
||||
//
|
||||
// source_path = 源目录(待整理),dest_path = 目的地目录(整理输出)。
|
||||
// target_path 为 dest_path 的向后兼容别名。
|
||||
type organizeReq struct {
|
||||
TargetPath string `json:"target_path"`
|
||||
SourcePath string `json:"source_path"`
|
||||
DestPath string `json:"dest_path"`
|
||||
TargetPath string `json:"target_path"` // deprecated alias for dest_path
|
||||
TransferMode string `json:"transfer_mode"`
|
||||
}
|
||||
|
||||
@@ -21,7 +26,14 @@ type organizeReq struct {
|
||||
func bindOrganizeOptions(c *gin.Context) service.OrganizeOptions {
|
||||
var req organizeReq
|
||||
_ = c.ShouldBindJSON(&req)
|
||||
opts := service.OrganizeOptions{TargetPath: strings.TrimSpace(req.TargetPath)}
|
||||
dest := strings.TrimSpace(req.DestPath)
|
||||
if dest == "" {
|
||||
dest = strings.TrimSpace(req.TargetPath)
|
||||
}
|
||||
opts := service.OrganizeOptions{
|
||||
SourcePath: strings.TrimSpace(req.SourcePath),
|
||||
DestPath: dest,
|
||||
}
|
||||
if m := strings.TrimSpace(req.TransferMode); m != "" {
|
||||
opts.TransferMode = service.TransferMode(m)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user