Atualização automática: 2026-05-24 01:20:13
This commit is contained in:
+13
-12
@@ -680,11 +680,14 @@ app.post('/api/ai/inject-redesign', (req, res) => {
|
||||
if (isCustomPath) {
|
||||
// Se for um caminho customizado absoluto fornecido pelo usuário
|
||||
folderPath = cloneDir;
|
||||
originalFolderName = path.basename(folderPath);
|
||||
newFolderPath = path.join(path.dirname(folderPath), `${originalFolderName}_${agentName || 'designer'}`);
|
||||
const cleanPath = cloneDir.endsWith('/') ? cloneDir.slice(0, -1) : cloneDir;
|
||||
originalFolderName = path.basename(cleanPath);
|
||||
// Sempre salvar a versão do designer em cloned-sites para o preview funcionar
|
||||
newFolderPath = path.join(__dirname, '..', 'cloned-sites', `${originalFolderName}_${agentName || 'designer'}`);
|
||||
} else {
|
||||
// Comportamento padrão (lendo da storage interna cloned-sites)
|
||||
originalFolderName = cloneDir.split('/').pop();
|
||||
const cleanDir = cloneDir.endsWith('/') ? cloneDir.slice(0, -1) : cloneDir;
|
||||
originalFolderName = cleanDir.split('/').pop();
|
||||
folderPath = path.join(__dirname, '..', 'cloned-sites', originalFolderName);
|
||||
newFolderPath = path.join(__dirname, '..', 'cloned-sites', `${originalFolderName}_${agentName || 'designer'}`);
|
||||
}
|
||||
@@ -829,15 +832,13 @@ p, span, li, label, td, th {
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Sincronizar o novo diretório com o host (somente se NÃO for customPath, pois customPath já está no lugar certo)
|
||||
if (!isCustomPath) {
|
||||
const hostDir = outputDir || '/root/Desktop/CLONE_SITE';
|
||||
const containerId = require('os').hostname();
|
||||
exec(`mkdir -p "${hostDir}" && cp -r "${newFolderPath}" "${hostDir}/" 2>/dev/null || docker cp ${containerId}:"${newFolderPath}" "${hostDir}/" 2>/dev/null`, (syncErr) => {
|
||||
if (syncErr) console.log('⚠️ Redesign sync to host failed:', syncErr.message);
|
||||
else console.log('✅ Redesign synced to host output dir:', path.basename(newFolderPath));
|
||||
});
|
||||
}
|
||||
// 3. Sincronizar o novo diretório com o host
|
||||
const hostDir = outputDir || '/root/Desktop/CLONE_SITE';
|
||||
const containerId = require('os').hostname();
|
||||
exec(`mkdir -p "${hostDir}" && cp -r "${newFolderPath}" "${hostDir}/" 2>/dev/null || docker cp ${containerId}:"${newFolderPath}" "${hostDir}/" 2>/dev/null`, (syncErr) => {
|
||||
if (syncErr) console.log('⚠️ Redesign sync to host failed:', syncErr.message);
|
||||
else console.log('✅ Redesign synced to host output dir:', path.basename(newFolderPath));
|
||||
});
|
||||
|
||||
res.json({ success: true, message: 'AI Redesign CSS injected successfully', newFolderName: path.basename(newFolderPath) });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user