⬆️ 升级 orion kit 版本.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
SERVICE_PORT=1081
|
||||
VOLUME_BASE=/data/orion-visor-space/docker-volumes
|
||||
|
||||
MYSQL_HOST=mysql
|
||||
MYSQL_PORT=3306
|
||||
MYSQL_DATABASE=orion_visor
|
||||
@@ -10,4 +11,5 @@ MYSQL_ROOT_PASSWORD=Data@123456
|
||||
REDIS_HOST=redis
|
||||
REDIS_PASSWORD=Data@123456
|
||||
|
||||
SECRET_KEY=uQeacXV8b3isvKLK
|
||||
SECRET_KEY=uQeacXV8b3isvKLK
|
||||
DEMO_MODE=false
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
docker compose down
|
||||
# demo 启动
|
||||
if [ "$1" == "demo" ]; then
|
||||
sed -i 's/DEMO_MODE=false/DEMO_MODE=true/g' docker-compose.yml
|
||||
sed -i 's/\${DEMO_MODE:-false}/true/g' docker-compose.yml
|
||||
fi
|
||||
docker compose up -d --remove-orphans
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<spring.boot.version>2.7.17</spring.boot.version>
|
||||
<spring.boot.admin.version>2.7.15</spring.boot.admin.version>
|
||||
<flatten.maven.plugin.version>1.5.0</flatten.maven.plugin.version>
|
||||
<orion.kit.version>1.0.7</orion.kit.version>
|
||||
<orion.kit.version>1.0.8</orion.kit.version>
|
||||
<aspectj.version>1.9.7</aspectj.version>
|
||||
<lombok.version>1.18.26</lombok.version>
|
||||
<springdoc.version>1.6.15</springdoc.version>
|
||||
|
||||
@@ -34,9 +34,6 @@ public class CommandSnippetCacheDTO implements LongCacheIdModel, Serializable {
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "触发前缀")
|
||||
private String prefix;
|
||||
|
||||
@Schema(description = "代码片段")
|
||||
private String command;
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.orion.visor.module.asset.entity.dto;
|
||||
|
||||
import com.orion.visor.framework.desensitize.core.annotation.DesensitizeObject;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 主机终端传输参数
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/12/26 15:47
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@DesensitizeObject
|
||||
@Schema(name = "HostTerminalTransferDTO", description = "主机终端传输参数")
|
||||
public class HostTerminalTransferDTO {
|
||||
|
||||
@Schema(description = "userId")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "username")
|
||||
private String username;
|
||||
|
||||
}
|
||||
@@ -33,9 +33,6 @@ public class CommandSnippetVO implements Serializable {
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "触发前缀")
|
||||
private String prefix;
|
||||
|
||||
@Schema(description = "代码片段")
|
||||
private String command;
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.utils.Valid;
|
||||
import com.orion.visor.module.asset.handler.host.terminal.model.TerminalConfig;
|
||||
import com.orion.visor.module.asset.handler.host.terminal.model.response.SftpFileVO;
|
||||
import com.orion.visor.module.asset.utils.SftpUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.socket.WebSocketSession;
|
||||
|
||||
@@ -84,9 +83,7 @@ public class SftpSession extends TerminalSession implements ISftpSession {
|
||||
public void move(String source, String target) {
|
||||
source = Valid.checkNormalize(source);
|
||||
// 移动
|
||||
SftpUtils.move(executor, source, target);
|
||||
// FIXME kit
|
||||
// executor.move(source, target);
|
||||
executor.move(source, target);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,9 +2,7 @@ package com.orion.visor.module.asset.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.orion.lang.utils.Booleans;
|
||||
import com.orion.lang.utils.Exceptions;
|
||||
import com.orion.lang.utils.Strings;
|
||||
import com.orion.lang.utils.io.Files1;
|
||||
import com.orion.net.host.sftp.SftpExecutor;
|
||||
import com.orion.net.host.sftp.SftpFile;
|
||||
import com.orion.visor.module.asset.define.config.AppSftpConfig;
|
||||
@@ -41,49 +39,8 @@ public class SftpUtils {
|
||||
SftpFileBackupParams backupParams = new SftpFileBackupParams(file.getName(), System.currentTimeMillis());
|
||||
String target = Strings.format(config.getBackupFileName(), JSON.parseObject(JSON.toJSONString(backupParams)));
|
||||
// 移动
|
||||
// FIXME kit
|
||||
move(executor, path, target);
|
||||
// executor.move(path, target);
|
||||
executor.move(path, target);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移动文件
|
||||
* FIXME kit DELETE
|
||||
*
|
||||
* @param executor executor
|
||||
* @param source source
|
||||
* @param target target
|
||||
*/
|
||||
public static void move(SftpExecutor executor, String source, String target) {
|
||||
try {
|
||||
source = Files1.getPath(source);
|
||||
target = Files1.getPath(target);
|
||||
if (target.charAt(0) == '/') {
|
||||
// 检查是否需要创建目标文件目录
|
||||
if (!isSameParentPath(source, target)) {
|
||||
executor.makeDirectories(Files1.getParentPath(target));
|
||||
}
|
||||
// 绝对路径
|
||||
executor.getChannel().rename(source, Files1.getPath(Files1.normalize(target)));
|
||||
} else {
|
||||
// 相对路径
|
||||
executor.getChannel().rename(source, Files1.getPath(Files1.normalize(Files1.getPath(source + "/../" + target))));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw Exceptions.sftp(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* FIXME kit DELETE
|
||||
*
|
||||
* @param source source
|
||||
* @param target target
|
||||
* @return res
|
||||
*/
|
||||
private static boolean isSameParentPath(String source, String target) {
|
||||
return Files1.getParentPath(source).equals(Files1.getParentPath(target));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user