html needs /proxy
parent
444245c0f5
commit
f3cbfa1c48
|
|
@ -5,10 +5,34 @@
|
|||
<script>
|
||||
function formsay(message) {
|
||||
console.log(`say '${message}'`)
|
||||
http("GET", `/proxy?user=${document.getElementById("user").value}&say=${message}`, noopcallback, null)
|
||||
}
|
||||
function formsend(message) {
|
||||
console.log(`send '${message}'`)
|
||||
http("GET", `/proxy/gm/rpc/vote?user=${document.getElementById("user").value}&payload=${message}`, noopcallback, null)
|
||||
}
|
||||
function http(method, remote, callback, body) {
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (xmlhttp.readyState == XMLHttpRequest.DONE) {
|
||||
callback(xmlhttp.responseText, xmlhttp.status)
|
||||
}
|
||||
};
|
||||
xmlhttp.open(method, remote, true);
|
||||
if (typeof body == "undefined") {
|
||||
body = null
|
||||
}
|
||||
xmlhttp.send(body);
|
||||
}
|
||||
function noopcallback(responseBody, responseStatus) {
|
||||
}
|
||||
setInterval(() => {
|
||||
http("GET", `/proxy?user=${document.getElementById("user")}`, (b, s) => {
|
||||
if (s != 200)
|
||||
return
|
||||
document.getElementById("ntfy").innerHTML = b.replace("\n", "<br>")
|
||||
}, null)
|
||||
}, 1500)
|
||||
</script>
|
||||
</header>
|
||||
<body>
|
||||
|
|
|
|||
Loading…
Reference in New Issue