Atualização automática: 2026-05-23 22:02:28
This commit is contained in:
+32
-3
@@ -320,7 +320,7 @@ app.post('/api/wget-clone', async (req, res) => {
|
||||
|
||||
// Smart Clone Endpoint (Local Spawn)
|
||||
app.post('/api/smart-clone', (req, res) => {
|
||||
const { url } = req.body;
|
||||
const { url, folderName } = req.body;
|
||||
|
||||
if (!url) {
|
||||
return res.status(400).json({ error: 'URL is required' });
|
||||
@@ -331,9 +331,12 @@ app.post('/api/smart-clone', (req, res) => {
|
||||
|
||||
// Spawn the smart cloner process
|
||||
const scriptPath = path.join(__dirname, '..', 'simple-crawler', 'smart-cloner.js');
|
||||
console.log(`[SmartClone] Executing: node "${scriptPath}" --url="${url}"`);
|
||||
let spawnArgs = [scriptPath, `--url=${url}`];
|
||||
if (folderName) spawnArgs.push(`--folderName=${folderName}`);
|
||||
|
||||
const child = spawn('node', [scriptPath, `--url=${url}`], {
|
||||
console.log(`[SmartClone] Executing: node "${scriptPath}" --url="${url}" ${folderName ? `--folderName="${folderName}"` : ''}`);
|
||||
|
||||
const child = spawn('node', spawnArgs, {
|
||||
cwd: path.join(__dirname, '..'),
|
||||
shell: true
|
||||
});
|
||||
@@ -596,6 +599,32 @@ app.get('/index', (req, res) => {
|
||||
res.redirect('/');
|
||||
});
|
||||
|
||||
// List optimized pages
|
||||
app.get('/api/optimized-pages', (req, res) => {
|
||||
try {
|
||||
const clonesDir = path.join(__dirname, '..', 'cloned-sites');
|
||||
if (!fs.existsSync(clonesDir)) {
|
||||
return res.json({ success: true, pages: [] });
|
||||
}
|
||||
|
||||
const items = fs.readdirSync(clonesDir);
|
||||
const optimized = items
|
||||
.filter(item => {
|
||||
const fullPath = path.join(clonesDir, item);
|
||||
return fs.statSync(fullPath).isDirectory() && item.endsWith('_designer');
|
||||
})
|
||||
.map(item => ({
|
||||
name: item,
|
||||
directory: item
|
||||
}));
|
||||
|
||||
res.json({ success: true, pages: optimized });
|
||||
} catch (error) {
|
||||
console.error('Error listing optimized pages:', error);
|
||||
res.status(500).json({ success: false, error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
// AI Agent Route (MiniMax)
|
||||
app.post('/api/ai/agent', async (req, res) => {
|
||||
const { systemPrompt, userMessage } = req.body;
|
||||
|
||||
Reference in New Issue
Block a user