Dockerfile update

This commit is contained in:
2025-10-21 21:43:46 +03:00
parent 1d0ab8caee
commit d02928e307
3 changed files with 38 additions and 25 deletions

View File

@@ -300,6 +300,19 @@ console.log("📂 Download path:", DOWNLOAD_DIR);
const server = app.listen(PORT, () =>
console.log(`✅ WebTorrent server ${PORT} portunda çalışıyor`)
);
// --- ✅ Client build (frontend) dosyalarını sun ---
const publicDir = path.join(__dirname, "public");
if (fs.existsSync(publicDir)) {
app.use(express.static(publicDir));
// Frontend route'larını index.html'e yönlendir
app.get("*", (req, res, next) => {
if (req.path.startsWith("/api")) return next();
res.sendFile(path.join(publicDir, "index.html"));
});
}
const wss = new WebSocketServer({ server });
wss.on("connection", (ws) => {
ws.send(JSON.stringify({ type: "progress", torrents: snapshot() }));