idk what did i do
This commit is contained in:
parent
9af8f7d3d6
commit
9111c63691
2 changed files with 53 additions and 15 deletions
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>HTML 5 Boilerplate</title>
|
||||
<title>Vencord EAS</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/beercss@3.5.8/dist/cdn/beer.min.css" rel="stylesheet">
|
||||
|
||||
<script type="module" src="https://cdn.jsdelivr.net/npm/beercss@3.5.8/dist/cdn/beer.min.js"></script>
|
||||
|
@ -19,31 +19,27 @@
|
|||
<h3>Vencord EAS Client</h3>
|
||||
<div class="field suffix border" style="margin-bottom: 0px;">
|
||||
<select id="endpoint">
|
||||
<option>Get message</option>
|
||||
<option>🔑 Send message</option>
|
||||
<option>🔑 Clear message</option>
|
||||
<option value="get">Get message</option>
|
||||
<option value="msg">🔑 Send message</option>
|
||||
<option value="clear">🔑 Clear message</option>
|
||||
</select>
|
||||
<i>arrow_drop_down</i>
|
||||
</div>
|
||||
<div class="field label border" style="margin-top: 5px; margin-bottom: 0px;">
|
||||
<input type="password">
|
||||
<input type="password" id="token">
|
||||
<label>Token (if needed)</label>
|
||||
</div>
|
||||
<div class="field label border" style="margin-top: 5px; margin-bottom: 10px;">
|
||||
<input type="text">
|
||||
<input type="text" id="msg">
|
||||
<label>Message (if needed)</label>
|
||||
</div>
|
||||
<button class="responsive" style="margin-bottom: 20px;">
|
||||
<button class="responsive" onclick="processSend()" style="margin-bottom: 20px;">
|
||||
<i>rocket</i>
|
||||
<span>Send</span>
|
||||
</button>
|
||||
<hr>
|
||||
<div class="field textarea label border">
|
||||
<textarea readonly style="width: 100%;" id="log"></textarea>
|
||||
<label>Logs</label>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
</script>
|
||||
<h6>Logs</h6>
|
||||
<p id="log"></p>
|
||||
<script src="index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
42
front/index.js
Normal file
42
front/index.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
const socket = new WebSocket('wss://eas-ws.nin0.dev');
|
||||
|
||||
socket.onopen = function(event) {
|
||||
log("Connection opened")
|
||||
};
|
||||
|
||||
socket.onmessage = function(event) {
|
||||
log("IN: " + event.data)
|
||||
if(event.data.startsWith("MSG ")) {
|
||||
alert(event.data.replace("MSG ", ""))
|
||||
}
|
||||
};
|
||||
|
||||
socket.onclose = function(event) {
|
||||
alert("Connection has been closed, refresh the page.");
|
||||
};
|
||||
|
||||
function sendMessage(message) {
|
||||
socket.send(message);
|
||||
log("OUT: " + message)
|
||||
}
|
||||
|
||||
function log(message) {
|
||||
const logArea = document.getElementById("log");
|
||||
const newVal = message + "<br/>" + logArea.innerHTML;
|
||||
logArea.innerHTML = newVal;
|
||||
}
|
||||
|
||||
function processSend() {
|
||||
const endpoint = document.getElementById("endpoint").value
|
||||
if(endpoint == "get") {
|
||||
sendMessage("GET")
|
||||
}
|
||||
const token = document.getElementById("token").value
|
||||
const msg = document.getElementById("msg").value
|
||||
if(endpoint == "msg") {
|
||||
sendMessage(`MSG ${token} ${msg}`)
|
||||
}
|
||||
if(endpoint == "clear") {
|
||||
sendMessage(`CLEAR ${token}`)
|
||||
}
|
||||
}
|
Reference in a new issue