Add TLS/SSL support

This commit is contained in:
Mattias Erming 2014-09-10 08:56:19 -07:00
parent 9fc69978e7
commit ef22d84d97
4 changed files with 57 additions and 31 deletions

View File

@ -9,6 +9,7 @@ body {
} }
body { body {
background: #505d70; background: #505d70;
background: #455164;
color: #222; color: #222;
font: 16px Lato, sans-serif; font: 16px Lato, sans-serif;
margin: 0; margin: 0;
@ -81,14 +82,14 @@ button {
padding: 0 30px; padding: 0 30px;
} }
::-moz-placeholder { ::-moz-placeholder {
color: rgba(0, 0, 0, .25); color: rgba(0, 0, 0, .35);
opacity: 1; opacity: 1;
} }
::-webkit-input-placeholder { ::-webkit-input-placeholder {
color: rgba(0, 0, 0, .25); color: rgba(0, 0, 0, .35);
} }
:-ms-input-placeholder { :-ms-input-placeholder {
color: rgba(0, 0, 0, .25) !important; color: rgba(0, 0, 0, .35) !important;
} }
#wrap { #wrap {
height: 100%; height: 100%;
@ -135,7 +136,7 @@ button {
margin-top: 30px; margin-top: 30px;
} }
#sidebar .empty { #sidebar .empty {
color: #818b9e; color: #9ca5b4;
line-height: 1.6; line-height: 1.6;
font-size: 12px; font-size: 12px;
margin-top: 20px; margin-top: 20px;
@ -241,7 +242,7 @@ button {
background: none; background: none;
} }
#footer .icon { #footer .icon {
color: #818b9e; color: #9ca5b4;
display: inline-block; display: inline-block;
font: 14px FontAwesome; font: 14px FontAwesome;
line-height: 34px; line-height: 34px;
@ -262,13 +263,13 @@ button {
display: none; display: none;
} }
#footer .sign-in:before { #footer .sign-in:before {
content: "\f090"; content: "\f023";
} }
#footer .connect:before { #footer .connect:before {
content: "\f1eb"; content: "\f067";
} }
#footer .settings:before { #footer .settings:before {
content: "\f02d"; content: "\f013";
} }
#footer .sign-out:before { #footer .sign-out:before {
content: "\f13e"; content: "\f13e";
@ -340,6 +341,13 @@ button {
#windows .window h1 { #windows .window h1 {
font: 36px Lato; font: 36px Lato;
} }
#windows .window h2 {
border-bottom: 1px solid #eee;
color: #7f8c8d;
font-size: 22px;
margin: 30px 0 10px;
padding-bottom: 7px;
}
#windows .active { #windows .active {
display: block; display: block;
} }
@ -460,17 +468,12 @@ button {
vertical-align: top; vertical-align: top;
} }
#chat .time { #chat .time {
background: #fcfdfd; color: #d0dbe2;
background: #fcfcfc;
color: #e4eaee;
text-align: right; text-align: right;
width: 46px; width: 46px;
min-width: 46px; min-width: 46px;
} }
#chat .from { #chat .from {
background: #fcfdfd;
background: #fcfcfc;
border-right: 1px solid #f6f8f9;
border-right: 1px solid #f6f6f6; border-right: 1px solid #f6f6f6;
color: #b1c3ce; color: #b1c3ce;
padding-right: 10px; padding-right: 10px;
@ -521,9 +524,7 @@ button {
max-width: 240px; max-width: 240px;
} }
#chat .count { #chat .count {
background: #fcfcfc; background: #fafafa;
background: #fff;
border-bottom: 1px dashed #e7e7e7;
height: 48px; height: 48px;
left: 0; left: 0;
position: absolute; position: absolute;
@ -531,7 +532,7 @@ button {
top: 0; top: 0;
} }
#chat .count:before { #chat .count:before {
color: #eee; color: #cfcfcf;
font: 14px FontAwesome; font: 14px FontAwesome;
content: "\f002"; content: "\f002";
position: absolute; position: absolute;
@ -590,15 +591,18 @@ button {
margin: 28px 0 0 -17px; margin: 28px 0 0 -17px;
position: absolute; position: absolute;
} }
#connect .btn { #connect .tls {
margin-top: 25px; float: left;
font-size: 14px;
padding: 10px 2px;
} }
#settings h2 { #connect .tls input {
border-bottom: 1px solid #eee; float: left;
color: #7f8c8d; margin: 3px 10px 0 0;
font-size: 22px; }
margin: 30px 0 10px; #connect .btn {
padding-bottom: 7px; float: left;
margin-top: 25px;
} }
#settings .title { #settings .title {
margin-bottom: -10px; margin-bottom: -10px;
@ -705,6 +709,9 @@ button {
} }
@media (max-width: 480px) { @media (max-width: 480px) {
.container {
margin: 40px 0;
}
#chat .messages { #chat .messages {
display: block; display: block;
padding: 5px 10px; padding: 5px 10px;

View File

@ -78,9 +78,19 @@
<div class="col-xs-4"> <div class="col-xs-4">
<label class="port"> <label class="port">
Port Port
<input class="input" name="port" value="6667"> <input class="input" name="port" value="6697">
</label> </label>
</div> </div>
<div class="col-xs-12">
<label class="tls">
<input type="checkbox" name="tls" checked="checked">
Enable TLS/SSL
</label>
</div>
<div class="clearfix"></div>
<div class="col-xs-12">
<h2>User Preferences</h2>
</div>
<div class="col-xs-5"> <div class="col-xs-5">
<label> <label>
Nick Nick

View File

@ -1,7 +1,7 @@
{ {
"name": "shout", "name": "shout",
"description": "A web IRC client", "description": "A web IRC client",
"version": "0.20.1", "version": "0.21.0",
"author": "Mattias Erming", "author": "Mattias Erming",
"preferGlobal": true, "preferGlobal": true,
"bin": { "bin": {

View File

@ -1,6 +1,7 @@
var _ = require("lodash"); var _ = require("lodash");
var config = require("../config.json"); var config = require("../config.json");
var net = require("net"); var net = require("net");
var Msg = require("./models/msg");
var Network = require("./models/network"); var Network = require("./models/network");
var slate = require("slate-irc"); var slate = require("slate-irc");
var tls = require("tls"); var tls = require("tls");
@ -90,13 +91,21 @@ Client.prototype.connect = function(args) {
var client = this; var client = this;
var server = _.defaults(_.pick(args, ['host', 'port', 'rejectUnauthorized', 'name']), { var server = _.defaults(_.pick(args, ['host', 'port', 'rejectUnauthorized', 'name']), {
host: "irc.freenode.org", host: "irc.freenode.org",
port: 6667, port: 6697,
rejectUnauthorized: true rejectUnauthorized: false
}); });
var stream = args.tls ? tls.connect(server) : net.connect(server); var stream = args.tls ? tls.connect(server) : net.connect(server);
stream.on("error", function(e) { stream.on("error", function(e) {
console.log(e); console.log("Client#connect():\n" + e);
stream.end();
var msg = new Msg({
type: Msg.Type.ERROR,
text: "Connection error."
});
client.emit("msg", {
msg: msg
});
}); });
var nick = args.nick || "shout-user"; var nick = args.nick || "shout-user";