Skip to content

Commit

Permalink
v0.26.3 - Fixes igorantun#14
Browse files Browse the repository at this point in the history
  • Loading branch information
igorantun committed Aug 10, 2015
1 parent 6084f20 commit 9c103aa
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Node.JS Chat
============
[![GitHub Stars](https://img.shields.io/github/stars/IgorAntun/node-chat.svg)](https://github.com/IgorAntun/node-chat/stargazers) [![GitHub Issues](https://img.shields.io/github/issues/IgorAntun/node-chat.svg)](https://github.com/IgorAntun/node-chat/issues) [![Current Version](https://img.shields.io/badge/version-0.26.1-green.svg)](https://github.com/IgorAntun/node-chat) [![Live Demo](https://img.shields.io/badge/demo-online-green.svg)](https://igorantun.com/chat) " [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/IgorAntun/node-chat?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![GitHub Stars](https://img.shields.io/github/stars/IgorAntun/node-chat.svg)](https://github.com/IgorAntun/node-chat/stargazers) [![GitHub Issues](https://img.shields.io/github/issues/IgorAntun/node-chat.svg)](https://github.com/IgorAntun/node-chat/issues) [![Current Version](https://img.shields.io/badge/version-0.26.3-green.svg)](https://github.com/IgorAntun/node-chat) [![Live Demo](https://img.shields.io/badge/demo-online-green.svg)](https://igorantun.com/chat) " [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/IgorAntun/node-chat?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

This is a node.js chat application powered by SockJS and Express that provides the main functions you'd expect from a chat, such as emojis, private messages, an admin system, etc.

Expand Down
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = {
for(var client in clients) {
if(clients[client].role > 1 && (data.info === 'connection' || data.info === 'disconnection')) {
data.user.ip = clients[client].ip;
} else {
} else if(data.user) {
data.user.ip = null;
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-chat",
"version": "0.26.1",
"version": "0.26.3",
"private": true,
"scripts": {
"start": "node app.js"
Expand Down
8 changes: 4 additions & 4 deletions public/js/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ document.getElementById('version').innerHTML = version;
var connect = function() {
var protocol;

if(window.location.protocol === 'https') {
if(window.location.protocol === 'https:') {
protocol = 'wss://';
} else {
protocol = 'ws://';
Expand Down Expand Up @@ -112,7 +112,7 @@ var connect = function() {
switch(data.info) {
case 'rejected':
var message;

if(data.reason == 'length') {
message = 'Your username must have at least 3 characters and no more than 16 characters';
}
Expand Down Expand Up @@ -153,15 +153,15 @@ var connect = function() {
break;

case 'connection':
var userip = data.user.ip ? '[' + data.user.ip + ']' : '';
var userip = data.user.ip ? ' [' + data.user.ip + ']' : '';
showChat('info', null, data.user.un + userip + ' connected to the server');

clients[data.user.id] = data.user;
document.getElementById('users').innerHTML = Object.keys(clients).length + ' USERS';
break;

case 'disconnection':
var userip = data.user.ip ? '[' + data.user.ip + ']' : '';
var userip = data.user.ip ? ' [' + data.user.ip + ']' : '';

if(data.user.un != null) {
showChat('info', null, data.user.un + userip + ' disconnected from the server');
Expand Down

0 comments on commit 9c103aa

Please sign in to comment.