Skip to content

Commit 9c103aa

Browse files
committed
v0.26.3 - Fixes #14
1 parent 6084f20 commit 9c103aa

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Node.JS Chat
22
============
3-
[![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)
3+
[![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)
44

55
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.
66

lib/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = {
1919
for(var client in clients) {
2020
if(clients[client].role > 1 && (data.info === 'connection' || data.info === 'disconnection')) {
2121
data.user.ip = clients[client].ip;
22-
} else {
22+
} else if(data.user) {
2323
data.user.ip = null;
2424
}
2525

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-chat",
3-
"version": "0.26.1",
3+
"version": "0.26.3",
44
"private": true,
55
"scripts": {
66
"start": "node app.js"

public/js/chat.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ document.getElementById('version').innerHTML = version;
3939
var connect = function() {
4040
var protocol;
4141

42-
if(window.location.protocol === 'https') {
42+
if(window.location.protocol === 'https:') {
4343
protocol = 'wss://';
4444
} else {
4545
protocol = 'ws://';
@@ -112,7 +112,7 @@ var connect = function() {
112112
switch(data.info) {
113113
case 'rejected':
114114
var message;
115-
115+
116116
if(data.reason == 'length') {
117117
message = 'Your username must have at least 3 characters and no more than 16 characters';
118118
}
@@ -153,15 +153,15 @@ var connect = function() {
153153
break;
154154

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

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

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

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

0 commit comments

Comments
 (0)