diff --git a/website/admin.html b/website/admin.html index 1d68ba1..af9b8e0 100644 --- a/website/admin.html +++ b/website/admin.html @@ -5,8 +5,9 @@ Game server - + + diff --git a/website/css/terminal.css b/website/css/terminal.css index 6d2243c..e42799f 100644 --- a/website/css/terminal.css +++ b/website/css/terminal.css @@ -25,7 +25,7 @@ border: solid grey; background-color: var(--terminal-color-background); width: min(95%, 1024px); - height: 40em; + height: 20em; overflow-x: hidden; overflow-y: auto; display: flex; @@ -36,7 +36,7 @@ margin: 0; padding: 0; font-family: monospace; - font-weight: bold; + /* font-weight: bold; */ white-space: pre-wrap; /* word-break: break-all; */ color: var(--terminal-color-default); @@ -59,7 +59,7 @@ border: solid grey; background-color: var(--terminal-color-background); width: min(95%, 1024px); - height: 40em; + height: 20em; overflow-x: hidden; overflow-y: auto; display: flex; @@ -70,7 +70,7 @@ margin: 0; padding: 0; font-family: monospace; - font-weight: bold; + /* font-weight: bold; */ white-space: pre-wrap; /* word-break: break-all; */ color: var(--terminal-color-default); @@ -93,7 +93,7 @@ border: solid grey; background-color: var(--terminal-color-background); width: min(95%, 1024px); - height: 40em; + height: 20em; overflow-x: hidden; overflow-y: auto; display: flex; @@ -104,7 +104,7 @@ margin: 0; padding: 0; font-family: monospace; - font-weight: bold; + /* font-weight: bold; */ white-space: pre-wrap; /* word-break: break-all; */ color: var(--terminal-color-default); @@ -172,3 +172,7 @@ .TERM_FOREGROUND_7_INTENSE { color: var(--terminal-color-7-intense); } + +.TERM_FOREGROUND_BOLD { + font-weight: bold; +} diff --git a/website/js/mindustry.js b/website/js/mindustry.js index 7f80b23..cce8258 100644 --- a/website/js/mindustry.js +++ b/website/js/mindustry.js @@ -18,7 +18,7 @@ function mindustry_init() { // Connection opened socket.addEventListener('open', function (event) { - socket.send('help'); + socket.send('status'); }); // Listen for messages @@ -30,60 +30,6 @@ function mindustry_init() { }); } -function sendHello() { - socket.send('Hello'); -} - -// Shell command can have control codes. Some of these mean colours. -function convertTerminalCodeToHtml(line) { - let htmlline = ""; - let open_spans = 0; - for(let i = 0; i < line.length; i++) { - if(line[i] == '\033') { - let code = line[++i] - if(code == '[') { - // This means it's a colour - let colour_code = ""; - for(i++; i < line.length && line[i] != 'm'; i++) { - colour_code += line[i]; - } - colour_code = parseInt(colour_code); - if(colour_code === 0) { - for(let i = 0; i < open_spans; i++) { - htmlline += ""; - } - } - else if(colour_code >= 30 && colour_code <= 37) { - htmlline += ''; - open_spans++; - } - else if(colour_code >= 90 && colour_code <= 97) { - htmlline += ''; - open_spans++; - } - } - } - else if(line[i] == '<') { - htmlline += "<" - } - else if(line[i] == '>') { - htmlline += ">" - } - else if(line[i] == '&') { - htmlline += "&" - } - else { - htmlline += line[i]; - } - } - - for(let i = 0; i < open_spans; i++) { - htmlline += ""; - } - - return htmlline -} - if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', mindustry_init); } else { diff --git a/website/js/terminalcolors.js b/website/js/terminalcolors.js new file mode 100644 index 0000000..64423b4 --- /dev/null +++ b/website/js/terminalcolors.js @@ -0,0 +1,95 @@ +// Shell command can have control codes. Some of these mean colours. +function convertTerminalCodeToHtml(line) { + let htmlline = ""; + let open_spans = 0; + for(let i = 0; i < line.length; i++) { + if(line[i] == '\033') { + let code = line[++i] + if(code == '[') { + // This means it's a colour + let colour_code = ""; + for(i++; i < line.length && line[i] != 'm'; i++) { + colour_code += line[i]; + } + colour_code = parseInt(colour_code); + if(colour_code === 0) { + for(let i = 0; i < open_spans; i++) { + htmlline += ""; + } + open_spans = 0; + } + else if(colour_code >= 30 && colour_code <= 37) { + htmlline += ''; + open_spans++; + } + else if(colour_code >= 90 && colour_code <= 97) { + htmlline += ''; + open_spans++; + } + } + } + else if(line[i] == '<') { + htmlline += "<" + } + else if(line[i] == '>') { + htmlline += ">" + } + else if(line[i] == '&') { + htmlline += "&" + } + else { + htmlline += line[i]; + } + } + + for(let i = 0; i < open_spans; i++) { + htmlline += ""; + } + + return htmlline +} + +// Shell command can have control codes. Some of these mean colours. +function convertDaemonedCodeToHtml(line) { + let htmlline = ""; + let open_spans = 0; + for(let i = 0; i < line.length; i++) { + if(line[i] == '^') { + let code = line[++i] + for(let i = 0; i < open_spans; i++) { + htmlline += ""; + } + open_spans = 0; + + if(code == 'N') { + htmlline += ''; + open_spans++; + } + else { + let colour_code = parseInt(code); + if(colour_code >= 0) { + htmlline += ''; + open_spans++; + } + } + } + else if(line[i] == '<') { + htmlline += "<" + } + else if(line[i] == '>') { + htmlline += ">" + } + else if(line[i] == '&') { + htmlline += "&" + } + else { + htmlline += line[i]; + } + } + + for(let i = 0; i < open_spans; i++) { + htmlline += ""; + } + + return htmlline +} diff --git a/website/js/unvanguished.js b/website/js/unvanguished.js index 8035a9b..3669751 100644 --- a/website/js/unvanguished.js +++ b/website/js/unvanguished.js @@ -18,72 +18,19 @@ function unvanguished_init() { // Connection opened socket.addEventListener('open', function (event) { - socket.send('help'); + socket.send('/status'); }); // Listen for messages socket.addEventListener('message', function (event) { + console.log(event); const unvanguished_output = document.getElementById('unvanguished_output'); let line = document.createElement('p') - line.innerHTML = convertTerminalCodeToHtml(event.data); + line.innerHTML = convertDaemonedCodeToHtml(event.data); unvanguished_output.prepend(line); }); } -function sendHello() { - socket.send('Hello'); -} - -// Shell command can have control codes. Some of these mean colours. -function convertTerminalCodeToHtml(line) { - let htmlline = ""; - let open_spans = 0; - for(let i = 0; i < line.length; i++) { - if(line[i] == '\033') { - let code = line[++i] - if(code == '[') { - // This means it's a colour - let colour_code = ""; - for(i++; i < line.length && line[i] != 'm'; i++) { - colour_code += line[i]; - } - colour_code = parseInt(colour_code); - if(colour_code === 0) { - for(let i = 0; i < open_spans; i++) { - htmlline += ""; - } - } - else if(colour_code >= 30 && colour_code <= 37) { - htmlline += ''; - open_spans++; - } - else if(colour_code >= 90 && colour_code <= 97) { - htmlline += ''; - open_spans++; - } - } - } - else if(line[i] == '<') { - htmlline += "<" - } - else if(line[i] == '>') { - htmlline += ">" - } - else if(line[i] == '&') { - htmlline += "&" - } - else { - htmlline += line[i]; - } - } - - for(let i = 0; i < open_spans; i++) { - htmlline += ""; - } - - return htmlline -} - if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', unvanguished_init); } else { diff --git a/website/js/xonotic.js b/website/js/xonotic.js index d1e5a13..be07fde 100644 --- a/website/js/xonotic.js +++ b/website/js/xonotic.js @@ -18,72 +18,18 @@ function xonotic_init() { // Connection opened socket.addEventListener('open', function (event) { - socket.send('help'); + socket.send('/status'); }); // Listen for messages socket.addEventListener('message', function (event) { const xonotic_output = document.getElementById('xonotic_output'); let line = document.createElement('p') - line.innerHTML = convertTerminalCodeToHtml(event.data); + line.innerHTML = convertDaemonedCodeToHtml(event.data); xonotic_output.prepend(line); }); } -function sendHello() { - socket.send('Hello'); -} - -// Shell command can have control codes. Some of these mean colours. -function convertTerminalCodeToHtml(line) { - let htmlline = ""; - let open_spans = 0; - for(let i = 0; i < line.length; i++) { - if(line[i] == '\033') { - let code = line[++i] - if(code == '[') { - // This means it's a colour - let colour_code = ""; - for(i++; i < line.length && line[i] != 'm'; i++) { - colour_code += line[i]; - } - colour_code = parseInt(colour_code); - if(colour_code === 0) { - for(let i = 0; i < open_spans; i++) { - htmlline += ""; - } - } - else if(colour_code >= 30 && colour_code <= 37) { - htmlline += ''; - open_spans++; - } - else if(colour_code >= 90 && colour_code <= 97) { - htmlline += ''; - open_spans++; - } - } - } - else if(line[i] == '<') { - htmlline += "<" - } - else if(line[i] == '>') { - htmlline += ">" - } - else if(line[i] == '&') { - htmlline += "&" - } - else { - htmlline += line[i]; - } - } - - for(let i = 0; i < open_spans; i++) { - htmlline += ""; - } - - return htmlline -} - if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', xonotic_init); } else {