🔨 添加 vnc 配置.

This commit is contained in:
lijiahangmax
2025-07-07 00:03:45 +08:00
parent e72a9d97cd
commit 4b25de3811
7 changed files with 240 additions and 1 deletions

5
docs/README.md Normal file
View File

@@ -0,0 +1,5 @@
## 文档已迁移至网页端
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn

View File

@@ -95,6 +95,16 @@ public class TerminalPreferenceModel implements GenericsDataModel {
*/
private JSONObject rdpActionBarSetting;
/**
* vnc 图形化设置
*/
private JSONObject vncGraphSetting;
/**
* vnc 操作栏设置
*/
private JSONObject vncActionBarSetting;
/**
* 快捷键设置
*/
@@ -297,6 +307,11 @@ public class TerminalPreferenceModel implements GenericsDataModel {
*/
private Integer scrollBackLine;
/**
* 替换退格符
*/
private Boolean replaceBackspace;
}
@Data
@@ -481,6 +496,97 @@ public class TerminalPreferenceModel implements GenericsDataModel {
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class VncGraphSettingModel implements IJsonObject {
/**
* 显示大小
*/
private String displaySize;
/**
* 显示宽度
*/
private Integer displayWidth;
/**
* 显示高度
*/
private Integer displayHeight;
/**
* 颜色深度
*/
private Integer colorDepth;
/**
* 无损压缩
*/
private Boolean forceLossless;
/**
* 交换红蓝
*/
private Boolean swapRedBlue;
/**
* 光标
*/
private String cursor;
/**
* 质量等级
*/
private Integer compressLevel;
/**
* 压缩等级
*/
private Integer qualityLevel;
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class VncActionBarSettingModel implements IJsonObject {
/**
* 位置
*/
private String position;
/**
* 显示设置
*/
private Boolean display;
/**
* 组合键
*/
private Boolean combinationKey;
/**
* 剪切板
*/
private Boolean clipboard;
/**
* 断开连接
*/
private Boolean disconnect;
/**
* 关闭
*/
private Boolean close;
}
@Data
@Builder
@NoArgsConstructor

View File

@@ -68,6 +68,10 @@ public class TerminalPreferenceStrategy extends AbstractGenericsDataStrategy<Ter
.rdpActionBarSetting(JSONObject.parseObject(this.getDefaultRdpActionBarSetting()))
// rdp 会话设置
.rdpSessionSetting(JSONObject.parseObject(this.getDefaultRdpSessionSetting()))
// vnc 图形化设置
.vncGraphSetting(JSONObject.parseObject(this.getDefaultVncGraphSetting()))
// vnc 图形化设置
.vncActionBarSetting(JSONObject.parseObject(this.getDefaultVncSessionSetting()))
// 快捷键设置
.shortcutSetting(JSONObject.parseObject(this.getDefaultShortcutSetting()))
.build();
@@ -148,6 +152,7 @@ public class TerminalPreferenceStrategy extends AbstractGenericsDataStrategy<Ter
.wordSeparator("/\\()\"'` -.,:;<>~!@#$%^&*|+=[]{}~?│")
.terminalEmulationType(TerminalType.XTERM.getType())
.scrollBackLine(1000)
.replaceBackspace(false)
.build()
.toJsonString();
}
@@ -226,6 +231,43 @@ public class TerminalPreferenceStrategy extends AbstractGenericsDataStrategy<Ter
.toJsonString();
}
/**
* 获取 vnc 图形化默认设置
*
* @return setting
*/
private String getDefaultVncGraphSetting() {
return TerminalPreferenceModel.VncGraphSettingModel.builder()
.displaySize("fit")
.displayWidth(0)
.displayHeight(0)
.colorDepth(24)
.forceLossless(true)
.swapRedBlue(false)
.cursor("local")
.compressLevel(5)
.qualityLevel(5)
.build()
.toJsonString();
}
/**
* 获取 vnc 工具栏默认设置
*
* @return setting
*/
private String getDefaultVncSessionSetting() {
return TerminalPreferenceModel.VncActionBarSettingModel.builder()
.position("top")
.display(true)
.combinationKey(true)
.clipboard(true)
.disconnect(true)
.close(true)
.build()
.toJsonString();
}
/**
* 获取默认快捷键设置
*

View File

@@ -24,9 +24,11 @@ package org.dromara.visor.module.terminal.convert;
import org.dromara.visor.common.session.config.RdpConnectConfig;
import org.dromara.visor.common.session.config.SshConnectConfig;
import org.dromara.visor.common.session.config.VncConnectConfig;
import org.dromara.visor.module.terminal.handler.terminal.model.config.TerminalSessionRdpConfig;
import org.dromara.visor.module.terminal.handler.terminal.model.config.TerminalSessionSftpConfig;
import org.dromara.visor.module.terminal.handler.terminal.model.config.TerminalSessionSshConfig;
import org.dromara.visor.module.terminal.handler.terminal.model.config.TerminalSessionVncConfig;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@@ -48,4 +50,6 @@ public interface TerminalSessionConvert {
TerminalSessionRdpConfig toRdp(RdpConnectConfig domain);
TerminalSessionVncConfig toVnc(VncConnectConfig domain);
}

View File

@@ -138,4 +138,24 @@ public class TerminalChannelExtra {
// -------------------- vnc --------------------
/**
* 交换红蓝
*/
private Boolean swapRedBlue;
/**
* 光标
*/
private String cursor;
/**
* 压缩等级
*/
private Integer compressLevel;
/**
* 质量等级
*/
private Integer qualityLevel;
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.terminal.handler.terminal.model.config;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.dromara.visor.common.session.config.VncConnectConfig;
/**
* 终端会话配置 VNC
*
* @author Jiahang Li
* @version 1.0.0
* @since 2025/6/24 17:08
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class TerminalSessionVncConfig extends VncConnectConfig implements ITerminalSessionConfig {
@Schema(description = "logId")
private Long logId;
@Schema(description = "录屏文件路径")
private String recordPath;
@Schema(description = "")
private Integer width;
@Schema(description = "")
private Integer height;
@Schema(description = "dpi")
private Integer dpi;
}