mirror of
https://github.com/ad1217/PrinterStatus
synced 2024-11-21 15:03:48 -05:00
Minor formatting changes from prettier 2.0
This commit is contained in:
parent
a08e57afad
commit
a50d53203c
@ -3,5 +3,5 @@ import Vue from 'vue';
|
|||||||
import App from './App';
|
import App from './App';
|
||||||
|
|
||||||
let app = new Vue({
|
let app = new Vue({
|
||||||
render: h => h(App),
|
render: (h) => h(App),
|
||||||
}).$mount('#app');
|
}).$mount('#app');
|
||||||
|
@ -21,7 +21,7 @@ const config: {
|
|||||||
} = yaml.safeLoad(fs.readFileSync('config.yaml', 'utf8'));
|
} = yaml.safeLoad(fs.readFileSync('config.yaml', 'utf8'));
|
||||||
|
|
||||||
const proxy = httpProxy.createProxyServer({});
|
const proxy = httpProxy.createProxyServer({});
|
||||||
proxy.on('error', function(e) {
|
proxy.on('error', function (e) {
|
||||||
console.error('Proxy failed:');
|
console.error('Proxy failed:');
|
||||||
console.error(e);
|
console.error(e);
|
||||||
});
|
});
|
||||||
@ -42,13 +42,13 @@ function broadcastPayload(payload: messages.ExtendedMessage) {
|
|||||||
const wsInstance = expressWs(express());
|
const wsInstance = expressWs(express());
|
||||||
const app = wsInstance.app;
|
const app = wsInstance.app;
|
||||||
|
|
||||||
app.ws('/ws', function(ws, req) {
|
app.ws('/ws', function (ws, req) {
|
||||||
printerStatuses.forEach((ps: PrinterStatus) => ps.send_init(ws));
|
printerStatuses.forEach((ps: PrinterStatus) => ps.send_init(ws));
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/webcam/:printer', (req, res) => {
|
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?.webcamURL) {
|
if (printer?.webcamURL) {
|
||||||
req.url = ''; // truncate the url for passing to the proxy
|
req.url = ''; // truncate the url for passing to the proxy
|
||||||
@ -153,7 +153,7 @@ class PrinterStatus {
|
|||||||
|
|
||||||
function initPrinters() {
|
function initPrinters() {
|
||||||
printerStatuses = config.printers.map(
|
printerStatuses = config.printers.map(
|
||||||
printer => new PrinterStatus(printer.address, printer.apikey)
|
(printer) => new PrinterStatus(printer.address, printer.apikey)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user