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:
parent
cfbb71464b
commit
5384f36c6d
@ -44,9 +44,10 @@ app.get('/webcam/:printer', (req, res) => {
|
|||||||
let printer: PrinterStatus | undefined = printerStatuses.find(
|
let printer: PrinterStatus | undefined = printerStatuses.find(
|
||||||
p => p.name === req.params.printer
|
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 });
|
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'));
|
let bundler = new Bundler(path.join(__dirname, 'index.html'));
|
||||||
|
Loading…
Reference in New Issue
Block a user