html needs /proxy
parent
444245c0f5
commit
f3cbfa1c48
|
|
@ -5,10 +5,34 @@
|
||||||
<script>
|
<script>
|
||||||
function formsay(message) {
|
function formsay(message) {
|
||||||
console.log(`say '${message}'`)
|
console.log(`say '${message}'`)
|
||||||
|
http("GET", `/proxy?user=${document.getElementById("user").value}&say=${message}`, noopcallback, null)
|
||||||
}
|
}
|
||||||
function formsend(message) {
|
function formsend(message) {
|
||||||
console.log(`send '${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>
|
</script>
|
||||||
</header>
|
</header>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue