🔨 会话关闭中断传输记录.

This commit is contained in:
lijiahangmax
2025-06-28 20:48:44 +08:00
parent eb81a030e3
commit 4bdefc6194
7 changed files with 3 additions and 128 deletions

View File

@@ -49,7 +49,4 @@ public class AppInfoVO implements Serializable {
@Schema(description = "系统版本")
private String version;
@Schema(description = "机器码")
private String uuid;
}

View File

@@ -45,7 +45,6 @@ import org.dromara.visor.module.infra.entity.request.system.SystemSettingUpdateR
import org.dromara.visor.module.infra.entity.vo.AppInfoVO;
import org.dromara.visor.module.infra.entity.vo.RsaKeyPairVO;
import org.dromara.visor.module.infra.service.SystemSettingService;
import org.dromara.visor.module.infra.utils.SystemUuidUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -73,7 +72,6 @@ public class SystemSettingServiceImpl implements SystemSettingService {
public AppInfoVO getAppInfo() {
return AppInfoVO.builder()
.version(AppConst.VERSION)
.uuid(SystemUuidUtils.getSystemUuid())
.build();
}

View File

@@ -1,114 +0,0 @@
/*
* 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.infra.utils;
import cn.orionsec.kit.ext.process.ProcessAwaitExecutor;
import cn.orionsec.kit.lang.support.Attempt;
import cn.orionsec.kit.lang.utils.Arrays1;
import cn.orionsec.kit.lang.utils.Strings;
import cn.orionsec.kit.lang.utils.crypto.Signatures;
import cn.orionsec.kit.lang.utils.io.Streams;
import org.dromara.visor.common.constant.Const;
import java.io.ByteArrayOutputStream;
/**
* 系统 UUID 工具类
*
* @author Jiahang Li
* @version 1.0.0
* @since 2025/1/16 11:07
*/
public class SystemUuidUtils {
private static String uuid;
private SystemUuidUtils() {
}
/**
* 获取系统 uuid
*
* @return uuid
*/
public static String getSystemUuid() {
if (SystemUuidUtils.uuid != null) {
return SystemUuidUtils.uuid;
}
String[][] cmd = new String[][]{
new String[]{"/bin/sh", "-c", "cat /sys/class/dmi/id/product_serial"},
new String[]{"/bin/bash", "-c", "cat /sys/class/dmi/id/product_serial"},
new String[]{"/bin/sh", "-c", "dmidecode -s system-uuid"},
new String[]{"/bin/bash", "-c", "dmidecode -s system-uuid"},
new String[]{"cmd", "/c", "wmic csproduct get uuid"}
};
for (String[] s : cmd) {
try {
String uuid = SystemUuidUtils.getCommandOutput(s);
if (Strings.isBlank(uuid)) {
continue;
}
// 去除符号并且转为大写
uuid = uuid.replaceAll(Const.DASHED, Const.EMPTY)
.toUpperCase()
.trim();
// 去除 \n
String extraUuid = Arrays1.last(uuid.trim().split(Const.LF));
if (!Strings.isBlank(extraUuid)) {
uuid = extraUuid.trim();
}
// 去除 :
extraUuid = Arrays1.last(uuid.trim().split(Const.COLON));
if (!Strings.isBlank(extraUuid)) {
uuid = extraUuid.trim();
}
return SystemUuidUtils.uuid = Signatures.md5(uuid);
} catch (Exception e) {
// IGNORED
}
}
return SystemUuidUtils.uuid = Const.UNKNOWN;
}
/**
* 获取输出结果
*
* @param command command
* @return result
*/
public static String getCommandOutput(String[] command) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
ProcessAwaitExecutor executor = new ProcessAwaitExecutor(command);
try {
executor.streamHandler(i -> Attempt.uncheck(Streams::transfer, i, out))
.waitFor()
.sync()
.exec();
return out.toString();
} finally {
Streams.close(out);
Streams.close(executor);
}
}
}

View File

@@ -15,7 +15,6 @@ export interface SystemSettingUpdateRequest {
*/
export interface AppInfoResponse {
version: string;
uuid: string;
}
/**

View File

@@ -61,6 +61,7 @@
<!-- RDP版本 -->
<a-form-item field="versionGt81"
label="RDP版本"
tooltip="RDP 8.1 及以上版本支持动态调整分辨率"
hide-asterisk>
<a-switch v-model="formModel.versionGt81"
type="round"

View File

@@ -6,12 +6,6 @@
:align="{ label: 'right', value: 'left' }"
:label-style="{ paddingTop: '2px', paddingLeft: '32px', verticalAlign: 'top' }"
:column="1">
<!-- 机器码 -->
<a-descriptions-item label="机器码">
<span class="text-copy uuid-wrapper" @click="copy(app.uuid, true)">
{{ app.uuid }}
</span>
</a-descriptions-item>
<!-- 当前前端版本 -->
<a-descriptions-item label="当前前端版本">
<!-- 前端版本 -->
@@ -66,7 +60,6 @@
const app = ref<AppInfoResponse>({
version: '',
uuid: '',
});
const repo = ref<AppReleaseResponse>({

View File

@@ -1,6 +1,6 @@
import type { IRdpTransferManager, IRdpSession } from '@/views/terminal/interfaces';
import type Guacamole from 'guacamole-common-js';
import { TerminalMessages } from '../../types/const';
import { TerminalMessages, TransferStatus } from '../../types/const';
import { Message } from '@arco-design/web-vue';
import BaseTransferManager from './base-transfer-manager';
import RdpFileDownloadTask from './rdp-file-download-task';
@@ -62,6 +62,7 @@ export default class RdpTransferManager extends BaseTransferManager implements I
// 通过 sessionKey 关闭
closeBySessionKey(sessionKey: string): void {
this.tasks.filter(s => s.sessionKey === sessionKey)
.filter(s => s.state.status === TransferStatus.WAITING || s.state.status === TransferStatus.TRANSFERRING)
.forEach(s => s.onError(TerminalMessages.sessionClosed));
}