检查索引的http请求改为websocket

This commit is contained in:
miao 2023-02-14 08:50:40 +08:00 committed by fangxiang
parent e4827b4fe6
commit 5a1dba7a8f
4 changed files with 572 additions and 538 deletions

View File

@ -117,7 +117,7 @@ export default defineComponent({
console.log(e); console.log(e);
} }
EventBus.getInstance().on(EventNamesDefine.CheckDebug, () => { EventBus.getInstance().on(EventNamesDefine.CheckDebug2, () => {
const to_normal_url = () => { const to_normal_url = () => {
const p1 = window.location.href.indexOf("?debug"); const p1 = window.location.href.indexOf("?debug");
const p2 = window.location.href.indexOf("#"); const p2 = window.location.href.indexOf("#");

View File

@ -1519,6 +1519,15 @@ export default class ClientConnection {
console.error(e); console.error(e);
} }
} }
public async CheckModeIndex(mode_index:number) {
try {
return await this.doRpc<Protocol.RpcCheckModeIndexResponseEntity>(
new Protocol.RpcCheckModeIndexRequestEntity(mode_index)
);
} catch (e) {
console.error(e);
}
}
} }
export interface NotifyMessage { export interface NotifyMessage {

File diff suppressed because it is too large Load Diff

View File

@ -534,6 +534,9 @@ export namespace Protocol {
public static get kRpcFileManagerCreateDirectory() { public static get kRpcFileManagerCreateDirectory() {
return Commands.PROTOCOL_PREFIX + "RpcFileManagerCreateDirectory"; return Commands.PROTOCOL_PREFIX + "RpcFileManagerCreateDirectory";
} }
public static get kRpcCheckModeIndex() {
return Commands.PROTOCOL_PREFIX + "RpcCheckModeIndex";
}
static _all_commands = new Set([ static _all_commands = new Set([
Commands.kUnKnowCommand, Commands.kUnKnowCommand,
Commands.kSearchDevice, Commands.kSearchDevice,
@ -668,6 +671,7 @@ export namespace Protocol {
Commands.kRpcFileManagerRename, Commands.kRpcFileManagerRename,
Commands.kRpcFileManagerDelete, Commands.kRpcFileManagerDelete,
Commands.kRpcFileManagerCreateDirectory, Commands.kRpcFileManagerCreateDirectory,
Commands.kRpcCheckModeIndex,
]); ]);
public static get AllCommands() { public static get AllCommands() {
return this._all_commands; return this._all_commands;
@ -3541,4 +3545,21 @@ export namespace Protocol {
error_message="" error_message=""
error_code=0; error_code=0;
} }
export class RpcCheckModeIndexRequestEntity extends PacketEntity{
constructor(mode_index:number,rpc_id = 0) {
super();
super.command = Commands.kRpcCheckModeIndex;
super.flag = PacketEntity.FLAG_REQUEST;
this.mode_index=mode_index
}
mode_index = 0;
}
export class RpcCheckModeIndexResponseEntity extends PacketEntity{
constructor() {
super();
super.flag = PacketEntity.FLAG_RESPONSE;
}
success = false;
}
} }