generated from ztimson/template
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1e88159b0 | ||
|
|
8261c671af | ||
|
|
22985b6230 | ||
|
|
9b5bf5d2fb |
@@ -7,6 +7,13 @@ curl -sL https://git.zakscode.com/ztimson/fallback-ap/raw/branch/master/install.
|
|||||||
|
|
||||||
# VNC
|
# VNC
|
||||||
sudo raspi-config nonint do_vnc 0
|
sudo raspi-config nonint do_vnc 0
|
||||||
|
cat <<EOF | sudo tee /etc/wayvnc/config
|
||||||
|
use_relative_paths=true
|
||||||
|
address=127.0.0.1
|
||||||
|
enable_auth=false
|
||||||
|
enable_pam=false
|
||||||
|
relax_encryption=true
|
||||||
|
EOF
|
||||||
|
|
||||||
# Node
|
# Node
|
||||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.7/install.sh | bash
|
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.7/install.sh | bash
|
||||||
|
|||||||
+2
-25
@@ -67,36 +67,13 @@ wss.on('connection', ws => {
|
|||||||
|
|
||||||
const socket = net.createConnection(VNC_PORT, VNC_HOST);
|
const socket = net.createConnection(VNC_PORT, VNC_HOST);
|
||||||
|
|
||||||
socket.on('connect', () => {
|
|
||||||
console.log(`Connected to VNC ${VNC_HOST}:${VNC_PORT}`);
|
|
||||||
});
|
|
||||||
|
|
||||||
socket.on('data', data => {
|
socket.on('data', data => {
|
||||||
console.log(`VNC -> browser: ${data.length} bytes`);
|
if (ws.readyState === ws.OPEN) ws.send(data, {binary: true});
|
||||||
|
|
||||||
if (data.length <= 64) {
|
|
||||||
console.log(` hex: ${data.toString('hex')}`);
|
|
||||||
console.log(` text: ${JSON.stringify(data.toString())}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ws.readyState === ws.OPEN) {
|
|
||||||
ws.send(data, {binary: true});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ws.on('message', (data, isBinary) => {
|
ws.on('message', (data, isBinary) => {
|
||||||
const buffer = Buffer.isBuffer(data) ? data : Buffer.from(data);
|
const buffer = Buffer.isBuffer(data) ? data : Buffer.from(data);
|
||||||
|
if (socket.writable) socket.write(buffer);
|
||||||
console.log(`Browser -> VNC: ${buffer.length} bytes (${isBinary ? 'binary' : 'text'})`);
|
|
||||||
|
|
||||||
if (buffer.length <= 64) {
|
|
||||||
console.log(` hex: ${buffer.toString('hex')}`);
|
|
||||||
console.log(` text: ${JSON.stringify(buffer.toString())}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (socket.writable) {
|
|
||||||
socket.write(buffer);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ws.on('error', error => {
|
ws.on('error', error => {
|
||||||
|
|||||||
Reference in New Issue
Block a user