* Add split tunneling (#17)

* refactor imports

* remove bandwidth tests from hooks

* add autoclikers for call join

* add autoclikers for call join

* refactor - split to classes, update namings

* display bot api in console

* mute audio as a separate js script

* fix NUL byte in udp for windows

* update readme, collapse call webview, edit tab names

* fix ports allocation when target is taken

* fix ports allocation when target is taken

* increment release version

---------

Co-authored-by: senya <76913432+senya-sh@users.noreply.github.com>
Co-authored-by: kulikov <user@Mac.lan>
This commit is contained in:
authored and GitHub committed 2026-03-29 22:55:32 +02:00
1 parent 2ce446f74c
commit d6a98e84ee
52 files changed
+1193 -629

No files matched your search

+1 -54
View File
@@ -3,7 +3,7 @@
if (window.__hookInstalled) return;
window.__hookInstalled = true;
const WS_URL = 'ws://127.0.0.1:9000/ws';
const WS_URL = 'ws://127.0.0.1:' + (window.WS_PORT || 9000) + '/ws';
const log = (...args) => console.log('[HOOK]', ...args);
const peers = [];
let activeWS = null;
@@ -60,34 +60,8 @@
activeDC = null;
};
let bwRecvBytes = 0;
let bwRecvStart = 0;
let bwMode = false;
dc.onmessage = (e) => {
if (dc !== activeDC) return;
if (bwMode) {
if (e.data instanceof ArrayBuffer) {
if (bwRecvStart === 0) bwRecvStart = performance.now();
bwRecvBytes += e.data.byteLength;
return;
}
if (typeof e.data === 'string' && e.data === 'bw:done') {
var elapsed = (performance.now() - bwRecvStart) / 1000;
var kbps = (bwRecvBytes * 8 / 1024 / elapsed).toFixed(1);
log('=== RECV COMPLETE: ' + (bwRecvBytes/1024).toFixed(1) + ' KB in ' + elapsed.toFixed(2) + 's = ' + kbps + ' kbps ===');
bwRecvBytes = 0;
bwRecvStart = 0;
bwMode = false;
return;
}
}
if (typeof e.data === 'string' && e.data === 'bw:start') {
bwMode = true;
bwRecvBytes = 0;
bwRecvStart = 0;
return;
}
if (activeWS && wsOpen) {
activeWS.send(e.data);
}
@@ -136,32 +110,5 @@
}
window.__hook = { peers: peers, log: log };
window.__hook.runBandwidthTest = function(totalMB) {
totalMB = totalMB || 1;
if (!dcOpen || !activeDC) { log('DC not open'); return; }
var chunkSize = 16384;
var chunk = new ArrayBuffer(chunkSize);
var totalBytes = totalMB * 1024 * 1024;
var sent = 0;
var start = performance.now();
activeDC.send('bw:start');
log('Starting bandwidth test: ' + totalMB + ' MB...');
var sendBatch = function() {
while (sent < totalBytes) {
if (activeDC.bufferedAmount > 512 * 1024) {
setTimeout(sendBatch, 5);
return;
}
activeDC.send(chunk);
sent += chunkSize;
}
activeDC.send('bw:done');
var elapsed = (performance.now() - start) / 1000;
var kbps = (totalBytes * 8 / 1024 / elapsed).toFixed(1);
log('=== SEND COMPLETE: ' + (totalBytes/1024).toFixed(1) + ' KB in ' + elapsed.toFixed(2) + 's = ' + kbps + ' kbps ===');
};
sendBatch();
};
log('Hook installed');
})();