lintageddon 6
This commit is contained in:
parent
7c20b25faf
commit
bf91bb1b5a
@ -57,7 +57,9 @@ class ChannelManager {
|
|||||||
|
|
||||||
createByChannelType(data: any) {
|
createByChannelType(data: any) {
|
||||||
try {
|
try {
|
||||||
logger.accessLog.info(`attempting to create channel of type ${data.channel_type}, channel id: ${data.channel}...`);
|
logger.accessLog.info(
|
||||||
|
`attempting to create channel of type ${data.channel_type}, channel id: ${data.channel}...`
|
||||||
|
);
|
||||||
|
|
||||||
if (data.channel_type === 'public') {
|
if (data.channel_type === 'public') {
|
||||||
return new PublicChannel(data.channel);
|
return new PublicChannel(data.channel);
|
||||||
|
@ -27,7 +27,7 @@ class ClientManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clientsOfType(client_type: string) {
|
clientsOfType(client_type: string) {
|
||||||
let result: PublicClient[]|PrivateClient[]|CustomClient[] = [];
|
const result: PublicClient[]|PrivateClient[]|CustomClient[] = [];
|
||||||
|
|
||||||
for (const client of this.clients) {
|
for (const client of this.clients) {
|
||||||
if (client.type() === client_type) {
|
if (client.type() === client_type) {
|
||||||
|
@ -3,7 +3,7 @@ import * as express from 'express';
|
|||||||
|
|
||||||
const app = require('./config/app');
|
const app = require('./config/app');
|
||||||
const corsOptions = {
|
const corsOptions = {
|
||||||
origin: (origin: string, callback: Function) => {
|
origin: (origin: string, callback: (error: any, success?: boolean) => void) => {
|
||||||
if (app.whitelist.indexOf(origin) !== -1) {
|
if (app.whitelist.indexOf(origin) !== -1) {
|
||||||
callback(null, true);
|
callback(null, true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -26,6 +26,7 @@ function connectionManager() {
|
|||||||
ws.close();
|
ws.close();
|
||||||
} else {
|
} else {
|
||||||
const data = result.data;
|
const data = result.data;
|
||||||
|
var client: PublicClient|PrivateClient|CustomClient|null;
|
||||||
logger.accessLog.info(`Client Connected: ${data.user_id}`);
|
logger.accessLog.info(`Client Connected: ${data.user_id}`);
|
||||||
|
|
||||||
if (!channelManager.channelExists(data.channel)) {
|
if (!channelManager.channelExists(data.channel)) {
|
||||||
@ -33,13 +34,13 @@ function connectionManager() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (clientManager.clientExists(data.user_id)) {
|
if (clientManager.clientExists(data.user_id)) {
|
||||||
var client: PublicClient|PrivateClient|CustomClient|null = clientManager.getClient(data.user_id);
|
client = clientManager.getClient(data.user_id);
|
||||||
|
|
||||||
if (client != null) {
|
if (client != null) {
|
||||||
client.replaceWebSocket(ws);
|
client.replaceWebSocket(ws);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var client: PublicClient|PrivateClient|CustomClient|null = clientManager.addClient(data, channelManager, ws);
|
client = clientManager.addClient(data, channelManager, ws);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client != null) {
|
if (client != null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user