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

Method handleUninstall

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

Source from the content-addressed store, hash-verified

330
331 await execAsync(`systemctl stop openlist || true`);
332 await execAsync(`cp "${installPath}/openlist" /tmp/openlist.bak || true`);
333 await execAsync(`tar zxf "${tarPath}" -C "${installPath}/"`);
334 await execAsync(`chmod +x "${installPath}/openlist"`);
335 await execAsync(`systemctl restart openlist`);
336
337 const { stdout: verOut } = await execAsync(
338 `bash -lc '"${installPath}/openlist" version 2>&1 || true'`
339 );
340 const verMatch = verOut.match(/Version:\s*([^\s]+)/);
341 const version = verMatch ? verMatch[1] : "";
342 await msg.edit({ text: `更新完成${version ? `,版本: ${version}` : ""}` });
343 } catch (error: any) {
344 await msg.edit({ text: `更新失败: ${error?.message || error}` });
345 }
346 }
347
348 private async handleUninstall(msg: Api.Message) {
349 try {
350 if (process.platform !== "linux") {
351 await msg.edit({ text: "仅支持 Linux(systemd)环境" });
352 return;
353 }
354
355 const installPath = await this.detectInstalledPath();

Callers 1

handleCommandMethod · 0.95

Calls 3

detectInstalledPathMethod · 0.95
fileExistsMethod · 0.95
editMethod · 0.45

Tested by

no test coverage detected