fix: clean up empty blocks and unused variables in backend utils

修复了后端工具文件中的空块和未使用的变量:
- auth-manager.ts: 移除空 else 块
- system-crypto.ts: 修复空 catch 块并添加注释
- starter.ts: 修复空 catch 块并添加注释
- server-stats.ts: 将未使用的 reject 参数重命名为 _reject
- credentials.ts: 将 connectionTimeout 从 let 改为 const

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ZacharyZcR
2025-10-05 20:40:45 +08:00
parent 78ae23f680
commit d75b76dbb9
5 changed files with 8 additions and 6 deletions

View File

@@ -1124,9 +1124,8 @@ async function deploySSHKeyToHost(
): Promise<{ success: boolean; message?: string; error?: string }> {
return new Promise((resolve) => {
const conn = new Client();
let connectionTimeout: NodeJS.Timeout;
connectionTimeout = setTimeout(() => {
const connectionTimeout = setTimeout(() => {
conn.destroy();
resolve({ success: false, error: "Connection timeout" });
}, 120000);

View File

@@ -60,7 +60,7 @@ class SSHConnectionPool {
return client;
}
return new Promise((resolve, reject) => {
return new Promise((resolve, _reject) => {
const checkAvailable = () => {
const available = connections.find((conn) => !conn.inUse);
if (available) {

View File

@@ -21,7 +21,9 @@ import { systemLogger, versionLogger } from "./utils/logger.js";
if (persistentConfig.parsed) {
Object.assign(process.env, persistentConfig.parsed);
}
} catch {}
} catch {
// Ignore errors if .env file doesn't exist
}
let version = "unknown";

View File

@@ -108,7 +108,6 @@ class AuthManager {
if (migrationResult.migrated) {
await saveMemoryDatabaseToFile();
} else {
}
} catch (error) {
databaseLogger.error("Lazy encryption migration failed", error, {

View File

@@ -37,7 +37,9 @@ class SystemCrypto {
process.env.JWT_SECRET = jwtMatch[1];
return;
}
} catch {}
} catch {
// Ignore file read errors, will generate new secret
}
await this.generateAndGuideUser();
} catch (error) {