organize handshake packets

This commit is contained in:
dank074 2021-11-26 19:45:53 -06:00
parent 7cd825209b
commit 98a080257b
12 changed files with 107 additions and 36 deletions

View File

@ -248,8 +248,6 @@ import { PurchaseFromCatalogComposer } from './messages/outgoing/catalog/Purchas
import { RedeemVoucherMessageComposer } from './messages/outgoing/catalog/RedeemVoucherMessageComposer'; import { RedeemVoucherMessageComposer } from './messages/outgoing/catalog/RedeemVoucherMessageComposer';
import { RoomAdPurchaseInitiatedComposer } from './messages/outgoing/catalog/RoomAdPurchaseInitiatedComposer'; import { RoomAdPurchaseInitiatedComposer } from './messages/outgoing/catalog/RoomAdPurchaseInitiatedComposer';
import { SelectClubGiftComposer } from './messages/outgoing/catalog/SelectClubGiftComposer'; import { SelectClubGiftComposer } from './messages/outgoing/catalog/SelectClubGiftComposer';
import { ClientPongComposer } from './messages/outgoing/client/ClientPongComposer';
import { ClientReleaseVersionComposer } from './messages/outgoing/client/ClientReleaseVersionComposer';
import { ForwardToACompetitionRoomMessageComposer } from './messages/outgoing/competition/ForwardToACompetitionRoomMessageComposer'; import { ForwardToACompetitionRoomMessageComposer } from './messages/outgoing/competition/ForwardToACompetitionRoomMessageComposer';
import { GetIsUserPartOfCompetitionMessageComposer } from './messages/outgoing/competition/GetIsUserPartOfCompetitionMessageComposer'; import { GetIsUserPartOfCompetitionMessageComposer } from './messages/outgoing/competition/GetIsUserPartOfCompetitionMessageComposer';
import { CraftComposer } from './messages/outgoing/crafting/CraftComposer'; import { CraftComposer } from './messages/outgoing/crafting/CraftComposer';
@ -293,8 +291,13 @@ import { GroupSaveInformationComposer } from './messages/outgoing/group/GroupSav
import { GroupSavePreferencesComposer } from './messages/outgoing/group/GroupSavePreferencesComposer'; import { GroupSavePreferencesComposer } from './messages/outgoing/group/GroupSavePreferencesComposer';
import { GroupSettingsComposer } from './messages/outgoing/group/GroupSettingsComposer'; import { GroupSettingsComposer } from './messages/outgoing/group/GroupSettingsComposer';
import { AuthenticationMessageComposer } from './messages/outgoing/handshake/AuthenticationMessageComposer'; import { AuthenticationMessageComposer } from './messages/outgoing/handshake/AuthenticationMessageComposer';
import { InfoRetrieveBaseMessageComposer } from './messages/outgoing/handshake/InfoRetrieveBaseMessageComposer'; import { ClientHelloMessageComposer } from './messages/outgoing/handshake/ClientHelloMessageComposer';
import { SecurityTicketComposer } from './messages/outgoing/handshake/SecurityTicketComposer'; import { DisconnectMessageComposer } from './messages/outgoing/handshake/DisconnectMessageComposer';
import { InfoRetrieveMessageComposer } from './messages/outgoing/handshake/InfoRetrieveMessageComposer';
import { PongMessageComposer } from './messages/outgoing/handshake/PongMessageComposer';
import { SSOTicketMessageComposer } from './messages/outgoing/handshake/SSOTicketMessageComposer';
import { UniqueIDMessageComposer } from './messages/outgoing/handshake/UniqueIDMessageComposer';
import { VersionCheckMessageComposer } from './messages/outgoing/handshake/VersionCheckMessageComposer';
import { RequestBadgesComposer } from './messages/outgoing/inventory/badges/RequestBadgesComposer'; import { RequestBadgesComposer } from './messages/outgoing/inventory/badges/RequestBadgesComposer';
import { SetActivatedBadgesComposer } from './messages/outgoing/inventory/badges/SetActivatedBadgesComposer'; import { SetActivatedBadgesComposer } from './messages/outgoing/inventory/badges/SetActivatedBadgesComposer';
import { GetBotInventoryComposer } from './messages/outgoing/inventory/bots/GetBotInventoryComposer'; import { GetBotInventoryComposer } from './messages/outgoing/inventory/bots/GetBotInventoryComposer';
@ -997,6 +1000,15 @@ export class NitroMessages implements IMessageConfiguration
this._composers.set(OutgoingHeader.UPDATE_FORUM_SETTINGS, UpdateForumSettingsMessageComposer); this._composers.set(OutgoingHeader.UPDATE_FORUM_SETTINGS, UpdateForumSettingsMessageComposer);
this._composers.set(OutgoingHeader.FORUM_UPDATE_THREAD, UpdateThreadMessageComposer); this._composers.set(OutgoingHeader.FORUM_UPDATE_THREAD, UpdateThreadMessageComposer);
// HANDSHAKE
this._composers.set(OutgoingHeader.CLIENT_PONG, PongMessageComposer);
this._composers.set(OutgoingHeader.RELEASE_VERSION, ClientHelloMessageComposer);
this._composers.set(OutgoingHeader.SECURITY_TICKET, SSOTicketMessageComposer);
this._composers.set(OutgoingHeader.USER_INFO, InfoRetrieveMessageComposer);
this._composers.set(OutgoingHeader.DISCONNECT, DisconnectMessageComposer);
this._composers.set(OutgoingHeader.SECURITY_MACHINE, UniqueIDMessageComposer);
this._composers.set(OutgoingHeader.CLIENT_VARIABLES, VersionCheckMessageComposer);
// HELP // HELP
this._composers.set(OutgoingHeader.CALL_FOR_HELP_FROM_FORUM_MESSAGE, CallForHelpFromForumMessageMessageComposer); this._composers.set(OutgoingHeader.CALL_FOR_HELP_FROM_FORUM_MESSAGE, CallForHelpFromForumMessageMessageComposer);
this._composers.set(OutgoingHeader.CALL_FOR_HELP_FROM_FORUM_THREAD, CallForHelpFromForumThreadMessageComposer); this._composers.set(OutgoingHeader.CALL_FOR_HELP_FROM_FORUM_THREAD, CallForHelpFromForumThreadMessageComposer);
@ -1029,10 +1041,6 @@ export class NitroMessages implements IMessageConfiguration
this._composers.set(OutgoingHeader.POST_QUIZ_ANSWERS, PostQuizAnswersComposer); this._composers.set(OutgoingHeader.POST_QUIZ_ANSWERS, PostQuizAnswersComposer);
this._composers.set(OutgoingHeader.SEARCH_FAQS, SearchFaqsMessageComposer); this._composers.set(OutgoingHeader.SEARCH_FAQS, SearchFaqsMessageComposer);
// CLIENT
this._composers.set(OutgoingHeader.CLIENT_PONG, ClientPongComposer);
this._composers.set(OutgoingHeader.RELEASE_VERSION, ClientReleaseVersionComposer);
// DESKTOP // DESKTOP
this._composers.set(OutgoingHeader.DESKTOP_VIEW, DesktopViewComposer); this._composers.set(OutgoingHeader.DESKTOP_VIEW, DesktopViewComposer);
@ -1058,10 +1066,6 @@ export class NitroMessages implements IMessageConfiguration
this._composers.set(OutgoingHeader.GROUP_FAVORITE, GroupFavoriteComposer); this._composers.set(OutgoingHeader.GROUP_FAVORITE, GroupFavoriteComposer);
this._composers.set(OutgoingHeader.GROUP_BADGES, GroupBadgesComposer); this._composers.set(OutgoingHeader.GROUP_BADGES, GroupBadgesComposer);
// SECURITY
this._composers.set(OutgoingHeader.SECURITY_TICKET, SecurityTicketComposer);
this._composers.set(OutgoingHeader.USER_INFO, InfoRetrieveBaseMessageComposer);
// NAVIGATOR // NAVIGATOR
this._composers.set(OutgoingHeader.NAVIGATOR_CATEGORIES, NavigatorCategoriesComposer); this._composers.set(OutgoingHeader.NAVIGATOR_CATEGORIES, NavigatorCategoriesComposer);
this._composers.set(OutgoingHeader.NAVIGATOR_INIT, NavigatorInitComposer); this._composers.set(OutgoingHeader.NAVIGATOR_INIT, NavigatorInitComposer);
@ -1288,7 +1292,7 @@ export class NitroMessages implements IMessageConfiguration
// SUBSCRIPTION // SUBSCRIPTION
this._composers.set(OutgoingHeader.USER_SUBSCRIPTION, UserSubscriptionComposer); this._composers.set(OutgoingHeader.USER_SUBSCRIPTION, UserSubscriptionComposer);
// MODTOOL // MODERATION
this._composers.set(OutgoingHeader.MODTOOL_REQUEST_ROOM_INFO, GetModeratorRoomInfoMessageComposer); this._composers.set(OutgoingHeader.MODTOOL_REQUEST_ROOM_INFO, GetModeratorRoomInfoMessageComposer);
this._composers.set(OutgoingHeader.MODTOOL_CHANGE_ROOM_SETTINGS, ModerateRoomMessageComposer); this._composers.set(OutgoingHeader.MODTOOL_CHANGE_ROOM_SETTINGS, ModerateRoomMessageComposer);
this._composers.set(OutgoingHeader.MODTOOL_REQUEST_USER_CHATLOG, GetUserChatlogMessageComposer); this._composers.set(OutgoingHeader.MODTOOL_REQUEST_USER_CHATLOG, GetUserChatlogMessageComposer);

View File

@ -6,10 +6,10 @@ import { Nitro } from '../../Nitro';
import { INitroCommunicationManager } from '../INitroCommunicationManager'; import { INitroCommunicationManager } from '../INitroCommunicationManager';
import { ClientPingEvent } from '../messages/incoming/client/ClientPingEvent'; import { ClientPingEvent } from '../messages/incoming/client/ClientPingEvent';
import { AuthenticatedEvent } from '../messages/incoming/security/AuthenticatedEvent'; import { AuthenticatedEvent } from '../messages/incoming/security/AuthenticatedEvent';
import { ClientPongComposer } from '../messages/outgoing/client/ClientPongComposer'; import { ClientHelloMessageComposer } from '../messages/outgoing/handshake/ClientHelloMessageComposer';
import { ClientReleaseVersionComposer } from '../messages/outgoing/client/ClientReleaseVersionComposer'; import { InfoRetrieveMessageComposer } from '../messages/outgoing/handshake/InfoRetrieveMessageComposer';
import { InfoRetrieveBaseMessageComposer } from '../messages/outgoing/handshake/InfoRetrieveBaseMessageComposer'; import { PongMessageComposer } from '../messages/outgoing/handshake/PongMessageComposer';
import { SecurityTicketComposer } from '../messages/outgoing/handshake/SecurityTicketComposer'; import { SSOTicketMessageComposer } from '../messages/outgoing/handshake/SSOTicketMessageComposer';
import { NitroCommunicationDemoEvent } from './NitroCommunicationDemoEvent'; import { NitroCommunicationDemoEvent } from './NitroCommunicationDemoEvent';
export class NitroCommunicationDemo extends NitroManager export class NitroCommunicationDemo extends NitroManager
@ -88,7 +88,7 @@ export class NitroCommunicationDemo extends NitroManager
this.startHandshake(connection); this.startHandshake(connection);
connection.send(new ClientReleaseVersionComposer(null, null, null, null)); connection.send(new ClientHelloMessageComposer(null, null, null, null));
this.tryAuthentication(connection); this.tryAuthentication(connection);
} }
@ -129,7 +129,7 @@ export class NitroCommunicationDemo extends NitroManager
return; return;
} }
connection.send(new SecurityTicketComposer(this._sso, Nitro.instance.time)); connection.send(new SSOTicketMessageComposer(this._sso, Nitro.instance.time));
} }
private onClientPingEvent(event: ClientPingEvent): void private onClientPingEvent(event: ClientPingEvent): void
@ -149,7 +149,7 @@ export class NitroCommunicationDemo extends NitroManager
//event.connection.send(new UserHomeRoomComposer(555)); //event.connection.send(new UserHomeRoomComposer(555));
event.connection.send(new InfoRetrieveBaseMessageComposer()); event.connection.send(new InfoRetrieveMessageComposer());
} }
public setSSO(sso: string): void public setSSO(sso: string): void
@ -195,7 +195,7 @@ export class NitroCommunicationDemo extends NitroManager
if(!connection) return; if(!connection) return;
connection.send(new ClientPongComposer()); connection.send(new PongMessageComposer());
} }
private dispatchCommunicationDemoEvent(type: string, connection: IConnection): void private dispatchCommunicationDemoEvent(type: string, connection: IConnection): void

View File

@ -376,4 +376,5 @@ export class OutgoingHeader
public static POLL_ANSWER = 3505; public static POLL_ANSWER = 3505;
public static POLL_REJECT = 1773; public static POLL_REJECT = 1773;
public static POLL_START = 109; public static POLL_START = 109;
public static DISCONNECT = 2445;
} }

View File

@ -1,2 +0,0 @@
export * from './ClientPongComposer';
export * from './ClientReleaseVersionComposer';

View File

@ -3,9 +3,9 @@ import { ClientDeviceCategoryEnum } from '../../../../../core/communication/conn
import { ClientPlatformEnum } from '../../../../../core/communication/connections/enums/ClientPlatformEnum'; import { ClientPlatformEnum } from '../../../../../core/communication/connections/enums/ClientPlatformEnum';
import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer'; import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer';
export class ClientReleaseVersionComposer implements IMessageComposer<ConstructorParameters<typeof ClientReleaseVersionComposer>> export class ClientHelloMessageComposer implements IMessageComposer<ConstructorParameters<typeof ClientHelloMessageComposer>>
{ {
private _data: ConstructorParameters<typeof ClientReleaseVersionComposer>; private _data: ConstructorParameters<typeof ClientHelloMessageComposer>;
constructor(releaseVersion: string, type: string, platform: number, category: number) constructor(releaseVersion: string, type: string, platform: number, category: number)
{ {

View File

@ -0,0 +1,21 @@
import { IMessageComposer } from '../../../../..';
export class DisconnectMessageComposer implements IMessageComposer<ConstructorParameters<typeof DisconnectMessageComposer>>
{
private _data: ConstructorParameters<typeof DisconnectMessageComposer>;
constructor()
{
this._data = [];
}
public getMessageArray()
{
return this._data;
}
public dispose(): void
{
return;
}
}

View File

@ -1,8 +1,8 @@
import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer'; import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer';
export class InfoRetrieveBaseMessageComposer implements IMessageComposer<ConstructorParameters<typeof InfoRetrieveBaseMessageComposer>> export class InfoRetrieveMessageComposer implements IMessageComposer<ConstructorParameters<typeof InfoRetrieveMessageComposer>>
{ {
private _data: ConstructorParameters<typeof InfoRetrieveBaseMessageComposer>; private _data: ConstructorParameters<typeof InfoRetrieveMessageComposer>;
constructor() constructor()
{ {

View File

@ -1,8 +1,8 @@
import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer'; import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer';
export class ClientPongComposer implements IMessageComposer<ConstructorParameters<typeof ClientPongComposer>> export class PongMessageComposer implements IMessageComposer<ConstructorParameters<typeof PongMessageComposer>>
{ {
private _data: ConstructorParameters<typeof ClientPongComposer>; private _data: ConstructorParameters<typeof PongMessageComposer>;
constructor() constructor()
{ {

View File

@ -1,8 +1,8 @@
import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer'; import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer';
export class SecurityTicketComposer implements IMessageComposer<ConstructorParameters<typeof SecurityTicketComposer>> export class SSOTicketMessageComposer implements IMessageComposer<ConstructorParameters<typeof SSOTicketMessageComposer>>
{ {
private _data: ConstructorParameters<typeof SecurityTicketComposer>; private _data: ConstructorParameters<typeof SSOTicketMessageComposer>;
constructor(ticket: string, time: number) constructor(ticket: string, time: number)
{ {

View File

@ -0,0 +1,21 @@
import { IMessageComposer } from '../../../../..';
export class UniqueIDMessageComposer implements IMessageComposer<ConstructorParameters<typeof UniqueIDMessageComposer>>
{
private _data: ConstructorParameters<typeof UniqueIDMessageComposer>;
constructor(machineId:string, fingerprint:string, flashVersion:string)
{
this._data = [ machineId, fingerprint, flashVersion ];
}
public getMessageArray()
{
return this._data;
}
public dispose(): void
{
return;
}
}

View File

@ -0,0 +1,21 @@
import { IMessageComposer } from '../../../../..';
export class VersionCheckMessageComposer implements IMessageComposer<ConstructorParameters<typeof VersionCheckMessageComposer>>
{
private _data: ConstructorParameters<typeof VersionCheckMessageComposer>;
constructor(clientID:number, clientURL:string, externalVariablesURL:string)
{
this._data = [clientID, clientURL, externalVariablesURL];
}
public getMessageArray()
{
return this._data;
}
public dispose(): void
{
return;
}
}

View File

@ -1,3 +1,8 @@
export * from './AuthenticationMessageComposer'; export * from './AuthenticationMessageComposer';
export * from './InfoRetrieveBaseMessageComposer'; export * from './ClientHelloMessageComposer';
export * from './SecurityTicketComposer'; export * from './DisconnectMessageComposer';
export * from './InfoRetrieveMessageComposer';
export * from './PongMessageComposer';
export * from './SSOTicketMessageComposer';
export * from './UniqueIDMessageComposer';
export * from './VersionCheckMessageComposer';