🔨 记录 RDP 传输日志.
This commit is contained in:
@@ -275,7 +275,11 @@
|
||||
|
||||
// 上传文件
|
||||
const uploadFile = () => {
|
||||
transferManager.rdp.addUpload(props.session, fileList.value[0].file as File);
|
||||
const file = fileList.value[0].file as File;
|
||||
// 记录事件
|
||||
props.session.onFileSystemEvent({ event: 'terminal:rdp-upload', path: file.name });
|
||||
// 上传文件
|
||||
transferManager.rdp.addUpload(props.session, file);
|
||||
fileList.value = [];
|
||||
};
|
||||
|
||||
|
||||
@@ -175,6 +175,8 @@ export interface IRdpSession extends IGuacdSession {
|
||||
|
||||
// 初始化
|
||||
init: (config: GuacdInitConfig) => Promise<void>;
|
||||
// 文件系统事件
|
||||
onFileSystemEvent: (event: Record<string, any>) => void;
|
||||
// 发送键
|
||||
sendKeys: (keys: Array<number>) => void;
|
||||
// 粘贴
|
||||
|
||||
@@ -11,6 +11,7 @@ import type { OutputPayload } from '@/views/terminal/types/protocol';
|
||||
import { InputProtocol } from '@/views/terminal/types/protocol';
|
||||
import { TerminalMessages, fitDisplayValue, TerminalCloseCode } from '@/views/terminal/types/const';
|
||||
import { screenshot } from '@/views/terminal/types/utils';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import { useTerminalStore } from '@/store';
|
||||
import Guacamole from 'guacamole-common-js';
|
||||
import BaseSession from './base-session';
|
||||
@@ -105,6 +106,13 @@ export default class RdpSession extends BaseSession<GuacdReactiveSessionStatus,
|
||||
};
|
||||
// 下载文件回调
|
||||
this.client.onfile = (stream, mimetype, filename) => {
|
||||
if (!this.isWriteable()) {
|
||||
Message.error('无写入权限');
|
||||
return;
|
||||
}
|
||||
// 记录事件
|
||||
this.onFileSystemEvent({ event: 'terminal:rdp-download', path: filename });
|
||||
// 下载文件
|
||||
useTerminalStore().transferManager.rdp.addDownload(this, stream, mimetype, filename);
|
||||
};
|
||||
}
|
||||
@@ -160,6 +168,11 @@ export default class RdpSession extends BaseSession<GuacdReactiveSessionStatus,
|
||||
}
|
||||
}
|
||||
|
||||
// 文件系统事件
|
||||
onFileSystemEvent(event: Record<string, any>): void {
|
||||
this.channel.send(InputProtocol.RDP_FILE_SYSTEM_EVENT, { event: JSON.stringify(event) });
|
||||
}
|
||||
|
||||
// 发送键
|
||||
sendKeys(keys: Array<number>): void {
|
||||
if (!this.isWriteable()) {
|
||||
|
||||
@@ -45,6 +45,11 @@ export const InputProtocol = {
|
||||
type: 'rs',
|
||||
template: ['type', 'width', 'height']
|
||||
},
|
||||
// guacd 指令
|
||||
GUACD_INSTRUCTION: {
|
||||
type: 'gi',
|
||||
template: ['type', 'instruction']
|
||||
},
|
||||
// SSH 输入
|
||||
SSH_INPUT: {
|
||||
type: 'i',
|
||||
@@ -95,11 +100,11 @@ export const InputProtocol = {
|
||||
type: 'sc',
|
||||
template: ['type', 'path']
|
||||
},
|
||||
// guacd 指令
|
||||
GUACD_INSTRUCTION: {
|
||||
type: 'gi',
|
||||
template: ['type', 'instruction']
|
||||
}
|
||||
// RDP 文件系统事件
|
||||
RDP_FILE_SYSTEM_EVENT: {
|
||||
type: 'fse',
|
||||
template: ['type', 'event']
|
||||
},
|
||||
};
|
||||
|
||||
// 输出协议
|
||||
@@ -140,6 +145,12 @@ export const OutputProtocol = {
|
||||
template: ['type'],
|
||||
processMethod: 'processPong'
|
||||
},
|
||||
// guacd 指令
|
||||
GUACD_INSTRUCTION: {
|
||||
type: 'gi',
|
||||
template: ['type', 'instruction'],
|
||||
processMethod: 'processInstruction'
|
||||
},
|
||||
// SSH 输出
|
||||
SSH_OUTPUT: {
|
||||
type: 'o',
|
||||
@@ -200,12 +211,6 @@ export const OutputProtocol = {
|
||||
template: ['type', 'result', 'msg', 'token'],
|
||||
processMethod: 'processSftpSetContent'
|
||||
},
|
||||
// guacd 指令
|
||||
GUACD_INSTRUCTION: {
|
||||
type: 'gi',
|
||||
template: ['type', 'instruction'],
|
||||
processMethod: 'processInstruction'
|
||||
}
|
||||
};
|
||||
|
||||
// 解析参数
|
||||
|
||||
Reference in New Issue
Block a user