feat: 宿主机 ↔ 容器路径双向映射
部署到群晖 / deploy (push) Successful in 46s

config.yaml 新增 path_mapping 段声明宿主机前缀与容器挂载点前缀的对应关系。
用户在 Web 界面和 config 里填宿主机真实路径(如群晖 /volume2/...),
程序在真正落盘、调用云盘 SDK 前透明转成容器内路径,保证文件写到 bind mount
而不是容器 overlay 文件系统;前端显示/返回的路径再反向转回宿主机形式。

无映射配置时所有 to_container/to_host 均原样返回,向后兼容老配置。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
yuming
2026-04-24 21:43:55 +08:00
parent 4fc76e27f3
commit a697ce8852
3 changed files with 82 additions and 5 deletions
+3 -2
View File
@@ -16,6 +16,7 @@ from ruamel.yaml import YAML
from werkzeug.serving import make_server
import utils
from module import path_mapper
from module.app import Application, ChatDownloadConfig, TaskNode
from module.download_stat import (
DownloadState,
@@ -337,7 +338,7 @@ def get_download_list():
"total_size": format_byte(r.get("file_size") or 0),
"download_progress": "100",
"download_speed": r.get("download_time", ""),
"save_path": (r.get("file_path") or "").replace("\\", "/"),
"save_path": path_mapper.to_host((r.get("file_path") or "").replace("\\", "/")),
"status": r.get("status", "success"),
})
return json.dumps({
@@ -363,7 +364,7 @@ def get_download_list():
"total_size": format_byte(value["total_size"]),
"download_progress": str(round(value["down_byte"] / value["total_size"] * 100, 1)),
"download_speed": download_speed,
"save_path": value["file_name"].replace("\\", "/"),
"save_path": path_mapper.to_host(value["file_name"].replace("\\", "/")),
"paused": is_message_paused(str(chat_id), idx),
})
return json.dumps(items, ensure_ascii=False)