decode not work

This commit is contained in:
rustdesk 2022-01-20 21:58:28 +08:00
parent 3dcbbcc416
commit 50834353b2
8 changed files with 468 additions and 272 deletions

View File

@ -4,7 +4,8 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="favicon.svg" /> <link rel="icon" type="image/svg+xml" href="favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="ogvjs/ogv.js"></script> <script src="node_modules/ogv/dist/ogv.js"></script>
<script src="./yuv-canvas-1.2.6.js"></script>
<title>Vite App</title> <title>Vite App</title>
</head> </head>
<body> <body>

View File

@ -2,8 +2,8 @@
"name": "web_hbb", "name": "web_hbb",
"version": "1.0.0", "version": "1.0.0",
"scripts": { "scripts": {
"dev": "cp -rf node_modules/ogv/dist/* ogvjs/ && vite", "dev": "curl -O https://raw.githubusercontent.com/rgov/js-theora-decoder/main/yuv-canvas-1.2.6.js; vite",
"build": "cp node_modules/ogv/dist/* dist/ogvjs/ && tsc && vite build", "build": "tsc && vite build",
"preview": "vite preview" "preview": "vite preview"
}, },
"devDependencies": { "devDependencies": {

View File

@ -19,13 +19,14 @@
OGVDecoderVideoAV1SIMDMTW: 'ogv-decoder-video-av1-simd-mt-wasm.js', OGVDecoderVideoAV1SIMDMTW: 'ogv-decoder-video-av1-simd-mt-wasm.js',
*/ */
export function loadVp9() { export function loadVp9(callback) {
window.OGVLoader.loadClass( window.OGVLoader.loadClass(
"OGVDecoderVideoVP9W", "OGVDecoderVideoVP9W",
(videoCodecClass) => { (videoCodecClass) => {
window.videoCodecClass = videoCodecClass;
videoCodecClass().then((decoder) => { videoCodecClass().then((decoder) => {
decoder.init(() => { decoder.init(() => {
onVp9Ready(decoder) callback(decoder);
}) })
}) })
}, },
@ -33,30 +34,16 @@ export function loadVp9() {
); );
} }
export function loadOpus() { export function loadOpus(callback) {
window.OGVLoader.loadClass( window.OGVLoader.loadClass(
"OGVDecoderAudioOpusW", "OGVDecoderAudioOpusW",
(audioCodecClass) => { (audioCodecClass) => {
audioCodecClass().then((decoder) => { audioCodecClass().then((decoder) => {
decoder.init(() => { decoder.init(() => {
onOpusReady(decoder) callback(decoder);
}) })
}) })
}, },
{ worker: true } { worker: true }
); );
} }
async function onVp9Ready(decoder) {
console.log("Vp9 decoder ready");
/*
decoder.processFrame(buffer, () => {
player.drawFrame(decoder.frameBuffer)
})
*/
}
async function onOpusReady(decoder) {
console.log("Opus decoder ready");
}

View File

@ -1,16 +1,17 @@
import Websock from './websock'; import Websock from "./websock";
import * as message from './message.js'; import * as message from "./message.js";
import * as rendezvous from './rendezvous.js'; import * as rendezvous from "./rendezvous.js";
import { loadVp9, loadOpus } from './codec'; import { loadVp9, loadOpus } from "./codec";
import * as sha256 from "fast-sha256"; import * as sha256 from "fast-sha256";
import * as globals from './globals'; import * as globals from "./globals";
const PORT = 21116; const PORT = 21116;
const HOST = 'rs-sg.rustdesk.com'; const HOST = "rs-sg.rustdesk.com";
const licenceKey = ''; const licenceKey = "";
const SCHEMA = 'ws://'; const SCHEMA = "ws://";
type MsgboxCallback = (type: string, title: string, text: string) => void; type MsgboxCallback = (type: string, title: string, text: string) => void;
type DrawCallback = (Uint8Array) => void;
export default class Connection { export default class Connection {
_msgs: any[]; _msgs: any[];
@ -19,18 +20,30 @@ export default class Connection {
_id: string; _id: string;
_hash: message.Hash | undefined; _hash: message.Hash | undefined;
_msgbox: MsgboxCallback | undefined; _msgbox: MsgboxCallback | undefined;
_draw: DrawCallback | undefined;
_peerInfo: message.PeerInfo | undefined; _peerInfo: message.PeerInfo | undefined;
_firstFrame: Boolean | undefined; _firstFrame: Boolean | undefined;
_videoDecoder: any;
_audioDecoder: any;
constructor() { constructor() {
this._msgs = []; this._msgs = [];
this._id = ''; this._id = "";
this._interval = setInterval(() => { this._interval = setInterval(() => {
while (this._msgs.length) { while (this._msgs.length) {
this._ws?.sendMessage(this._msgs[0]); this._ws?.sendMessage(this._msgs[0]);
this._msgs.splice(0, 1); this._msgs.splice(0, 1);
} }
}, 1); }, 1);
loadVp9((decoder: any) => {
this._videoDecoder = decoder;
console.log("vp9 loaded");
console.log(decoder);
});
loadOpus((decoder: any) => {
this._audioDecoder = decoder;
console.log("opus loaded");
});
} }
async start(id: string) { async start(id: string) {
@ -38,9 +51,9 @@ export default class Connection {
const ws = new Websock(uri); const ws = new Websock(uri);
this._ws = ws; this._ws = ws;
this._id = id; this._id = id;
console.log(new Date() + ': Conntecting to rendezvoous server: ' + uri); console.log(new Date() + ": Conntecting to rendezvoous server: " + uri);
await ws.open(); await ws.open();
console.log(new Date() + ': Connected to rendezvoous server'); console.log(new Date() + ": Connected to rendezvoous server");
const connType = rendezvous.ConnType.DEFAULT_CONN; const connType = rendezvous.ConnType.DEFAULT_CONN;
const natType = rendezvous.NatType.SYMMETRIC; const natType = rendezvous.NatType.SYMMETRIC;
const punchHoleRequest = rendezvous.PunchHoleRequest.fromPartial({ const punchHoleRequest = rendezvous.PunchHoleRequest.fromPartial({
@ -52,24 +65,24 @@ export default class Connection {
ws.sendRendezvous({ punchHoleRequest }); ws.sendRendezvous({ punchHoleRequest });
const msg = ws.parseRendezvous(await ws.next()); const msg = ws.parseRendezvous(await ws.next());
ws.close(); ws.close();
console.log(new Date() + ': Got relay response'); console.log(new Date() + ": Got relay response");
const phr = msg.punchHoleResponse; const phr = msg.punchHoleResponse;
const rr = msg.relayResponse; const rr = msg.relayResponse;
if (phr) { if (phr) {
if (phr.failure != rendezvous.PunchHoleResponse_Failure.UNKNOWN) { if (phr.failure != rendezvous.PunchHoleResponse_Failure.UNKNOWN) {
switch (phr?.failure) { switch (phr?.failure) {
case rendezvous.PunchHoleResponse_Failure.ID_NOT_EXIST: case rendezvous.PunchHoleResponse_Failure.ID_NOT_EXIST:
this.msgbox('error', 'Error', 'ID does not exist'); this.msgbox("error", "Error", "ID does not exist");
break; break;
case rendezvous.PunchHoleResponse_Failure.OFFLINE: case rendezvous.PunchHoleResponse_Failure.OFFLINE:
this.msgbox('error', 'Error', 'Remote desktop is offline'); this.msgbox("error", "Error", "Remote desktop is offline");
break; break;
case rendezvous.PunchHoleResponse_Failure.LICENSE_MISMATCH: case rendezvous.PunchHoleResponse_Failure.LICENSE_MISMATCH:
this.msgbox('error', 'Error', 'Key mismatch'); this.msgbox("error", "Error", "Key mismatch");
break; break;
default: default:
if (phr?.otherFailure) { if (phr?.otherFailure) {
this.msgbox('error', 'Error', phr?.otherFailure); this.msgbox("error", "Error", phr?.otherFailure);
} }
} }
} }
@ -87,10 +100,10 @@ export default class Connection {
uri = getDefaultUri(true); uri = getDefaultUri(true);
} }
const uuid = rr.uuid; const uuid = rr.uuid;
console.log(new Date() + ': Connecting to relay server: ' + uri); console.log(new Date() + ": Connecting to relay server: " + uri);
const ws = new Websock(uri); const ws = new Websock(uri);
await ws.open(); await ws.open();
console.log(new Date() + ': Connected to relay server'); console.log(new Date() + ": Connected to relay server");
this._ws = ws; this._ws = ws;
const requestRelay = rendezvous.RequestRelay.fromPartial({ const requestRelay = rendezvous.RequestRelay.fromPartial({
licenceKey, licenceKey,
@ -103,7 +116,7 @@ export default class Connection {
async secure(pk: Uint8Array | undefined) { async secure(pk: Uint8Array | undefined) {
if (pk) { if (pk) {
const RS_PK = 'OeVuKk5nlHiXp+APNn0Y3pC1Iwpwn44JGqrQCsWqmBw='; const RS_PK = "OeVuKk5nlHiXp+APNn0Y3pC1Iwpwn44JGqrQCsWqmBw=";
try { try {
pk = await globals.verify(pk, RS_PK).catch(); pk = await globals.verify(pk, RS_PK).catch();
if (pk?.length != 32) { if (pk?.length != 32) {
@ -113,7 +126,10 @@ export default class Connection {
console.error(e); console.error(e);
pk = undefined; pk = undefined;
} }
if (!pk) console.error('Handshake failed: invalid public key from rendezvous server'); if (!pk)
console.error(
"Handshake failed: invalid public key from rendezvous server"
);
} }
if (!pk) { if (!pk) {
// send an empty message out in case server is setting up secure and waiting for first message // send an empty message out in case server is setting up secure and waiting for first message
@ -138,7 +154,7 @@ export default class Connection {
return; return;
} }
signedId = new TextDecoder().decode(signedId!); signedId = new TextDecoder().decode(signedId!);
const tmp = signedId.split('\0'); const tmp = signedId.split("\0");
const id = tmp[0]; const id = tmp[0];
let theirPk = tmp[1]; let theirPk = tmp[1];
if (id != this._id!) { if (id != this._id!) {
@ -148,16 +164,21 @@ export default class Connection {
} }
theirPk = globals.decodeBase64(theirPk); theirPk = globals.decodeBase64(theirPk);
if (theirPk.length != 32) { if (theirPk.length != 32) {
console.error("Handshake failed: invalid public box key length from peer"); console.error(
"Handshake failed: invalid public box key length from peer"
);
await this._ws?.sendMessage({}); await this._ws?.sendMessage({});
return; return;
} }
const [mySk, asymmetricValue] = globals.genBoxKeyPair(); const [mySk, asymmetricValue] = globals.genBoxKeyPair();
const secretKey = globals.genSecretKey(); const secretKey = globals.genSecretKey();
const symmetricValue = globals.seal(secretKey, theirPk, mySk); const symmetricValue = globals.seal(secretKey, theirPk, mySk);
const publicKey = message.PublicKey.fromPartial({ asymmetricValue, symmetricValue }); const publicKey = message.PublicKey.fromPartial({
asymmetricValue,
symmetricValue,
});
await this._ws?.sendMessage({ publicKey }); await this._ws?.sendMessage({ publicKey });
this._ws?.setSecretKey(secretKey) this._ws?.setSecretKey(secretKey);
} }
async msgLoop() { async msgLoop() {
@ -175,13 +196,17 @@ export default class Connection {
} else if (msg?.loginResponse) { } else if (msg?.loginResponse) {
const r = msg?.loginResponse; const r = msg?.loginResponse;
if (r.error) { if (r.error) {
this.msgbox('error', 'Error', r.error); this.msgbox("error", "Error", r.error);
} else if (r.peerInfo) { } else if (r.peerInfo) {
this._peerInfo = r.peerInfo; this._peerInfo = r.peerInfo;
this.msgbox('success', 'Successful', 'Connected, waiting for image...'); this.msgbox(
"success",
"Successful",
"Connected, waiting for image..."
);
} }
} else if (msg?.videoFrame) { } else if (msg?.videoFrame) {
this.handleVideoFrame(); this.handleVideoFrame(msg?.videoFrame!);
} }
} }
} }
@ -194,6 +219,10 @@ export default class Connection {
this._msgbox?.(type_, title, text); this._msgbox?.(type_, title, text);
} }
draw(frame: Uint8Array) {
this._draw?.(frame);
}
close() { close() {
clearInterval(this._interval); clearInterval(this._interval);
this._ws?.close(); this._ws?.close();
@ -203,8 +232,12 @@ export default class Connection {
this._msgbox = callback; this._msgbox = callback;
} }
setDraw(callback: DrawCallback) {
this._draw = callback;
}
async login(password: string) { async login(password: string) {
this.msgbox('connecting', 'Connecting...', 'Logging in...'); this.msgbox("connecting", "Connecting...", "Logging in...");
let salt = this._hash?.salt; let salt = this._hash?.salt;
if (salt) { if (salt) {
let p = hash([password, salt]); let p = hash([password, salt]);
@ -219,21 +252,34 @@ export default class Connection {
async _sendLoginMessage(password: Uint8Array | undefined = undefined) { async _sendLoginMessage(password: Uint8Array | undefined = undefined) {
const loginRequest = message.LoginRequest.fromPartial({ const loginRequest = message.LoginRequest.fromPartial({
username: this._id!, username: this._id!,
myId: 'web', // to-do myId: "web", // to-do
myName: 'web', // to-do myName: "web", // to-do
password, password,
}); });
await this._ws?.sendMessage({ loginRequest }); await this._ws?.sendMessage({ loginRequest });
} }
handleVideoFrame() { handleVideoFrame(vf: message.VideoFrame) {
if (!this._firstFrame) { if (!this._firstFrame) {
this.msgbox('', '', ''); this.msgbox("", "", "");
this._firstFrame = true; this._firstFrame = true;
} }
if (vf.vp9s) {
let dec = this._videoDecoder;
vf.vp9s.frames.forEach((f) => {
dec.processFrame(f.data.buffer, (ok: any) => {
console.log(ok);
if (dec.frameBuffer) {
console.log(dec.frameBuffer);
this.draw(dec.frameBuffer);
}
});
});
}
} }
} }
// @ts-ignore
async function testDelay() { async function testDelay() {
const ws = new Websock(getDefaultUri(false)); const ws = new Websock(getDefaultUri(false));
await ws.open(); await ws.open();
@ -241,17 +287,17 @@ async function testDelay() {
} }
function getDefaultUri(isRelay: Boolean = false): string { function getDefaultUri(isRelay: Boolean = false): string {
const host = localStorage.getItem('host'); const host = localStorage.getItem("host");
return SCHEMA + (host || HOST) + ':' + (PORT + (isRelay ? 3 : 2)); return SCHEMA + (host || HOST) + ":" + (PORT + (isRelay ? 3 : 2));
} }
function getrUriFromRs(uri: string): string { function getrUriFromRs(uri: string): string {
if (uri.indexOf(':') > 0) { if (uri.indexOf(":") > 0) {
const tmp = uri.split(':'); const tmp = uri.split(":");
const port = parseInt(tmp[1]); const port = parseInt(tmp[1]);
uri = tmp[0] + ':' + (port + 2); uri = tmp[0] + ":" + (port + 2);
} else { } else {
uri += ':' + (PORT + 3); uri += ":" + (PORT + 3);
} }
return SCHEMA + uri; return SCHEMA + uri;
} }
@ -259,7 +305,7 @@ function getrUriFromRs(uri: string): string {
function hash(datas: (string | Uint8Array)[]): Uint8Array { function hash(datas: (string | Uint8Array)[]): Uint8Array {
const hasher = new sha256.Hash(); const hasher = new sha256.Hash();
datas.forEach((data) => { datas.forEach((data) => {
if (typeof data == 'string') { if (typeof data == "string") {
data = new TextEncoder().encode(data); data = new TextEncoder().encode(data);
} }
return hasher.update(data); return hasher.update(data);

View File

@ -1,6 +1,6 @@
/* eslint-disable */ /* eslint-disable */
import { util, configure, Writer, Reader } from "protobufjs/minimal"; import Long from "long";
import * as Long from "long"; import _m0 from "protobufjs/minimal";
export const protobufPackage = "hbb"; export const protobufPackage = "hbb";
@ -983,7 +983,7 @@ function createBaseVP9(): VP9 {
} }
export const VP9 = { export const VP9 = {
encode(message: VP9, writer: Writer = Writer.create()): Writer { encode(message: VP9, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.data.length !== 0) { if (message.data.length !== 0) {
writer.uint32(10).bytes(message.data); writer.uint32(10).bytes(message.data);
} }
@ -996,8 +996,8 @@ export const VP9 = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): VP9 { decode(input: _m0.Reader | Uint8Array, length?: number): VP9 {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseVP9(); const message = createBaseVP9();
while (reader.pos < end) { while (reader.pos < end) {
@ -1055,15 +1055,15 @@ function createBaseVP9s(): VP9s {
} }
export const VP9s = { export const VP9s = {
encode(message: VP9s, writer: Writer = Writer.create()): Writer { encode(message: VP9s, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
for (const v of message.frames) { for (const v of message.frames) {
VP9.encode(v!, writer.uint32(10).fork()).ldelim(); VP9.encode(v!, writer.uint32(10).fork()).ldelim();
} }
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): VP9s { decode(input: _m0.Reader | Uint8Array, length?: number): VP9s {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseVP9s(); const message = createBaseVP9s();
while (reader.pos < end) { while (reader.pos < end) {
@ -1110,15 +1110,15 @@ function createBaseRGB(): RGB {
} }
export const RGB = { export const RGB = {
encode(message: RGB, writer: Writer = Writer.create()): Writer { encode(message: RGB, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.compress === true) { if (message.compress === true) {
writer.uint32(8).bool(message.compress); writer.uint32(8).bool(message.compress);
} }
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): RGB { decode(input: _m0.Reader | Uint8Array, length?: number): RGB {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRGB(); const message = createBaseRGB();
while (reader.pos < end) { while (reader.pos < end) {
@ -1159,7 +1159,7 @@ function createBaseYUV(): YUV {
} }
export const YUV = { export const YUV = {
encode(message: YUV, writer: Writer = Writer.create()): Writer { encode(message: YUV, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.compress === true) { if (message.compress === true) {
writer.uint32(8).bool(message.compress); writer.uint32(8).bool(message.compress);
} }
@ -1169,8 +1169,8 @@ export const YUV = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): YUV { decode(input: _m0.Reader | Uint8Array, length?: number): YUV {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseYUV(); const message = createBaseYUV();
while (reader.pos < end) { while (reader.pos < end) {
@ -1217,7 +1217,10 @@ function createBaseVideoFrame(): VideoFrame {
} }
export const VideoFrame = { export const VideoFrame = {
encode(message: VideoFrame, writer: Writer = Writer.create()): Writer { encode(
message: VideoFrame,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.vp9s !== undefined) { if (message.vp9s !== undefined) {
VP9s.encode(message.vp9s, writer.uint32(50).fork()).ldelim(); VP9s.encode(message.vp9s, writer.uint32(50).fork()).ldelim();
} }
@ -1230,8 +1233,8 @@ export const VideoFrame = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): VideoFrame { decode(input: _m0.Reader | Uint8Array, length?: number): VideoFrame {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseVideoFrame(); const message = createBaseVideoFrame();
while (reader.pos < end) { while (reader.pos < end) {
@ -1298,7 +1301,10 @@ function createBaseDisplayInfo(): DisplayInfo {
} }
export const DisplayInfo = { export const DisplayInfo = {
encode(message: DisplayInfo, writer: Writer = Writer.create()): Writer { encode(
message: DisplayInfo,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.x !== 0) { if (message.x !== 0) {
writer.uint32(8).sint32(message.x); writer.uint32(8).sint32(message.x);
} }
@ -1320,8 +1326,8 @@ export const DisplayInfo = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): DisplayInfo { decode(input: _m0.Reader | Uint8Array, length?: number): DisplayInfo {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseDisplayInfo(); const message = createBaseDisplayInfo();
while (reader.pos < end) { while (reader.pos < end) {
@ -1394,7 +1400,10 @@ function createBasePortForward(): PortForward {
} }
export const PortForward = { export const PortForward = {
encode(message: PortForward, writer: Writer = Writer.create()): Writer { encode(
message: PortForward,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.host !== "") { if (message.host !== "") {
writer.uint32(10).string(message.host); writer.uint32(10).string(message.host);
} }
@ -1404,8 +1413,8 @@ export const PortForward = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): PortForward { decode(input: _m0.Reader | Uint8Array, length?: number): PortForward {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePortForward(); const message = createBasePortForward();
while (reader.pos < end) { while (reader.pos < end) {
@ -1454,7 +1463,10 @@ function createBaseFileTransfer(): FileTransfer {
} }
export const FileTransfer = { export const FileTransfer = {
encode(message: FileTransfer, writer: Writer = Writer.create()): Writer { encode(
message: FileTransfer,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.dir !== "") { if (message.dir !== "") {
writer.uint32(10).string(message.dir); writer.uint32(10).string(message.dir);
} }
@ -1464,8 +1476,8 @@ export const FileTransfer = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): FileTransfer { decode(input: _m0.Reader | Uint8Array, length?: number): FileTransfer {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseFileTransfer(); const message = createBaseFileTransfer();
while (reader.pos < end) { while (reader.pos < end) {
@ -1522,7 +1534,10 @@ function createBaseLoginRequest(): LoginRequest {
} }
export const LoginRequest = { export const LoginRequest = {
encode(message: LoginRequest, writer: Writer = Writer.create()): Writer { encode(
message: LoginRequest,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.username !== "") { if (message.username !== "") {
writer.uint32(10).string(message.username); writer.uint32(10).string(message.username);
} }
@ -1553,8 +1568,8 @@ export const LoginRequest = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): LoginRequest { decode(input: _m0.Reader | Uint8Array, length?: number): LoginRequest {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseLoginRequest(); const message = createBaseLoginRequest();
while (reader.pos < end) { while (reader.pos < end) {
@ -1662,15 +1677,18 @@ function createBaseChatMessage(): ChatMessage {
} }
export const ChatMessage = { export const ChatMessage = {
encode(message: ChatMessage, writer: Writer = Writer.create()): Writer { encode(
message: ChatMessage,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.text !== "") { if (message.text !== "") {
writer.uint32(10).string(message.text); writer.uint32(10).string(message.text);
} }
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): ChatMessage { decode(input: _m0.Reader | Uint8Array, length?: number): ChatMessage {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseChatMessage(); const message = createBaseChatMessage();
while (reader.pos < end) { while (reader.pos < end) {
@ -1721,7 +1739,10 @@ function createBasePeerInfo(): PeerInfo {
} }
export const PeerInfo = { export const PeerInfo = {
encode(message: PeerInfo, writer: Writer = Writer.create()): Writer { encode(
message: PeerInfo,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.username !== "") { if (message.username !== "") {
writer.uint32(10).string(message.username); writer.uint32(10).string(message.username);
} }
@ -1746,8 +1767,8 @@ export const PeerInfo = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): PeerInfo { decode(input: _m0.Reader | Uint8Array, length?: number): PeerInfo {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePeerInfo(); const message = createBasePeerInfo();
while (reader.pos < end) { while (reader.pos < end) {
@ -1836,7 +1857,10 @@ function createBaseLoginResponse(): LoginResponse {
} }
export const LoginResponse = { export const LoginResponse = {
encode(message: LoginResponse, writer: Writer = Writer.create()): Writer { encode(
message: LoginResponse,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.error !== undefined) { if (message.error !== undefined) {
writer.uint32(10).string(message.error); writer.uint32(10).string(message.error);
} }
@ -1846,8 +1870,8 @@ export const LoginResponse = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): LoginResponse { decode(input: _m0.Reader | Uint8Array, length?: number): LoginResponse {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseLoginResponse(); const message = createBaseLoginResponse();
while (reader.pos < end) { while (reader.pos < end) {
@ -1904,7 +1928,10 @@ function createBaseMouseEvent(): MouseEvent {
} }
export const MouseEvent = { export const MouseEvent = {
encode(message: MouseEvent, writer: Writer = Writer.create()): Writer { encode(
message: MouseEvent,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.mask !== 0) { if (message.mask !== 0) {
writer.uint32(8).int32(message.mask); writer.uint32(8).int32(message.mask);
} }
@ -1922,8 +1949,8 @@ export const MouseEvent = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): MouseEvent { decode(input: _m0.Reader | Uint8Array, length?: number): MouseEvent {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMouseEvent(); const message = createBaseMouseEvent();
while (reader.pos < end) { while (reader.pos < end) {
@ -2005,7 +2032,10 @@ function createBaseKeyEvent(): KeyEvent {
} }
export const KeyEvent = { export const KeyEvent = {
encode(message: KeyEvent, writer: Writer = Writer.create()): Writer { encode(
message: KeyEvent,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.down === true) { if (message.down === true) {
writer.uint32(8).bool(message.down); writer.uint32(8).bool(message.down);
} }
@ -2032,8 +2062,8 @@ export const KeyEvent = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): KeyEvent { decode(input: _m0.Reader | Uint8Array, length?: number): KeyEvent {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseKeyEvent(); const message = createBaseKeyEvent();
while (reader.pos < end) { while (reader.pos < end) {
@ -2137,7 +2167,10 @@ function createBaseCursorData(): CursorData {
} }
export const CursorData = { export const CursorData = {
encode(message: CursorData, writer: Writer = Writer.create()): Writer { encode(
message: CursorData,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.id !== 0) { if (message.id !== 0) {
writer.uint32(8).uint64(message.id); writer.uint32(8).uint64(message.id);
} }
@ -2159,8 +2192,8 @@ export const CursorData = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): CursorData { decode(input: _m0.Reader | Uint8Array, length?: number): CursorData {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCursorData(); const message = createBaseCursorData();
while (reader.pos < end) { while (reader.pos < end) {
@ -2238,7 +2271,10 @@ function createBaseCursorPosition(): CursorPosition {
} }
export const CursorPosition = { export const CursorPosition = {
encode(message: CursorPosition, writer: Writer = Writer.create()): Writer { encode(
message: CursorPosition,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.x !== 0) { if (message.x !== 0) {
writer.uint32(8).sint32(message.x); writer.uint32(8).sint32(message.x);
} }
@ -2248,8 +2284,8 @@ export const CursorPosition = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): CursorPosition { decode(input: _m0.Reader | Uint8Array, length?: number): CursorPosition {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCursorPosition(); const message = createBaseCursorPosition();
while (reader.pos < end) { while (reader.pos < end) {
@ -2298,7 +2334,7 @@ function createBaseHash(): Hash {
} }
export const Hash = { export const Hash = {
encode(message: Hash, writer: Writer = Writer.create()): Writer { encode(message: Hash, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.salt !== "") { if (message.salt !== "") {
writer.uint32(10).string(message.salt); writer.uint32(10).string(message.salt);
} }
@ -2308,8 +2344,8 @@ export const Hash = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): Hash { decode(input: _m0.Reader | Uint8Array, length?: number): Hash {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseHash(); const message = createBaseHash();
while (reader.pos < end) { while (reader.pos < end) {
@ -2356,7 +2392,10 @@ function createBaseClipboard(): Clipboard {
} }
export const Clipboard = { export const Clipboard = {
encode(message: Clipboard, writer: Writer = Writer.create()): Writer { encode(
message: Clipboard,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.compress === true) { if (message.compress === true) {
writer.uint32(8).bool(message.compress); writer.uint32(8).bool(message.compress);
} }
@ -2366,8 +2405,8 @@ export const Clipboard = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): Clipboard { decode(input: _m0.Reader | Uint8Array, length?: number): Clipboard {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseClipboard(); const message = createBaseClipboard();
while (reader.pos < end) { while (reader.pos < end) {
@ -2421,7 +2460,10 @@ function createBaseFileEntry(): FileEntry {
} }
export const FileEntry = { export const FileEntry = {
encode(message: FileEntry, writer: Writer = Writer.create()): Writer { encode(
message: FileEntry,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.entryType !== 0) { if (message.entryType !== 0) {
writer.uint32(8).int32(message.entryType); writer.uint32(8).int32(message.entryType);
} }
@ -2440,8 +2482,8 @@ export const FileEntry = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): FileEntry { decode(input: _m0.Reader | Uint8Array, length?: number): FileEntry {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseFileEntry(); const message = createBaseFileEntry();
while (reader.pos < end) { while (reader.pos < end) {
@ -2514,7 +2556,10 @@ function createBaseFileDirectory(): FileDirectory {
} }
export const FileDirectory = { export const FileDirectory = {
encode(message: FileDirectory, writer: Writer = Writer.create()): Writer { encode(
message: FileDirectory,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.id !== 0) { if (message.id !== 0) {
writer.uint32(8).int32(message.id); writer.uint32(8).int32(message.id);
} }
@ -2527,8 +2572,8 @@ export const FileDirectory = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): FileDirectory { decode(input: _m0.Reader | Uint8Array, length?: number): FileDirectory {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseFileDirectory(); const message = createBaseFileDirectory();
while (reader.pos < end) { while (reader.pos < end) {
@ -2592,7 +2637,10 @@ function createBaseReadDir(): ReadDir {
} }
export const ReadDir = { export const ReadDir = {
encode(message: ReadDir, writer: Writer = Writer.create()): Writer { encode(
message: ReadDir,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.path !== "") { if (message.path !== "") {
writer.uint32(10).string(message.path); writer.uint32(10).string(message.path);
} }
@ -2602,8 +2650,8 @@ export const ReadDir = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): ReadDir { decode(input: _m0.Reader | Uint8Array, length?: number): ReadDir {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseReadDir(); const message = createBaseReadDir();
while (reader.pos < end) { while (reader.pos < end) {
@ -2653,7 +2701,10 @@ function createBaseReadAllFiles(): ReadAllFiles {
} }
export const ReadAllFiles = { export const ReadAllFiles = {
encode(message: ReadAllFiles, writer: Writer = Writer.create()): Writer { encode(
message: ReadAllFiles,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.id !== 0) { if (message.id !== 0) {
writer.uint32(8).int32(message.id); writer.uint32(8).int32(message.id);
} }
@ -2666,8 +2717,8 @@ export const ReadAllFiles = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): ReadAllFiles { decode(input: _m0.Reader | Uint8Array, length?: number): ReadAllFiles {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseReadAllFiles(); const message = createBaseReadAllFiles();
while (reader.pos < end) { while (reader.pos < end) {
@ -2734,7 +2785,10 @@ function createBaseFileAction(): FileAction {
} }
export const FileAction = { export const FileAction = {
encode(message: FileAction, writer: Writer = Writer.create()): Writer { encode(
message: FileAction,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.readDir !== undefined) { if (message.readDir !== undefined) {
ReadDir.encode(message.readDir, writer.uint32(10).fork()).ldelim(); ReadDir.encode(message.readDir, writer.uint32(10).fork()).ldelim();
} }
@ -2777,8 +2831,8 @@ export const FileAction = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): FileAction { decode(input: _m0.Reader | Uint8Array, length?: number): FileAction {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseFileAction(); const message = createBaseFileAction();
while (reader.pos < end) { while (reader.pos < end) {
@ -2935,16 +2989,16 @@ function createBaseFileTransferCancel(): FileTransferCancel {
export const FileTransferCancel = { export const FileTransferCancel = {
encode( encode(
message: FileTransferCancel, message: FileTransferCancel,
writer: Writer = Writer.create() writer: _m0.Writer = _m0.Writer.create()
): Writer { ): _m0.Writer {
if (message.id !== 0) { if (message.id !== 0) {
writer.uint32(8).int32(message.id); writer.uint32(8).int32(message.id);
} }
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): FileTransferCancel { decode(input: _m0.Reader | Uint8Array, length?: number): FileTransferCancel {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseFileTransferCancel(); const message = createBaseFileTransferCancel();
while (reader.pos < end) { while (reader.pos < end) {
@ -2992,7 +3046,10 @@ function createBaseFileResponse(): FileResponse {
} }
export const FileResponse = { export const FileResponse = {
encode(message: FileResponse, writer: Writer = Writer.create()): Writer { encode(
message: FileResponse,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.dir !== undefined) { if (message.dir !== undefined) {
FileDirectory.encode(message.dir, writer.uint32(10).fork()).ldelim(); FileDirectory.encode(message.dir, writer.uint32(10).fork()).ldelim();
} }
@ -3014,8 +3071,8 @@ export const FileResponse = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): FileResponse { decode(input: _m0.Reader | Uint8Array, length?: number): FileResponse {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseFileResponse(); const message = createBaseFileResponse();
while (reader.pos < end) { while (reader.pos < end) {
@ -3104,7 +3161,10 @@ function createBaseFileTransferBlock(): FileTransferBlock {
} }
export const FileTransferBlock = { export const FileTransferBlock = {
encode(message: FileTransferBlock, writer: Writer = Writer.create()): Writer { encode(
message: FileTransferBlock,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.id !== 0) { if (message.id !== 0) {
writer.uint32(8).int32(message.id); writer.uint32(8).int32(message.id);
} }
@ -3120,8 +3180,8 @@ export const FileTransferBlock = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): FileTransferBlock { decode(input: _m0.Reader | Uint8Array, length?: number): FileTransferBlock {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseFileTransferBlock(); const message = createBaseFileTransferBlock();
while (reader.pos < end) { while (reader.pos < end) {
@ -3188,7 +3248,10 @@ function createBaseFileTransferError(): FileTransferError {
} }
export const FileTransferError = { export const FileTransferError = {
encode(message: FileTransferError, writer: Writer = Writer.create()): Writer { encode(
message: FileTransferError,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.id !== 0) { if (message.id !== 0) {
writer.uint32(8).int32(message.id); writer.uint32(8).int32(message.id);
} }
@ -3201,8 +3264,8 @@ export const FileTransferError = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): FileTransferError { decode(input: _m0.Reader | Uint8Array, length?: number): FileTransferError {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseFileTransferError(); const message = createBaseFileTransferError();
while (reader.pos < end) { while (reader.pos < end) {
@ -3260,8 +3323,8 @@ function createBaseFileTransferSendRequest(): FileTransferSendRequest {
export const FileTransferSendRequest = { export const FileTransferSendRequest = {
encode( encode(
message: FileTransferSendRequest, message: FileTransferSendRequest,
writer: Writer = Writer.create() writer: _m0.Writer = _m0.Writer.create()
): Writer { ): _m0.Writer {
if (message.id !== 0) { if (message.id !== 0) {
writer.uint32(8).int32(message.id); writer.uint32(8).int32(message.id);
} }
@ -3274,8 +3337,11 @@ export const FileTransferSendRequest = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): FileTransferSendRequest { decode(
const reader = input instanceof Reader ? input : new Reader(input); input: _m0.Reader | Uint8Array,
length?: number
): FileTransferSendRequest {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseFileTransferSendRequest(); const message = createBaseFileTransferSendRequest();
while (reader.pos < end) { while (reader.pos < end) {
@ -3333,7 +3399,10 @@ function createBaseFileTransferDone(): FileTransferDone {
} }
export const FileTransferDone = { export const FileTransferDone = {
encode(message: FileTransferDone, writer: Writer = Writer.create()): Writer { encode(
message: FileTransferDone,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.id !== 0) { if (message.id !== 0) {
writer.uint32(8).int32(message.id); writer.uint32(8).int32(message.id);
} }
@ -3343,8 +3412,8 @@ export const FileTransferDone = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): FileTransferDone { decode(input: _m0.Reader | Uint8Array, length?: number): FileTransferDone {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseFileTransferDone(); const message = createBaseFileTransferDone();
while (reader.pos < end) { while (reader.pos < end) {
@ -3396,8 +3465,8 @@ function createBaseFileTransferReceiveRequest(): FileTransferReceiveRequest {
export const FileTransferReceiveRequest = { export const FileTransferReceiveRequest = {
encode( encode(
message: FileTransferReceiveRequest, message: FileTransferReceiveRequest,
writer: Writer = Writer.create() writer: _m0.Writer = _m0.Writer.create()
): Writer { ): _m0.Writer {
if (message.id !== 0) { if (message.id !== 0) {
writer.uint32(8).int32(message.id); writer.uint32(8).int32(message.id);
} }
@ -3411,10 +3480,10 @@ export const FileTransferReceiveRequest = {
}, },
decode( decode(
input: Reader | Uint8Array, input: _m0.Reader | Uint8Array,
length?: number length?: number
): FileTransferReceiveRequest { ): FileTransferReceiveRequest {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseFileTransferReceiveRequest(); const message = createBaseFileTransferReceiveRequest();
while (reader.pos < end) { while (reader.pos < end) {
@ -3477,7 +3546,10 @@ function createBaseFileRemoveDir(): FileRemoveDir {
} }
export const FileRemoveDir = { export const FileRemoveDir = {
encode(message: FileRemoveDir, writer: Writer = Writer.create()): Writer { encode(
message: FileRemoveDir,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.id !== 0) { if (message.id !== 0) {
writer.uint32(8).int32(message.id); writer.uint32(8).int32(message.id);
} }
@ -3490,8 +3562,8 @@ export const FileRemoveDir = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): FileRemoveDir { decode(input: _m0.Reader | Uint8Array, length?: number): FileRemoveDir {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseFileRemoveDir(); const message = createBaseFileRemoveDir();
while (reader.pos < end) { while (reader.pos < end) {
@ -3546,7 +3618,10 @@ function createBaseFileRemoveFile(): FileRemoveFile {
} }
export const FileRemoveFile = { export const FileRemoveFile = {
encode(message: FileRemoveFile, writer: Writer = Writer.create()): Writer { encode(
message: FileRemoveFile,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.id !== 0) { if (message.id !== 0) {
writer.uint32(8).int32(message.id); writer.uint32(8).int32(message.id);
} }
@ -3559,8 +3634,8 @@ export const FileRemoveFile = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): FileRemoveFile { decode(input: _m0.Reader | Uint8Array, length?: number): FileRemoveFile {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseFileRemoveFile(); const message = createBaseFileRemoveFile();
while (reader.pos < end) { while (reader.pos < end) {
@ -3616,7 +3691,10 @@ function createBaseFileDirCreate(): FileDirCreate {
} }
export const FileDirCreate = { export const FileDirCreate = {
encode(message: FileDirCreate, writer: Writer = Writer.create()): Writer { encode(
message: FileDirCreate,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.id !== 0) { if (message.id !== 0) {
writer.uint32(8).int32(message.id); writer.uint32(8).int32(message.id);
} }
@ -3626,8 +3704,8 @@ export const FileDirCreate = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): FileDirCreate { decode(input: _m0.Reader | Uint8Array, length?: number): FileDirCreate {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseFileDirCreate(); const message = createBaseFileDirCreate();
while (reader.pos < end) { while (reader.pos < end) {
@ -3676,7 +3754,10 @@ function createBaseSwitchDisplay(): SwitchDisplay {
} }
export const SwitchDisplay = { export const SwitchDisplay = {
encode(message: SwitchDisplay, writer: Writer = Writer.create()): Writer { encode(
message: SwitchDisplay,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.display !== 0) { if (message.display !== 0) {
writer.uint32(8).int32(message.display); writer.uint32(8).int32(message.display);
} }
@ -3695,8 +3776,8 @@ export const SwitchDisplay = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): SwitchDisplay { decode(input: _m0.Reader | Uint8Array, length?: number): SwitchDisplay {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSwitchDisplay(); const message = createBaseSwitchDisplay();
while (reader.pos < end) { while (reader.pos < end) {
@ -3764,7 +3845,10 @@ function createBasePermissionInfo(): PermissionInfo {
} }
export const PermissionInfo = { export const PermissionInfo = {
encode(message: PermissionInfo, writer: Writer = Writer.create()): Writer { encode(
message: PermissionInfo,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.permission !== 0) { if (message.permission !== 0) {
writer.uint32(8).int32(message.permission); writer.uint32(8).int32(message.permission);
} }
@ -3774,8 +3858,8 @@ export const PermissionInfo = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): PermissionInfo { decode(input: _m0.Reader | Uint8Array, length?: number): PermissionInfo {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePermissionInfo(); const message = createBasePermissionInfo();
while (reader.pos < end) { while (reader.pos < end) {
@ -3836,7 +3920,10 @@ function createBaseOptionMessage(): OptionMessage {
} }
export const OptionMessage = { export const OptionMessage = {
encode(message: OptionMessage, writer: Writer = Writer.create()): Writer { encode(
message: OptionMessage,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.imageQuality !== 0) { if (message.imageQuality !== 0) {
writer.uint32(8).int32(message.imageQuality); writer.uint32(8).int32(message.imageQuality);
} }
@ -3864,8 +3951,8 @@ export const OptionMessage = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): OptionMessage { decode(input: _m0.Reader | Uint8Array, length?: number): OptionMessage {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseOptionMessage(); const message = createBaseOptionMessage();
while (reader.pos < end) { while (reader.pos < end) {
@ -3980,7 +4067,10 @@ function createBaseOptionResponse(): OptionResponse {
} }
export const OptionResponse = { export const OptionResponse = {
encode(message: OptionResponse, writer: Writer = Writer.create()): Writer { encode(
message: OptionResponse,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.opt !== undefined) { if (message.opt !== undefined) {
OptionMessage.encode(message.opt, writer.uint32(10).fork()).ldelim(); OptionMessage.encode(message.opt, writer.uint32(10).fork()).ldelim();
} }
@ -3990,8 +4080,8 @@ export const OptionResponse = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): OptionResponse { decode(input: _m0.Reader | Uint8Array, length?: number): OptionResponse {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseOptionResponse(); const message = createBaseOptionResponse();
while (reader.pos < end) { while (reader.pos < end) {
@ -4044,7 +4134,10 @@ function createBaseTestDelay(): TestDelay {
} }
export const TestDelay = { export const TestDelay = {
encode(message: TestDelay, writer: Writer = Writer.create()): Writer { encode(
message: TestDelay,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.time !== 0) { if (message.time !== 0) {
writer.uint32(8).int64(message.time); writer.uint32(8).int64(message.time);
} }
@ -4054,8 +4147,8 @@ export const TestDelay = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): TestDelay { decode(input: _m0.Reader | Uint8Array, length?: number): TestDelay {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTestDelay(); const message = createBaseTestDelay();
while (reader.pos < end) { while (reader.pos < end) {
@ -4107,7 +4200,10 @@ function createBasePublicKey(): PublicKey {
} }
export const PublicKey = { export const PublicKey = {
encode(message: PublicKey, writer: Writer = Writer.create()): Writer { encode(
message: PublicKey,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.asymmetricValue.length !== 0) { if (message.asymmetricValue.length !== 0) {
writer.uint32(10).bytes(message.asymmetricValue); writer.uint32(10).bytes(message.asymmetricValue);
} }
@ -4117,8 +4213,8 @@ export const PublicKey = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): PublicKey { decode(input: _m0.Reader | Uint8Array, length?: number): PublicKey {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePublicKey(); const message = createBasePublicKey();
while (reader.pos < end) { while (reader.pos < end) {
@ -4181,15 +4277,18 @@ function createBaseSignedId(): SignedId {
} }
export const SignedId = { export const SignedId = {
encode(message: SignedId, writer: Writer = Writer.create()): Writer { encode(
message: SignedId,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.id.length !== 0) { if (message.id.length !== 0) {
writer.uint32(10).bytes(message.id); writer.uint32(10).bytes(message.id);
} }
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): SignedId { decode(input: _m0.Reader | Uint8Array, length?: number): SignedId {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSignedId(); const message = createBaseSignedId();
while (reader.pos < end) { while (reader.pos < end) {
@ -4233,7 +4332,10 @@ function createBaseAudioFormat(): AudioFormat {
} }
export const AudioFormat = { export const AudioFormat = {
encode(message: AudioFormat, writer: Writer = Writer.create()): Writer { encode(
message: AudioFormat,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.sampleRate !== 0) { if (message.sampleRate !== 0) {
writer.uint32(8).uint32(message.sampleRate); writer.uint32(8).uint32(message.sampleRate);
} }
@ -4243,8 +4345,8 @@ export const AudioFormat = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): AudioFormat { decode(input: _m0.Reader | Uint8Array, length?: number): AudioFormat {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseAudioFormat(); const message = createBaseAudioFormat();
while (reader.pos < end) { while (reader.pos < end) {
@ -4295,15 +4397,18 @@ function createBaseAudioFrame(): AudioFrame {
} }
export const AudioFrame = { export const AudioFrame = {
encode(message: AudioFrame, writer: Writer = Writer.create()): Writer { encode(
message: AudioFrame,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.data.length !== 0) { if (message.data.length !== 0) {
writer.uint32(10).bytes(message.data); writer.uint32(10).bytes(message.data);
} }
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): AudioFrame { decode(input: _m0.Reader | Uint8Array, length?: number): AudioFrame {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseAudioFrame(); const message = createBaseAudioFrame();
while (reader.pos < end) { while (reader.pos < end) {
@ -4360,7 +4465,7 @@ function createBaseMisc(): Misc {
} }
export const Misc = { export const Misc = {
encode(message: Misc, writer: Writer = Writer.create()): Writer { encode(message: Misc, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.chatMessage !== undefined) { if (message.chatMessage !== undefined) {
ChatMessage.encode( ChatMessage.encode(
message.chatMessage, message.chatMessage,
@ -4403,8 +4508,8 @@ export const Misc = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): Misc { decode(input: _m0.Reader | Uint8Array, length?: number): Misc {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMisc(); const message = createBaseMisc();
while (reader.pos < end) { while (reader.pos < end) {
@ -4565,7 +4670,10 @@ function createBaseMessage(): Message {
} }
export const Message = { export const Message = {
encode(message: Message, writer: Writer = Writer.create()): Writer { encode(
message: Message,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.signedId !== undefined) { if (message.signedId !== undefined) {
SignedId.encode(message.signedId, writer.uint32(26).fork()).ldelim(); SignedId.encode(message.signedId, writer.uint32(26).fork()).ldelim();
} }
@ -4632,8 +4740,8 @@ export const Message = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): Message { decode(input: _m0.Reader | Uint8Array, length?: number): Message {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMessage(); const message = createBaseMessage();
while (reader.pos < end) { while (reader.pos < end) {
@ -4957,11 +5065,9 @@ function longToNumber(long: Long): number {
return long.toNumber(); return long.toNumber();
} }
// If you get a compile-error about 'Constructor<Long> and ... have no overlap', if (_m0.util.Long !== Long) {
// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. _m0.util.Long = Long as any;
if (util.Long !== Long) { _m0.configure();
util.Long = Long as any;
configure();
} }
function isSet(value: any): boolean { function isSet(value: any): boolean {

View File

@ -1,6 +1,6 @@
/* eslint-disable */ /* eslint-disable */
import { util, configure, Writer, Reader } from "protobufjs/minimal"; import Long from "long";
import * as Long from "long"; import _m0 from "protobufjs/minimal";
export const protobufPackage = "hbb"; export const protobufPackage = "hbb";
@ -357,7 +357,10 @@ function createBaseRegisterPeer(): RegisterPeer {
} }
export const RegisterPeer = { export const RegisterPeer = {
encode(message: RegisterPeer, writer: Writer = Writer.create()): Writer { encode(
message: RegisterPeer,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.id !== "") { if (message.id !== "") {
writer.uint32(10).string(message.id); writer.uint32(10).string(message.id);
} }
@ -367,8 +370,8 @@ export const RegisterPeer = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): RegisterPeer { decode(input: _m0.Reader | Uint8Array, length?: number): RegisterPeer {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRegisterPeer(); const message = createBaseRegisterPeer();
while (reader.pos < end) { while (reader.pos < end) {
@ -419,16 +422,19 @@ function createBaseRegisterPeerResponse(): RegisterPeerResponse {
export const RegisterPeerResponse = { export const RegisterPeerResponse = {
encode( encode(
message: RegisterPeerResponse, message: RegisterPeerResponse,
writer: Writer = Writer.create() writer: _m0.Writer = _m0.Writer.create()
): Writer { ): _m0.Writer {
if (message.requestPk === true) { if (message.requestPk === true) {
writer.uint32(16).bool(message.requestPk); writer.uint32(16).bool(message.requestPk);
} }
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): RegisterPeerResponse { decode(
const reader = input instanceof Reader ? input : new Reader(input); input: _m0.Reader | Uint8Array,
length?: number
): RegisterPeerResponse {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRegisterPeerResponse(); const message = createBaseRegisterPeerResponse();
while (reader.pos < end) { while (reader.pos < end) {
@ -471,7 +477,10 @@ function createBasePunchHoleRequest(): PunchHoleRequest {
} }
export const PunchHoleRequest = { export const PunchHoleRequest = {
encode(message: PunchHoleRequest, writer: Writer = Writer.create()): Writer { encode(
message: PunchHoleRequest,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.id !== "") { if (message.id !== "") {
writer.uint32(10).string(message.id); writer.uint32(10).string(message.id);
} }
@ -487,8 +496,8 @@ export const PunchHoleRequest = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): PunchHoleRequest { decode(input: _m0.Reader | Uint8Array, length?: number): PunchHoleRequest {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePunchHoleRequest(); const message = createBasePunchHoleRequest();
while (reader.pos < end) { while (reader.pos < end) {
@ -551,7 +560,10 @@ function createBasePunchHole(): PunchHole {
} }
export const PunchHole = { export const PunchHole = {
encode(message: PunchHole, writer: Writer = Writer.create()): Writer { encode(
message: PunchHole,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.socketAddr.length !== 0) { if (message.socketAddr.length !== 0) {
writer.uint32(10).bytes(message.socketAddr); writer.uint32(10).bytes(message.socketAddr);
} }
@ -564,8 +576,8 @@ export const PunchHole = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): PunchHole { decode(input: _m0.Reader | Uint8Array, length?: number): PunchHole {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePunchHole(); const message = createBasePunchHole();
while (reader.pos < end) { while (reader.pos < end) {
@ -627,15 +639,18 @@ function createBaseTestNatRequest(): TestNatRequest {
} }
export const TestNatRequest = { export const TestNatRequest = {
encode(message: TestNatRequest, writer: Writer = Writer.create()): Writer { encode(
message: TestNatRequest,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.serial !== 0) { if (message.serial !== 0) {
writer.uint32(8).int32(message.serial); writer.uint32(8).int32(message.serial);
} }
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): TestNatRequest { decode(input: _m0.Reader | Uint8Array, length?: number): TestNatRequest {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTestNatRequest(); const message = createBaseTestNatRequest();
while (reader.pos < end) { while (reader.pos < end) {
@ -678,7 +693,10 @@ function createBaseTestNatResponse(): TestNatResponse {
} }
export const TestNatResponse = { export const TestNatResponse = {
encode(message: TestNatResponse, writer: Writer = Writer.create()): Writer { encode(
message: TestNatResponse,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.port !== 0) { if (message.port !== 0) {
writer.uint32(8).int32(message.port); writer.uint32(8).int32(message.port);
} }
@ -688,8 +706,8 @@ export const TestNatResponse = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): TestNatResponse { decode(input: _m0.Reader | Uint8Array, length?: number): TestNatResponse {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTestNatResponse(); const message = createBaseTestNatResponse();
while (reader.pos < end) { while (reader.pos < end) {
@ -748,7 +766,10 @@ function createBasePunchHoleSent(): PunchHoleSent {
} }
export const PunchHoleSent = { export const PunchHoleSent = {
encode(message: PunchHoleSent, writer: Writer = Writer.create()): Writer { encode(
message: PunchHoleSent,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.socketAddr.length !== 0) { if (message.socketAddr.length !== 0) {
writer.uint32(10).bytes(message.socketAddr); writer.uint32(10).bytes(message.socketAddr);
} }
@ -767,8 +788,8 @@ export const PunchHoleSent = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): PunchHoleSent { decode(input: _m0.Reader | Uint8Array, length?: number): PunchHoleSent {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePunchHoleSent(); const message = createBasePunchHoleSent();
while (reader.pos < end) { while (reader.pos < end) {
@ -842,7 +863,10 @@ function createBaseRegisterPk(): RegisterPk {
} }
export const RegisterPk = { export const RegisterPk = {
encode(message: RegisterPk, writer: Writer = Writer.create()): Writer { encode(
message: RegisterPk,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.id !== "") { if (message.id !== "") {
writer.uint32(10).string(message.id); writer.uint32(10).string(message.id);
} }
@ -858,8 +882,8 @@ export const RegisterPk = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): RegisterPk { decode(input: _m0.Reader | Uint8Array, length?: number): RegisterPk {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRegisterPk(); const message = createBaseRegisterPk();
while (reader.pos < end) { while (reader.pos < end) {
@ -930,16 +954,16 @@ function createBaseRegisterPkResponse(): RegisterPkResponse {
export const RegisterPkResponse = { export const RegisterPkResponse = {
encode( encode(
message: RegisterPkResponse, message: RegisterPkResponse,
writer: Writer = Writer.create() writer: _m0.Writer = _m0.Writer.create()
): Writer { ): _m0.Writer {
if (message.result !== 0) { if (message.result !== 0) {
writer.uint32(8).int32(message.result); writer.uint32(8).int32(message.result);
} }
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): RegisterPkResponse { decode(input: _m0.Reader | Uint8Array, length?: number): RegisterPkResponse {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRegisterPkResponse(); const message = createBaseRegisterPkResponse();
while (reader.pos < end) { while (reader.pos < end) {
@ -993,7 +1017,10 @@ function createBasePunchHoleResponse(): PunchHoleResponse {
} }
export const PunchHoleResponse = { export const PunchHoleResponse = {
encode(message: PunchHoleResponse, writer: Writer = Writer.create()): Writer { encode(
message: PunchHoleResponse,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.socketAddr.length !== 0) { if (message.socketAddr.length !== 0) {
writer.uint32(10).bytes(message.socketAddr); writer.uint32(10).bytes(message.socketAddr);
} }
@ -1018,8 +1045,8 @@ export const PunchHoleResponse = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): PunchHoleResponse { decode(input: _m0.Reader | Uint8Array, length?: number): PunchHoleResponse {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePunchHoleResponse(); const message = createBasePunchHoleResponse();
while (reader.pos < end) { while (reader.pos < end) {
@ -1119,7 +1146,10 @@ function createBaseConfigUpdate(): ConfigUpdate {
} }
export const ConfigUpdate = { export const ConfigUpdate = {
encode(message: ConfigUpdate, writer: Writer = Writer.create()): Writer { encode(
message: ConfigUpdate,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.serial !== 0) { if (message.serial !== 0) {
writer.uint32(8).int32(message.serial); writer.uint32(8).int32(message.serial);
} }
@ -1129,8 +1159,8 @@ export const ConfigUpdate = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): ConfigUpdate { decode(input: _m0.Reader | Uint8Array, length?: number): ConfigUpdate {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseConfigUpdate(); const message = createBaseConfigUpdate();
while (reader.pos < end) { while (reader.pos < end) {
@ -1193,7 +1223,10 @@ function createBaseRequestRelay(): RequestRelay {
} }
export const RequestRelay = { export const RequestRelay = {
encode(message: RequestRelay, writer: Writer = Writer.create()): Writer { encode(
message: RequestRelay,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.id !== "") { if (message.id !== "") {
writer.uint32(10).string(message.id); writer.uint32(10).string(message.id);
} }
@ -1218,8 +1251,8 @@ export const RequestRelay = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): RequestRelay { decode(input: _m0.Reader | Uint8Array, length?: number): RequestRelay {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRequestRelay(); const message = createBaseRequestRelay();
while (reader.pos < end) { while (reader.pos < end) {
@ -1313,7 +1346,10 @@ function createBaseRelayResponse(): RelayResponse {
} }
export const RelayResponse = { export const RelayResponse = {
encode(message: RelayResponse, writer: Writer = Writer.create()): Writer { encode(
message: RelayResponse,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.socketAddr.length !== 0) { if (message.socketAddr.length !== 0) {
writer.uint32(10).bytes(message.socketAddr); writer.uint32(10).bytes(message.socketAddr);
} }
@ -1338,8 +1374,8 @@ export const RelayResponse = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): RelayResponse { decode(input: _m0.Reader | Uint8Array, length?: number): RelayResponse {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRelayResponse(); const message = createBaseRelayResponse();
while (reader.pos < end) { while (reader.pos < end) {
@ -1429,15 +1465,18 @@ function createBaseSoftwareUpdate(): SoftwareUpdate {
} }
export const SoftwareUpdate = { export const SoftwareUpdate = {
encode(message: SoftwareUpdate, writer: Writer = Writer.create()): Writer { encode(
message: SoftwareUpdate,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.url !== "") { if (message.url !== "") {
writer.uint32(10).string(message.url); writer.uint32(10).string(message.url);
} }
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): SoftwareUpdate { decode(input: _m0.Reader | Uint8Array, length?: number): SoftwareUpdate {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSoftwareUpdate(); const message = createBaseSoftwareUpdate();
while (reader.pos < end) { while (reader.pos < end) {
@ -1480,7 +1519,10 @@ function createBaseFetchLocalAddr(): FetchLocalAddr {
} }
export const FetchLocalAddr = { export const FetchLocalAddr = {
encode(message: FetchLocalAddr, writer: Writer = Writer.create()): Writer { encode(
message: FetchLocalAddr,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.socketAddr.length !== 0) { if (message.socketAddr.length !== 0) {
writer.uint32(10).bytes(message.socketAddr); writer.uint32(10).bytes(message.socketAddr);
} }
@ -1490,8 +1532,8 @@ export const FetchLocalAddr = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): FetchLocalAddr { decode(input: _m0.Reader | Uint8Array, length?: number): FetchLocalAddr {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseFetchLocalAddr(); const message = createBaseFetchLocalAddr();
while (reader.pos < end) { while (reader.pos < end) {
@ -1552,7 +1594,10 @@ function createBaseLocalAddr(): LocalAddr {
} }
export const LocalAddr = { export const LocalAddr = {
encode(message: LocalAddr, writer: Writer = Writer.create()): Writer { encode(
message: LocalAddr,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.socketAddr.length !== 0) { if (message.socketAddr.length !== 0) {
writer.uint32(10).bytes(message.socketAddr); writer.uint32(10).bytes(message.socketAddr);
} }
@ -1571,8 +1616,8 @@ export const LocalAddr = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): LocalAddr { decode(input: _m0.Reader | Uint8Array, length?: number): LocalAddr {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseLocalAddr(); const message = createBaseLocalAddr();
while (reader.pos < end) { while (reader.pos < end) {
@ -1658,7 +1703,10 @@ function createBasePeerDiscovery(): PeerDiscovery {
} }
export const PeerDiscovery = { export const PeerDiscovery = {
encode(message: PeerDiscovery, writer: Writer = Writer.create()): Writer { encode(
message: PeerDiscovery,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.cmd !== "") { if (message.cmd !== "") {
writer.uint32(10).string(message.cmd); writer.uint32(10).string(message.cmd);
} }
@ -1683,8 +1731,8 @@ export const PeerDiscovery = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): PeerDiscovery { decode(input: _m0.Reader | Uint8Array, length?: number): PeerDiscovery {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePeerDiscovery(); const message = createBasePeerDiscovery();
while (reader.pos < end) { while (reader.pos < end) {
@ -1781,7 +1829,10 @@ function createBaseRendezvousMessage(): RendezvousMessage {
} }
export const RendezvousMessage = { export const RendezvousMessage = {
encode(message: RendezvousMessage, writer: Writer = Writer.create()): Writer { encode(
message: RendezvousMessage,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.registerPeer !== undefined) { if (message.registerPeer !== undefined) {
RegisterPeer.encode( RegisterPeer.encode(
message.registerPeer, message.registerPeer,
@ -1878,8 +1929,8 @@ export const RendezvousMessage = {
return writer; return writer;
}, },
decode(input: Reader | Uint8Array, length?: number): RendezvousMessage { decode(input: _m0.Reader | Uint8Array, length?: number): RendezvousMessage {
const reader = input instanceof Reader ? input : new Reader(input); const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRendezvousMessage(); const message = createBaseRendezvousMessage();
while (reader.pos < end) { while (reader.pos < end) {
@ -2240,11 +2291,9 @@ export type Exact<P, I extends P> = P extends Builtin
never never
>; >;
// If you get a compile-error about 'Constructor<Long> and ... have no overlap', if (_m0.util.Long !== Long) {
// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. _m0.util.Long = Long as any;
if (util.Long !== Long) { _m0.configure();
util.Long = Long as any;
configure();
} }
function isSet(value: any): boolean { function isSet(value: any): boolean {

View File

@ -21,8 +21,11 @@ if (app) {
<div id="text" style="line-height: 2em"></div> <div id="text" style="line-height: 2em"></div>
<button id="cancel" onclick="cancel();">Cancel</button> <button id="cancel" onclick="cancel();">Cancel</button>
</div> </div>
<canvas id="player"></canvas>
`; `;
let player;
document.body.onload = () => { document.body.onload = () => {
const host = document.querySelector('#host'); const host = document.querySelector('#host');
host.value = localStorage.getItem('host'); host.value = localStorage.getItem('host');
@ -30,6 +33,7 @@ if (app) {
id.value = localStorage.getItem('id'); id.value = localStorage.getItem('id');
const key = document.querySelector('#key'); const key = document.querySelector('#key');
key.value = localStorage.getItem('key'); key.value = localStorage.getItem('key');
player = YUVCanvas.attach(document.getElementById("player"))
}; };
window.connect = () => { window.connect = () => {
@ -42,6 +46,9 @@ if (app) {
const func = async () => { const func = async () => {
const conn = globals.newConn(); const conn = globals.newConn();
conn.setMsgbox(msgbox); conn.setMsgbox(msgbox);
conn.setDraw((f) => {
player.drawFrame(f);
});
document.querySelector('div#status').style.display = 'block'; document.querySelector('div#status').style.display = 'block';
document.querySelector('div#connect').style.display = 'none'; document.querySelector('div#connect').style.display = 'none';
document.querySelector('div#text').innerHTML = 'Connecting ...'; document.querySelector('div#text').innerHTML = 'Connecting ...';

View File

@ -5,16 +5,16 @@ import os
path = os.path.abspath(os.path.join(os.getcwd(), '..', 'hbb', 'libs', 'hbb_common', 'protos')) path = os.path.abspath(os.path.join(os.getcwd(), '..', 'hbb', 'libs', 'hbb_common', 'protos'))
if os.name == 'nt': if os.name == 'nt':
cmd = r'protoc --plugin=protoc-gen-ts_proto=.\node_modules\.bin\protoc-gen-ts_proto.cmd -I "%s" --ts_proto_out=./src/ rendezvous.proto'%path cmd = r'protoc --ts_proto_opt=esModuleInterop=true --plugin=protoc-gen-ts_proto=.\node_modules\.bin\protoc-gen-ts_proto.cmd -I "%s" --ts_proto_out=./src/ rendezvous.proto'%path
print(cmd) print(cmd)
os.system(cmd) os.system(cmd)
cmd = r'protoc --plugin=protoc-gen-ts_proto=.\node_modules\.bin\protoc-gen-ts_proto.cmd -I "%s" --ts_proto_out=./src/ message.proto'%path cmd = r'protoc --ts_proto_opt=esModuleInterop=true --plugin=protoc-gen-ts_proto=.\node_modules\.bin\protoc-gen-ts_proto.cmd -I "%s" --ts_proto_out=./src/ message.proto'%path
print(cmd) print(cmd)
os.system(cmd) os.system(cmd)
else: else:
cmd = r'protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto -I "%s" --ts_proto_out=./src/ rendezvous.proto'%path cmd = r'protoc --ts_proto_opt=esModuleInterop=true --plugin=./node_modules/.bin/protoc-gen-ts_proto -I "%s" --ts_proto_out=./src/ rendezvous.proto'%path
print(cmd) print(cmd)
os.system(cmd) os.system(cmd)
cmd = r'protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto -I "%s" --ts_proto_out=./src/ message.proto'%path cmd = r'protoc --ts_proto_opt=esModuleInterop=true --plugin=./node_modules/.bin/protoc-gen-ts_proto -I "%s" --ts_proto_out=./src/ message.proto'%path
print(cmd) print(cmd)
os.system(cmd) os.system(cmd)