V0.1.8 (#20)
* 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:
52 files changed
+1193
-629
No files matched your search
@@ -0,0 +1,37 @@
|
||||
(function() {
|
||||
if (window.__autoclickInstalled) return;
|
||||
window.__autoclickInstalled = true;
|
||||
|
||||
var log = function() {
|
||||
var args = ['[HOOK] [autoclick]'];
|
||||
for (var i = 0; i < arguments.length; i++) args.push(arguments[i]);
|
||||
console.log.apply(console, args);
|
||||
};
|
||||
|
||||
log('Autoclick installed');
|
||||
|
||||
function scan() {
|
||||
var all = document.querySelectorAll('[data-testid="orb-button"]');
|
||||
log('scan: ' + all.length + ' orb-buttons found');
|
||||
for (var i = 0; i < all.length; i++) {
|
||||
var txt = (all[i].textContent || '').trim();
|
||||
log(' btn[' + i + ']: "' + txt + '"');
|
||||
if (txt.indexOf('Продолжить в браузере') !== -1) {
|
||||
log('Clicking: Продолжить в браузере');
|
||||
all[i].click();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var joinBtn = document.querySelector('[data-testid="enter-conference-button"]');
|
||||
if (joinBtn) {
|
||||
log('Clicking: Подключиться');
|
||||
joinBtn.click();
|
||||
clearInterval(iv);
|
||||
log('Autoclick done');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var iv = setInterval(scan, 1500);
|
||||
})();
|
||||
@@ -0,0 +1,44 @@
|
||||
(function() {
|
||||
if (window.__autoclickInstalled) return;
|
||||
window.__autoclickInstalled = true;
|
||||
|
||||
var log = function() {
|
||||
var args = ['[HOOK] [autoclick]'];
|
||||
for (var i = 0; i < arguments.length; i++) args.push(arguments[i]);
|
||||
console.log.apply(console, args);
|
||||
};
|
||||
|
||||
log('Autoclick installed');
|
||||
|
||||
function findNameInput() {
|
||||
var inputs = document.querySelectorAll('input[type="text"]');
|
||||
for (var i = 0; i < inputs.length; i++) {
|
||||
var ph = (inputs[i].placeholder || '').toLowerCase();
|
||||
if (ph.indexOf('name') !== -1 || ph.indexOf('имя') !== -1) return inputs[i];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function scan() {
|
||||
var inp = findNameInput();
|
||||
if (inp && !inp.value) {
|
||||
log('Filling name');
|
||||
var set = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value').set;
|
||||
set.call(inp, 'Hello');
|
||||
inp.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
inp.dispatchEvent(new Event('change', { bubbles: true }));
|
||||
return;
|
||||
}
|
||||
|
||||
var joinBtn = document.querySelector('[data-testid="calls_preview_join_button_anonym"]');
|
||||
if (joinBtn && inp && inp.value) {
|
||||
log('Clicking: Join');
|
||||
joinBtn.click();
|
||||
clearInterval(iv);
|
||||
log('Autoclick done');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var iv = setInterval(scan, 1500);
|
||||
})();
|
||||
@@ -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;
|
||||
@@ -278,31 +278,5 @@
|
||||
}
|
||||
|
||||
window.__hook = { peers: peers, log: log };
|
||||
window.__hook.runBandwidthTest = function(totalMB) {
|
||||
totalMB = totalMB || 1;
|
||||
if (!tunnelReady || !outboundDC) { log('Tunnel not ready'); return; }
|
||||
var chunkSize = 4096;
|
||||
var totalBytes = totalMB * 1024 * 1024;
|
||||
var sent = 0;
|
||||
var start = performance.now();
|
||||
sendRaw('bw:start');
|
||||
log('Starting bandwidth test: ' + totalMB + ' MB...');
|
||||
var sendBatch = function() {
|
||||
while (sent < totalBytes) {
|
||||
if (outboundDC.bufferedAmount > 512 * 1024) {
|
||||
setTimeout(sendBatch, 5);
|
||||
return;
|
||||
}
|
||||
sendRaw(new ArrayBuffer(chunkSize));
|
||||
sent += chunkSize;
|
||||
}
|
||||
sendRaw('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');
|
||||
})();
|
||||
@@ -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');
|
||||
})();
|
||||
@@ -0,0 +1,14 @@
|
||||
(function() {
|
||||
var oac = window.AudioContext || window.webkitAudioContext;
|
||||
if (oac) {
|
||||
var nac = function() {
|
||||
var c = new oac();
|
||||
c.suspend();
|
||||
c.resume = function() { return Promise.resolve(); };
|
||||
return c;
|
||||
};
|
||||
nac.prototype = oac.prototype;
|
||||
window.AudioContext = nac;
|
||||
if (window.webkitAudioContext) window.webkitAudioContext = nac;
|
||||
}
|
||||
})();
|
||||
Reference in new issue
Block a user