🐛 修复会话打开黑屏.

This commit is contained in:
lijiahangmax
2025-07-10 03:32:45 +08:00
parent d2cba947b3
commit b42645b0ce
9 changed files with 43 additions and 16 deletions

View File

@@ -13,7 +13,7 @@ spring:
host: ${REDIS_HOST:127.0.0.1}
port: ${REDIS_PORT:6379}
password: ${REDIS_PASSWORD:Data@123456}
database: ${REDIS_DATABASE:10}
database: ${REDIS_DATABASE:1}
data-version: ${REDIS_DATA_VERSION:1}
mock: false
redisson:

View File

@@ -62,6 +62,7 @@ public class HostVncConfigStrategy extends AbstractHostConfigStrategy<HostVncCon
.authType(HostAuthTypeEnum.PASSWORD.name())
.noUsername(false)
.noPassword(false)
.timezone("Asia/Shanghai")
.clipboardEncoding(Const.UTF_8)
.build();
}
@@ -94,7 +95,11 @@ public class HostVncConfigStrategy extends AbstractHostConfigStrategy<HostVncCon
afterModel.setAuthType(HostAuthTypeEnum.PASSWORD.name());
}
// 加密密码
this.checkEncryptPassword(afterModel.getAuthType(), beforeModel, afterModel);
if (Booleans.isTrue(afterModel.getNoPassword())) {
afterModel.setPassword(beforeModel.getPassword());
} else {
this.checkEncryptPassword(afterModel.getAuthType(), beforeModel, afterModel);
}
afterModel.setHasPassword(null);
afterModel.setUseNewPassword(null);
}

View File

@@ -277,6 +277,9 @@ public class TerminalConnectHandler extends AbstractTerminalHandler<ITerminalSen
} else if (TerminalConnectTypeEnum.RDP.name().equals(connectType)) {
// RDP
connectConfig = hostConnectApi.getRdpConnectConfig(host, userId);
} else if (TerminalConnectTypeEnum.VNC.name().equals(connectType)) {
// VNC
connectConfig = hostConnectApi.getVncConnectConfig(host, userId);
} else {
throw Exceptions.unsupported();
}

View File

@@ -632,7 +632,7 @@ body[terminal-theme='dark'] .arco-modal-container {
align-items: center;
justify-content: center;
:deep(> div) {
& > div {
position: relative;
z-index: 8;
}
@@ -647,7 +647,7 @@ body[terminal-theme='dark'] .arco-modal-container {
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
z-index: 30;
}
// guacd 工具栏

View File

@@ -96,12 +96,10 @@ export function formatSecond(second: number, p = 'HH:mm') {
/**
* 格式化持续时间
* @param start
* @param end
*/
export function formatDuration(start: number, end?: number): string {
export function formatDuration(start: number, end?: number, none: string = ''): string {
if (!end) {
return '';
return none;
}
const duration = (end - start) / 1000;
if (duration < 1) {

View File

@@ -1,4 +1,5 @@
import type { TableColumnData } from '@arco-design/web-vue';
import { formatDuration } from '@/utils';
export const logColumns = [
{
@@ -46,6 +47,16 @@ export const logColumns = [
align: 'left',
ellipsis: true,
default: true,
}, {
title: '持续时间',
dataIndex: 'duration',
slotName: 'duration',
align: 'left',
width: 142,
render: ({ record }) => {
return formatDuration(record.startTime, record.endTime, '-');
},
default: true,
}, {
title: '连接时间',
dataIndex: 'connectTime',

View File

@@ -11,10 +11,18 @@
</a-button>
<a-button type="primary"
size="small"
title="仅将文本发送到远程剪切板"
:disabled="!clipboardData"
@click="sendClipboardData">
@click="sendClipboardData(false)">
发送
</a-button>
<a-button type="primary"
size="small"
title="将文本发送到远程剪切板并执行粘贴操作"
:disabled="!clipboardData"
@click="sendClipboardData(true)">
粘贴
</a-button>
</a-space>
</template>
@@ -38,8 +46,8 @@
const clipboardData = ref('');
// 发送剪切板数据
const sendClipboardData = () => {
props.session.paste(clipboardData.value);
const sendClipboardData = (sendPaste: boolean) => {
props.session.paste(clipboardData.value, sendPaste);
emits('close');
};

View File

@@ -176,7 +176,7 @@ export interface IGuacdSession extends ITerminalSession<GuacdReactiveSessionStat
// 发送键
sendKeys: (keys: Array<number>) => void;
// 粘贴
paste: (data: string) => void;
paste: (data: string, sendPaste: boolean) => void;
}
// RDP 会话定义

View File

@@ -141,16 +141,18 @@ export default abstract class BaseGuacdSession extends BaseSession<GuacdReactive
}
// 粘贴
paste(data: string): void {
paste(data: string, sendPaste: boolean): void {
if (!this.isWriteable()) {
return;
}
// 发送至远程剪切板
this.clipboardHandler?.sendDataToRemoteClipboard(data);
// 发送粘贴命令
setTimeout(() => {
this.sendKeys([65507, 118]);
}, 100);
if (sendPaste) {
setTimeout(() => {
this.sendKeys([65507, 118]);
}, 100);
}
}
// 聚焦