fix(core): update
This commit is contained in:
parent
ff9cb9132c
commit
8a8277ae9f
@ -135,10 +135,15 @@ export class Universe {
|
|||||||
universeConnectionInstance
|
universeConnectionInstance
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
await UniverseChannel.authorizeAMessageForAChannel(
|
const unauthenticatedMessage = UniverseMessage.createMessageFromPayload(dataArg);
|
||||||
|
const foundChannel = await UniverseChannel.authorizeAMessageForAChannel(
|
||||||
this.universeCache,
|
this.universeCache,
|
||||||
UniverseMessage.createMessageFromPayload(dataArg)
|
unauthenticatedMessage
|
||||||
);
|
);
|
||||||
|
if (foundChannel) {
|
||||||
|
const authenticatedMessage = unauthenticatedMessage;
|
||||||
|
await this.universeCache.addMessage(authenticatedMessage);
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -50,7 +50,7 @@ export class UniverseChannel {
|
|||||||
public static authorizeAMessageForAChannel(
|
public static authorizeAMessageForAChannel(
|
||||||
universeCacheArg: UniverseCache,
|
universeCacheArg: UniverseCache,
|
||||||
universeMessageArg: UniverseMessage
|
universeMessageArg: UniverseMessage
|
||||||
) {
|
): UniverseChannel {
|
||||||
const foundChannel = universeCacheArg.channelMap.find(universeChannel => {
|
const foundChannel = universeCacheArg.channelMap.find(universeChannel => {
|
||||||
const result = universeChannel.authenticate(universeMessageArg);
|
const result = universeChannel.authenticate(universeMessageArg);
|
||||||
return result;
|
return result;
|
||||||
@ -58,11 +58,13 @@ 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');
|
||||||
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');
|
console.log('message not valid');
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user