Убраны неиспользуемые пакеты
This commit is contained in:
@@ -1,54 +0,0 @@
|
|||||||
import Packet from "../packet";
|
|
||||||
import Stream from "../stream";
|
|
||||||
|
|
||||||
export class PacketAppUpdate extends Packet {
|
|
||||||
|
|
||||||
private url: string = "";
|
|
||||||
private version: string = "";
|
|
||||||
private kernelVersionRequired: string = "";
|
|
||||||
|
|
||||||
public getPacketId(): number {
|
|
||||||
return 0x0E;
|
|
||||||
}
|
|
||||||
|
|
||||||
public _receive(stream: Stream): void {
|
|
||||||
this.url = stream.readString();
|
|
||||||
this.version = stream.readString();
|
|
||||||
this.kernelVersionRequired = stream.readString();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public _send(): Promise<Stream> | Stream {
|
|
||||||
let stream = new Stream();
|
|
||||||
stream.writeInt16(this.getPacketId());
|
|
||||||
stream.writeString(this.url);
|
|
||||||
stream.writeString(this.version);
|
|
||||||
stream.writeString(this.kernelVersionRequired);
|
|
||||||
return stream;
|
|
||||||
}
|
|
||||||
|
|
||||||
public getUrl(): string {
|
|
||||||
return this.url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public setUrl(url: string): void {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public getVersion(): string {
|
|
||||||
return this.version;
|
|
||||||
}
|
|
||||||
|
|
||||||
public setVersion(version: string): void {
|
|
||||||
this.version = version;
|
|
||||||
}
|
|
||||||
|
|
||||||
public getKernelVersionRequired(): string {
|
|
||||||
return this.kernelVersionRequired;
|
|
||||||
}
|
|
||||||
|
|
||||||
public setKernelVersionRequired(kernelVersionRequired: string): void {
|
|
||||||
this.kernelVersionRequired = kernelVersionRequired;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
import Packet from "../packet";
|
|
||||||
import Stream from "../stream";
|
|
||||||
|
|
||||||
export class PacketAvatar extends Packet {
|
|
||||||
|
|
||||||
private privateKey : string = "";
|
|
||||||
private fromPublicKey: string = "";
|
|
||||||
private toPublicKey: string = "";
|
|
||||||
private blob: string = "";
|
|
||||||
|
|
||||||
private chachaKey: string = "";
|
|
||||||
|
|
||||||
|
|
||||||
public getPacketId(): number {
|
|
||||||
return 0x0C;
|
|
||||||
}
|
|
||||||
|
|
||||||
public _receive(stream: Stream): void {
|
|
||||||
this.privateKey = stream.readString();
|
|
||||||
this.fromPublicKey = stream.readString();
|
|
||||||
this.toPublicKey = stream.readString();
|
|
||||||
this.chachaKey = stream.readString();
|
|
||||||
this.blob = stream.readString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public _send(): Promise<Stream> | Stream {
|
|
||||||
const stream = new Stream();
|
|
||||||
stream.writeInt16(this.getPacketId());
|
|
||||||
stream.writeString(this.privateKey);
|
|
||||||
stream.writeString(this.fromPublicKey);
|
|
||||||
stream.writeString(this.toPublicKey);
|
|
||||||
stream.writeString(this.chachaKey);
|
|
||||||
stream.writeString(this.blob);
|
|
||||||
return stream;
|
|
||||||
}
|
|
||||||
|
|
||||||
public setFromPublicKey(fromPublicKey: string): void {
|
|
||||||
this.fromPublicKey = fromPublicKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public setToPublicKey(toPublicKey: string): void {
|
|
||||||
this.toPublicKey = toPublicKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public getFromPublicKey(): string {
|
|
||||||
return this.fromPublicKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public getToPublicKey(): string {
|
|
||||||
return this.toPublicKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public setPrivateKey(hash: string): void {
|
|
||||||
this.privateKey = hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
public getPrivateKey(): string {
|
|
||||||
return this.privateKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public setBlob(blob: string): void {
|
|
||||||
this.blob = blob;
|
|
||||||
}
|
|
||||||
|
|
||||||
public getBlob(): string {
|
|
||||||
return this.blob;
|
|
||||||
}
|
|
||||||
|
|
||||||
public setChachaKey(key: string): void {
|
|
||||||
this.chachaKey = key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public getChachaKey(): string {
|
|
||||||
return this.chachaKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
import Packet from "../packet";
|
|
||||||
import Stream from "../stream";
|
|
||||||
|
|
||||||
export class PacketKernelUpdate extends Packet {
|
|
||||||
|
|
||||||
private url: string = "";
|
|
||||||
private version: string = "";
|
|
||||||
|
|
||||||
|
|
||||||
public getPacketId(): number {
|
|
||||||
return 0x0D;
|
|
||||||
}
|
|
||||||
|
|
||||||
public _receive(stream: Stream): void {
|
|
||||||
this.url = stream.readString();
|
|
||||||
this.version = stream.readString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public _send(): Promise<Stream> | Stream {
|
|
||||||
let stream = new Stream();
|
|
||||||
stream.writeInt16(this.getPacketId());
|
|
||||||
stream.writeString(this.url);
|
|
||||||
stream.writeString(this.version);
|
|
||||||
return stream;
|
|
||||||
}
|
|
||||||
|
|
||||||
public getUrl(): string {
|
|
||||||
return this.url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public setUrl(url: string): void {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public getVersion(): string {
|
|
||||||
return this.version;
|
|
||||||
}
|
|
||||||
|
|
||||||
public setVersion(version: string): void {
|
|
||||||
this.version = version;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -13,9 +13,6 @@ import { PacketDelivery } from "./packets/packet.delivery";
|
|||||||
import { PacketRequestUpdate } from "./packets/packet.requestupdate";
|
import { PacketRequestUpdate } from "./packets/packet.requestupdate";
|
||||||
import { RECONNECTING_INTERVAL } from "@/app/constants";
|
import { RECONNECTING_INTERVAL } from "@/app/constants";
|
||||||
import { PacketTyping } from "./packets/packet.typeing";
|
import { PacketTyping } from "./packets/packet.typeing";
|
||||||
import { PacketAvatar } from "./packets/packet.avatar";
|
|
||||||
import { PacketKernelUpdate } from "./packets/packet.kernelupdate";
|
|
||||||
import { PacketAppUpdate } from "./packets/packet.appupdate";
|
|
||||||
import { PacketRequestTransport } from "./packets/packet.requesttransport";
|
import { PacketRequestTransport } from "./packets/packet.requesttransport";
|
||||||
import { PacketPushNotification } from "./packets/packet.push.notification";
|
import { PacketPushNotification } from "./packets/packet.push.notification";
|
||||||
import { PacketCreateGroup } from "./packets/packet.create.group";
|
import { PacketCreateGroup } from "./packets/packet.create.group";
|
||||||
@@ -113,9 +110,9 @@ export default class Protocol extends EventEmitter {
|
|||||||
this._supportedPackets.set(0x09, new PacketDeviceNew());
|
this._supportedPackets.set(0x09, new PacketDeviceNew());
|
||||||
this._supportedPackets.set(0x0A, new PacketRequestUpdate());
|
this._supportedPackets.set(0x0A, new PacketRequestUpdate());
|
||||||
this._supportedPackets.set(0x0B, new PacketTyping());
|
this._supportedPackets.set(0x0B, new PacketTyping());
|
||||||
this._supportedPackets.set(0x0C, new PacketAvatar());
|
//this._supportedPackets.set(0x0C, new PacketAvatar());
|
||||||
this._supportedPackets.set(0x0D, new PacketKernelUpdate());
|
//this._supportedPackets.set(0x0D, new PacketKernelUpdate());
|
||||||
this._supportedPackets.set(0x0E, new PacketAppUpdate());
|
//this._supportedPackets.set(0x0E, new PacketAppUpdate());
|
||||||
this._supportedPackets.set(0x0F, new PacketRequestTransport());
|
this._supportedPackets.set(0x0F, new PacketRequestTransport());
|
||||||
this._supportedPackets.set(0x10, new PacketPushNotification());
|
this._supportedPackets.set(0x10, new PacketPushNotification());
|
||||||
this._supportedPackets.set(0x11, new PacketCreateGroup());
|
this._supportedPackets.set(0x11, new PacketCreateGroup());
|
||||||
@@ -144,7 +141,6 @@ export default class Protocol extends EventEmitter {
|
|||||||
this.isManuallyClosed = false;
|
this.isManuallyClosed = false;
|
||||||
|
|
||||||
this.socket.addEventListener('open', () => {
|
this.socket.addEventListener('open', () => {
|
||||||
//this.reconnectTryings = 0;
|
|
||||||
this.emit('connect');
|
this.emit('connect');
|
||||||
this._flushPacketQueue(); // Отправляем все пакеты из очереди
|
this._flushPacketQueue(); // Отправляем все пакеты из очереди
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user