|
|
|
|
@ -4,6 +4,8 @@ const express = require('express');
|
|
|
|
|
const app = express();
|
|
|
|
|
const fileUpload = require('express-fileupload');
|
|
|
|
|
|
|
|
|
|
const fetch = require('node-fetch');
|
|
|
|
|
|
|
|
|
|
app.use(express.json());
|
|
|
|
|
app.use(fileUpload());
|
|
|
|
|
|
|
|
|
|
@ -141,6 +143,24 @@ app.post("/playoverlay", (req, res) => {
|
|
|
|
|
res.json({ status: 'ok' });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
app.post("/startprojector", (req, res) => {
|
|
|
|
|
require('child_process').spawn('sudo', ['/home/pi/video-player/start-projector.sh']);
|
|
|
|
|
res.json({ status: 'ok' });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
app.post("/stopprojector", (req, res) => {
|
|
|
|
|
require('child_process').spawn('sudo', ['/home/pi/video-player/stop-projector.sh']);
|
|
|
|
|
res.json({ status: 'ok' });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
app.get("/projectorstatus", async (req, res) => {
|
|
|
|
|
const res1 = await fetch('http://192.168.1.93/api/v01/control/escvp21?cmd=PWR?');
|
|
|
|
|
const status1 = await res1.text();
|
|
|
|
|
const res2 = await fetch('http://192.168.1.67/api/v01/control/escvp21?cmd=PWR?');
|
|
|
|
|
const status2 = await res2.text();
|
|
|
|
|
res.json({ status1, status2 });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
app.post('/upload', function (req, res) {
|
|
|
|
|
|
|
|
|
|
if (!req.files || Object.keys(req.files).length === 0) {
|
|
|
|
|
|