fix(core): update

This commit is contained in:
Philipp Kunz 2019-08-13 15:55:01 +02:00
parent ec2afbfd55
commit 3a7ebcdd80
7 changed files with 11 additions and 10 deletions

View File

@ -30,6 +30,7 @@
"@pushrocks/smartexpress": "^3.0.38", "@pushrocks/smartexpress": "^3.0.38",
"@pushrocks/smartfile": "^7.0.4", "@pushrocks/smartfile": "^7.0.4",
"@pushrocks/smarthash": "^2.0.6", "@pushrocks/smarthash": "^2.0.6",
"@pushrocks/smartlog": "^2.0.19",
"@pushrocks/smartpromise": "^3.0.2", "@pushrocks/smartpromise": "^3.0.2",
"@pushrocks/smartrequest": "^1.1.16", "@pushrocks/smartrequest": "^1.1.16",
"@pushrocks/smartrx": "^2.0.3", "@pushrocks/smartrx": "^2.0.3",

View File

@ -87,7 +87,6 @@ export class ClientUniverse {
role: 'UniverseClient', role: 'UniverseClient',
url: parsedURL.protocol + '//' + parsedURL.hostname url: parsedURL.protocol + '//' + parsedURL.hostname
}; };
console.log(socketConfig);
this.smartsocketClient = new SmartsocketClient(socketConfig); this.smartsocketClient = new SmartsocketClient(socketConfig);
this.observableIntake = new plugins.smartrx.ObservableIntake(); this.observableIntake = new plugins.smartrx.ObservableIntake();
@ -111,7 +110,7 @@ export class ClientUniverse {
funcName: 'processMessage', funcName: 'processMessage',
allowedRoles: [], allowedRoles: [],
funcDef: async (data: interfaces.IServerUnsubscribeActionPayload) => { funcDef: async (data: interfaces.IServerUnsubscribeActionPayload) => {
console.log('Got message from server'); plugins.smartlog.defaultLogger.log('info', 'Got message from server');
} }
}); });
@ -120,7 +119,7 @@ export class ClientUniverse {
this.smartsocketClient.addSocketFunction(socketFunctionProcessMessage); this.smartsocketClient.addSocketFunction(socketFunctionProcessMessage);
await this.smartsocketClient.connect(); await this.smartsocketClient.connect();
console.log('universe client connected successfully'); plugins.smartlog.defaultLogger.log('info', 'universe client connected successfully');
await this.clientUniverseCache.channelMap.forEach(async clientUniverseChannelArg => { await this.clientUniverseCache.channelMap.forEach(async clientUniverseChannelArg => {
await clientUniverseChannelArg.subscribe(); await clientUniverseChannelArg.subscribe();
}); });

View File

@ -121,8 +121,9 @@ export class Universe {
socketConnectionArg socketConnectionArg
); );
if (universeConnection) { if (universeConnection) {
console.log('found UniverseConnection for socket'); plugins.smartlog.defaultLogger.log('ok', 'found UniverseConnection for socket for incoming message');
} else { } else {
plugins.smartlog.defaultLogger.log('warn', 'found no Authorized channel for incoming message');
return { return {
error: 'You need to authenticate for a channel' error: 'You need to authenticate for a channel'
}; };
@ -149,7 +150,7 @@ export class Universe {
// start everything // start everything
await this.smartexpressServer.start(); await this.smartexpressServer.start();
await this.smartsocket.start(); await this.smartsocket.start();
console.log('started universe'); plugins.smartlog.defaultLogger.log('success', 'started universe');
} }
/** /**

View File

@ -61,12 +61,12 @@ export class UniverseChannel {
if (foundChannel) { if (foundChannel) {
universeMessageArg.authenticated = true; universeMessageArg.authenticated = true;
universeMessageArg.universeChannelList.add(foundChannel); universeMessageArg.universeChannelList.add(foundChannel);
console.log('message authorized'); plugins.smartlog.defaultLogger.log('ok', 'message authorized');
return foundChannel; return foundChannel;
} else { } else {
universeMessageArg.authenticated = false; universeMessageArg.authenticated = false;
universeMessageArg.universeChannelList.add(universeCacheArg.blackListChannel); universeMessageArg.universeChannelList.add(universeCacheArg.blackListChannel);
console.log('message not valid'); plugins.smartlog.defaultLogger.log('warn', 'message not valid');
return null; return null;
} }
} }

View File

@ -58,7 +58,6 @@ export class UniverseConnection {
universeConnectionArg: UniverseConnection universeConnectionArg: UniverseConnection
): Promise<UniverseConnection> { ): Promise<UniverseConnection> {
for (const authenticationRequest of universeConnectionArg.authenticationRequests) { for (const authenticationRequest of universeConnectionArg.authenticationRequests) {
// TODO: authenticate channel subscriptions
const universeChannelToAuthenticateAgainst = UniverseChannel.getUniverseChannelByName(universeRef, authenticationRequest.name); const universeChannelToAuthenticateAgainst = UniverseChannel.getUniverseChannelByName(universeRef, authenticationRequest.name);
if (universeChannelToAuthenticateAgainst.passphrase === authenticationRequest.passphrase) { if (universeChannelToAuthenticateAgainst.passphrase === authenticationRequest.passphrase) {
universeConnectionArg.authenticatedChannels.push(universeChannelToAuthenticateAgainst); universeConnectionArg.authenticatedChannels.push(universeChannelToAuthenticateAgainst);
@ -74,7 +73,6 @@ export class UniverseConnection {
connectionArg1: UniverseConnection, connectionArg1: UniverseConnection,
connectionArg2: UniverseConnection connectionArg2: UniverseConnection
) { ) {
// TODO: merge connections
return connectionArg1; return connectionArg1;
} }

View File

@ -91,7 +91,7 @@ export class UniverseMessage implements interfaces.IUniverseMessage {
* handles bad messages for further analysis * handles bad messages for further analysis
*/ */
public handleAsBadMessage() { public handleAsBadMessage() {
console.log('received a bad message'); plugins.smartlog.defaultLogger.log('warn', 'received a bad message');
} }
/** /**

View File

@ -9,6 +9,7 @@ import * as smarthash from '@pushrocks/smarthash';
import * as smartdelay from '@pushrocks/smartdelay'; import * as smartdelay from '@pushrocks/smartdelay';
import * as smartexpress from '@pushrocks/smartexpress'; import * as smartexpress from '@pushrocks/smartexpress';
import * as smartfile from '@pushrocks/smartfile'; import * as smartfile from '@pushrocks/smartfile';
import * as smartlog from '@pushrocks/smartlog';
import * as smartpromise from '@pushrocks/smartpromise'; import * as smartpromise from '@pushrocks/smartpromise';
import * as smartrequest from '@pushrocks/smartrequest'; import * as smartrequest from '@pushrocks/smartrequest';
import * as smartrx from '@pushrocks/smartrx'; import * as smartrx from '@pushrocks/smartrx';
@ -22,6 +23,7 @@ export {
smartdelay, smartdelay,
smartexpress, smartexpress,
smartfile, smartfile,
smartlog,
smartpromise, smartpromise,
smartrx, smartrx,
smartrequest, smartrequest,