* refactor go files, add headless telemost support * js crap -> ts crap * docker-build (#32) Co-authored-by: Mimocro <suzumagefag@gmail.com> * add headless telemost for creator app * UX improvements (#39) * Add search in split tunneling app list * Add captcha detection * Add autoclick settings * headless vk joiner * add headless telemost joiner * refactor go modules * redesign settings dialog * headless option in settings * headless joiner support in MainActivity * display headless vk status in statusBar * update ux for headless in creator app * fix double log render for headless mode in creator * unicode for cyrillic * add socks auth * put socksPort inf prefs, verify that port is free on start * proxy only mode * mask addresses in go network errors * update docker build, add file write logic for headless * increment release version, add make-release script --------- Co-authored-by: kulikov <user@Mac.lan> Co-authored-by: Mimocro <67226986+Mimocro@users.noreply.github.com> Co-authored-by: Mimocro <suzumagefag@gmail.com> Co-authored-by: senya <76913432+senya-sh@users.noreply.github.com>
82 lines
2.6 KiB
JavaScript
82 lines
2.6 KiB
JavaScript
(function() {
|
|
if (window.__callCreatorStarted) return;
|
|
window.__callCreatorStarted = true;
|
|
|
|
var CALL_MENU_TRIGGER_ID = 'call-menu-trigger';
|
|
var CREATE_CALL_TEXT = 'Создать звонок по';
|
|
var CALL_IN_PROGRESS_KEY = 'call_in_progress';
|
|
var VK_CALL_BASE = 'https://vk.com/call/join/';
|
|
|
|
var start = function() {
|
|
console.log("[BOT] VKCalls: DOM ready...");
|
|
|
|
var waitAndClick = function(fn) {
|
|
if (fn()) return;
|
|
var observer = new MutationObserver(function() {
|
|
if (fn()) observer.disconnect();
|
|
});
|
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
};
|
|
|
|
waitAndClick(function() {
|
|
var trigger = document.getElementById(CALL_MENU_TRIGGER_ID);
|
|
if (!trigger) return false;
|
|
|
|
trigger.click();
|
|
console.log("[BOT] VKCalls: opened call menu");
|
|
|
|
waitAndClick(function() {
|
|
var spans = document.querySelectorAll('span');
|
|
var el = null;
|
|
for (var i = 0; i < spans.length; i++) {
|
|
if (spans[i].textContent.indexOf(CREATE_CALL_TEXT) !== -1) {
|
|
el = spans[i];
|
|
break;
|
|
}
|
|
}
|
|
var btn = el ? (el.closest('button') || el.closest('div')) : null;
|
|
if (!btn) return false;
|
|
|
|
btn.click();
|
|
console.log("[BOT] VKCalls: created call");
|
|
|
|
var origFetch = window.fetch;
|
|
window.fetch = function() {
|
|
var args = arguments;
|
|
return origFetch.apply(window, args).then(function(res) {
|
|
if (window.__CALL_LINK_CAPTURED__) return res;
|
|
try {
|
|
var clone = res.clone();
|
|
clone.text().then(function(text) {
|
|
if (text.indexOf(CALL_IN_PROGRESS_KEY) === -1) return;
|
|
var json = JSON.parse(text);
|
|
var items = json && json.response && json.response[1] && json.response[1].items;
|
|
if (!items) return;
|
|
for (var j = 0; j < items.length; j++) {
|
|
var join = items[j] && items[j].call_in_progress && items[j].call_in_progress.join_link;
|
|
if (join) {
|
|
var link = VK_CALL_BASE + join;
|
|
console.log("[BOT] VKCalls: call link:", link);
|
|
window.__CALL_LINK__ = link;
|
|
window.__CALL_LINK_CAPTURED__ = true;
|
|
break;
|
|
}
|
|
}
|
|
});
|
|
} catch (e) {}
|
|
return res;
|
|
});
|
|
};
|
|
return true;
|
|
});
|
|
return true;
|
|
});
|
|
};
|
|
|
|
if (document.readyState === "loading") {
|
|
document.addEventListener("DOMContentLoaded", start);
|
|
} else {
|
|
start();
|
|
}
|
|
})();
|