5 Commits
Author SHA1 Message Date
耗子 b070d2d0d0 chore: 支持迁移用户 2026-08-15 10:02:37 +08:00
耗子andClaude Fable 5 745e88df69 feat: 迁移补回传输进度日志并改进时间显示
- 传输层通过回调上报字节数,下载与上传共用一套节流与格式化,每秒最多一条;
  首秒不打,秒传的小文件无需进度,耗时过短算出的速度也没有参考价值
- 运行中显示实时累计耗时,结束后显示时间区间与总耗时,此前结束时间为空
  会渲染成两个横杠
- 步骤条末步按内容收缩,其没有连接线,再占等分宽度会在右侧留下空白
- 预检阶段提示目标缺少来源所用的 PHP 版本:宝塔从站点表的 php_version 取,
  1Panel 网站列表只给运行环境名,从运行环境列表换取版本

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-15 07:02:04 +08:00
耗子andClaude Opus 5 2a63a022e0 refactor: 重写宝塔与 1Panel 迁移
对照宝塔 11.0 与 1Panel v2 源码核实全部接口与字段,删除凭空猜测的兼容分支:
status 别名表、key/Key/k 环境变量、msg/message 双兼容、字符串二次解析、
下载重试 180 次、归档 magic 校验、残留资源清单。

按分层重新组织:service 只处理 HTTP,编排与导入下沉到 biz,两个适配器共享
HTTP 客户端,助手函数与正则收进各自结构体。容器与 Compose 迁移不再支持。

顺带修复宝塔 GetSSL 在未开启 SSL 时被误判为接口失败,以及备份完成后才恢复
来源导致停机时间过长。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-14 21:26:16 +08:00
耗子 5303979097 feat: 支持宝塔和 1Panel 迁移 2026-08-13 01:11:12 +08:00
7da411b2f3 feat: 工具箱-迁移功能 (Toolbox Migration) (#1358)
* Initial plan

* feat: add migration backend service, routes and Wire injection

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* feat: add migration frontend - API, WebSocket, MigrationView and tab integration

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* refactor: move migration types to pkg/types, fix code review issues

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* chore: final cleanup

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* feat: add refresh button on migration pre-check step

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* feat: add SSH key exchange for rsync authentication

Generate temporary ED25519 key pair before migration, deploy public
key to remote via POST /api/toolbox_migration/ssh_key, use -i flag
in all rsync/ssh commands, cleanup key from both sides after migration.

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* fix: lint

* fix: lint

* fix: align migration code with actual codebase patterns

- Project service name: use project name directly (not ace-project-xxx)
- MySQL dump: use MYSQL_PWD env var (not -p flag), remove --socket
- PostgreSQL dump: use PGPASSWORD env var with pg_dump -h 127.0.0.1 -U postgres
- PostgreSQL import: use PGPASSWORD with psql -h 127.0.0.1 -U postgres
- MySQL import: use MYSQL_PWD on remote
- Website create API: use correct listens/domains/type fields
- Project create API: use root_dir/exec_start/user fields
- Database create API: pass server_id properly
- Site directory: use filepath.Join(app.Root, "sites") instead of hardcoded path
- maskPassword: handle MYSQL_PWD/PGPASSWORD env var format

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* fix: add PHP version and proxy backend to website create API body

PHP sites now include the php version number, and reverse proxy sites
include the backend address from Proxies[0].Pass. This matches the
WebsiteCreate validation rules (requiredIf:Type,php / requiredIf:Type,proxy).

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* refactor: replace map[string]any with typed request structs for all remote API calls

Use request.WebsiteCreate, request.DatabaseCreate, request.ProjectCreate,
and request.ToolboxMigrationSSHKey instead of ad-hoc map[string]any.
This ensures all required/validated fields are properly typed and present.

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* fix: website list empty and database migration items stuck in running status

1. Website list: pass "all" to websiteRepo.List() instead of "" — empty
   string was treated as a type filter matching nothing.

2. Database status: result was stored with name "aaa (mysql)" but
   failResult/succeedResult looked up by "aaa" — name mismatch meant
   status was never updated from "running". Use displayName consistently.

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* fix: use acepanel CLI to get remote DB passwords, show success text in results

1. Remote DB import: use `acepanel setting get mysql_root_password` and
   `acepanel setting get postgres_password` on the remote server via SSH
   instead of guessing file paths. The $() is escaped so it executes on
   the remote side, not locally.

2. Migration results: successful items now show "Migration succeeded"
   text alongside the completion timestamp instead of a bare date.

Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>

* fix: lint

* refactor: 不基于rsync的迁移

* fix: lint

* fix: lint

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: devhaozi <115467771+devhaozi@users.noreply.github.com>
Co-authored-by: 耗子 <haozi@loli.email>
2026-02-10 02:51:03 +08:00