From 1fde3c5caba99ddeff559d85163195ab71fd6800 Mon Sep 17 00:00:00 2001 From: Hermes Date: Mon, 18 May 2026 11:36:09 +0000 Subject: [PATCH] =?UTF-8?q?Atualiza=C3=A7=C3=A3o=20autom=C3=A1tica:=202026?= =?UTF-8?q?-05-18=2011:36:09?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 4 ++++ web-interface/server.js | 18 ++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 166eea6..e3957a9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -68,6 +68,8 @@ services: volumes: - ./services/api-gateway:/app - /app/node_modules + - ./cloned-sites:/app/cloned-sites + - /root/Desktop/Clonados:/root/Desktop/Clonados # Crawler Service crawler-service: @@ -87,6 +89,8 @@ services: volumes: - ./services/crawler:/app - /app/node_modules + - ./cloned-sites:/app/cloned-sites + - /root/Desktop/Clonados:/root/Desktop/Clonados volumes: postgres_data: diff --git a/web-interface/server.js b/web-interface/server.js index 6b20fe4..f5b27f4 100644 --- a/web-interface/server.js +++ b/web-interface/server.js @@ -83,9 +83,9 @@ app.post('/api/wget-clone', async (req, res) => { const containerId = require('os').hostname(); const cloneDir = directory.split('/').pop(); const hostDir = '/root/Desktop/Clonados'; - exec(`docker cp ${containerId}:${directory} ${hostDir}/ 2>/dev/null`, (err) => { + exec(`mkdir -p ${hostDir} && cp -r ${directory} ${hostDir}/ 2>/dev/null || docker cp ${containerId}:${directory} ${hostDir}/ 2>/dev/null`, (err) => { if (err) console.log('⚠️ Sync to host failed:', err.message); - else console.log('✅ Clone synced to host:', cloneDir); + else console.log('✅ Clone synced to host Desktop:', cloneDir); }); } @@ -152,6 +152,20 @@ app.post('/api/smart-clone', (req, res) => { if (matches && matches.length > 0) { const lastMatch = matches[matches.length - 1]; const result = JSON.parse(lastMatch); + + // Sync to host /root/Desktop/Clonados + const directory = result.data?.directory || result.directory || result.path; + if (result.success && directory) { + const { exec } = require('child_process'); + const containerId = require('os').hostname(); + const cloneDir = directory.split('/').pop(); + const hostDir = '/root/Desktop/Clonados'; + exec(`mkdir -p ${hostDir} && cp -r ${directory} ${hostDir}/ 2>/dev/null || docker cp ${containerId}:${directory} ${hostDir}/ 2>/dev/null`, (err) => { + if (err) console.log('⚠️ SmartClone sync to host failed:', err.message); + else console.log('✅ SmartClone synced to host Desktop:', cloneDir); + }); + } + res.json({ success: result.success, data: result,