last fix
This commit is contained in:
parent
4f551179f2
commit
bc65cc0cd9
202
client.html
202
client.html
@ -4,207 +4,7 @@
|
||||
<head></head>
|
||||
<meta charset='utf-8'>
|
||||
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
|
||||
<title>Samsung TVController</title><!DOCTYPE html>
|
||||
<html>
|
||||
<!--Hello! You have found my TV Controller. The API provided in this source is behind a firewall and will be of no use to you. Move along!-->
|
||||
<head></head>
|
||||
<meta charset='utf-8'>
|
||||
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
|
||||
<title>Scott Household TV Controller</title>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
||||
<center>
|
||||
<div id="view"></div>
|
||||
<center>
|
||||
|
||||
<style>
|
||||
body {
|
||||
background-color: #101010;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
nav a {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
footer {
|
||||
color: #ffffff;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
let rootURL = "https://grwh.work:3031"
|
||||
let pass = prompt("Enter the password!", "");
|
||||
let text;
|
||||
fetch(rootURL + "/checkPass?pass=" + pass)
|
||||
.then(function (response) {
|
||||
return response.json();
|
||||
})
|
||||
.then(function (data) {
|
||||
if (data == "1") {
|
||||
if (pass == null || pass == "") {
|
||||
document.getElementById("view").innerHTML = "<meta http-equiv=\"refresh\" content=0;>"
|
||||
} else {
|
||||
document.getElementById("view").innerHTML = "CURRENT COMMAND SHORTCUTS: <BR>HOME: H<BR> UP: W<BR> LEFT: A<BR> DOWN: S <BR> RIGHT: D<BR> Back: X<BR> Volume Up: P<BR> Volume Down: O<BR>MUTE: M<BR> Enter: Enter<BR>Picture Mode: P<BR><BR>Not Working? Issue a new Token using: r";
|
||||
|
||||
|
||||
function addEvent(element, eventName, callback) {
|
||||
if (element.addEventListener) {
|
||||
element.addEventListener(eventName, callback, false);
|
||||
} else if (element.attachEvent) {
|
||||
element.attachEvent("on" + eventName, callback);
|
||||
} else {
|
||||
element["on" + eventName] = callback;
|
||||
}
|
||||
}
|
||||
|
||||
addEvent(document, "keypress", function (e) {
|
||||
console.log(e)
|
||||
|
||||
e = e || window.event;
|
||||
// Handle
|
||||
if (e.key == "w") {
|
||||
fetch(rootURL + "/up")
|
||||
.then(function (response) {
|
||||
return response.json();
|
||||
})
|
||||
.then(function (data) {
|
||||
if (data == 1) return console.log("Command: UP - SENT!")
|
||||
})
|
||||
}
|
||||
|
||||
// Handle
|
||||
if (e.key == "a") {
|
||||
fetch(rootURL + "/left")
|
||||
.then(function (response) {
|
||||
return response.json();
|
||||
})
|
||||
.then(function (data) {
|
||||
if (data == 1) return console.log("Command: LEFT - SENT!")
|
||||
})
|
||||
}
|
||||
// Handle
|
||||
if (e.key == "s") {
|
||||
fetch(rootURL + "/down")
|
||||
.then(function (response) {
|
||||
return response.json();
|
||||
})
|
||||
.then(function (data) {
|
||||
if (data == 1) return console.log("Command: DOWN - SENT!")
|
||||
})
|
||||
}
|
||||
// Handle
|
||||
if (e.key == "d") {
|
||||
fetch(rootURL + "/right")
|
||||
.then(function (response) {
|
||||
return response.json();
|
||||
})
|
||||
.then(function (data) {
|
||||
if (data == 1) return console.log("Command: RIGHT - SENT!")
|
||||
})
|
||||
}
|
||||
|
||||
if (e.key == "Enter") {
|
||||
fetch(rootURL + "/enter")
|
||||
.then(function (response) {
|
||||
return response.json();
|
||||
})
|
||||
.then(function (data) {
|
||||
if (data == 1) return console.log("Command: ENTER - SENT!")
|
||||
})
|
||||
}
|
||||
if (e.key == "x") {
|
||||
fetch(rootURL + "/back")
|
||||
.then(function (response) {
|
||||
return response.json();
|
||||
})
|
||||
.then(function (data) {
|
||||
if (data == 1) return console.log("Command: BACK - SENT!")
|
||||
})
|
||||
}
|
||||
|
||||
if (e.key == "p") {
|
||||
fetch(rootURL + "/volumeUp")
|
||||
.then(function (response) {
|
||||
return response.json();
|
||||
})
|
||||
.then(function (data) {
|
||||
if (data == 1) return console.log("Command: BACK - SENT!")
|
||||
})
|
||||
}
|
||||
|
||||
if (e.key == "o") {
|
||||
fetch(rootURL + "/volumeDown")
|
||||
.then(function (response) {
|
||||
return response.json();
|
||||
})
|
||||
.then(function (data) {
|
||||
if (data == 1) return console.log("Command: BACK - SENT!")
|
||||
})
|
||||
}
|
||||
|
||||
if (e.key == "r") {
|
||||
fetch(rootURL + "/newToken")
|
||||
.then(function (response) {
|
||||
commandData
|
||||
return response.json();
|
||||
})
|
||||
.then(function (data) {
|
||||
if (data == 1) return console.log("Command: New Token - SENT!")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (e.key == "m") {
|
||||
fetch(rootURL + "/mute")
|
||||
.then(function (response) {
|
||||
commandData
|
||||
return response.json();
|
||||
})
|
||||
.then(function (data) {
|
||||
if (data == 1) return console.log("Command: MUTE - SENT!")
|
||||
})
|
||||
}
|
||||
|
||||
if (e.key == "p") {
|
||||
fetch(rootURL + "/pmode")
|
||||
.then(function (response) {
|
||||
commandData
|
||||
return response.json();
|
||||
})
|
||||
.then(function (data) {
|
||||
if (data == 1) return console.log("Command: PMODE - SENT!")
|
||||
})
|
||||
}
|
||||
|
||||
if (e.key == "h") {
|
||||
fetch(rootURL + "/home")
|
||||
.then(function (response) {
|
||||
commandData
|
||||
return response.json();
|
||||
})
|
||||
.then(function (data) {
|
||||
if (data == 1) return console.log("Command: HOME - SENT!")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
} else {
|
||||
document.getElementById("view").innerHTML = "<meta http-equiv=\"refresh\" content=3;> <CENTER>THE PASSWORD PROVIDED WAS INCORRECT!"
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
<title>Samsung TVController</title>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
||||
<center>
|
||||
<div id="view"></div>
|
||||
|
Loading…
Reference in New Issue
Block a user