Skip to content

Commit aaba8d3

Browse files
committed
Added an additional statistic: "Connections on the session since the beginning"
1 parent 0c9984e commit aaba8d3

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

lib/ClientConnect.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ class ClientConnect {
8888
this.client.gone='';
8989
this.client.goneTime='';
9090
this.client.users = -1;
91+
this.client.sessionConnections = 0;
9192

9293
// Default is null, false is reconnecting, and true is disconnected before 005.
9394
this.client.preConnectionLogout = false;
@@ -297,6 +298,7 @@ class ClientConnect {
297298
if (!this.client.authenticated) {
298299
this.client.authenticated = true;
299300
this.client.users=1;
301+
this.client.sessionConnections=1;
300302
this.client.nick_original = data[2];
301303
if (lines[n].lastIndexOf("@") > 0) {
302304
this.client.ircuser = lines[n].substr(lines[n].lastIndexOf("!") + 1, lines[n].lastIndexOf("@") - lines[n].lastIndexOf("!") - 1);

lib/ClientReconnect.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class ClientReconnect {
4545
this.write(socket, ":*jbnc 376 " + this.connection.nick + " :End of /MOTD command.\n");
4646
} else {
4747
this.connection.users++;
48+
this.connection.sessionConnections++;
4849
}
4950

5051
this.write(socket, ":*jbnc PRIVMSG " + this.connection.nick + " :Attaching you to the network\n");

lib/WebAdminPanel.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class WebAdminPanel {
6666
realname: this.connections[key].realname,
6767
goneTime: this.connections[key].goneTime,
6868
users: this.connections[key].users,
69+
sessionConnections: this.connections[key].sessionConnections,
6970
channelCount: this.instanceConnections.userChannelCount(key)
7071
};
7172
connectionsData.push(connection);

lib/webadminpanel/dashboard.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ <h1>JBNC</h1>
2222
<h4 class="mt-3">Last Launch: {{ last_launch }}</h4>
2323
<h5>Last UncaughtException: {{ last_bug }}</h5>
2424
<h2 class="mt-4">Connections (total: {{ count }}) :</h2>
25-
<ul>
26-
<li v-for="connection in connections" :key="connection.id">
27-
<button class="kill btn btn-primary" @click="removeConnection(connection.key, $event)">Kill</button> Nick: {{ connection.nick }} - User: {{ connection.user }} - Host: {{ connection.host }} - Number of channels: {{ connection.channelCount }} - Users: {{ connection.users }} - <span v-if="connection.goneTime !== ''" class="p-2 text-light bg-danger">{{ calculateElapsedTime(connection.goneTime) }}</span>
25+
<ul class="list-group">
26+
<li class="list-group-item" v-for="connection in connections" :key="connection.id">
27+
<button class="kill btn btn-primary" @click="removeConnection(connection.key, $event)">Kill</button> <strong>Nick:</strong> {{ connection.nick }} - <strong>User:</strong> {{ connection.user }} - <strong>Host:</strong> {{ connection.host }} - <strong>Number of channels:</strong> {{ connection.channelCount }} - <strong>Users:</strong> {{ connection.users }} - <strong>Connections on the session since the beginning:</strong> {{ connection.sessionConnections }} - <span v-if="connection.goneTime !== ''" class="p-2 text-light bg-danger">{{ calculateElapsedTime(connection.goneTime) }}</span>
2828
</li>
2929
</ul>
3030
</div>

0 commit comments

Comments
 (0)