将文件管理的http请求改为websocket

This commit is contained in:
miao 2023-02-12 15:58:54 +08:00
parent 2a6e8e78c0
commit aee328fb82
4 changed files with 1437 additions and 1346 deletions

View File

@ -1483,6 +1483,42 @@ export default class ClientConnection {
}
this.ws = null;
}
public async getFileListFileManager(dir_path:string) {
try {
return await this.doRpc<Protocol.RpcFileManagerGetFileListResponse>(
new Protocol.RpcFileManagerGetFileListRequest(dir_path)
);
} catch (e) {
console.error(e);
}
}
public async RenameFileManager(base_dir:string,file_name:string,new_file_name:string) {
try {
return await this.doRpc<Protocol.RpcFileManagerRenameResponse>(
new Protocol.RpcFileManagerRenameRequest(base_dir,file_name,new_file_name)
);
} catch (e) {
console.error(e);
}
}
public async DeleteFileManager(base_dir:string,file_name:string) {
try {
return await this.doRpc<Protocol.RpcFileManagerDeleteResponse>(
new Protocol.RpcFileManagerDeleteRequest(base_dir,file_name)
);
} catch (e) {
console.error(e);
}
}
public async CreateDirectoryFileManager(base_dir:string,dir_name:string) {
try {
return await this.doRpc<Protocol.RpcFileManagerCreateDirectoryResponse>(
new Protocol.RpcFileManagerCreateDirectoryRequest(base_dir,dir_name)
);
} catch (e) {
console.error(e);
}
}
}
export interface NotifyMessage {

File diff suppressed because it is too large Load Diff

View File

@ -521,7 +521,19 @@ export namespace Protocol {
public static get kSaveBlendingConfig() {
return Commands.PROTOCOL_PREFIX + "SaveBlendingConfig";
}
public static get kRpcFileManagerGetFileList() {
return Commands.PROTOCOL_PREFIX + "RpcFileManagerGetFileList";
}
public static get kRpcFileManagerRename() {
return Commands.PROTOCOL_PREFIX + "RpcFileManagerRename";
}
public static get kRpcFileManagerDelete() {
return Commands.PROTOCOL_PREFIX + "RpcFileManagerDelete";
}
public static get kRpcFileManagerCreateDirectory() {
return Commands.PROTOCOL_PREFIX + "RpcFileManagerCreateDirectory";
}
static _all_commands = new Set([
Commands.kUnKnowCommand,
Commands.kSearchDevice,
@ -652,6 +664,10 @@ export namespace Protocol {
Commands.kSaveBlendingConfig,
Commands.kRpcSetMagicWallGridState,
Commands.kRpcGetMagicWallGridState,
Commands.kRpcFileManagerGetFileList,
Commands.kRpcFileManagerRename,
Commands.kRpcFileManagerDelete,
Commands.kRpcFileManagerCreateDirectory,
]);
public static get AllCommands() {
return this._all_commands;
@ -3438,4 +3454,91 @@ export namespace Protocol {
}
name = "";
}
export class RpcFileManagerGetFileListRequest extends PacketEntity{
dir_path:string=""
constructor(dir_path:string,rpc_id = 0) {
super();
super.command = Commands.kRpcFileManagerGetFileList;
super.flag = PacketEntity.FLAG_REQUEST;
super.rpc_id = rpc_id;
this.dir_path=dir_path
}
}
export class RpcFileManagerGetFileListResponse extends PacketEntity{
constructor() {
super();
super.flag = PacketEntity.FLAG_RESPONSE;
}
error_code=0;
success = false;
error_message=""
free=0;
files:FileEntry[]=[]
}
export class RpcFileManagerRenameRequest extends PacketEntity{
constructor(base_dir:string,file_name:string,new_file_name:string,rpc_id = 0) {
super();
super.command = Commands.kRpcFileManagerRename;
super.flag = PacketEntity.FLAG_REQUEST;
super.rpc_id = rpc_id;
this.base_dir=base_dir
this.file_name=file_name
this.new_file_name=new_file_name
}
base_dir=""
file_name=""
new_file_name=""
}
export class RpcFileManagerRenameResponse extends PacketEntity{
constructor() {
super();
super.flag = PacketEntity.FLAG_RESPONSE;
}
success = false;
error_code=0;
error_message=""
}
export class RpcFileManagerDeleteRequest extends PacketEntity{
constructor(base_dir:string,file_name:string,rpc_id = 0) {
super();
super.command = Commands.kRpcFileManagerDelete;
super.flag = PacketEntity.FLAG_REQUEST;
super.rpc_id = rpc_id;
this.base_dir=base_dir
this.file_name=file_name
}
base_dir=""
file_name=""
}
export class RpcFileManagerDeleteResponse extends PacketEntity{
constructor() {
super();
super.flag = PacketEntity.FLAG_RESPONSE;
}
success = false;
delete_count=""
error_code=0;
error_message=""
}
export class RpcFileManagerCreateDirectoryRequest extends PacketEntity{
constructor(base_dir:string,dir_name:string,rpc_id = 0) {
super();
super.command = Commands.kRpcFileManagerCreateDirectory;
super.flag = PacketEntity.FLAG_REQUEST;
super.rpc_id = rpc_id;
this.base_dir=base_dir
this.dir_name=dir_name
}
base_dir=""
dir_name=""
}
export class RpcFileManagerCreateDirectoryResponse extends PacketEntity{
constructor() {
super();
super.flag = PacketEntity.FLAG_RESPONSE;
}
success = false;
error_message=""
error_code=0;
}
}

View File

@ -505,6 +505,7 @@
<q-item v-else>
<q-item-section avatar style="margin-right: 0px; padding-right: 0px">
<q-btn
flat
@click="isfullbtn()"
:icon="isfull ? 'fullscreen_exit' : 'fullscreen'"
/>