mirror of
https://github.com/KubaPro010/fm-dx-webserver.git
synced 2026-07-30 16:59:15 +02:00
yep
This commit is contained in:
@@ -34,9 +34,9 @@ function xrd_auth(ws, salt) {
|
|||||||
reject(new Error('Auth timeout'));
|
reject(new Error('Auth timeout'));
|
||||||
}, 10_000);
|
}, 10_000);
|
||||||
|
|
||||||
ws.once('message', (message, isBinary) => {
|
ws.once('message', (message) => {
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
const received = (isBinary ? message.toString() : message).trim();
|
const received = message.toString().trim();
|
||||||
if (received === expected) resolve();
|
if (received === expected) resolve();
|
||||||
else reject(new Error('Invalid credentials'));
|
else reject(new Error('Invalid credentials'));
|
||||||
});
|
});
|
||||||
@@ -68,7 +68,7 @@ xrd.on('connection', async (ws, request) => {
|
|||||||
ws.send(`OK\n`);
|
ws.send(`OK\n`);
|
||||||
|
|
||||||
ws.on('message', (message, isBinary) => {
|
ws.on('message', (message, isBinary) => {
|
||||||
const data = isBinary ? message : message.toString();
|
const data = message.toString();
|
||||||
|
|
||||||
if (!storage.ctl_output.write(data)) {
|
if (!storage.ctl_output.write(data)) {
|
||||||
ws.pause();
|
ws.pause();
|
||||||
|
|||||||
Reference in New Issue
Block a user