mirror of
https://github.com/ViaVersion/VIAaaS.git
synced 2024-11-04 09:30:00 +01:00
delete callback
This commit is contained in:
parent
ab67c699b8
commit
0c8280b0c6
@ -1,6 +1,5 @@
|
||||
// SW
|
||||
navigator.serviceWorker.register("sw.js")
|
||||
new BroadcastChannel('viaaas-notification').addEventListener("message", e => handleSWMsg(e));
|
||||
|
||||
// Minecraft.id
|
||||
let urlParams = new URLSearchParams();
|
||||
@ -283,18 +282,13 @@ function resetHtml() {
|
||||
renderActions();
|
||||
}
|
||||
|
||||
// Websocket
|
||||
function listen(token) {
|
||||
socket.send(JSON.stringify({"action": "listen_login_requests", "token": token}));
|
||||
}
|
||||
function confirmJoin(hash) {
|
||||
socket.send(JSON.stringify({action: "session_hash_response", session_hash: hash}));
|
||||
}
|
||||
// Notification
|
||||
var notificationCallbacks = {};
|
||||
function handleSWMsg(event) {
|
||||
console.log("sw msg: " + event);
|
||||
let data = event.data;
|
||||
let callback = notificationCallbacks[data.tag];
|
||||
delete notificationCallbacks[data.tag];
|
||||
if (callback == null) return;
|
||||
callback(data.action);
|
||||
}
|
||||
@ -322,8 +316,18 @@ function authNotification(msg, yes, no) {
|
||||
return;
|
||||
}
|
||||
};
|
||||
setTimeout(() => { delete notificationCallbacks[tag] }, 30_000);
|
||||
});
|
||||
}
|
||||
new BroadcastChannel("viaaas-notification").addEventListener("message", handleSWMsg);
|
||||
|
||||
// Websocket
|
||||
function listen(token) {
|
||||
socket.send(JSON.stringify({"action": "listen_login_requests", "token": token}));
|
||||
}
|
||||
function confirmJoin(hash) {
|
||||
socket.send(JSON.stringify({action: "session_hash_response", session_hash: hash}));
|
||||
}
|
||||
function handleJoinRequest(parsed) {
|
||||
authNotification("Allow auth impersonation from VIAaaS instance?\nUsername: " + parsed.user + "\nSession Hash: " + parsed.session_hash + "\nServer Message: '" + parsed.message + "'", () => {
|
||||
let account = findAccountByMcName(parsed.user);
|
||||
|
Loading…
Reference in New Issue
Block a user