-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinvite.html
40 lines (37 loc) · 1.37 KB
/
invite.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="/CSS/login.css">
<script src="/scripts/encryption.js"></script>
<title>proto-chat</title>
<script>
window.onload = (e) => {
var req = new XMLHttpRequest();
req.open('POST', `${window.location.origin}/invite`, true);
// req.responseType = 'text';
const serverId = window.location.pathname.replace("/invite/", "");
if (!serverId) window.location.pathname = '/';
req.onloadend = () => {
try {
if (req.response == 'OK') window.location.pathname = `/server/${serverId}`;
else alert("ERROR!");
console.log(req.response);
}
catch(err) {
console.error(err);
console.log(req.response);
alert("ERROR!");
}
}
req.setRequestHeader('sessionid', localStorage.getItem('sessionid'));
req.setRequestHeader('serverid', serverId);
req.send();
}
</script>
</head>
<body style="color:whitesmoke">
<h1 style="text-align: center;">Processing Request...</h1>
</body>
</html>