Skip to content
This repository was archived by the owner on Apr 1, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ var myNick = localStorageGet('my-nick')
var myChannel = window.location.search.replace(/^\?/, '')
var lastSent = [""]
var lastSentPos = 0
var banned = localStorageGet('banned') == 'true';


// Ping server every 50 seconds to retain WebSocket connection
Expand All @@ -75,7 +76,9 @@ function join(channel) {
}
if (myNick) {
localStorageSet('my-nick', myNick)
send({cmd: 'join', channel: channel, nick: myNick})
if (!banned) {
send({cmd: 'join', channel: channel, nick: myNick})
}
}
wasConnected = true
}
Expand Down Expand Up @@ -135,6 +138,12 @@ var COMMANDS = {
pushMessage({nick: '*', text: nick + " left"})
}
},
data: function(args) {
if (args.banned) {
banned = true;
localStorageSet('banned', banned)
}
}
}


Expand Down Expand Up @@ -184,7 +193,7 @@ function pushMessage(args) {
textEl.classList.add('text')

textEl.textContent = args.text || ''
textEl.innerHTML = textEl.innerHTML.replace(/(\?|https?:\/\/)\S+?(?=[,.!?:)]?\s|$)/g, parseLinks)
textEl.innerHTML = textEl.innerHTML.replace(/(\s|^)(\?|https?:\/\/|www\.)\S+/g, parseLinks)

if ($('#parse-latex').checked) {
// Temporary hotfix for \rule spamming, see https://github.com/Khan/KaTeX/issues/109
Expand Down
1 change: 1 addition & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ var COMMANDS = {
}

POLICE.arrest(getAddress(badClient))
send({cmd: 'data', banned: true}, badClient);
console.log(this.nick + " [" + this.trip + "] banned " + nick + " in " + this.channel)
broadcast({cmd: 'info', text: "Banned " + nick}, this.channel)
},
Expand Down