i hate this project
This commit is contained in:
parent
0b93120953
commit
3f99a9a35c
@ -12,6 +12,8 @@
|
|||||||
realname="A Teemant User"
|
realname="A Teemant User"
|
||||||
default_quit_msg="Teemant IRC"
|
default_quit_msg="Teemant IRC"
|
||||||
default_part_msg="Bye!"
|
default_part_msg="Bye!"
|
||||||
|
default_server="irc.icynet.ml"
|
||||||
|
default_port=6667
|
||||||
# Socket settings
|
# Socket settings
|
||||||
secure_by_default=false
|
secure_by_default=false
|
||||||
timeout=3000
|
timeout=3000
|
||||||
|
@ -42,9 +42,9 @@ module.exports.printRuntimeStats = function(runtime_stats, connections) {
|
|||||||
if(users != 0) // Don't divide by zero lmao
|
if(users != 0) // Don't divide by zero lmao
|
||||||
serversPerUser = servers/users;
|
serversPerUser = servers/users;
|
||||||
|
|
||||||
console.log(date+': Currently connected users: {0};' +
|
console.log(date+(': Currently connected users: {0}. ' +
|
||||||
'IRC server connections: {1};' +
|
'IRC server connections: {1}. ' +
|
||||||
'Average servers per user: {2};' +
|
'Average servers per user: {2}. ' +
|
||||||
'Total connections made: {3};' +
|
'Total connections made: {3}. ' +
|
||||||
'Uptime: {4}s;'.format(users, servers, serversPerUser, runtime_stats.connectionsMade, process.uptime()));
|
'Uptime: {4}s;').format(users, servers, serversPerUser, runtime_stats.connectionsMade, process.uptime()));
|
||||||
};
|
};
|
||||||
|
@ -33,10 +33,10 @@
|
|||||||
<input type="password" name="password" id="password">
|
<input type="password" name="password" id="password">
|
||||||
</div>
|
</div>
|
||||||
<label for="channel">Channel</label>
|
<label for="channel">Channel</label>
|
||||||
<input type="text" name="channel" id="channel" value="#diamond">
|
<input type="text" name="channel" id="channel" value="">
|
||||||
<div class="server_data">
|
<div class="server_data">
|
||||||
<label for="server">Server</label>
|
<label for="server">Server</label>
|
||||||
<input type="text" name="server" id="server" value="irc.icynet.ml">
|
<input type="text" name="server" id="server" value="">
|
||||||
<label for="port">Port</label>
|
<label for="port">Port</label>
|
||||||
<input type="number" name="port" id="port" value="6667">
|
<input type="number" name="port" id="port" value="6667">
|
||||||
<label for="secure">Secure connection</label>
|
<label for="secure">Secure connection</label>
|
||||||
|
@ -40,8 +40,6 @@ const colorizer = {
|
|||||||
stylize: require('./colorparser.js')
|
stylize: require('./colorparser.js')
|
||||||
};
|
};
|
||||||
|
|
||||||
let urlParams = {};
|
|
||||||
|
|
||||||
/*********************\
|
/*********************\
|
||||||
|** **|
|
|** **|
|
||||||
|** UTILITIES **|
|
|** UTILITIES **|
|
||||||
@ -1312,6 +1310,7 @@ class IRCConnector {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.formLocked = false;
|
this.formLocked = false;
|
||||||
this.canClose = false;
|
this.canClose = false;
|
||||||
|
this.defaults = {};
|
||||||
|
|
||||||
clientdom.connector.form.onsubmit = (e) => {
|
clientdom.connector.form.onsubmit = (e) => {
|
||||||
if(this.formLocked) {
|
if(this.formLocked) {
|
||||||
@ -1335,7 +1334,14 @@ class IRCConnector {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
fillFormFromURI() {
|
fillFormFromURI(urlParams) {
|
||||||
|
if(this.defaults.server)
|
||||||
|
clientdom.connector.server.value = this.defaults.server;
|
||||||
|
if(this.defaults.port)
|
||||||
|
clientdom.connector.port.value = this.defaults.port;
|
||||||
|
if(this.defaults.ssl)
|
||||||
|
clientdom.connector.secure.checked = this.defaults.ssl;
|
||||||
|
|
||||||
for(let param in urlParams) {
|
for(let param in urlParams) {
|
||||||
let value = urlParams[param];
|
let value = urlParams[param];
|
||||||
|
|
||||||
@ -1376,6 +1382,7 @@ class IRCConnector {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(window.location.hash)
|
if(window.location.hash)
|
||||||
clientdom.connector.channel.value = window.location.hash;
|
clientdom.connector.channel.value = window.location.hash;
|
||||||
|
|
||||||
@ -1395,6 +1402,10 @@ class IRCConnector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defaultTo(data) {
|
||||||
|
this.defaults = data;
|
||||||
|
}
|
||||||
|
|
||||||
getDataFromForm() {
|
getDataFromForm() {
|
||||||
let nickname = clientdom.connector.nickname.value;
|
let nickname = clientdom.connector.nickname.value;
|
||||||
let password = clientdom.connector.password.value;
|
let password = clientdom.connector.password.value;
|
||||||
@ -2043,11 +2054,11 @@ function parseURL() {
|
|||||||
decode = function (s) { return decodeURIComponent(s.replace(pl, ' ')); },
|
decode = function (s) { return decodeURIComponent(s.replace(pl, ' ')); },
|
||||||
query = window.location.search.substring(1);
|
query = window.location.search.substring(1);
|
||||||
|
|
||||||
urlParams = {};
|
let urlParams = {};
|
||||||
while (match = search.exec(query))
|
while (match = search.exec(query))
|
||||||
urlParams[decode(match[1])] = decode(match[2]);
|
urlParams[decode(match[1])] = decode(match[2]);
|
||||||
|
|
||||||
irc.auther.fillFormFromURI();
|
irc.auther.fillFormFromURI(urlParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopWarnings() {
|
function stopWarnings() {
|
||||||
@ -2055,8 +2066,6 @@ function stopWarnings() {
|
|||||||
window.onbeforeunload = null;
|
window.onbeforeunload = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onpopstate = parseURL;
|
|
||||||
|
|
||||||
window.onresize = function() {
|
window.onresize = function() {
|
||||||
if(irc.config.scrollOnResize)
|
if(irc.config.scrollOnResize)
|
||||||
clientdom.letterbox.scrollTop = clientdom.letterbox.scrollHeight;
|
clientdom.letterbox.scrollTop = clientdom.letterbox.scrollHeight;
|
||||||
@ -2104,9 +2113,14 @@ window.onload = function() {
|
|||||||
irc.auther = new IRCConnector();
|
irc.auther = new IRCConnector();
|
||||||
irc.chat = new IRCChatWindow();
|
irc.chat = new IRCChatWindow();
|
||||||
|
|
||||||
parseURL();
|
|
||||||
irc.settings.setInitialValues();
|
irc.settings.setInitialValues();
|
||||||
|
|
||||||
|
irc.socket.on('defaults', function (data) {
|
||||||
|
irc.auther.defaultTo(data);
|
||||||
|
parseURL();
|
||||||
|
window.onpopstate = parseURL;
|
||||||
|
});
|
||||||
|
|
||||||
irc.socket.on('connect', function (data) {
|
irc.socket.on('connect', function (data) {
|
||||||
irc.socketUp = true;
|
irc.socketUp = true;
|
||||||
});
|
});
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
const metafunctions = {
|
|
||||||
hexcolor: {regex: /#([A-F0-9]{3}([A-F0-9]{3})?)\b/gi, replacer: (function (line, regxp) {
|
|
||||||
return line.replace(regxp, (color) => {
|
|
||||||
return '<span class="color_preview">' + color +
|
|
||||||
'<div class="little_icon" style="background-color: "' + color + ';"> </div></span>';
|
|
||||||
});
|
|
||||||
})}
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
|
|
||||||
};
|
|
10
teemant.js
10
teemant.js
@ -90,6 +90,12 @@ io.sockets.on('connection', function (socket) {
|
|||||||
|
|
||||||
logger.debugLog('clientID: {0} from: {1}'.format(socket.id, userip));
|
logger.debugLog('clientID: {0} from: {1}'.format(socket.id, userip));
|
||||||
|
|
||||||
|
socket.emit('defaults', {
|
||||||
|
server: config.client.default_server,
|
||||||
|
port: config.client.default_port,
|
||||||
|
ssl: config.client.secure_by_default
|
||||||
|
});
|
||||||
|
|
||||||
// New object for connections
|
// New object for connections
|
||||||
connections[socket.id] = {
|
connections[socket.id] = {
|
||||||
host: {
|
host: {
|
||||||
@ -103,12 +109,12 @@ io.sockets.on('connection', function (socket) {
|
|||||||
hostQuery.then((arr) => {
|
hostQuery.then((arr) => {
|
||||||
if(arr.length > 0)
|
if(arr.length > 0)
|
||||||
connections[socket.id].host.hostname = arr[0];
|
connections[socket.id].host.hostname = arr[0];
|
||||||
|
|
||||||
|
logger.debugLog('Hostname of {0} was determined to be {1}'.format(socket.id, connections[socket.id].host.hostname));
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
logger.debugLog('Host resolve for {0} failed: {1}'.format(socket.id, err));
|
logger.debugLog('Host resolve for {0} failed: {1}'.format(socket.id, err));
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.debugLog('Hostname of {0} was determined to be {1}'.format(socket.id, connections[socket.id].host.hostname));
|
|
||||||
|
|
||||||
socket.on('disconnect', function() {
|
socket.on('disconnect', function() {
|
||||||
for (let d in connections[socket.id]) {
|
for (let d in connections[socket.id]) {
|
||||||
if(connections[socket.id][d].ipaddr) continue;
|
if(connections[socket.id][d].ipaddr) continue;
|
||||||
|
Reference in New Issue
Block a user