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
|
// SW
|
||||||
navigator.serviceWorker.register("sw.js")
|
navigator.serviceWorker.register("sw.js")
|
||||||
new BroadcastChannel('viaaas-notification').addEventListener("message", e => handleSWMsg(e));
|
|
||||||
|
|
||||||
// Minecraft.id
|
// Minecraft.id
|
||||||
let urlParams = new URLSearchParams();
|
let urlParams = new URLSearchParams();
|
||||||
@ -283,18 +282,13 @@ function resetHtml() {
|
|||||||
renderActions();
|
renderActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Websocket
|
// Notification
|
||||||
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}));
|
|
||||||
}
|
|
||||||
var notificationCallbacks = {};
|
var notificationCallbacks = {};
|
||||||
function handleSWMsg(event) {
|
function handleSWMsg(event) {
|
||||||
console.log("sw msg: " + event);
|
console.log("sw msg: " + event);
|
||||||
let data = event.data;
|
let data = event.data;
|
||||||
let callback = notificationCallbacks[data.tag];
|
let callback = notificationCallbacks[data.tag];
|
||||||
|
delete notificationCallbacks[data.tag];
|
||||||
if (callback == null) return;
|
if (callback == null) return;
|
||||||
callback(data.action);
|
callback(data.action);
|
||||||
}
|
}
|
||||||
@ -322,8 +316,18 @@ function authNotification(msg, yes, no) {
|
|||||||
return;
|
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) {
|
function handleJoinRequest(parsed) {
|
||||||
authNotification("Allow auth impersonation from VIAaaS instance?\nUsername: " + parsed.user + "\nSession Hash: " + parsed.session_hash + "\nServer Message: '" + parsed.message + "'", () => {
|
authNotification("Allow auth impersonation from VIAaaS instance?\nUsername: " + parsed.user + "\nSession Hash: " + parsed.session_hash + "\nServer Message: '" + parsed.message + "'", () => {
|
||||||
let account = findAccountByMcName(parsed.user);
|
let account = findAccountByMcName(parsed.user);
|
||||||
|
Loading…
Reference in New Issue
Block a user