diff --git a/public/css/main.css b/public/css/main.css index b9f43da..0c06cec 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -64,8 +64,15 @@ body { margin-top: 5px; color: #2196f3; } +.ircclient .coverwindow .wrapper label.autosize { + width: auto; + display: inline-block !important; + font-size: 90% !important; + margin-bottom: 10px; +} .ircclient .coverwindow .wrapper input[type=text], -.ircclient .coverwindow .wrapper input[type=number] { +.ircclient .coverwindow .wrapper input[type=number], +.ircclient .coverwindow .wrapper input[type=password] { padding: 8px; width: 300px; border-radius: 5px; diff --git a/public/index.html b/public/index.html index e6050a9..b1ced17 100644 --- a/public/index.html +++ b/public/index.html @@ -25,14 +25,22 @@
+   + + - - - - - - Use SSL +
+ + + + + + Use SSL +
diff --git a/public/js/main.js b/public/js/main.js index 7ed4141..3a662f9 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -415,6 +415,10 @@ let commands = { irc.socket.emit("userinput", {command: "quit", server: buffer.server, message: listargs.slice(1).join(" "), arguments: []}); }, description: "[] - Quit the current server with message.", aliases: ['exit']}, + mode: {execute: function(buffer, handler, command, message, listargs) { + irc.socket.emit("userinput", {command: "mode", server: buffer.server, message: listargs.slice(1).join(" "), arguments: []}); + }, description: "[target] [mode] - Set/remove mode of target."}, + msg: {execute: function(buffer, handler, command, message, listargs) { if(!listargs[1] || !listargs[2]) return handler.commandError(buffer, listargs[0].toUpperCase()+': Missing parameters!'); @@ -1060,6 +1064,10 @@ class IRCConnector { if(key === 27 && this.canClose) this.authComplete(); } + + clientdom.connector.pwtrigger.onclick = (e) => { + this.togglePassword(); + } } fillFormFromURI() { @@ -1113,6 +1121,7 @@ class IRCConnector { event.preventDefault(); let nickname = clientdom.connector.nickname.value; + let password = clientdom.connector.password.value; let channel = clientdom.connector.channel.value; let server = clientdom.connector.server.value; let port = clientdom.connector.port.value; @@ -1161,11 +1170,14 @@ class IRCConnector { return false; } + if(!clientdom.connector.pwtrigger.checked) + password = ""; + irc.socket.emit('irc_create', {nickname: nickname, autojoin: channel, server: server, port: port, - password: null, + password: password, secure: clientdom.connector.secure.checked }); return true; } @@ -1176,6 +1188,13 @@ class IRCConnector { this.formLocked = false; } + togglePassword() { + if(clientdom.connector.pwtrigger.checked) + clientdom.connector.pwbox.style.display = "block"; + else + clientdom.connector.pwbox.style.display = "none"; + } + authComplete() { clientdom.connector.frame.style.display = "none"; this.formLocked = false; @@ -1217,7 +1236,7 @@ class InputHandler { } keyUpHandle(e, key) { - if(key == 38 || key == 40 || key == 8 || key == 9) return; + if(key == 38 || key == 40 || key == 9) return; let input = clientdom.input.value; let word = input.split(/ |\n/).pop(); @@ -1296,11 +1315,6 @@ class InputHandler { // Remember the word until next time. this.lastWord = word; - return; - } else if(key == 8) { - this.index = -1; - this.lastWord = ""; - return; } } @@ -1753,6 +1767,9 @@ window.onload = function() { clientdom.connector['messenger'] = clientdom.connector.frame.querySelector('#connmsg'); clientdom.connector['form'] = clientdom.connector.frame.querySelector('#IRCConnector'); clientdom.connector['nickname'] = clientdom.connector.form.querySelector('#nickname'); + clientdom.connector['password'] = clientdom.connector.form.querySelector('#password'); + clientdom.connector['pwtrigger'] = clientdom.connector.form.querySelector('#password_trig'); + clientdom.connector['pwbox'] = clientdom.connector.form.querySelector('.password_box'); clientdom.connector['channel'] = clientdom.connector.form.querySelector('#channel'); clientdom.connector['server'] = clientdom.connector.form.querySelector('#server'); clientdom.connector['port'] = clientdom.connector.form.querySelector('#port'); diff --git a/public/main.styl b/public/main.styl index e00761a..6af0f06 100644 --- a/public/main.styl +++ b/public/main.styl @@ -75,7 +75,12 @@ body font-size: 80% margin-top: 5px color: #2196F3 - input[type=text], input[type=number] + &.autosize + width: auto + display: inline-block !important + font-size: 90% !important + margin-bottom: 10px + input[type=text], input[type=number], input[type=password] padding: 8px; width: 300px; border-radius: 5px; diff --git a/server/irc.js b/server/irc.js index 01fc57b..a027599 100644 --- a/server/irc.js +++ b/server/irc.js @@ -220,6 +220,7 @@ class IRCConnectionHandler { case "042": this.conn.emit('pass_to_client', {type: "server_message", messageType: "regular", message: line.arguments[1] +" "+ line.trailing, server: serverName, from: realServerName}); break; + case "501": case "401": case "402": case "421": diff --git a/teemant.js b/teemant.js index f0ed2ee..8a20f6e 100755 --- a/teemant.js +++ b/teemant.js @@ -54,7 +54,7 @@ io.sockets.on('connection', function (socket) { connections[socket.id] = { host: { ipaddr: userip, - hostname: "localhost" + hostname: userip } } @@ -63,10 +63,11 @@ io.sockets.on('connection', function (socket) { hostQuery.then((arr) => { if(arr.length > 0) connections[socket.id].host.hostname = arr[0]; - if(config.server.debug) - console.log("Hostname of "+socket.id+" was determined to be "+connections[socket.id].host.hostname); }).catch((err) => { console.log("Host resolve for "+socket.id+" failed: ", err); }); + if(config.server.debug) + console.log("Hostname of "+socket.id+" was determined to be "+connections[socket.id].host.hostname); + socket.on('disconnect', function() { for (let d in connections[socket.id]) { if(connections[socket.id][d].ipaddr) continue;