2
0
mirror of https://github.com/ad1217/PrinterStatus synced 2024-11-21 15:03:48 -05:00

Truncate URLs for passing to the webcam proxy

This commit is contained in:
Adam Goldsmith 2019-10-22 12:59:12 -04:00
parent cfbb71464b
commit 5384f36c6d

View File

@ -44,9 +44,10 @@ app.get('/webcam/:printer', (req, res) => {
let printer: PrinterStatus | undefined = printerStatuses.find(
p => p.name === req.params.printer
);
if (printer && printer.webcamURL)
if (printer && printer.webcamURL) {
req.url = ''; // truncate the url for passing to the proxy
proxy.web(req, res, { target: printer.webcamURL });
else res.status(404).send('Not Found: Printer not known or has no webcam.');
} else res.status(404).send('Not Found: Printer not known or has no webcam.');
});
let bundler = new Bundler(path.join(__dirname, 'index.html'));