add makefile

This commit is contained in:
MReenen 2023-11-09 21:28:40 +01:00
parent a9cc83427c
commit 1f63c928ca
3 changed files with 27 additions and 15 deletions

6
Makefile Normal file
View File

@ -0,0 +1,6 @@
run:
python3 recever.py
install:
cp index.html /var/www/html/index.html
cp commander.html /var/www/html/commander.html

0
commander.html Normal file
View File

View File

@ -13,31 +13,37 @@ font-size: xx-large;">
<canvas id="canvas" name="game"></canvas>
<div id="clientId"></div>
<script>
var clientId = Math.floor(Math.random() * (2**16)).toString();
var clientId = -1;
var ca = document.cookie.split(';');
for (var i=0; i<ca.length; i++){
var c = ca[i].trim();
var clientId = -1;
var ca = document.cookie.split(';');
for (var i=0; i<ca.length; i++)
{
var c = ca[i].trim();
if (c.indexOf("clientId") == 0){
clientId = c.substring("clientId=".length, c.length);
clientId = c.substring("clientId=".length, c.length);
}
}
if (clientId == -1){
clientId = Math.floor(Math.random() * 10000).toString();
document.cookie = "clientId=" + clientId
}
if (clientId == -1)
{
clientId = Math.floor(Math.random() * 10000).toString();
document.cookie = "clientId=" + clientId;
}
document.getElementById("clientId").innerHTML = "client id: " + clientId;
var connection = new WebSocket('ws://' + "10.254.0.1" + ':8080/', ['mbcRcRf']);
connection.onopen = function () {
connection.send('Connect ' + new Date());
connection.onopen = function ()
{
connection.send('Connect ' + (new Date()));
};
connection.onerror = function (error) {
connection.onerror = function (error)
{
console.log('WebSocket Error ', error);
alert('WebSocket Error ', error);
};
connection.onmessage = function (e) {
connection.onmessage = function (e)
{
console.log('Server: ', e.data);
};