From 15f17ab329a6cad8e374e9156e2a1f9dccbb8423 Mon Sep 17 00:00:00 2001
From: clerie <clemens@milchinsel.de>
Date: Wed, 4 Apr 2018 12:56:08 +0200
Subject: [PATCH] Cleaned code & updated README

---
 README.md | 16 +++++++++-------
 index.js  | 14 ++------------
 2 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/README.md b/README.md
index 1065c03..a6b8a08 100644
--- a/README.md
+++ b/README.md
@@ -9,16 +9,18 @@ It's only a bit of fun. His servers are much better ;P
 ### Setup
 Install node.js and download scripts
 ```
-  git clone https://github.com/clerie/pixelnode
-  sudo apt-get nodejs
-  nodejs index
+sudo apt-get nodejs git
+git clone https://github.com/clerie/pixelnode
+cd pixelnode/
+nodejs index
 ```
+Open the shown http port in a browser (you can use multiple on multiple machines).
+Start playing at the shown input port.
 
-Open localhost:61813 in a browser (you can use multiple).
+### Default ports
+* HTTP (for viewing) `61813`
+* INPUT (for plaing) `1337`
 
 ### Play
 Use PixelNode with the same protocol as Pixelflut:
 https://github.com/defnull/pixelflut#pixelflut-protocol
-
-
-
diff --git a/index.js b/index.js
index e9646c0..69b4768 100644
--- a/index.js
+++ b/index.js
@@ -10,9 +10,6 @@ const myip = require('quick-local-ip');
 const ip4 = myip.getLocalIP4();
 const ip6 = myip.getLocalIP6();
 
-console.log(ip4);
-console.log(ip6);
-
 // define canvas
 var canvas_size_x = 100;
 var canvas_size_y = 100;
@@ -100,7 +97,6 @@ io.on('connection', function (socket){
 var server = net.createServer();
 
 server.on('connection', function (server_socket) {
-  console.log(server_socket);
   conn_count++;
   server_socket.setEncoding('utf8');
   console.log('[INPUT] new input');
@@ -112,18 +108,12 @@ server.on('connection', function (server_socket) {
       if (x <= canvas_size_x && y <= canvas_size_y) {
         if (!isNaN(x) && !isNaN(y)) {
           if (command[3] != undefined) {
-            console.log("c is there");
             var color = str_to_color(command[3]);
-            console.log(color);
             if (color !== false) {
-              console.log("c ok");
               io.sockets.emit('draw', {type: 'pixel', x: x, y: y, color: color_to_html(color)});
               pixel_count++;
               color_to_canvas_content(x, y, color);
             }
-            else {
-              console.log("c not ok");
-            }
           }
           server_socket.write('PX ' + x + ' ' + y + ' ' + get_color(x, y) + '\n');
         }
@@ -142,7 +132,7 @@ server.on('connection', function (server_socket) {
 });
 
 // start http
-http.listen(http_port, () => console.log('[HTTP] port: ' + http_port));
+http.listen(http_port, () => console.log('[HTTP] started server at ' + ip4 + ':' + http_port));
 
 // start input socket
-server.listen(input_port, () => console.log('[INPUT] port: ' + input_port));
+server.listen(input_port, () => console.log('[INPUT] started server at ' + ip4 + ':' + input_port));