Spaces:
Sleeping
Sleeping
Download server.js from codebybrody/TwistedStreamingBrody: direct link, hf CLI and curl.
- Browser
- Download file 22.7 kB
-
https://huggingface.co/spaces/codebybrody/TwistedStreamingBrody/resolve/main/server.js
- Command line
-
hf download hf://spaces/codebybrody/TwistedStreamingBrody/server.js
-
curl -L -o server.js https://huggingface.co/spaces/codebybrody/TwistedStreamingBrody/resolve/main/server.js
22.7 kB
| import express from 'express'; | |
| import cors from 'cors'; | |
| import fs from 'fs'; | |
| import path from 'path'; | |
| import axios from 'axios'; | |
| import archiver from 'archiver'; | |
| import PDFDocument from 'pdfkit'; | |
| import { spawn } from 'child_process'; | |
| import { fileURLToPath } from 'url'; | |
| import { initializeApp } from 'firebase/app'; | |
| import sharp from 'sharp'; | |
| import { getFirestore, collection, query, where, getDocs, orderBy } from 'firebase/firestore'; | |
| sharp.cache(false); // Disable cache to prevent memory growth during batch processing | |
| const __filename = fileURLToPath(import.meta.url); | |
| const __dirname = path.dirname(__filename); | |
| const app = express(); | |
| const PORT = process.env.PORT || 7860; | |
| app.use(cors()); | |
| app.use(express.json({ limit: '50mb' })); | |
| // Serve static files from the dist directory | |
| app.use(express.static(path.join(__dirname, 'dist'))); | |
| // --- Firebase Config --- | |
| const firebaseConfig = { | |
| apiKey: "TU_NUEVA_API_KEY", | |
| authDomain: "twisted-streaming-brody.firebaseapp.com", | |
| projectId: "twisted-streaming-brody", | |
| storageBucket: "twisted-streaming-brody.firebasestorage.app", | |
| messagingSenderId: "TU_NUEVA_SENDER", | |
| appId: "TU_NUEVA_APPID", | |
| measurementId: "TU_NUEVA_MEASUREMENT" | |
| }; | |
| const firebaseApp = initializeApp(firebaseConfig); | |
| const db = getFirestore(firebaseApp); | |
| // --- 1. AlmacΓ©n global de progreso --- | |
| const progresoDescargas = {}; | |
| // --- Helpers --- | |
| const downloadsDir = path.join(__dirname, 'downloads'); | |
| if (!fs.existsSync(downloadsDir)) { | |
| fs.mkdirSync(downloadsDir); | |
| } | |
| // --- Colores para la Terminal --- | |
| const esc = String.fromCharCode(27); | |
| const c = { | |
| reset: `${esc}[0m`, | |
| bold: `${esc}[1m`, | |
| gray: `${esc}[90m`, | |
| cyan: `${esc}[96m`, | |
| green: `${esc}[92m`, | |
| yellow: `${esc}[93m`, | |
| magenta: `${esc}[95m`, | |
| red: `${esc}[31m` | |
| }; | |
| // --- Cleanup on Startup --- | |
| function cleanDownloadsFolder() { | |
| process.stdout.write(` ${c.gray}[SYSTEM]${c.reset} Limpiando archivos temporales...\n`); | |
| try { | |
| const files = fs.readdirSync(downloadsDir); | |
| let deletedCount = 0; | |
| for (const file of files) { | |
| if (file === '.gitkeep') continue; | |
| fs.unlinkSync(path.join(downloadsDir, file)); | |
| deletedCount++; | |
| } | |
| if (deletedCount > 0) { | |
| process.stdout.write(` ${c.gray}[SYSTEM]${c.reset} ${c.green}OK:${c.reset} Se eliminaron ${deletedCount} archivos antiguos.\n`); | |
| } else { | |
| process.stdout.write(` ${c.gray}[SYSTEM]${c.reset} ${c.green}OK:${c.reset} Carpeta limpia.\n`); | |
| } | |
| } catch (err) { | |
| process.stdout.write(` ${c.gray}[SYSTEM]${c.reset} ${c.red}ERROR:${c.reset} ${err.message}\n`); | |
| } | |
| } | |
| cleanDownloadsFolder(); | |
| function sanitizeFilename(name) { | |
| return name.replace(/[^a-z0-9]/gi, '_'); | |
| } | |
| async function downloadImage(url) { | |
| try { | |
| const response = await axios({ | |
| url, | |
| method: 'GET', | |
| responseType: 'arraybuffer', | |
| headers: { | |
| 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36', | |
| 'Referer': 'https://google.com' | |
| } | |
| }); | |
| if (response.status !== 200) throw new Error(`Status ${response.status}`); | |
| return response.data; | |
| } catch (error) { | |
| console.error(`[DEBUG] Download failed: ${error.message} (${url})`); | |
| throw error; | |
| } | |
| } | |
| // --- 2. Ruta para que el Frontend escuche el progreso (SSE) --- | |
| app.get('/api/download/progress/:jobId', (req, res) => { | |
| res.setHeader('Content-Type', 'text/event-stream'); | |
| res.setHeader('Cache-Control', 'no-cache'); | |
| res.setHeader('Connection', 'keep-alive'); | |
| const { jobId } = req.params; | |
| // Enviamos un latido cada 500ms | |
| const interval = setInterval(() => { | |
| const p = progresoDescargas[jobId] || 0; | |
| res.write(`data: ${JSON.stringify({ progress: p })}\n\n`); | |
| if (p >= 100 || p === 'error') { | |
| clearInterval(interval); | |
| if (p >= 100) delete progresoDescargas[jobId]; // Limpiar memoria | |
| } | |
| }, 500); | |
| req.on('close', () => clearInterval(interval)); | |
| }); | |
| // --- Firebase Fetch Helper --- | |
| async function getAllChapters(mangaId) { | |
| process.stdout.write(`[FIREBASE] Searching chapters: ${mangaId}\n`); | |
| // HACKER FIX: Consultamos solo por 'where' para evitar el error de "Index Required". | |
| // Ordenamos los datos nosotros mismos en la memoria RAM del servidor. | |
| const q = query( | |
| collection(db, "chapters"), | |
| where("manga_id", "==", mangaId) | |
| ); | |
| const querySnapshot = await getDocs(q); | |
| if (querySnapshot.empty) { | |
| // Fallback: Try with 'mangaId' just in case the field name varies | |
| console.log("[FIREBASE] Intento secundario con campo 'mangaId'..."); | |
| const q2 = query(collection(db, "chapters"), where("mangaId", "==", mangaId)); | |
| const snapshot2 = await getDocs(q2); | |
| if (snapshot2.empty) { | |
| throw new Error('No se encontraron capΓtulos para este mangaId (ni por manga_id ni mangaId).'); | |
| } | |
| return processSnapshot(snapshot2); | |
| } | |
| return processSnapshot(querySnapshot); | |
| } | |
| function processSnapshot(snapshot) { | |
| process.stdout.write(`[FIREBASE] Found ${snapshot.size} chapters. Sorting...\n`); | |
| const chapters = snapshot.docs.map(doc => { | |
| const data = doc.data(); | |
| return { | |
| id: doc.id, | |
| number: Number(data.number) || 0, // Ensure number for sorting | |
| original_pages: data.original_pages || [], | |
| pages: data.pages || [] | |
| }; | |
| }); | |
| // Ordenamiento manual (Bypass del Γndice compuesto) | |
| return chapters.sort((a, b) => a.number - b.number); | |
| } | |
| // --- Image Proxy & Optimization --- | |
| app.get('/api/image-proxy', async (req, res) => { | |
| const { url, width, height, quality, format } = req.query; | |
| if (!url) { | |
| return res.status(400).send('URL is required'); | |
| } | |
| try { | |
| // 1. Fetch the original image | |
| const response = await axios({ | |
| url: url, | |
| method: 'GET', | |
| responseType: 'arraybuffer', | |
| headers: { | |
| 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36', | |
| 'Referer': 'https://google.com' | |
| } | |
| }); | |
| let imageBuffer = response.data; | |
| // 2. Set aggressive cache headers (1 day) | |
| res.setHeader('Cache-Control', 'public, max-age=86400, mutable'); | |
| // 3. Resize if requested (Sharp) | |
| if (width || height || (format && format !== 'original')) { | |
| const pipeline = sharp(imageBuffer); | |
| if (width || height) { | |
| pipeline.resize( | |
| width ? parseInt(width) : null, | |
| height ? parseInt(height) : null, | |
| { | |
| fit: 'inside', | |
| withoutEnlargement: true | |
| } | |
| ); | |
| } | |
| // Format conversion (default to webp for performance check) | |
| const outFormat = format || 'webp'; | |
| const outQuality = quality ? parseInt(quality) : 85; | |
| if (outFormat === 'webp') { | |
| pipeline.webp({ quality: outQuality }); | |
| res.setHeader('Content-Type', 'image/webp'); | |
| } else if (outFormat === 'jpeg' || outFormat === 'jpg') { | |
| pipeline.jpeg({ quality: outQuality }); | |
| res.setHeader('Content-Type', 'image/jpeg'); | |
| } else if (outFormat === 'png') { | |
| pipeline.png({ quality: outQuality }); | |
| res.setHeader('Content-Type', 'image/png'); | |
| } | |
| imageBuffer = await pipeline.toBuffer(); | |
| } else { | |
| // Pass-through original content type if not converting | |
| res.setHeader('Content-Type', response.headers['content-type']); | |
| } | |
| res.send(imageBuffer); | |
| } catch (error) { | |
| console.error(`[PROXY ERROR] ${url}: ${error.message}`); | |
| // Fallback: Redirect to original URL if proxy fails | |
| res.redirect(url); | |
| } | |
| }); | |
| // --- Routes --- | |
| app.get('/api/progress/:jobId', (req, res) => { | |
| const { jobId } = req.params; | |
| res.writeHead(200, { | |
| 'Content-Type': 'text/event-stream', | |
| 'Cache-Control': 'no-cache', | |
| 'Connection': 'keep-alive' | |
| }); | |
| jobs[jobId] = { res, progress: 0 }; | |
| console.log(`[SERVIDOR] Cliente conectado (Job: ${jobId})`); | |
| req.on('close', () => { | |
| if (jobs[jobId]) delete jobs[jobId]; | |
| }); | |
| }); | |
| app.post('/api/download/zip', async (req, res) => { | |
| console.log("[DEBUG] Body recibido ZIP:", JSON.stringify(req.body).substring(0, 500)); | |
| const { mangaTitle, format } = req.body; // format: 'png', 'jpg', 'webp', 'original' | |
| const mangaId = req.body.mangaId || req.body.manga_id; | |
| if (!mangaId || mangaId === 'undefined') { | |
| console.error("[SERVIDOR] β Error: MangaId indefinido"); | |
| return res.status(400).json({ error: "ID requerido" }); | |
| } | |
| process.stdout.write(`\n[ZIP] Generating stream for: ${mangaTitle} (${format})\n`); | |
| try { | |
| const chapters = await getAllChapters(mangaId); | |
| // Set headers for download | |
| res.setHeader('Content-Type', 'application/zip'); | |
| res.setHeader('Content-Disposition', `attachment; filename="${sanitizeFilename(mangaTitle)}.zip"`); | |
| // OPTIMIZATION: Use level 1 (Fastest) instead of 9 (Best) to avoid CPU bottleneck | |
| const archive = archiver('zip', { zlib: { level: 1 } }); | |
| archive.on('error', (err) => { | |
| console.error('[SERVIDOR] β Error ZIP:', err); | |
| if (!res.headersSent) res.status(500).send({ error: err.message }); | |
| }); | |
| archive.pipe(res); | |
| // Collect all pages | |
| let totalPagesToDownload = 0; | |
| const chaptersToProcess = []; | |
| for (const chap of chapters) { | |
| let pages = []; | |
| if (format === 'original') { | |
| pages = (chap.original_pages && chap.original_pages.length > 0) ? chap.original_pages : chap.pages; | |
| } else { | |
| pages = (chap.pages && chap.pages.length > 0) ? chap.pages : chap.original_pages; | |
| } | |
| if (pages && pages.length > 0) { | |
| chaptersToProcess.push({ number: chap.number, pages }); | |
| totalPagesToDownload += pages.length; | |
| } | |
| } | |
| // Process chapters in parallel (limit parallelism to avoid memory exploded with sharp) | |
| let processedTotal = 0; | |
| // Helper for sequential processing within chapters to manage concurrency better | |
| for (const chap of chaptersToProcess) { | |
| console.log(`[STREAM] Procesando Cap ${chap.number}`); | |
| // OPTIMIZATION: Increased batch size from 20 to 50 for faster downloads | |
| const chunkSize = 50; | |
| for (let i = 0; i < chap.pages.length; i += chunkSize) { | |
| const batch = chap.pages.slice(i, i + chunkSize); | |
| await Promise.all(batch.map(async (pageUrl, batchIndex) => { | |
| const pageIndex = i + batchIndex; | |
| try { | |
| let buffer = await downloadImage(pageUrl); | |
| // --- CONVERSION LOGIC --- | |
| let ext = 'jpg'; | |
| let finalBuffer = buffer; | |
| // Usar sharp para leer de los headers del buffer el formato real | |
| try { | |
| const metadata = await sharp(buffer).metadata(); | |
| if (metadata.format) { | |
| ext = metadata.format === 'jpeg' ? 'jpg' : metadata.format; | |
| } | |
| } catch (err) { | |
| // Fallback si no es imagen o falla leer metadata | |
| if (pageUrl.toLowerCase().includes('.png') || pageUrl.toLowerCase().includes('.png?')) ext = 'png'; | |
| else if (pageUrl.toLowerCase().includes('.webp') || pageUrl.toLowerCase().includes('.webp?')) ext = 'webp'; | |
| } | |
| // IF format is NOT original, we convert (except GIFs to preserve animation) | |
| if (ext === 'gif') { | |
| // Si es un GIF, omitimos la conversiΓ³n para no perder la animaciΓ³n | |
| } else if (format && format !== 'original') { | |
| try { | |
| // Format mappings for sharp | |
| let sharpFormat = format; | |
| if (format === 'jpg') sharpFormat = 'jpeg'; | |
| // Perform conversion | |
| finalBuffer = await sharp(buffer) | |
| .toFormat(sharpFormat, { quality: 90 }) | |
| .toBuffer(); | |
| ext = format; // Update extension to requested format | |
| } catch (sharpErr) { | |
| console.warn(`[WARN] FallΓ³ conversiΓ³n a ${format}, usanda original.`, sharpErr.message); | |
| } | |
| } | |
| const cleanChapterNum = String(chap.number).padStart(2, '0'); | |
| const archivePath = `Capitulo_${cleanChapterNum}/pagina_${String(pageIndex + 1).padStart(3, '0')}.${ext}`; | |
| archive.append(finalBuffer, { name: archivePath }); | |
| // --- UPDATE PROGRESS --- | |
| processedTotal++; | |
| const porcentaje = Math.round((processedTotal / totalPagesToDownload) * 100); | |
| progresoDescargas[mangaId] = porcentaje; | |
| } catch (e) { | |
| console.error(`[!] Error Cap ${chap.number} pΓ‘g ${pageIndex}: ${e.message}`); | |
| } | |
| })); | |
| } | |
| } | |
| // Force 100% on complete | |
| progresoDescargas[mangaId] = 100; | |
| await archive.finalize(); | |
| } catch (error) { | |
| console.error(`[SERVIDOR] β Error Global: ${error.message}`); | |
| fs.writeFileSync(path.join(__dirname, 'server_error.log'), `[${new Date().toISOString()}] Error ZIP: ${error.stack}\n`, { flag: 'a' }); | |
| progresoDescargas[mangaId] = 'error'; | |
| if (!res.headersSent) res.status(500).json({ error: error.message }); | |
| } | |
| }); | |
| // const { spawn } = require('child_process'); // Removed: using import at top | |
| app.post('/api/download/pdf', async (req, res) => { | |
| console.log("[DEBUG] Body recibido PDF:", JSON.stringify(req.body).substring(0, 500)); | |
| const { mangaTitle, format, jobId } = req.body; | |
| const mangaId = req.body.mangaId || req.body.manga_id; | |
| if (!mangaId || mangaId === 'undefined') { | |
| console.error("[SERVIDOR] β Error: Se recibiΓ³ un mangaId indefinido para PDF"); | |
| return res.status(400).json({ error: "El ID del manga es obligatorio" }); | |
| } | |
| console.log(`\n[SERVIDOR] Solicitud PDF (Python Bridge) para: ${mangaTitle} (ID: ${mangaId})`); | |
| // Notify client PDF is starting (optional, but good if we kept SSE) | |
| // sendProgress(jobId, 10, 'starting'); // We might not be able to track detailed progress easily w/o advanced python ipc | |
| try { | |
| // 1. Fetch URLs using existing helper | |
| const chapters = await getAllChapters(mangaId); | |
| let allUrls = []; | |
| // Sort chapters just to be safe, though getAllChapters does it | |
| chapters.sort((a, b) => a.number - b.number); | |
| for (const chap of chapters) { | |
| let pages = []; | |
| if (format === 'original') pages = (chap.original_pages && chap.original_pages.length > 0) ? chap.original_pages : chap.pages; | |
| else pages = (chap.pages && chap.pages.length > 0) ? chap.pages : chap.original_pages; | |
| if (pages && pages.length > 0) { | |
| allUrls = allUrls.concat(pages); | |
| } | |
| } | |
| if (allUrls.length === 0) { | |
| throw new Error("No extracted pages found to convert."); | |
| } | |
| console.log(`[PYTHON] Delegando ${allUrls.length} pΓ‘ginas al script converter.py...`); | |
| const safeTitle = sanitizeFilename(mangaTitle); | |
| const timestamp = new Date().toISOString().replace(/[:.]/g, '-'); | |
| const pdfName = `${safeTitle}_HackerMode_${timestamp}.pdf`; | |
| const pdfPath = path.join(downloadsDir, pdfName); // Use full path | |
| // 2. Call Python Script in Unbuffered mode | |
| // HACKER FIX: En Docker/Linux a menudo es 'python3', en Windows 'python' | |
| const pythonCmd = process.env.PYTHON_CMD || (process.platform === 'win32' ? 'python' : 'python3'); | |
| console.log(`[SERVIDOR] Usando comando Python: ${pythonCmd}`); | |
| const scriptPath = path.join(__dirname, 'converter.py'); | |
| const pythonProcess = spawn(pythonCmd, ['-u', scriptPath]); | |
| // Send data to Python via STDIN | |
| pythonProcess.stdin.write(JSON.stringify({ | |
| urls: allUrls, | |
| output: pdfPath | |
| })); | |
| pythonProcess.stdin.end(); | |
| // π© Logic to sync progress with SSE | |
| let imagenesTerminadas = 0; | |
| const totalPaginasTarget = allUrls.length; | |
| pythonProcess.stdout.on('data', (data) => { | |
| const lineas = data.toString().split('\n'); | |
| lineas.forEach(line => { | |
| const mensaje = line.trim(); | |
| if (mensaje.includes("PROGRESS:IMAGE_DONE")) { | |
| imagenesTerminadas++; | |
| const porcentaje = Math.round((imagenesTerminadas / totalPaginasTarget) * 100); | |
| // Update global store for SSE | |
| progresoDescargas[mangaId] = porcentaje; | |
| process.stdout.write(`\r[PYTHON] β‘ Descarga Paralela: ${imagenesTerminadas}/${totalPaginasTarget} (${porcentaje}%)`); | |
| } else if (mensaje === "STATUS:SUCCESS") { | |
| console.log("\n[PYTHON] β PDF Creado con Γ©xito."); | |
| progresoDescargas[mangaId] = 100; // Ensure 100% | |
| } else if (mensaje.startsWith("DEBUG:")) { | |
| // console.log(`\n[PYTHON] ${mensaje}`); | |
| } | |
| }); | |
| }); | |
| pythonProcess.stderr.on('data', (data) => { | |
| console.error(`[PYTHON STDERR]: ${data}`); | |
| }); | |
| pythonProcess.on('close', (code) => { | |
| if (code === 0) { | |
| console.log(`[SERVIDOR] β PDF creado por Python: ${pdfPath}`); | |
| // 3. Send file to client | |
| res.download(pdfPath, (err) => { | |
| if (err) { | |
| console.error("Error sending file:", err); | |
| if (!res.headersSent) res.status(500).send("Error downloading file"); | |
| } | |
| // Cleanup temp file after sending | |
| if (fs.existsSync(pdfPath)) { | |
| // small timeout to ensure stream closed | |
| setTimeout(() => fs.unlinkSync(pdfPath), 1000); | |
| } | |
| }); | |
| } else { | |
| console.error(`[SERVIDOR] β Python exited with code ${code}`); | |
| if (!res.headersSent) res.status(500).send("Error en la conversiΓ³n a PDF (Python Code " + code + ")"); | |
| } | |
| }); | |
| } catch (error) { | |
| console.error(`[SERVIDOR] β Error Global PDF: ${error.message}`); | |
| if (!res.headersSent) res.status(500).send({ error: error.message }); | |
| } | |
| }); | |
| // --- Image Processing Endpoint --- | |
| app.post('/api/process-image', async (req, res) => { | |
| const startTime = Date.now(); | |
| const { name, index, total } = req.body; // Extraemos metadatos | |
| try { | |
| const { image } = req.body; | |
| if (!image) { | |
| return res.status(400).json({ error: 'Image data is required' }); | |
| } | |
| // Log inicial del lote (solo si es la primera imagen y viene la info) | |
| if (index === 1 && total) { | |
| console.log(`\n[PROCESAMIENTO] οΏ½ Iniciando lote: procesando ${total} imagenes`); | |
| } | |
| // Extract base64 | |
| const base64Data = image.replace(/^data:image\/\w+;base64,/, ""); | |
| const buffer = Buffer.from(base64Data, 'base64'); | |
| // Procesamiento en Paralelo | |
| const [webpBuffer, thumbnailBuffer] = await Promise.all([ | |
| sharp(buffer) | |
| .resize(1200, null, { fit: 'inside', withoutEnlargement: true }) | |
| .webp({ quality: 90 }) | |
| .toBuffer(), | |
| sharp(buffer) | |
| .resize(400, null, { fit: 'inside', withoutEnlargement: true }) | |
| .jpeg({ quality: 80, leaflet: true }) | |
| .toBuffer() | |
| ]); | |
| // Log de finalizaciΓ³n estilo solicitado | |
| if (index && total) { | |
| console.log(`finalizado ${index} paginas`); // "finalizado 1 paginas", "finalizado 2 paginas"... | |
| if (index === total) { | |
| console.log(`\n[PROCESAMIENTO] β Lote de ${total} imΓ‘genes completado.`); | |
| } | |
| } else { | |
| // Fallback para subidas individuales (portada, etc) | |
| const duration = Date.now() - startTime; | |
| console.log(`[PROCESAMIENTO] π’ Completado: ${name} (${duration}ms)`); | |
| } | |
| res.json({ | |
| success: true, | |
| data: { | |
| webp: `data:image/webp;base64,${webpBuffer.toString('base64')}`, | |
| thumbnail: `data:image/jpeg;base64,${thumbnailBuffer.toString('base64')}` | |
| } | |
| }); | |
| } catch (error) { | |
| console.error(`[PROCESAMIENTO] π΄ Error con ${name}:`, error.message); | |
| res.status(500).json({ error: 'Failed to process image', details: error.message }); | |
| } | |
| }); | |
| // --- Health Check --- | |
| app.get('/health', (req, res) => { | |
| res.status(200).send('OK'); | |
| }); | |
| // --- Catch-all to serve index.html for client-side routing (Express 5 fix) --- | |
| app.get(/.*/, (req, res) => { | |
| if (req.path.startsWith('/api')) { | |
| return res.status(404).json({ error: 'Not Found' }); | |
| } | |
| const indexPath = path.join(__dirname, 'dist', 'index.html'); | |
| if (fs.existsSync(indexPath)) { | |
| res.sendFile(indexPath); | |
| } else { | |
| // Fallback si no existe el build del frontend | |
| res.status(200).send(` | |
| <html> | |
| <head><title>Server Running</title></head> | |
| <body style="font-family: monospace; background: #1a1a1a; color: #0f0; padding: 2rem;"> | |
| <h1>β Server Status: ONLINE (Hacker Mode)</h1> | |
| <p>El servidor Backend estΓ‘ funcionando correctamente.</p> | |
| <hr style="border-color: #333;"> | |
| <p>β οΈ <strong>Frontend no encontrado:</strong> No se encontrΓ³ el archivo <code>dist/index.html</code>.</p> | |
| <p>Posibles causas:</p> | |
| <ul> | |
| <li>El proceso de build (<code>npm run build</code>) fallΓ³ o no se ejecutΓ³ en el Dockerfile.</li> | |
| <li>La carpeta <code>dist</code> estΓ‘ en .dockerignore pero no se generΓ³ dentro de la imagen.</li> | |
| </ul> | |
| <p>Revisa los logs de "Build" en Hugging Face.</p> | |
| </body> | |
| </html> | |
| `); | |
| } | |
| }); | |
| app.listen(PORT, '0.0.0.0', () => { | |
| console.log(`\n ${c.gray}ββββββββββββββββββββββββββββββββββββββββββββββββββββ${c.reset}`); | |
| console.log(` ${c.bold}MANGAFLOW${c.reset} ${c.gray}v2.5.0${c.reset} ${c.green}ONLINE${c.reset}`); | |
| console.log(` ${c.gray}ββββββββββββββββββββββββββββββββββββββββββββββββββββ${c.reset}`); | |
| console.log(` ${c.cyan}β Visualizador: ${c.reset}${c.green}http://localhost:3000/${c.reset}`); | |
| console.log(` ${c.cyan}β Administrador: ${c.reset}${c.magenta}http://localhost:3000/?admin=true${c.reset}`); | |
| console.log(` ${c.gray}ββββββββββββββββββββββββββββββββββββββββββββββββββββ${c.reset}\n`); | |
| }); | |