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

Function getSubStoreVersion

sub/sub.ts:62–89  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60
61// 获取Sub-Store版本
62async function getSubStoreVersion(): Promise<string> {
63 try {
64 const containerStatus = await sh(
65 "docker ps --format '{{.Names}}' | grep sub-store"
66 );
67 if (!containerStatus.trim()) {
68 return "未运行";
69 }
70
71 let logOutput = await sh(
72 "docker logs sub-store 2>&1 | grep 'Sub-Store -- v' | head -1"
73 );
74
75 // 如果没有找到版本信息,可能是日志不完整,重启容器生成完整日志
76 if (!logOutput.trim()) {
77 await sh("docker restart sub-store");
78 await sh("sleep 5"); // 等待容器启动
79 logOutput = await sh(
80 "docker logs sub-store 2>&1 | grep 'Sub-Store -- v' | head -1"
81 );
82 }
83
84 const versionMatch = logOutput.match(/Sub-Store -- (v[\d.]+)/);
85 return versionMatch ? versionMatch[1] : "未知版本";
86 } catch (error: any) {
87 return "获取失败";
88 }
89}
90
91// 获取远程最新版本
92async function getRemoteVersion(): Promise<string> {

Callers 1

SubStorePluginClass · 0.85

Calls 1

shFunction · 0.85

Tested by

no test coverage detected