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

Function restartSSHService

ssh/ssh.ts:213–231  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

211 static async get(key: string, defaultValue?: string): Promise<string> {
212 await this.init();
213 if (!this.db) return defaultValue || DEFAULT_CONFIG[key] || "";
214 const value = this.db.data[key];
215 return value ?? defaultValue ?? DEFAULT_CONFIG[key] ?? "";
216 }
217
218 static async set(key: string, value: string): Promise<boolean> {
219 await this.init();
220 if (!this.db) return false;
221 try {
222 this.db.data[key] = value;
223 await this.db.write();
224 return true;
225 } catch (error) {
226 console.error(`[ssh] 设置配置失败 ${key}:`, error);
227 return false;
228 }
229 }
230}
231
232// 帮助文本
233// SSH服务重启通用函数
234const restartSSHService = async (): Promise<{ success: boolean; command?: string }> => {

Callers 6

changeSSHPortMethod · 0.85
togglePasswordAuthMethod · 0.85
toggleKeyAuthMethod · 0.85
toggleRootLoginMethod · 0.85
enableRootAccountMethod · 0.85
restartSSHMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected