Improve mpv playback configuration
This commit is contained in:
@@ -31,6 +31,12 @@ const app = express();
|
||||
app.use(express.json());
|
||||
expressWs(app);
|
||||
|
||||
const frontendDistPath = [
|
||||
path.join(__dirname, "../dist/frontend"),
|
||||
path.join(__dirname, "../../frontend/dist"),
|
||||
].find((candidate) => fs.existsSync(path.join(candidate, "index.html")))
|
||||
|| path.join(__dirname, "../dist/frontend");
|
||||
|
||||
const apiRouter = express.Router();
|
||||
const mediaPlayer = new MediaPlayer();
|
||||
|
||||
@@ -300,14 +306,14 @@ apiRouter.get("/features", withErrorHandling(async (req, res) => {
|
||||
}));
|
||||
|
||||
// Serve static files for React app (after building)
|
||||
app.use(express.static(path.join(__dirname, "../dist/frontend")));
|
||||
app.use(express.static(frontendDistPath));
|
||||
|
||||
// Mount API routes under /api
|
||||
app.use("/api", apiRouter);
|
||||
|
||||
// Serve React app for all other routes (client-side routing)
|
||||
app.get("*", (req, res) => {
|
||||
res.sendFile(path.join(__dirname, "../dist/frontend/index.html"));
|
||||
res.sendFile(path.join(frontendDistPath, "index.html"));
|
||||
});
|
||||
|
||||
const port = process.env.PORT || 3000;
|
||||
|
||||
Reference in New Issue
Block a user