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

Method restoreFromBackup

zpr/zpr.ts:123–134  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

121 const backupExists = await fs.access(this.backupPath).then(() => true).catch(() => false);
122 if (backupExists) {
123 await fs.copyFile(this.backupPath, this.configPath);
124 console.log("[zpr] 从备份恢复配置成功");
125 }
126 } catch (error) {
127 console.error("[zpr] 备份恢复失败:", error);
128 await this.createDefaultConfig();
129 }
130 }
131
132 private static async createDefaultConfig(): Promise<void> {
133 await fs.writeFile(this.configPath, JSON.stringify(DEFAULT_CONFIG, null, 2));
134 console.log("[zpr] 创建默认配置");
135 }
136
137 private static async handleInitError(): Promise<void> {

Callers 2

validateAndRestoreMethod · 0.95
writeConfigWithRetryMethod · 0.95

Calls 2

createDefaultConfigMethod · 0.95
errorMethod · 0.80

Tested by

no test coverage detected