diff --git a/server/server.js b/server/server.js index 62b9acb..fc7945a 100644 --- a/server/server.js +++ b/server/server.js @@ -2086,7 +2086,6 @@ function broadcastFileUpdate(rootFolder) { function broadcastDiskSpace() { if (!wss) return; getSystemDiskInfo(DOWNLOAD_DIR).then(diskInfo => { - console.log("🔄 Broadcasting disk space:", diskInfo); const data = JSON.stringify({ type: "diskSpace", data: diskInfo @@ -3522,15 +3521,10 @@ const server = app.listen(PORT, () => wss = new WebSocketServer({ server }); wss.on("connection", (ws) => { - console.log("🔌 New WebSocket connection established"); ws.send(JSON.stringify({ type: "progress", torrents: snapshot() })); // Bağlantı kurulduğunda disk space bilgisi gönder broadcastDiskSpace(); - ws.on("close", () => { - console.log("🔌 WebSocket connection closed"); - }); - ws.on("error", (error) => { console.error("🔌 WebSocket error:", error); }); diff --git a/server/utils/diskSpace.js b/server/utils/diskSpace.js index 9d128a9..4fd340d 100644 --- a/server/utils/diskSpace.js +++ b/server/utils/diskSpace.js @@ -10,20 +10,17 @@ const execAsync = promisify(exec); * @returns {Promise} Disk alanı bilgileri */ export async function getDiskSpace(path = '/') { - console.log("🔍 Getting disk space for path:", path); try { // Linux/macOS için df komutu kullan if (process.platform !== 'win32') { const escapedPath = path.replace(/(["\\$`])/g, '\\$1'); const blockFlag = process.platform === 'darwin' ? '-k' : '-k'; const { stdout } = await execAsync(`df ${blockFlag} "${escapedPath}"`); - console.log("📊 df command output:", stdout); const lines = stdout.trim().split('\n'); if (lines.length >= 2) { // Çoğu dağıtımda veriler ikinci satırda const data = lines[lines.length - 1].trim().split(/\s+/); - console.log("📋 Parsed df data:", data); if (data.length < 5) { throw new Error("df output could not be parsed"); } @@ -37,8 +34,7 @@ export async function getDiskSpace(path = '/') { const total = totalBlocks * 1024; const used = usedBlocks * 1024; const available = availableBlocks * 1024; - - console.log("📏 Calculated sizes (bytes):", { total, used, available, usedPercent }); + const totalFormatted = formatBytes(total); const usedFormatted = formatBytes(used); @@ -62,7 +58,6 @@ export async function getDiskSpace(path = '/') { usedUnit: usedFormatted.unit }; - console.log("✅ Final disk space result:", result); return result; } } else { @@ -158,7 +153,6 @@ function parseSize(sizeStr) { const unit = match[2] ? match[2].toUpperCase() : ''; const result = value * (units[unit] || 1); - console.log(`🔍 parseSize: ${sizeStr} -> ${result} bytes`); return result; } @@ -228,13 +222,9 @@ export async function getDownloadsSize(downloadsPath) { * @returns {Promise} Kapsamlı disk bilgileri */ export async function getSystemDiskInfo(downloadsPath) { - console.log("🔍 Getting system disk info for:", downloadsPath); const diskSpace = await getDiskSpace(downloadsPath); const downloadsSize = await getDownloadsSize(downloadsPath); - console.log("📊 Disk space result:", diskSpace); - console.log("📁 Downloads size result:", downloadsSize); - return { ...diskSpace, downloads: downloadsSize,