Skip to content

Commit

Permalink
Merge pull request #55 from dromara/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
lijiahangmax committed Sep 2, 2024
2 parents 120eb1e + fd88c72 commit f73fa14
Show file tree
Hide file tree
Showing 143 changed files with 1,136 additions and 655 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

## 演示环境

* 🔗 演示地址: http://101.43.254.243:1081/
* 🔗 演示地址: https://dv.orionsec.cn/
* 🔏 演示账号: admin/admin
* ⭐ 体验后可以点一下 `star` 这对我很重要! [github](https://github.com/dromara/orion-visor) [gitee](https://gitee.com/dromara/orion-visor) [gitcode](https://gitcode.com/dromara/orion-visor/overview)
* 🌈 如果本项目对你有帮助请帮忙推广一下 让更多的人知道此项目!
Expand All @@ -72,11 +72,11 @@ docker compose up -d

## 项目文档

* [文档地址](https://lijiahangmax.github.io/open-orion/orion-visor/)
* [安装文档](https://lijiahangmax.github.io/open-orion/orion-visor/quickstart/docker.html)
* [更新日志](https://lijiahangmax.github.io/open-orion/orion-visor/update/change-log.html)
* [操作手册](https://lijiahangmax.github.io/open-orion/orion-visor/operator/asset.html)
* [常见问题](https://lijiahangmax.github.io/open-orion/orion-visor/support/faq.html)
* [文档地址](https://visor.orionsec.cn/)
* [安装文档](https://visor.orionsec.cn/quickstart/docker.html)
* [更新日志](https://visor.orionsec.cn/update/change-log.html)
* [操作手册](https://visor.orionsec.cn/operator/asset.html)
* [常见问题](https://visor.orionsec.cn/support/faq.html)

## 技术栈

Expand Down
6 changes: 3 additions & 3 deletions docker-compose-testing.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.3'
services:
service:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.1.4
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.1.5
privileged: true
ports:
- 1081:80
Expand Down Expand Up @@ -32,7 +32,7 @@ services:
- mysql
- redis
mysql:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.1.4
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.1.5
privileged: true
ports:
- 3307:3306
Expand All @@ -52,7 +52,7 @@ services:
retries: 10
start_period: 3s
redis:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.1.4
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.1.5
privileged: true
ports:
- 6380:6379
Expand Down
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.3'
services:
service:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.1.4
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.1.5
privileged: true
ports:
- ${SERVICE_PORT:-1081}:80
Expand Down Expand Up @@ -32,7 +32,7 @@ services:
- mysql
- redis
mysql:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.1.4
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.1.5
privileged: true
ports:
- 3307:3306
Expand All @@ -52,7 +52,7 @@ services:
retries: 15
start_period: 3s
redis:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.1.4
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.1.5
privileged: true
ports:
- 6380:6379
Expand All @@ -68,7 +68,7 @@ services:
retries: 15
start_period: 3s
adminer:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-adminer:2.1.4
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-adminer:2.1.5
ports:
- 8081:8080
depends_on:
Expand Down
2 changes: 1 addition & 1 deletion docker/adminer/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#/bin/bash
version=2.1.4
version=2.1.5
docker build -t orion-visor-adminer:${version} .
docker tag orion-visor-adminer:${version} registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-adminer:${version}
4 changes: 2 additions & 2 deletions docker/e2e/testsuite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ items:
code: 200
- name: userPermission
request:
api: /orion-visor/api/infra/permission/user
api: /orion-visor/api/infra/user-permission/user
header:
Authorization: Bearer {{.login.data.token}}
expect:
Expand All @@ -26,7 +26,7 @@ items:
msg: "success"
- name: menu
request:
api: /orion-visor/api/infra/permission/menu
api: /orion-visor/api/infra/user-permission/menu
header:
Authorization: Bearer {{.login.data.token}}
expect:
Expand Down
2 changes: 1 addition & 1 deletion docker/mysql/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#/bin/bash
version=2.1.4
version=2.1.5
cp -r ../../sql ./sql
docker build -t orion-visor-mysql:${version} .
rm -rf ./sql
Expand Down
2 changes: 1 addition & 1 deletion docker/push.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#/bin/bash
version=2.1.4
version=2.1.5
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-adminer:${version}
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:${version}
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
Expand Down
2 changes: 1 addition & 1 deletion docker/redis/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#/bin/bash
version=2.1.4
version=2.1.5
docker build -t orion-visor-redis:${version} .
docker tag orion-visor-redis:${version} registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
2 changes: 1 addition & 1 deletion docker/service/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#/bin/bash
version=2.1.4
version=2.1.5
mv ../../orion-visor-launch/target/orion-visor-launch.jar ./orion-visor-launch.jar
mv ../../orion-visor-ui/dist ./dist
docker build -t orion-visor-service:${version} .
Expand Down
2 changes: 1 addition & 1 deletion orion-visor-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<url>https://github.com/dromara/orion-visor</url>

<properties>
<revision>2.1.4</revision>
<revision>2.1.5</revision>
<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>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public interface AppConst extends OrionConst {
/**
* 同 ${orion.version} 迭代时候需要手动更改
*/
String VERSION = "2.1.4";
String VERSION = "2.1.5";

/**
* 同 ${spring.application.name}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ public interface Const extends com.orion.lang.constant.Const, FieldConst, CnCons

String SYSTEM_USERNAME = "system";

int BATCH_COUNT = 500;

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.orion.visor.framework.common.constant;

import com.orion.lang.exception.ApplicationException;
import com.orion.lang.exception.argument.InvalidArgumentException;

/**
* 错误信息
*
Expand Down Expand Up @@ -97,6 +100,14 @@ public interface ErrorMessage {

String TASK_ABSENT = "任务不存在";

String CONNECT_ERROR = "连接失败";

String AUTH_ERROR = "认证失败";

String SCRIPT_UPLOAD_ERROR = "脚本上传失败";

String EXEC_ERROR = "执行失败";

String ILLEGAL_STATUS = "当前状态不支持此操作";

String CHECK_AUTHORIZED_HOST = "请选择已授权的主机";
Expand All @@ -111,4 +122,41 @@ public interface ErrorMessage {

String UNABLE_DOWNLOAD_FOLDER = "无法下载文件夹";

/**
* 是否为业务异常
*
* @param ex ex
* @return biz exception
*/
static boolean isBizException(Exception ex) {
if (ex == null) {
return false;
}
return ex instanceof InvalidArgumentException
|| ex instanceof IllegalArgumentException
|| ex instanceof ApplicationException;
}

/**
* 获取错误信息
*
* @param ex ex
* @param defaultMsg defaultMsg
* @return message
*/
static String getErrorMessage(Exception ex, String defaultMsg) {
if (ex == null) {
return null;
}
String message = ex.getMessage();
if (message == null) {
return defaultMsg;
}
// 业务异常
if (isBizException(ex)) {
return message;
}
return defaultMsg;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.orion.visor.framework.common.entity;

/**
* 数据清理请求 定义
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/8/29 11:26
*/
public interface DataClearRequest {

/**
* 获取清理数量限制
*
* @return 清理限制
*/
Integer getLimit();

/**
* 设置清理数量限制
*
* @param limit limit
*/
void setLimit(Integer limit);

}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.orion.visor.framework.common.entity;

import com.orion.lang.define.wrapper.IPageRequest;
import com.orion.visor.framework.common.validator.group.Page;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

/**
* 公共页码请求
Expand All @@ -15,14 +17,18 @@
*/
@Data
@Schema(description = "公共页码请求")
public class PageRequest implements IPageRequest {
public class PageRequest {

@Range(min = 1, max = 10000, groups = Page.class)
@NotNull(groups = Page.class)
@Min(value = 1, groups = Page.class)
@Max(value = 10000, groups = Page.class)
@Schema(description = "页码")
private int page;
private Integer page;

@Range(min = 1, max = 200, groups = Page.class)
@NotNull(groups = Page.class)
@Min(value = 1, groups = Page.class)
@Max(value = 200, groups = Page.class)
@Schema(description = "大小")
private int limit;
private Integer limit;

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ private IpUtils() {
* @return addr
*/
public static String getRemoteAddr(HttpServletRequest request) {
// 获取实际地址
String realIp = request.getHeader(StandardHttpHeader.X_REAL_IP);
if (!Strings.isBlank(realIp)) {
return realIp;
}
// 获取实际地址 X_REAL_IP 在多代理情况下会有问题
// String realIp = request.getHeader(StandardHttpHeader.X_REAL_IP);
// if (!Strings.isBlank(realIp)) {
// return realIp;
// }
// 获取请求地址
return Servlets.getRemoteAddr(request);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.orion.visor.framework.common.utils;

import com.orion.visor.framework.common.constant.Const;

/**
* sql 工具类
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/8/26 16:03
*/
public class SqlUtils {

private SqlUtils() {
}

/**
* limit n
*
* @param limit limit
* @return limit
*/
public static String limit(Number limit) {
return Const.LIMIT + Const.SPACE + limit;
}

/**
* limit offset limit
*
* @param offset offset
* @param limit limit
* @return limit
*/
public static String limit(Number offset, Number limit) {
return Const.LIMIT + Const.SPACE + offset + Const.COMMA + limit;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import javax.validation.ConstraintViolationException;
import javax.validation.Validator;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;

Expand All @@ -31,6 +32,10 @@ public static String notBlank(String s) {
return notBlank(s, ErrorMessage.PARAM_MISSING);
}

public static <T extends Map<?, ?>> T notEmpty(T map) {
return notEmpty(map, ErrorMessage.PARAM_MISSING);
}

public static <T extends Collection<?>> T notEmpty(T object) {
return notEmpty(object, ErrorMessage.PARAM_MISSING);
}
Expand Down
Loading

0 comments on commit f73fa14

Please sign in to comment.