Skip to content

Commit afd7fb4

Browse files
committed
feat(switch): 默认扁平化布局,兼容嵌套
- versionSwitchPaths: 新增 FLAT_DIR_NAMES + findFlatPeerEdition() - resolveRuntimeHome: 检测扁平布局时 home=父目录 - ensureNestedLayout: 扁平优先,无 pendingNest - prepareEdition: 扁平模式下克隆到同级目录 - EditionLayout 接口 + NestedLayout 别名兼容 - controller: nest skip 消息区分扁平/嵌套 - switch help: 更新布局说明文本
1 parent fab200f commit afd7fb4

3 files changed

Lines changed: 216 additions & 41 deletions

File tree

‎src/plugin/switch.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ const T = {
6767
``,
6868
`在 TeleBox 和 TeleBox-Next 之间切换。`,
6969
`session 直接转换,不用重新登录。`,
70-
`两版都放在原安装目录下:telebox/telebox-classic 与 telebox/telebox-next。`,
70+
`两版默认放在同级目录:telebox 与 telebox-next(或 telebox-classic)。`,
71+
`也兼容嵌套布局:telebox/telebox-classic 与 telebox/telebox-next。`,
7172
``,
7273
`两个子命令:`,
7374
``,
@@ -271,7 +272,7 @@ const plugin = new (class extends Plugin {
271272
``,
272273
message,
273274
``,
274-
`会在原运行时目录下使用 telebox-classic / telebox-next 子目录;`,
275+
`会在同级目录或原运行时目录下使用 telebox / telebox-next 子目录;`,
275276
`没有的那一版会自动创建并下载。`,
276277
].join("\n"),
277278
});

‎src/utils/versionSwitchController.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ async function main(): Promise<void> {
489489
} catch { /* ignore */ }
490490
await progress.set("stop", "done", "源 bot 已离线,后续由目标版完成通知");
491491

492-
// Flatten → nested: move live edition into home/telebox-xx after process stopped
492+
// Flatten → nested: move live edition into home/telebox-xx after process stopped (nested layout only)
493493
const nestState = ensureNestedLayout();
494494
if (nestState.pendingNest) {
495495
await progress.set("nest", "running");
@@ -510,7 +510,7 @@ async function main(): Promise<void> {
510510
await progress.set("nest", "done");
511511
} else {
512512
REPO_ROOTS = resolveRepoRoots();
513-
await progress.set("nest", "skip", "已是嵌套布局");
513+
await progress.set("nest", "skip", nestState.flat ? "扁平布局,无需整理" : "已是嵌套布局");
514514
}
515515

516516
// ── Step 5: Start target (PM2 --cwd = nested edition dir) ─────────

0 commit comments

Comments
 (0)