MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / handleBackup

Method handleBackup

openlist/openlist.ts:354–374  ·  view source on GitHub ↗
(msg: Api.Message)

Source from the content-addressed store, hash-verified

352 return;
353 }
354
355 const installPath = await this.detectInstalledPath();
356 const existed = await this.fileExists(`${installPath}/openlist`);
357 await execAsync(`systemctl stop openlist || true`);
358 await execAsync(`systemctl disable openlist || true`);
359 await execAsync(`rm -f /etc/systemd/system/openlist.service || true`);
360 await execAsync(`systemctl daemon-reload || true`);
361 if (existed) {
362 await execAsync(`rm -rf "${installPath}"`);
363 }
364 await msg.edit({ text: "已卸载" });
365 } catch (error: any) {
366 await msg.edit({ text: `卸载失败: ${error?.message || error}` });
367 }
368 }
369
370 private async handleBackup(msg: Api.Message) {
371 try {
372 const installPath = await this.detectInstalledPath();
373 if (!(await this.dirExists(`${installPath}/data`))) {
374 await msg.edit({ text: `未找到配置目录:${codeTag(`${installPath}/data`)}`, parseMode: "html" });
375 return;
376 }
377

Callers 1

handleCommandMethod · 0.95

Calls 5

detectInstalledPathMethod · 0.95
dirExistsMethod · 0.95
codeTagFunction · 0.70
htmlEscapeFunction · 0.70
editMethod · 0.45

Tested by

no test coverage detected