lintageddon 5

This commit is contained in:
Josh Burman 2020-02-03 17:02:47 -05:00
parent e004a64e9b
commit 7c20b25faf
5 changed files with 11 additions and 9 deletions

View File

@ -54,7 +54,7 @@ class ChannelBase {
removeClient(id: number) {
for (const client of this.clients) {
if (client.id === id) {
const index = this.clients.indexOf(client)
const index = this.clients.indexOf(client);
this.clients.splice(index, 1);
return true;
}
@ -62,6 +62,6 @@ class ChannelBase {
return false;
}
};
}
export default ChannelBase;

View File

@ -9,7 +9,7 @@ class PrivateChannel extends ChannelBase {
to !== from &&
to.roles.includes('receiver') &&
from.roles.includes('broadcaster')
)
);
}
}

View File

@ -15,7 +15,7 @@ class ClientBase {
channel: PublicChannel|PrivateChannel|CustomChannel|null;
clientManager: ClientManager;
channelManager: ChannelManager;
roles: String[];
roles: string[];
messageListener: (data: any) => void;
constructor(data: any, ws: WebSocket, channelManager: ChannelManager, clientManager: ClientManager) {
@ -82,7 +82,10 @@ class ClientBase {
logger.accessLog.info(`message transaction complete on channel ${this.channel.id}: `, {message});
} else {
logger.errorLog.info(`Validation failed or client is not part of a channel, please review schema`, {data: {message, error: message.error}});
logger.errorLog.info(
`Validation failed or client is not part of a channel, please review schema`,
{data: {message, error: message.error}}
);
}
}

View File

@ -2,6 +2,6 @@ const app = require('../config/app');
module.exports = {
home: (req: any, res: any) => {
res.send(`Welcome to Braid v${app.version}`)
res.send(`Welcome to Braid v${app.version}`);
}
};

View File

@ -13,8 +13,7 @@ import PublicClient from './clients/types/publicClient';
import PrivateClient from './clients/types/privateClient';
import CustomClient from './clients/types/customClient';
const wss = new WebSocket.Server({ maxPayload:250000, port: app.port });
const wss = new WebSocket.Server({ maxPayload: 250000, port: app.port });
const clientManager = new ClientManager();
const channelManager = new ChannelManager();
@ -47,7 +46,7 @@ function connectionManager() {
channelManager.addClientToChannel(client, data.channel);
}
//remove any channels that have no users in them
// remove any channels that have no users in them
logger.accessLog.info(`Purging empty channels...`);
channelManager.purgeEmptyChannels();