Last active
April 19, 2020 23:32
-
-
Save hudsantos/4fb05f2efc909ad586138705d3011b9a to your computer and use it in GitHub Desktop.
This approves someone to join your meeting, and logs it to a http server backend.. without further controls.. use at your own risk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Http = new XMLHttpRequest(); | |
setInterval(() => { | |
// Lets find if someone is waiting to join: | |
// If yes, it would exist an element with the following text inside it: | |
let string = "Alguém quer participar desta reunião" | |
ask_for_approval_element = document.evaluate('//*[text()="' + string + '"]', document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE).snapshotItem(0) | |
if (ask_for_approval_element) { | |
// Okay, it seems someone is wanting to join! | |
// Finds out the name of who's asking to join: | |
// It should be inside the div element which has the attribute 'data-participant-id' | |
name_element = document.querySelectorAll('[data-participant-id]'); | |
if (name_element[0]) { | |
// The name element seems to be there | |
let participant_name = name_element[0].innerText | |
// Log it to another place: | |
url='http://localhost:8000/&date="' + new Date().toJSON() + '"&participant="' + participant_name + '"'; | |
Http.open("GET", url); | |
Http.send(); | |
} | |
// Finds the Allow button in order to click it | |
string = "Permitir" | |
allowBtn = document.evaluate('//*[text()="' + string + '"]', ask_for_approval_element, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE).snapshotItem(0) | |
if (allowBtn){ | |
// There's a button to allow, allowing | |
allowBtn.click() | |
} | |
} | |
}, 500) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment