mirror of
https://gitee.com/dromara/Jpom.git
synced 2024-11-29 18:38:32 +08:00
Merge branch 'dev'
# Conflicts: # .gitee/ISSUE_TEMPLATE/bug.yml # .gitee/ISSUE_TEMPLATE/config.yaml
This commit is contained in:
commit
733672ff9a
@ -201,3 +201,7 @@ dist
|
||||
.yarn/build-state.yml
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
|
||||
.git
|
||||
modules/server/logs
|
||||
modules/agent/logs
|
||||
|
@ -1,3 +1,26 @@
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2019 Code Technology Studio
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
# this software and associated documentation files (the "Software"), to deal in
|
||||
# the Software without restriction, including without limitation the rights to
|
||||
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
# the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
# subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Jpom 官方文档
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -31,6 +31,7 @@ yarn-error.log
|
||||
.idea
|
||||
yarn.lock
|
||||
package-lock.json
|
||||
pnpm-lock.yaml
|
||||
*bak
|
||||
pom.xml.versionsBackup
|
||||
#.vscode
|
||||
|
@ -1,5 +1,92 @@
|
||||
# 🚀 版本日志
|
||||
|
||||
### 2.10.42.5-beta
|
||||
|
||||
### 🐣 新增功能
|
||||
|
||||
1. 【server】新增 集群化管理工作空间(感谢@定格、[@paobu](https://gitee.com/iniushi) [Gitee issues I7UG5V](https://gitee.com/dromara/Jpom/issues/I7UG5V))
|
||||
|
||||
### 🐞 解决BUG、优化功能
|
||||
|
||||
1. 【server】修复 资产管理 SSH 管理系统名称显示未知问题(感谢@勤思·)
|
||||
2. 【server】优化 资产管理 Docker 管理支持配置分组
|
||||
3. 【server】优化 仓库管理支持配置分组
|
||||
4. 【server】优化 SSH 文件夹支持前端排序(感谢@勤思·)
|
||||
|
||||
------
|
||||
|
||||
### 2.10.42.4-beta (2023-08-19)
|
||||
|
||||
### 🐣 新增功能
|
||||
|
||||
1. 【server】优化 ssh 相关功能支持 openssh8+
|
||||
(感谢 [@孤城落寞](https://gitee.com/gclm) [Gitee pr 193](https://gitee.com/dromara/Jpom/pulls/193) )
|
||||
|
||||
### 🐞 解决BUG、优化功能
|
||||
|
||||
1. 【server】优化 仓库账号、 SSH 证书密码支持选择环境变量
|
||||
2. 【all】升级 commons-compress、fastjson、hutool 版本
|
||||
3. 【server】优化 maven 依赖冲突
|
||||
4. 【server】优化 文件发布-节点发布文件名使用真实名称(感谢@勤思·)
|
||||
5. 【server】优化 文件发布-ssh发布新增变量:FILE_NAME、FILE_EXT_NAME
|
||||
|
||||
------
|
||||
|
||||
### 2.10.42.3-beta (2023-08-04)
|
||||
|
||||
### 🐣 新增功能
|
||||
|
||||
1. 【server】新增 SSH
|
||||
文件管理修改文件权限功能(感谢 [@MichelleChung](https://gitee.com/michelle1028) [Gitee issues I6VDXS](https://gitee.com/dromara/Jpom/issues/I6VDXS) )
|
||||
|
||||
### 🐞 解决BUG、优化功能
|
||||
|
||||
1. 【server】升级 h2、SpringBoot 版本
|
||||
2. 【server】使用系统git时,无法克隆tag问题优化 (感谢@唐明)
|
||||
3. 【server】优化 SSH 和 代码仓库的密码从工作空间变量中读取
|
||||
|
||||
------
|
||||
|
||||
### 2.10.42.2-beta (2023-07-04)
|
||||
|
||||
### 🐣 新增功能
|
||||
|
||||
1. 【server】新增 Docker 容器重建功能,即删除原有的容器,重新创建一个新的容器
|
||||
|
||||
### 🐞 解决BUG、优化功能
|
||||
|
||||
1. 【server】优化
|
||||
删除工作空间前预检查关联数据存在情况(感谢 [@陈旭](https://gitee.com/chenxu8989) [Gitee issues I7F0ZN](https://gitee.com/dromara/Jpom/issues/I7F0ZN) )
|
||||
2. 【server】优化
|
||||
退出登录支持彻底退出、切换账号退出(感谢 [@wangfubiao](https://gitee.com/wangfubiao) [Gitee issues I7GA5Q](https://gitee.com/dromara/Jpom/issues/I7GA5Q) )
|
||||
3. 【server】优化 IP 白名单验证忽略 IPV6 情况
|
||||
4. 【server】优化 服务端缓存管理支持查看黑名单 IP 详细信息(感谢@酱总)
|
||||
|
||||
------
|
||||
|
||||
### 2.10.42.1-beta (2023-06-26)
|
||||
|
||||
### 🐣 新增功能
|
||||
|
||||
1. 【server】新增 Docker 管理增加 SSH 连接
|
||||
|
||||
### 🐞 解决BUG、优化功能
|
||||
|
||||
1. 【server】修复 SSH
|
||||
编辑输入框出现部分关键词时保持报错(感谢 [@一只羊](https://gitee.com/hjdyzy) [Gitee issues I7E3UG](https://gitee.com/dromara/Jpom/issues/I7E3UG) )
|
||||
2. 【server】优化 日志组件支持显示 \t 制表符、清空缓冲区滚动到顶部
|
||||
3. 【server】修复 彻底删除节点分发时未自动删除关联日志(感谢@ccx2480)
|
||||
4. 【server】修复
|
||||
节点管理中脚本模板翻页无效(感谢 [@wangfubiao](https://gitee.com/wangfubiao) [Gitee issues I7F0RS](https://gitee.com/dromara/Jpom/issues/I7F0RS) )
|
||||
5. 【server】优化
|
||||
工作空间配置页面中新增节点分发白名单配置入口(感谢 [@陈旭](https://gitee.com/chenxu8989) [Gitee issues I7F0W0](https://gitee.com/dromara/Jpom/issues/I7F0W0) )
|
||||
6. 【server】优化 构建附加环境变量支持解析 URL 参数格式
|
||||
(感谢 [@爱琳琳真是太好了](https://gitee.com/qiqi513_admin) [Gitee issues I7FROG](https://gitee.com/dromara/Jpom/issues/I7FROG) )
|
||||
7. 【server】优化 构建支持单个配置保留天数和保留个数
|
||||
(感谢 [@阿超](https://gitee.com/VampireAchao) [Gitee issues I7FOG2](https://gitee.com/dromara/Jpom/issues/I7FOG2) )
|
||||
|
||||
------
|
||||
|
||||
### 2.10.41.3-beta (2023-06-12)
|
||||
|
||||
### 🐣 新增功能
|
||||
@ -16,7 +103,8 @@
|
||||
4. 【server】优化 页面滚动条样式
|
||||
5. 【server】优化 编辑关联分发,选择项目下拉框不能显示项目全名称(tooltip)(感谢@LYY)
|
||||
6. 【server】优化 监听页面关闭事件,主动关闭 websocket
|
||||
7. 【server】修复 批量构建触发器无法正常使用(感谢 [@botboy](https://github.com/cheakin) [Github issues 48](https://github.com/dromara/Jpom/issues/48) )
|
||||
7. 【server】修复
|
||||
批量构建触发器无法正常使用(感谢 [@botboy](https://github.com/cheakin) [Github issues 48](https://github.com/dromara/Jpom/issues/48) )
|
||||
|
||||
### ⚠️ 注意
|
||||
|
||||
@ -50,8 +138,10 @@
|
||||
|
||||
1. 【server】优化 资产管理支持管理共享仓库
|
||||
2. 【server】优化 增大验证码检测功能异常捕捉范围
|
||||
3. 【server】修复 令牌导入仓库令牌长度不足问题(感谢 [@Sherman Chu](https://github.com/yeliulee) [Github issues 45](https://github.com/dromara/Jpom/issues/45) )
|
||||
4. 【server】修复 分发列表配置功能无法使用(感谢 [@Free](https://gitee.com/fjlyy321) [Gitee issues I716UI](https://gitee.com/dromara/Jpom/issues/I716UI) )
|
||||
3. 【server】修复
|
||||
令牌导入仓库令牌长度不足问题(感谢 [@Sherman Chu](https://github.com/yeliulee) [Github issues 45](https://github.com/dromara/Jpom/issues/45) )
|
||||
4. 【server】修复
|
||||
分发列表配置功能无法使用(感谢 [@Free](https://gitee.com/fjlyy321) [Gitee issues I716UI](https://gitee.com/dromara/Jpom/issues/I716UI) )
|
||||
5. 【server】修复 构建卡片布局、构建详情中构建方式显示不正确(感谢@A)
|
||||
|
||||
------
|
||||
@ -60,8 +150,10 @@
|
||||
|
||||
### 🐞 解决BUG、优化功能
|
||||
|
||||
1. 【server】修复 仓库编辑清除密码按钮弹窗层级问题(感谢 [@轩辕豆豆](https://gitee.com/xuanyuandoudou) [Gitee issues I6VSCR](https://gitee.com/dromara/Jpom/issues/I6VSCR) )
|
||||
2. 【server】修复 优化构建列表卡片布局存在未构建数据布局错乱问题(感谢 [@lin_yeqi](https://gitee.com/lin_yeqi) [Gitee issues I6VUB7](https://gitee.com/dromara/Jpom/issues/I6VUB7) )
|
||||
1. 【server】修复
|
||||
仓库编辑清除密码按钮弹窗层级问题(感谢 [@轩辕豆豆](https://gitee.com/xuanyuandoudou) [Gitee issues I6VSCR](https://gitee.com/dromara/Jpom/issues/I6VSCR) )
|
||||
2. 【server】修复
|
||||
优化构建列表卡片布局存在未构建数据布局错乱问题(感谢 [@lin_yeqi](https://gitee.com/lin_yeqi) [Gitee issues I6VUB7](https://gitee.com/dromara/Jpom/issues/I6VUB7) )
|
||||
|
||||
------
|
||||
|
||||
@ -69,7 +161,7 @@
|
||||
|
||||
### 🐞 解决BUG、优化功能
|
||||
|
||||
1. 【server】修复 在线更新无法正常使用
|
||||
1. 【server】修复 在线更新无法正常使用
|
||||
|
||||
------
|
||||
|
||||
@ -77,7 +169,8 @@
|
||||
|
||||
### 🐣 新增功能
|
||||
|
||||
1. 【server】新增 容器构建中对 gradle 插件的支持(感谢 [@xiaozhi](https://gitee.com/XiaoZhiGongChengShi) [Gitee pr 188](https://gitee.com/dromara/Jpom/pulls/188) )
|
||||
1. 【server】新增 容器构建中对 gradle
|
||||
插件的支持(感谢 [@xiaozhi](https://gitee.com/XiaoZhiGongChengShi) [Gitee pr 188](https://gitee.com/dromara/Jpom/pulls/188) )
|
||||
|
||||
### 🐞 解决BUG、优化功能
|
||||
|
||||
@ -97,7 +190,8 @@
|
||||
|
||||
1. 【server】修复 清空浏览器缓存未跳转到登录页面
|
||||
2. 【server】优化 构建拉取 git 仓库支持使用服务器中的 git 插件,实现配置克隆深度参数
|
||||
3. 【server】修复 删除节点脚本报错(感谢 [@xiaozhi](https://gitee.com/XiaoZhiGongChengShi) [Gitee issues I6USMY](https://gitee.com/dromara/Jpom/issues/I6USMY) )
|
||||
3. 【server】修复
|
||||
删除节点脚本报错(感谢 [@xiaozhi](https://gitee.com/XiaoZhiGongChengShi) [Gitee issues I6USMY](https://gitee.com/dromara/Jpom/issues/I6USMY) )
|
||||
|
||||
------
|
||||
|
||||
@ -141,7 +235,6 @@
|
||||
|
||||
------
|
||||
|
||||
|
||||
### 2.10.39.4-beta (2023-04-03)
|
||||
|
||||
### 🐞 解决BUG、优化功能
|
||||
@ -196,7 +289,6 @@
|
||||
|
||||
### 2.10.38.10-beta (2023-03-30)
|
||||
|
||||
|
||||
### 🐞 解决BUG、优化功能
|
||||
|
||||
1. 【server】修复 节点脚本支持全局共享同步节点、节点管理查看脚本重复问题(感谢@奇奇)
|
||||
@ -232,7 +324,7 @@
|
||||
|
||||
### 🐣 新增功能
|
||||
|
||||
1. 【server】新增 构建新增配置排除发布目录表达式(感谢@毛毛虫)
|
||||
1. 【server】新增 构建新增配置排除发布目录表达式(感谢@毛毛虫)
|
||||
|
||||
### 🐞 解决BUG、优化功能
|
||||
|
||||
@ -298,7 +390,8 @@
|
||||
|
||||
### 🐣 新增功能
|
||||
|
||||
1. 【server】新增 支持 oauth2 登录 (感谢 [@MaxKeyTop](https://gitee.com/maxkeytop_admin) [Gitee pr 183](https://gitee.com/dromara/Jpom/pulls/183) )
|
||||
1. 【server】新增 支持 oauth2 登录
|
||||
(感谢 [@MaxKeyTop](https://gitee.com/maxkeytop_admin) [Gitee pr 183](https://gitee.com/dromara/Jpom/pulls/183) )
|
||||
|
||||
### 🐞 解决BUG、优化功能
|
||||
|
||||
|
102
PLANS.md
102
PLANS.md
@ -3,60 +3,66 @@
|
||||
## 2.10.x
|
||||
|
||||
1. **构建流水线**
|
||||
2. **资产管理**
|
||||
2. **netty-agent**
|
||||
3. 凭证管理
|
||||
4. 升级 JDK 11 或者 17
|
||||
5. 端口监控、监控报警、机器监控、ssh 监控报警
|
||||
6. 资产监控
|
||||
7. nginx 流量切换(nginx 功能可能下线)
|
||||
8. acme.sh ui
|
||||
9. 执行审计
|
||||
10. 执行部分命令耗时和直接执行相差太大
|
||||
11. **非 root 用户提升权限写入 root 用户文件**
|
||||
12. 部分数据迁移工作空间(项目,构建,仓库、节点分发)
|
||||
13. 前端表格用户自定义列显示
|
||||
14. 前端升级 vue3
|
||||
15. `导入云效仓库 (zx) 依赖太重,非单接口实现(需要标准验证流程)`
|
||||
16. 节点取消,白名单配置和下载白名单(统一到服务端工作空间配置)
|
||||
17. ~~仓库~~、构建、分发、~~项目~~导入导出
|
||||
18. 隧道节点
|
||||
19. ~~docker 容器编辑重建(zx)~~
|
||||
20. 前端主题切换
|
||||
21. docker-compose sh
|
||||
22. ~~仓库密码、ssh 密码引用环境变量支持使用下拉框 sh~~
|
||||
23. 监控通知模块优化支持更多(飞书) zx
|
||||
24. SSH 修改文件权限 zx
|
||||
25. vue3 资产管理 zs
|
||||
26. vue3 用户管理 zs
|
||||
|
||||
### DONE
|
||||
|
||||
1. ~~SSH 连接 docker (sh)~~
|
||||
2. ~~批量删除镜像 (sh)~~
|
||||
3. **资产管理**
|
||||
1. ~~机器管理~~
|
||||
2. ~~机器监控~~
|
||||
3. ~~SSH 管理~~
|
||||
4. ~~dokcer 管理~~
|
||||
5. ~~docker 集群~~
|
||||
6. ~~ssh 监控~~
|
||||
7. 仓库管理(待定,可以和凭证管理一起考虑)
|
||||
3. netty-agent
|
||||
4. 凭证管理
|
||||
5. 升级 JDK 11 或者 17
|
||||
6. 端口监控、监控报警、机器监控、ssh 监控报警
|
||||
7. nginx 流量切换
|
||||
8. acme.sh ui
|
||||
9. 执行审计
|
||||
10. 执行部分命令耗时和直接执行相差太大
|
||||
11. 监控通知模块优化支持更多(飞书)
|
||||
12. **非 root 用户提升权限写入 root 用户文件**
|
||||
13. 部分数据迁移工作空间(项目,构建,仓库、节点分发)
|
||||
14. 前端表格用户自定义列显示
|
||||
15. 前端升级 vue3
|
||||
16. `导入云效仓库 (zx) 依赖太重,非单接口实现(需要标准验证流程)`
|
||||
17. 节点取消,白名单配置和下载白名单(统一到服务端工作空间配置)
|
||||
18. ~~仓库~~、构建、分发、~~项目~~导入导出
|
||||
19. SSH 连接 docker (sh)
|
||||
20. docker-compose
|
||||
21. 隧道节点
|
||||
22. 批量删除镜像 (sh)
|
||||
23. docker 容器编辑重建(zx)
|
||||
24. 仓库引用环境变量支持使用下拉框
|
||||
|
||||
### DONE
|
||||
1. ~~使用服务端的 git 插件~~
|
||||
2. ~~日志组件卡顿~~
|
||||
3. ~~清理触发器表~~
|
||||
4. ~~scp 发布实践案例~~
|
||||
5. ~~SSH 上传文件进度(前端分片+进度)~~
|
||||
6. ~~**用户体系支持接入第三方系统**~~
|
||||
7. ~~传输信息加密(混淆,避免 http 明文传输)~~
|
||||
8. ~~插件端证书验证迁移到服务端~~
|
||||
9. ~~稳定版/体验版~~
|
||||
10. ~~插件端自定义发布文件~~
|
||||
11. ~~容器构建基础镜像的管理~~
|
||||
12. ~~tomcat 实践案例~~
|
||||
13. ~~**分片上传文件**~~
|
||||
14. ~~**支持 mysql 数据库**~~
|
||||
15. ~~配置文件优化~~
|
||||
16. ~~项目触发器~~
|
||||
17. ~~节点转发模块优化~~
|
||||
18. ~~构建事件触发新增更多(前后)~~
|
||||
19. ~~复制项目~~
|
||||
20. ~~测命令行参数~~
|
||||
21. ~~标签页缓存问题(定时器未清空)~~
|
||||
22. ~~发布到指定目录~~
|
||||
7. ~~仓库管理(待定,可以和凭证管理一起考虑)~~
|
||||
4. ~~使用服务端的 git 插件~~
|
||||
5. ~~日志组件卡顿~~
|
||||
6. ~~清理触发器表~~
|
||||
7. ~~scp 发布实践案例~~
|
||||
8. ~~SSH 上传文件进度(前端分片+进度)~~
|
||||
9. ~~**用户体系支持接入第三方系统**~~
|
||||
10. ~~传输信息加密(混淆,避免 http 明文传输)~~
|
||||
11. ~~插件端证书验证迁移到服务端~~
|
||||
12. ~~稳定版/体验版~~
|
||||
13. ~~插件端自定义发布文件~~
|
||||
14. ~~容器构建基础镜像的管理~~
|
||||
15. ~~tomcat 实践案例~~
|
||||
16. ~~**分片上传文件**~~
|
||||
17. ~~**支持 mysql 数据库**~~
|
||||
18. ~~配置文件优化~~
|
||||
19. ~~项目触发器~~
|
||||
20. ~~节点转发模块优化~~
|
||||
21. ~~构建事件触发新增更多(前后)~~
|
||||
22. ~~复制项目~~
|
||||
23. ~~测命令行参数~~
|
||||
24. ~~标签页缓存问题(定时器未清空)~~
|
||||
25. ~~发布到指定目录~~
|
||||
|
||||
## 2.8.x
|
||||
|
||||
|
@ -289,6 +289,7 @@ docker-compose -f docker-compose.yml up
|
||||
# docker-compose -f docker-compose.yml build --no-cache
|
||||
# docker-compose -f docker-compose-local.yml up
|
||||
# docker-compose -f docker-compose-local.yml build --build-arg TEMP_VERSION=.0
|
||||
# docker-compose -f docker-compose-cluster.yml up --build
|
||||
```
|
||||
|
||||
### 方式六:💻 编译运行
|
||||
|
@ -7,6 +7,7 @@ currently being supported with security updates.
|
||||
|
||||
| Version | Supported |
|
||||
|-------------|--------------------|
|
||||
| 2.10.x | :white_check_mark: |
|
||||
| 2.9.x | :white_check_mark: |
|
||||
| 2.8.x | :x: |
|
||||
| 2.8.1-2.8.6 | :x: |
|
||||
|
85
docker-compose-cluster.yml
Normal file
85
docker-compose-cluster.yml
Normal file
@ -0,0 +1,85 @@
|
||||
version: '3.8'
|
||||
services:
|
||||
server:
|
||||
env_file:
|
||||
- env-beta.env
|
||||
image: jpomdocker/jpom:server-${JPOM_VERSION}
|
||||
build:
|
||||
dockerfile: ./modules/server/Dockerfile
|
||||
context: .
|
||||
args:
|
||||
JPOM_VERSION: ${JPOM_VERSION}
|
||||
environment:
|
||||
"JPOM_SERVER_TEMP_TOKEN": ${SERVER_TOKEN}
|
||||
"jpom.cluster.id": server00
|
||||
volumes:
|
||||
- jpom-server-data:/usr/local/jpom-server/data
|
||||
- jpom-server-logs:/usr/local/jpom-server/logs
|
||||
- jpom-server-conf:/usr/local/jpom-server/conf
|
||||
ports:
|
||||
- "2122:2122"
|
||||
hostname: server
|
||||
server01:
|
||||
env_file:
|
||||
- env-beta.env
|
||||
image: jpomdocker/jpom:server-${JPOM_VERSION}
|
||||
build:
|
||||
dockerfile: ./modules/server/Dockerfile
|
||||
context: .
|
||||
args:
|
||||
JPOM_VERSION: ${JPOM_VERSION}
|
||||
environment:
|
||||
"JPOM_SERVER_TEMP_TOKEN": ${SERVER_TOKEN}
|
||||
"jpom.cluster.id": server01
|
||||
volumes:
|
||||
- jpom-server01-data:/usr/local/jpom-server/data
|
||||
- jpom-server01-logs:/usr/local/jpom-server/logs
|
||||
- jpom-server01-conf:/usr/local/jpom-server/conf
|
||||
ports:
|
||||
- "2120:2122"
|
||||
hostname: server01
|
||||
agent01:
|
||||
env_file:
|
||||
- env-beta.env
|
||||
image: jpomdocker/jpom:agent-${JPOM_VERSION}
|
||||
build:
|
||||
dockerfile: ./modules/agent/Dockerfile
|
||||
context: .
|
||||
args:
|
||||
JPOM_VERSION: ${JPOM_VERSION}
|
||||
RUN_ARG: --auto-push-to-server 'http://server:2122/api/node/receive_push?token=${SERVER_TOKEN}&workspaceId=DEFAULT'
|
||||
|
||||
volumes:
|
||||
- jpom-agent01:/usr/local/jpom-agent
|
||||
ports:
|
||||
- "2123:2123"
|
||||
depends_on:
|
||||
- server
|
||||
hostname: agent01
|
||||
agent02:
|
||||
env_file:
|
||||
- env-beta.env
|
||||
image: jpomdocker/jpom:agent-${JPOM_VERSION}
|
||||
build:
|
||||
dockerfile: ./modules/agent/Dockerfile
|
||||
context: .
|
||||
args:
|
||||
JPOM_VERSION: ${JPOM_VERSION}
|
||||
RUN_ARG: --auto-push-to-server 'http://server01:2122/api/node/receive_push?token=${SERVER_TOKEN}&workspaceId=DEFAULT'
|
||||
|
||||
volumes:
|
||||
- jpom-agent02:/usr/local/jpom-agent
|
||||
ports:
|
||||
- "2124:2123"
|
||||
depends_on:
|
||||
- server01
|
||||
hostname: agent02
|
||||
volumes:
|
||||
jpom-agent01:
|
||||
jpom-agent02:
|
||||
jpom-server-data:
|
||||
jpom-server-logs:
|
||||
jpom-server-conf:
|
||||
jpom-server01-data:
|
||||
jpom-server01-logs:
|
||||
jpom-server01-conf:
|
@ -1,3 +1,3 @@
|
||||
JPOM_VERSION=2.10.41.3
|
||||
JPOM_VERSION=2.10.42.4
|
||||
# Server Token 生产部署请更换
|
||||
SERVER_TOKEN=7094f673-2c53-4fc1-82e7-86e528449d97
|
||||
|
@ -30,7 +30,7 @@
|
||||
<parent>
|
||||
<groupId>org.dromara.jpom.agent-transport</groupId>
|
||||
<artifactId>jpom-agent-transport-parent</artifactId>
|
||||
<version>2.10.41</version>
|
||||
<version>2.10.42.4</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
<parent>
|
||||
<groupId>org.dromara.jpom.agent-transport</groupId>
|
||||
<artifactId>jpom-agent-transport-parent</artifactId>
|
||||
<version>2.10.41</version>
|
||||
<version>2.10.42.4</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
<parent>
|
||||
<artifactId>jpom-parent</artifactId>
|
||||
<groupId>org.dromara.jpom</groupId>
|
||||
<version>2.10.41</version>
|
||||
<version>2.10.42.4</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<packaging>pom</packaging>
|
||||
@ -38,7 +38,7 @@
|
||||
<module>agent-transport-http</module>
|
||||
</modules>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<version>2.10.41</version>
|
||||
<version>2.10.42.4</version>
|
||||
<groupId>org.dromara.jpom.agent-transport</groupId>
|
||||
<artifactId>jpom-agent-transport-parent</artifactId>
|
||||
<name>Jpom Agent Transport</name>
|
||||
|
@ -30,7 +30,7 @@ VOLUME ["/root/.m2"]
|
||||
ARG TEMP_VERSION=""
|
||||
ARG JPOM_VERSION
|
||||
ENV USE_JPOM_VERSION=${JPOM_VERSION}${TEMP_VERSION}
|
||||
RUN --mount=type=cache,target=/root/.m2 sh ./script/replaceVersion.sh ${USE_JPOM_VERSION}
|
||||
RUN --mount=type=cache,target=/root/.m2 sh ./script/replaceVersion.sh ${USE_JPOM_VERSION} "release"
|
||||
|
||||
RUN --mount=type=cache,target=/root/.m2 mvn -B -e -T 1C clean package -pl modules/agent -am -Dmaven.test.skip=true -Dmaven.compile.fork=true -s script/settings.xml
|
||||
|
||||
|
@ -29,12 +29,12 @@
|
||||
<parent>
|
||||
<artifactId>jpom-parent</artifactId>
|
||||
<groupId>org.dromara.jpom</groupId>
|
||||
<version>2.10.41</version>
|
||||
<version>2.10.42.4</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>agent</artifactId>
|
||||
<version>2.10.41</version>
|
||||
<version>2.10.42.4</version>
|
||||
<name>Jpom Agent</name>
|
||||
<properties>
|
||||
<start-class>org.dromara.jpom.JpomAgentApplication</start-class>
|
||||
@ -81,11 +81,6 @@
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-json</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
@ -24,8 +24,8 @@ package org.dromara.jpom.common.interceptor;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import org.dromara.jpom.common.Const;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.system.AgentAuthorize;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.MediaType;
|
||||
|
@ -26,11 +26,12 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.system.SystemUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.common.BaseAgentController;
|
||||
import org.dromara.jpom.common.JpomManifest;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.RemoteVersion;
|
||||
import org.dromara.jpom.common.commander.AbstractProjectCommander;
|
||||
import org.dromara.jpom.common.commander.AbstractSystemCommander;
|
||||
@ -78,7 +79,7 @@ public class IndexController extends BaseAgentController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "info", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<JSONObject> info() {
|
||||
public IJsonMessage<JSONObject> info() {
|
||||
|
||||
JpomManifest instance = JpomManifest.getInstance();
|
||||
cn.keepbx.jpom.RemoteVersion remoteVersion = RemoteVersion.cacheInfo();
|
||||
@ -97,7 +98,7 @@ public class IndexController extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@PostMapping(value = "get-stat-info", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<JSONObject> getDirectTop() {
|
||||
public IJsonMessage<JSONObject> getDirectTop() {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
JSONObject topInfo = OshiUtils.getSimpleInfo();
|
||||
jsonObject.put("simpleStatus", topInfo);
|
||||
@ -132,7 +133,7 @@ public class IndexController extends BaseAgentController {
|
||||
|
||||
|
||||
@RequestMapping(value = "processList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<List<JSONObject>> getProcessList(String processName, Integer count) {
|
||||
public IJsonMessage<List<JSONObject>> getProcessList(String processName, Integer count) {
|
||||
processName = StrUtil.emptyToDefault(processName, "java");
|
||||
List<JSONObject> processes = OshiUtils.getProcesses(processName, Convert.toInt(count, 20));
|
||||
processes = processes.stream()
|
||||
@ -148,7 +149,7 @@ public class IndexController extends BaseAgentController {
|
||||
|
||||
|
||||
@PostMapping(value = "kill.json", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<String> kill(int pid) {
|
||||
public IJsonMessage<String> kill(int pid) {
|
||||
long jpomAgentId = JpomManifest.getInstance().getPid();
|
||||
Assert.state(!StrUtil.equals(StrUtil.toString(jpomAgentId), StrUtil.toString(pid)), "不支持在线关闭 Agent 进程");
|
||||
String result = AbstractSystemCommander.getInstance().kill(null, pid);
|
||||
@ -159,19 +160,19 @@ public class IndexController extends BaseAgentController {
|
||||
}
|
||||
|
||||
@PostMapping(value = "disk-info", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<List<JSONObject>> diskInfo() {
|
||||
public IJsonMessage<List<JSONObject>> diskInfo() {
|
||||
List<JSONObject> list = OshiUtils.fileStores();
|
||||
return JsonMessage.success("", list);
|
||||
}
|
||||
|
||||
@PostMapping(value = "hw-disk--info", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<List<JSONObject>> hwDiskInfo() {
|
||||
public IJsonMessage<List<JSONObject>> hwDiskInfo() {
|
||||
List<JSONObject> list = OshiUtils.diskStores();
|
||||
return JsonMessage.success("", list);
|
||||
}
|
||||
|
||||
@PostMapping(value = "network-interfaces", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<List<JSONObject>> networkInterfaces() {
|
||||
public IJsonMessage<List<JSONObject>> networkInterfaces() {
|
||||
List<JSONObject> list = OshiUtils.networkInterfaces();
|
||||
return JsonMessage.success("", list);
|
||||
}
|
||||
|
@ -24,9 +24,10 @@ package org.dromara.jpom.controller.manage;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.common.BaseAgentController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.commander.CommandOpResult;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.dromara.jpom.system.AgentConfig;
|
||||
@ -55,18 +56,18 @@ public class FileManageController extends BaseAgentController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "upload-sharding", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<CommandOpResult> uploadSharding(MultipartFile file,
|
||||
String sliceId,
|
||||
Integer totalSlice,
|
||||
Integer nowSlice,
|
||||
String fileSumMd5) throws Exception {
|
||||
public IJsonMessage<CommandOpResult> uploadSharding(MultipartFile file,
|
||||
String sliceId,
|
||||
Integer totalSlice,
|
||||
Integer nowSlice,
|
||||
String fileSumMd5) throws Exception {
|
||||
String tempPathName = agentConfig.getFixedTempPathName();
|
||||
this.uploadSharding(file, tempPathName, sliceId, totalSlice, nowSlice, fileSumMd5);
|
||||
return JsonMessage.success("上传成功");
|
||||
}
|
||||
|
||||
@RequestMapping(value = "sharding-merge", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<CommandOpResult> shardingMerge(String type,
|
||||
public IJsonMessage<CommandOpResult> shardingMerge(String type,
|
||||
@ValidatorItem String path,
|
||||
Integer stripComponents,
|
||||
String sliceId,
|
||||
|
@ -30,10 +30,11 @@ import cn.hutool.core.lang.RegexPool;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.util.EnumUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.common.BaseAgentController;
|
||||
import org.dromara.jpom.common.Const;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.commander.AbstractProjectCommander;
|
||||
import org.dromara.jpom.model.RunMode;
|
||||
import org.dromara.jpom.model.data.DslYmlDto;
|
||||
@ -162,7 +163,7 @@ public class ManageEditProjectController extends BaseAgentController {
|
||||
|
||||
|
||||
@RequestMapping(value = "saveProject", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<String> saveProject(NodeProjectInfoModel projectInfo) {
|
||||
public IJsonMessage<String> saveProject(NodeProjectInfoModel projectInfo) {
|
||||
// 预检查数据
|
||||
String strPreviewData = getParameter("previewData");
|
||||
boolean previewData = Convert.toBool(strPreviewData, false);
|
||||
@ -218,7 +219,7 @@ public class ManageEditProjectController extends BaseAgentController {
|
||||
* @param previewData 是否是预检查
|
||||
* @return 错误信息
|
||||
*/
|
||||
private JsonMessage<String> save(NodeProjectInfoModel projectInfo, NodeProjectInfoModel exits, boolean previewData) {
|
||||
private IJsonMessage<String> save(NodeProjectInfoModel projectInfo, NodeProjectInfoModel exits, boolean previewData) {
|
||||
projectInfo.setWorkspaceId(getWorkspaceId());
|
||||
|
||||
this.checkPath(projectInfo);
|
||||
@ -356,7 +357,7 @@ public class ManageEditProjectController extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "deleteProject", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<String> deleteProject(String copyId, String thorough) {
|
||||
public IJsonMessage<String> deleteProject(String copyId, String thorough) {
|
||||
NodeProjectInfoModel nodeProjectInfoModel = tryGetProjectInfoModel();
|
||||
if (nodeProjectInfoModel == null) {
|
||||
// 返回正常 200 状态码,考虑节点分发重复操作
|
||||
@ -420,7 +421,7 @@ public class ManageEditProjectController extends BaseAgentController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "releaseOutGiving", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<Object> releaseOutGiving() {
|
||||
public IJsonMessage<Object> releaseOutGiving() {
|
||||
NodeProjectInfoModel nodeProjectInfoModel = tryGetProjectInfoModel();
|
||||
if (nodeProjectInfoModel != null) {
|
||||
nodeProjectInfoModel.setOutGivingProject(false);
|
||||
|
@ -27,10 +27,11 @@ import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.common.BaseAgentController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.dromara.jpom.model.data.NodeProjectInfoModel;
|
||||
import org.dromara.jpom.script.ProjectFileBackupUtil;
|
||||
@ -69,7 +70,7 @@ public class ProjectFileBackupController extends BaseAgentController {
|
||||
* @return list
|
||||
*/
|
||||
@RequestMapping(value = "list-backup", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<JSONObject> listBackup(String id) {
|
||||
public IJsonMessage<JSONObject> listBackup(String id) {
|
||||
//
|
||||
NodeProjectInfoModel projectInfoModel = super.getProjectInfoModel(id);
|
||||
// 合并
|
||||
@ -100,7 +101,7 @@ public class ProjectFileBackupController extends BaseAgentController {
|
||||
* @return list
|
||||
*/
|
||||
@RequestMapping(value = "backup-item-files", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<List<JSONObject>> backupItemFiles(String id, String path, @ValidatorItem String backupId) {
|
||||
public IJsonMessage<List<JSONObject>> backupItemFiles(String id, String path, @ValidatorItem String backupId) {
|
||||
// 查询项目路径
|
||||
NodeProjectInfoModel projectInfoModel = super.getProjectInfoModel();
|
||||
File lib = ProjectFileBackupUtil.pathProjectBackup(projectInfoModel, backupId);
|
||||
@ -149,7 +150,7 @@ public class ProjectFileBackupController extends BaseAgentController {
|
||||
* @return msg
|
||||
*/
|
||||
@RequestMapping(value = "backup-delete", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<Object> deleteFile(String id, @ValidatorItem String backupId, @ValidatorItem String filename, String levelName) {
|
||||
public IJsonMessage<Object> deleteFile(String id, @ValidatorItem String backupId, @ValidatorItem String filename, String levelName) {
|
||||
NodeProjectInfoModel projectInfoModel = super.getProjectInfoModel();
|
||||
File lib = ProjectFileBackupUtil.pathProjectBackup(projectInfoModel, backupId);
|
||||
File file = FileUtil.file(lib, StrUtil.emptyToDefault(levelName, FileUtil.FILE_SEPARATOR), filename);
|
||||
@ -168,7 +169,7 @@ public class ProjectFileBackupController extends BaseAgentController {
|
||||
* @return msg
|
||||
*/
|
||||
@RequestMapping(value = "backup-recover", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<Object> recoverFile(String id, @ValidatorItem String backupId, String type, String filename, String levelName) {
|
||||
public IJsonMessage<Object> recoverFile(String id, @ValidatorItem String backupId, String type, String filename, String levelName) {
|
||||
NodeProjectInfoModel projectInfoModel = super.getProjectInfoModel();
|
||||
File backupPath = ProjectFileBackupUtil.pathProjectBackup(projectInfoModel, backupId);
|
||||
String projectPath = projectInfoModel.allLib();
|
||||
|
@ -33,11 +33,12 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.Lombok;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.common.BaseAgentController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.commander.AbstractProjectCommander;
|
||||
import org.dromara.jpom.common.commander.CommandOpResult;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
@ -94,7 +95,7 @@ public class ProjectFileControl extends BaseAgentController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "getFileList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<List<JSONObject>> getFileList(String id, String path) {
|
||||
public IJsonMessage<List<JSONObject>> getFileList(String id, String path) {
|
||||
// 查询项目路径
|
||||
NodeProjectInfoModel pim = projectInfoService.getItem(id);
|
||||
Assert.notNull(pim, "查询失败:项目不存在");
|
||||
@ -125,7 +126,7 @@ public class ProjectFileControl extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@PostMapping(value = "diff_file", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<JSONObject> diffFile(@RequestBody DiffFileVo diffFileVo) {
|
||||
public IJsonMessage<JSONObject> diffFile(@RequestBody DiffFileVo diffFileVo) {
|
||||
String id = diffFileVo.getId();
|
||||
NodeProjectInfoModel projectInfoModel = super.getProjectInfoModel(id);
|
||||
//
|
||||
@ -215,7 +216,7 @@ public class ProjectFileControl extends BaseAgentController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "upload-sharding", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<CommandOpResult> uploadSharding(MultipartFile file,
|
||||
public IJsonMessage<CommandOpResult> uploadSharding(MultipartFile file,
|
||||
String sliceId,
|
||||
Integer totalSlice,
|
||||
Integer nowSlice,
|
||||
@ -227,7 +228,7 @@ public class ProjectFileControl extends BaseAgentController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "sharding-merge", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<CommandOpResult> shardingMerge(String type,
|
||||
public IJsonMessage<CommandOpResult> shardingMerge(String type,
|
||||
String levelName,
|
||||
Integer stripComponents,
|
||||
String sliceId,
|
||||
@ -251,7 +252,7 @@ public class ProjectFileControl extends BaseAgentController {
|
||||
* @return 结果
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
private JsonMessage<CommandOpResult> upload(File file, String type, String levelName, Integer stripComponents, String after) throws Exception {
|
||||
private IJsonMessage<CommandOpResult> upload(File file, String type, String levelName, Integer stripComponents, String after) throws Exception {
|
||||
NodeProjectInfoModel pim = getProjectInfoModel();
|
||||
File lib = StrUtil.isEmpty(levelName) ? new File(pim.allLib()) : FileUtil.file(pim.allLib(), levelName);
|
||||
// 备份文件
|
||||
@ -346,7 +347,7 @@ public class ProjectFileControl extends BaseAgentController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "deleteFile", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<String> deleteFile(String filename, String type, String levelName) {
|
||||
public IJsonMessage<String> deleteFile(String filename, String type, String levelName) {
|
||||
NodeProjectInfoModel pim = getProjectInfoModel();
|
||||
File file = FileUtil.file(pim.allLib(), StrUtil.emptyToDefault(levelName, StrUtil.SLASH));
|
||||
// 备份文件
|
||||
@ -380,7 +381,7 @@ public class ProjectFileControl extends BaseAgentController {
|
||||
|
||||
|
||||
@RequestMapping(value = "batch_delete", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<String> batchDelete(@RequestBody DiffFileVo diffFileVo) {
|
||||
public IJsonMessage<String> batchDelete(@RequestBody DiffFileVo diffFileVo) {
|
||||
String id = diffFileVo.getId();
|
||||
String dir = diffFileVo.getDir();
|
||||
NodeProjectInfoModel projectInfoModel = super.getProjectInfoModel(id);
|
||||
@ -414,7 +415,7 @@ public class ProjectFileControl extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@PostMapping(value = "read_file", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<String> readFile(String filePath, String filename) {
|
||||
public IJsonMessage<String> readFile(String filePath, String filename) {
|
||||
NodeProjectInfoModel pim = getProjectInfoModel();
|
||||
filePath = StrUtil.emptyToDefault(filePath, File.separator);
|
||||
// 判断文件后缀
|
||||
@ -434,7 +435,7 @@ public class ProjectFileControl extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@PostMapping(value = "update_config_file", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<Object> updateConfigFile(String filePath, String filename, String fileText) {
|
||||
public IJsonMessage<Object> updateConfigFile(String filePath, String filename, String fileText) {
|
||||
NodeProjectInfoModel pim = getProjectInfoModel();
|
||||
filePath = StrUtil.emptyToDefault(filePath, File.separator);
|
||||
// 判断文件后缀
|
||||
@ -492,7 +493,7 @@ public class ProjectFileControl extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@PostMapping(value = "remote_download", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<String> remoteDownload(String id, String url, String levelName, String unzip, Integer stripComponents) {
|
||||
public IJsonMessage<String> remoteDownload(String id, String url, String levelName, String unzip, Integer stripComponents) {
|
||||
Assert.hasText(url, "请输入正确的远程地址");
|
||||
|
||||
|
||||
@ -542,7 +543,7 @@ public class ProjectFileControl extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@PostMapping(value = "new_file_folder.json", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<Object> newFileFolder(String id, String levelName, @ValidatorItem String filename, String unFolder) {
|
||||
public IJsonMessage<Object> newFileFolder(String id, String levelName, @ValidatorItem String filename, String unFolder) {
|
||||
NodeProjectInfoModel projectInfoModel = projectInfoService.getItem(id);
|
||||
Assert.notNull(projectInfoModel, "没有对应到项目");
|
||||
File file = FileUtil.file(projectInfoModel.allLib(), StrUtil.emptyToDefault(levelName, FileUtil.FILE_SEPARATOR), filename);
|
||||
@ -569,7 +570,7 @@ public class ProjectFileControl extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@PostMapping(value = "rename.json", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<Object> rename(String id, String levelName, @ValidatorItem String filename, String newname) {
|
||||
public IJsonMessage<Object> rename(String id, String levelName, @ValidatorItem String filename, String newname) {
|
||||
NodeProjectInfoModel projectInfoModel = getProjectInfoModel();
|
||||
File file = FileUtil.file(projectInfoModel.allLib(), StrUtil.emptyToDefault(levelName, FileUtil.FILE_SEPARATOR), filename);
|
||||
File newFile = FileUtil.file(projectInfoModel.allLib(), StrUtil.emptyToDefault(levelName, FileUtil.FILE_SEPARATOR), newname);
|
||||
|
@ -23,9 +23,10 @@
|
||||
package org.dromara.jpom.controller.manage;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.common.BaseAgentController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.commander.AbstractProjectCommander;
|
||||
import org.dromara.jpom.model.RunMode;
|
||||
import org.dromara.jpom.model.data.NodeProjectInfoModel;
|
||||
@ -57,7 +58,7 @@ public class ProjectListController extends BaseAgentController {
|
||||
* @see NodeProjectInfoModel
|
||||
*/
|
||||
@RequestMapping(value = "getProjectItem", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<NodeProjectInfoModel> getProjectItem(String id) {
|
||||
public IJsonMessage<NodeProjectInfoModel> getProjectItem(String id) {
|
||||
NodeProjectInfoModel nodeProjectInfoModel = projectInfoService.getItem(id);
|
||||
if (nodeProjectInfoModel != null) {
|
||||
RunMode runMode = nodeProjectInfoModel.getRunMode();
|
||||
@ -88,7 +89,7 @@ public class ProjectListController extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "getProjectInfo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<List<NodeProjectInfoModel>> getProjectInfo() {
|
||||
public IJsonMessage<List<NodeProjectInfoModel>> getProjectInfo() {
|
||||
try {
|
||||
// 查询数据
|
||||
List<NodeProjectInfoModel> nodeProjectInfoModels = projectInfoService.list();
|
||||
@ -103,7 +104,7 @@ public class ProjectListController extends BaseAgentController {
|
||||
* 展示项目页面
|
||||
*/
|
||||
@RequestMapping(value = "project_copy_list", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<List<NodeProjectInfoModel.JavaCopyItem>> projectCopyList(String id) {
|
||||
public IJsonMessage<List<NodeProjectInfoModel.JavaCopyItem>> projectCopyList(String id) {
|
||||
NodeProjectInfoModel nodeProjectInfoModel = projectInfoService.getItem(id);
|
||||
Assert.notNull(nodeProjectInfoModel, "没有对应项目");
|
||||
|
||||
|
@ -23,11 +23,12 @@
|
||||
package org.dromara.jpom.controller.manage;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.common.BaseAgentController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.commander.AbstractProjectCommander;
|
||||
import org.dromara.jpom.common.commander.CommandOpResult;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
@ -68,7 +69,7 @@ public class ProjectStatusController extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "getProjectStatus", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<JSONObject> getProjectStatus(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "项目id 不正确") String id, String getCopy) {
|
||||
public IJsonMessage<JSONObject> getProjectStatus(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "项目id 不正确") String id, String getCopy) {
|
||||
NodeProjectInfoModel nodeProjectInfoModel = tryGetProjectInfoModel();
|
||||
Assert.notNull(nodeProjectInfoModel, "项目id不存在");
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
@ -110,7 +111,7 @@ public class ProjectStatusController extends BaseAgentController {
|
||||
* @return obj
|
||||
*/
|
||||
@RequestMapping(value = "getProjectPort", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<JSONObject> getProjectPort(String ids) {
|
||||
public IJsonMessage<JSONObject> getProjectPort(String ids) {
|
||||
Assert.hasText(ids, "没有要获取的信息");
|
||||
JSONArray jsonArray = JSONArray.parseArray(ids);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
@ -155,7 +156,7 @@ public class ProjectStatusController extends BaseAgentController {
|
||||
* @return obj
|
||||
*/
|
||||
@RequestMapping(value = "getProjectCopyPort", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<JSONObject> getProjectPort(String id, String copyIds) {
|
||||
public IJsonMessage<JSONObject> getProjectPort(String id, String copyIds) {
|
||||
if (StrUtil.isEmpty(copyIds) || StrUtil.isEmpty(id)) {
|
||||
return new JsonMessage<>(400, "参数异常");
|
||||
}
|
||||
@ -195,7 +196,7 @@ public class ProjectStatusController extends BaseAgentController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "restart", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<CommandOpResult> restart(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "项目id 不正确") String id, String copyId) {
|
||||
public IJsonMessage<CommandOpResult> restart(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "项目id 不正确") String id, String copyId) {
|
||||
NodeProjectInfoModel item = projectInfoService.getItem(id);
|
||||
Assert.notNull(item, "没有找到对应的项目");
|
||||
NodeProjectInfoModel.JavaCopyItem copyItem = item.findCopyItem(copyId);
|
||||
@ -213,7 +214,7 @@ public class ProjectStatusController extends BaseAgentController {
|
||||
|
||||
|
||||
@RequestMapping(value = "stop", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<CommandOpResult> stop(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "项目id 不正确") String id, String copyId) {
|
||||
public IJsonMessage<CommandOpResult> stop(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "项目id 不正确") String id, String copyId) {
|
||||
NodeProjectInfoModel item = projectInfoService.getItem(id);
|
||||
Assert.notNull(item, "没有找到对应的项目");
|
||||
NodeProjectInfoModel.JavaCopyItem copyItem = item.findCopyItem(copyId);
|
||||
@ -229,7 +230,7 @@ public class ProjectStatusController extends BaseAgentController {
|
||||
|
||||
|
||||
@RequestMapping(value = "start", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<CommandOpResult> start(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "项目id 不正确") String id, String copyId) {
|
||||
public IJsonMessage<CommandOpResult> start(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "项目id 不正确") String id, String copyId) {
|
||||
NodeProjectInfoModel item = projectInfoService.getItem(id);
|
||||
Assert.notNull(item, "没有找到对应的项目");
|
||||
NodeProjectInfoModel.JavaCopyItem copyItem = item.findCopyItem(copyId);
|
||||
|
@ -24,10 +24,11 @@ package org.dromara.jpom.controller.manage.log;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.common.BaseAgentController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.commander.AbstractProjectCommander;
|
||||
import org.dromara.jpom.model.data.NodeProjectInfoModel;
|
||||
import org.dromara.jpom.util.FileUtils;
|
||||
@ -52,7 +53,7 @@ import java.util.List;
|
||||
public class LogBackController extends BaseAgentController {
|
||||
|
||||
@RequestMapping(value = "logSize", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<JSONObject> logSize(String id, String copyId) {
|
||||
public IJsonMessage<JSONObject> logSize(String id, String copyId) {
|
||||
NodeProjectInfoModel nodeProjectInfoModel = getProjectInfoModel();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
//
|
||||
@ -67,7 +68,7 @@ public class LogBackController extends BaseAgentController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "resetLog", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<String> resetLog(String copyId) {
|
||||
public IJsonMessage<String> resetLog(String copyId) {
|
||||
NodeProjectInfoModel pim = getProjectInfoModel();
|
||||
NodeProjectInfoModel.JavaCopyItem copyItem = pim.findCopyItem(copyId);
|
||||
try {
|
||||
@ -83,7 +84,7 @@ public class LogBackController extends BaseAgentController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "logBack_delete", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<String> clear(String name, String copyId) {
|
||||
public IJsonMessage<String> clear(String name, String copyId) {
|
||||
Assert.hasText(name, "没有对应到文件");
|
||||
NodeProjectInfoModel pim = getProjectInfoModel();
|
||||
NodeProjectInfoModel.JavaCopyItem copyItem = pim.findCopyItem(copyId);
|
||||
@ -120,7 +121,7 @@ public class LogBackController extends BaseAgentController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "logBack", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<JSONObject> console(String copyId) {
|
||||
public IJsonMessage<JSONObject> console(String copyId) {
|
||||
// 查询项目路径
|
||||
NodeProjectInfoModel pim = getProjectInfoModel();
|
||||
NodeProjectInfoModel.JavaCopyItem copyItem = pim.findCopyItem(copyId);
|
||||
|
@ -28,11 +28,12 @@ import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.lang.Opt;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.dromara.jpom.common.BaseAgentController;
|
||||
import org.dromara.jpom.common.Const;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.dromara.jpom.common.validator.ValidatorRule;
|
||||
import org.dromara.jpom.model.data.NodeScriptExecLogModel;
|
||||
@ -76,17 +77,17 @@ public class ScriptController extends BaseAgentController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "list.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<List<NodeScriptModel>> list() {
|
||||
public IJsonMessage<List<NodeScriptModel>> list() {
|
||||
return JsonMessage.success("", nodeScriptServer.list());
|
||||
}
|
||||
|
||||
@RequestMapping(value = "item.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<NodeScriptModel> item(String id) {
|
||||
public IJsonMessage<NodeScriptModel> item(String id) {
|
||||
return JsonMessage.success("", nodeScriptServer.getItem(id));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "save.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<Object> save(NodeScriptModel nodeScriptModel, String type, String global, String nodeId) {
|
||||
public IJsonMessage<Object> save(NodeScriptModel nodeScriptModel, String type, String global, String nodeId) {
|
||||
Assert.notNull(nodeScriptModel, "没有数据");
|
||||
Assert.hasText(nodeScriptModel.getContext(), "内容为空");
|
||||
//
|
||||
@ -141,7 +142,7 @@ public class ScriptController extends BaseAgentController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "del.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<Object> del(String id) {
|
||||
public IJsonMessage<Object> del(String id) {
|
||||
nodeScriptServer.deleteItem(id);
|
||||
return JsonMessage.success("删除成功");
|
||||
}
|
||||
@ -155,7 +156,7 @@ public class ScriptController extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "log", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<JSONObject> getNowLog(@ValidatorItem() String id,
|
||||
public IJsonMessage<JSONObject> getNowLog(@ValidatorItem() String id,
|
||||
@ValidatorItem() String executeId,
|
||||
@ValidatorItem(value = ValidatorRule.POSITIVE_INTEGER, msg = "line") int line) {
|
||||
NodeScriptModel item = nodeScriptServer.getItem(id);
|
||||
@ -177,7 +178,7 @@ public class ScriptController extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "del_log", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<Object> delLog(@ValidatorItem() String id,
|
||||
public IJsonMessage<Object> delLog(@ValidatorItem() String id,
|
||||
@ValidatorItem() String executeId) {
|
||||
NodeScriptModel item = nodeScriptServer.getItem(id);
|
||||
if (item == null) {
|
||||
@ -199,7 +200,7 @@ public class ScriptController extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "exec", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<String> exec(@ValidatorItem() String id, String args, String params) {
|
||||
public IJsonMessage<String> exec(@ValidatorItem() String id, String args, String params) {
|
||||
NodeScriptModel item = nodeScriptServer.getItem(id);
|
||||
Assert.notNull(item, "对应脚本已经不存在啦");
|
||||
String nowUserName = getNowUserName();
|
||||
@ -229,7 +230,7 @@ public class ScriptController extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "pull_exec_log", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<List<NodeScriptExecLogModel>> pullExecLog(@ValidatorItem int pullCount) {
|
||||
public IJsonMessage<List<NodeScriptExecLogModel>> pullExecLog(@ValidatorItem int pullCount) {
|
||||
Assert.state(pullCount > 0, "pull count error");
|
||||
List<NodeScriptExecLogModel> list = nodeScriptExecLogServer.list();
|
||||
list = CollUtil.sub(list, 0, pullCount);
|
||||
@ -246,7 +247,7 @@ public class ScriptController extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "del_exec_log", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<Object> delExecLog(@RequestBody JSONObject jsonObject) {
|
||||
public IJsonMessage<Object> delExecLog(@RequestBody JSONObject jsonObject) {
|
||||
JSONArray ids = jsonObject.getJSONArray("ids");
|
||||
if (ids != null) {
|
||||
for (Object id : ids) {
|
||||
|
@ -24,12 +24,13 @@ package org.dromara.jpom.controller.system;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.event.ICacheTask;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.dromara.jpom.JpomApplication;
|
||||
import org.dromara.jpom.common.BaseAgentController;
|
||||
import org.dromara.jpom.common.JpomManifest;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.commander.AbstractProjectCommander;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.dromara.jpom.common.validator.ValidatorRule;
|
||||
@ -79,7 +80,7 @@ public class AgentCacheManageController extends BaseAgentController implements I
|
||||
* @return json
|
||||
*/
|
||||
@PostMapping(value = "cache", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<JSONObject> cache() {
|
||||
public IJsonMessage<JSONObject> cache() {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
//
|
||||
jsonObject.put("fileSize", this.tempFileSize);
|
||||
@ -112,7 +113,7 @@ public class AgentCacheManageController extends BaseAgentController implements I
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "clearCache", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<String> clearCache(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "类型错误") String type) {
|
||||
public IJsonMessage<String> clearCache(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "类型错误") String type) {
|
||||
switch (type) {
|
||||
case "pidPort":
|
||||
AbstractProjectCommander.PID_PORT.clear();
|
||||
|
@ -23,8 +23,9 @@
|
||||
package org.dromara.jpom.controller.system;
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import org.dromara.jpom.common.BaseAgentController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.dromara.jpom.model.system.WorkspaceEnvVarModel;
|
||||
import org.dromara.jpom.service.system.AgentWorkspaceEnvVarService;
|
||||
@ -56,10 +57,10 @@ public class AgentWorkspaceEnvVarController extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@PostMapping(value = "/update", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<Object> updateWorkspaceEnvVar(@ValidatorItem String name,
|
||||
@ValidatorItem String value,
|
||||
@ValidatorItem String description,
|
||||
Integer privacy) {
|
||||
public IJsonMessage<Object> updateWorkspaceEnvVar(@ValidatorItem String name,
|
||||
@ValidatorItem String value,
|
||||
@ValidatorItem String description,
|
||||
Integer privacy) {
|
||||
String workspaceId = getWorkspaceId();
|
||||
synchronized (AgentWorkspaceEnvVarController.class) {
|
||||
WorkspaceEnvVarModel.WorkspaceEnvVarItemModel workspaceEnvVarModel = new WorkspaceEnvVarModel.WorkspaceEnvVarItemModel();
|
||||
@ -91,7 +92,7 @@ public class AgentWorkspaceEnvVarController extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@PostMapping(value = "/delete", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<Object> delete(@ValidatorItem String name) {
|
||||
public IJsonMessage<Object> delete(@ValidatorItem String name) {
|
||||
String workspaceId = getWorkspaceId();
|
||||
synchronized (AgentWorkspaceEnvVarController.class) {
|
||||
//
|
||||
|
@ -25,9 +25,10 @@ package org.dromara.jpom.controller.system;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.common.BaseAgentController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.dromara.jpom.model.data.CertModel;
|
||||
import org.dromara.jpom.service.system.CertService;
|
||||
@ -65,7 +66,7 @@ public class CertificateController extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "/getCertList", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<List<CertModel>> getCertList() {
|
||||
public IJsonMessage<List<CertModel>> getCertList() {
|
||||
List<CertModel> array = certService.list();
|
||||
return JsonMessage.success("", array);
|
||||
}
|
||||
@ -77,7 +78,7 @@ public class CertificateController extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<String> delete(@ValidatorItem String id) {
|
||||
public IJsonMessage<String> delete(@ValidatorItem String id) {
|
||||
certService.deleteItem(id);
|
||||
return JsonMessage.success("删除成功");
|
||||
}
|
||||
|
@ -24,9 +24,10 @@ package org.dromara.jpom.controller.system;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.dromara.jpom.common.BaseAgentController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.dromara.jpom.common.validator.ValidatorRule;
|
||||
import org.dromara.jpom.socket.AgentFileTailWatcher;
|
||||
@ -56,7 +57,7 @@ public class LogManageController extends BaseAgentController {
|
||||
|
||||
|
||||
@RequestMapping(value = "log_data.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<List<JSONObject>> logData() {
|
||||
public IJsonMessage<List<JSONObject>> logData() {
|
||||
List<JSONObject> data = DirTreeUtil.getTreeData(LogbackConfig.getPath());
|
||||
return JsonMessage.success("", data);
|
||||
}
|
||||
@ -64,7 +65,7 @@ public class LogManageController extends BaseAgentController {
|
||||
|
||||
@RequestMapping(value = "log_del.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public JsonMessage<String> logData(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "path错误") String path) {
|
||||
public IJsonMessage<String> logData(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "path错误") String path) {
|
||||
File file = FileUtil.file(LogbackConfig.getPath(), path);
|
||||
// 判断修改时间
|
||||
long modified = file.lastModified();
|
||||
|
@ -28,6 +28,8 @@ import cn.hutool.core.text.StrSplitter;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.system.SystemUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.github.odiszapc.nginxparser.NgxBlock;
|
||||
@ -36,7 +38,6 @@ import com.github.odiszapc.nginxparser.NgxEntry;
|
||||
import com.github.odiszapc.nginxparser.NgxParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.common.BaseAgentController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.commander.AbstractSystemCommander;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.dromara.jpom.common.validator.ValidatorRule;
|
||||
@ -84,7 +85,7 @@ public class NginxController extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "list_data.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<List<JSONObject>> list(String whitePath, String name, String showAll) {
|
||||
public IJsonMessage<List<JSONObject>> list(String whitePath, String name, String showAll) {
|
||||
boolean checkNgxDirectory = whitelistDirectoryService.checkNgxDirectory(whitePath);
|
||||
Assert.state(checkNgxDirectory, "文件路径错误,非白名单路径");
|
||||
if (StrUtil.isEmpty(name)) {
|
||||
@ -98,7 +99,7 @@ public class NginxController extends BaseAgentController {
|
||||
* nginx列表
|
||||
*/
|
||||
@RequestMapping(value = "tree.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<JSONArray> tree() {
|
||||
public IJsonMessage<JSONArray> tree() {
|
||||
JSONArray array = nginxService.tree();
|
||||
return JsonMessage.success("", array);
|
||||
}
|
||||
@ -111,7 +112,7 @@ public class NginxController extends BaseAgentController {
|
||||
* @return 页面
|
||||
*/
|
||||
@RequestMapping(value = "item_data", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<JSONObject> itemData(String path, String name) {
|
||||
public IJsonMessage<JSONObject> itemData(String path, String name) {
|
||||
boolean ngxDirectory = whitelistDirectoryService.checkNgxDirectory(path);
|
||||
Assert.state(ngxDirectory, "文件路径错误,非白名单路径");
|
||||
String realPath = AgentWhitelist.convertRealPath(path);
|
||||
@ -142,7 +143,7 @@ public class NginxController extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "updateNgx", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<String> updateNgx(String name, String whitePath, String genre, @ValidatorItem(msg = "请填写配置信息") String context) {
|
||||
public IJsonMessage<String> updateNgx(String name, String whitePath, String genre, @ValidatorItem(msg = "请填写配置信息") String context) {
|
||||
this.checkName(name);
|
||||
//
|
||||
boolean ngxDirectory = whitelistDirectoryService.checkNgxDirectory(whitePath);
|
||||
@ -243,7 +244,7 @@ public class NginxController extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "delete", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<String> delete(String path, String name, String type, String from) {
|
||||
public IJsonMessage<String> delete(String path, String name, String type, String from) {
|
||||
if (!whitelistDirectoryService.checkNgxDirectory(path)) {
|
||||
return new JsonMessage<>(400, "非法操作");
|
||||
}
|
||||
@ -284,7 +285,7 @@ public class NginxController extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "status", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<JSONObject> status() {
|
||||
public IJsonMessage<JSONObject> status() {
|
||||
String name = nginxService.getServiceName();
|
||||
if (StrUtil.isEmpty(name)) {
|
||||
return new JsonMessage<>(500, "服务名错误");
|
||||
@ -303,7 +304,7 @@ public class NginxController extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "updateConf", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<Object> updateConf(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "服务名称错误") String name) {
|
||||
public IJsonMessage<Object> updateConf(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "服务名称错误") String name) {
|
||||
JSONObject ngxConf = nginxService.getNgxConf();
|
||||
ngxConf.put("name", name);
|
||||
nginxService.save(ngxConf);
|
||||
@ -316,7 +317,7 @@ public class NginxController extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "config", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<JSONObject> config() {
|
||||
public IJsonMessage<JSONObject> config() {
|
||||
JSONObject ngxConf = nginxService.getNgxConf();
|
||||
return JsonMessage.success("", ngxConf);
|
||||
}
|
||||
@ -327,7 +328,7 @@ public class NginxController extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "open", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<Object> open() {
|
||||
public IJsonMessage<Object> open() {
|
||||
String name = nginxService.getServiceName();
|
||||
String result = AbstractSystemCommander.getInstance().startService(name);
|
||||
return JsonMessage.success("nginx服务已启动 " + result);
|
||||
@ -339,7 +340,7 @@ public class NginxController extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "close", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<Object> close() {
|
||||
public IJsonMessage<Object> close() {
|
||||
String name = nginxService.getServiceName();
|
||||
String result = AbstractSystemCommander.getInstance().stopService(name);
|
||||
return JsonMessage.success("nginx服务已停止 " + result);
|
||||
@ -391,7 +392,7 @@ public class NginxController extends BaseAgentController {
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "reload", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<String> reload() {
|
||||
public IJsonMessage<String> reload() {
|
||||
String checkResult = this.checkNginx();
|
||||
if (StrUtil.isNotEmpty(checkResult) && !StrUtil.containsIgnoreCase(checkResult, "successful")) {
|
||||
return new JsonMessage<>(400, checkResult);
|
||||
|
@ -26,12 +26,13 @@ import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.JpomApplication;
|
||||
import org.dromara.jpom.common.BaseAgentController;
|
||||
import org.dromara.jpom.common.Const;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.dromara.jpom.system.ExtConfigBean;
|
||||
import org.springframework.boot.env.YamlPropertySourceLoader;
|
||||
@ -58,7 +59,7 @@ import java.nio.charset.StandardCharsets;
|
||||
public class SystemConfigController extends BaseAgentController {
|
||||
|
||||
@RequestMapping(value = "getConfig.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<JSONObject> config() throws IOException {
|
||||
public IJsonMessage<JSONObject> config() throws IOException {
|
||||
Resource resource = ExtConfigBean.getResource();
|
||||
String content = IoUtil.read(resource.getInputStream(), CharsetUtil.CHARSET_UTF_8);
|
||||
JSONObject json = new JSONObject();
|
||||
@ -68,7 +69,7 @@ public class SystemConfigController extends BaseAgentController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "save_config.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<String> saveConfig(@ValidatorItem(msg = "内容不能为空") String content, String restart) throws IOException {
|
||||
public IJsonMessage<String> saveConfig(@ValidatorItem(msg = "内容不能为空") String content, String restart) throws IOException {
|
||||
try {
|
||||
YamlPropertySourceLoader yamlPropertySourceLoader = new YamlPropertySourceLoader();
|
||||
// @author hjk 前端编辑器允许使用tab键,并设定为2个空格,再转换为yml时要把tab键换成2个空格
|
||||
|
@ -29,9 +29,14 @@ import cn.hutool.core.io.resource.ResourceUtil;
|
||||
import cn.hutool.core.lang.Tuple;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.URLUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.Type;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import org.dromara.jpom.JpomApplication;
|
||||
import org.dromara.jpom.common.*;
|
||||
import org.dromara.jpom.common.BaseAgentController;
|
||||
import org.dromara.jpom.common.Const;
|
||||
import org.dromara.jpom.common.JpomManifest;
|
||||
import org.dromara.jpom.common.RemoteVersion;
|
||||
import org.dromara.jpom.system.AgentConfig;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@ -65,10 +70,10 @@ public class SystemUpdateController extends BaseAgentController {
|
||||
}
|
||||
|
||||
@PostMapping(value = "upload-jar-sharding", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<String> uploadJarSharding(MultipartFile file, String sliceId,
|
||||
Integer totalSlice,
|
||||
Integer nowSlice,
|
||||
String fileSumMd5) throws IOException {
|
||||
public IJsonMessage<String> uploadJarSharding(MultipartFile file, String sliceId,
|
||||
Integer totalSlice,
|
||||
Integer nowSlice,
|
||||
String fileSumMd5) throws IOException {
|
||||
//
|
||||
String tempPathName = agentConfig.getFixedTempPathName();
|
||||
this.uploadSharding(file, tempPathName, sliceId, totalSlice, nowSlice, fileSumMd5, "jar", "zip");
|
||||
@ -76,7 +81,7 @@ public class SystemUpdateController extends BaseAgentController {
|
||||
}
|
||||
|
||||
@PostMapping(value = "upload-jar-sharding-merge", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<String> uploadJarShardingMerge(String sliceId,
|
||||
public IJsonMessage<String> uploadJarShardingMerge(String sliceId,
|
||||
Integer totalSlice,
|
||||
String fileSumMd5) throws IOException {
|
||||
//
|
||||
@ -102,7 +107,7 @@ public class SystemUpdateController extends BaseAgentController {
|
||||
}
|
||||
|
||||
@PostMapping(value = "change_log", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<String> changeLog(String beta) {
|
||||
public IJsonMessage<String> changeLog(String beta) {
|
||||
//
|
||||
boolean betaBool = Convert.toBool(beta, false);
|
||||
boolean betaRelease = RemoteVersion.betaRelease();
|
||||
@ -122,7 +127,7 @@ public class SystemUpdateController extends BaseAgentController {
|
||||
* @see RemoteVersion
|
||||
*/
|
||||
@PostMapping(value = "check_version.json", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<cn.keepbx.jpom.RemoteVersion> checkVersion() {
|
||||
public IJsonMessage<cn.keepbx.jpom.RemoteVersion> checkVersion() {
|
||||
cn.keepbx.jpom.RemoteVersion remoteVersion = RemoteVersion.loadRemoteInfo();
|
||||
return JsonMessage.success("", remoteVersion);
|
||||
}
|
||||
@ -134,7 +139,7 @@ public class SystemUpdateController extends BaseAgentController {
|
||||
* @see RemoteVersion
|
||||
*/
|
||||
@PostMapping(value = "remote_upgrade.json", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<Object> upgrade() throws IOException {
|
||||
public IJsonMessage<Object> upgrade() throws IOException {
|
||||
RemoteVersion.upgrade(configBean.getTempPath().getAbsolutePath());
|
||||
return JsonMessage.success(Const.UPGRADE_MSG);
|
||||
}
|
||||
|
@ -27,8 +27,9 @@ import cn.hutool.core.lang.RegexPool;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import org.dromara.jpom.common.BaseJpomController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.model.data.AgentWhitelist;
|
||||
import org.dromara.jpom.service.WhitelistDirectoryService;
|
||||
import org.dromara.jpom.system.AgentConfig;
|
||||
@ -59,14 +60,14 @@ public class WhitelistDirectoryController extends BaseJpomController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "whitelistDirectory_data", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<AgentWhitelist> whiteListDirectoryData() {
|
||||
public IJsonMessage<AgentWhitelist> whiteListDirectoryData() {
|
||||
AgentWhitelist agentWhitelist = whitelistDirectoryService.getWhitelist();
|
||||
return JsonMessage.success("", agentWhitelist);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "whitelistDirectory_submit", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<String> whitelistDirectorySubmit(String project, String nginx, String nginxPath,
|
||||
public IJsonMessage<String> whitelistDirectorySubmit(String project, String nginx, String nginxPath,
|
||||
String allowEditSuffix, String allowRemoteDownloadHost) {
|
||||
List<String> list = AgentWhitelist.parseToList(project, true, "项目路径白名单不能为空");
|
||||
//
|
||||
|
@ -25,9 +25,9 @@ package org.dromara.jpom.model.data;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.setting.yaml.YamlUtil;
|
||||
import cn.keepbx.jpom.model.BaseJsonModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.jpom.model.BaseJsonModel;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -27,9 +27,9 @@ import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.keepbx.jpom.model.BaseJsonModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.jpom.model.BaseJsonModel;
|
||||
import org.dromara.jpom.model.RunMode;
|
||||
import org.dromara.jpom.system.JpomRuntimeException;
|
||||
import org.springframework.util.Assert;
|
||||
|
@ -23,7 +23,7 @@
|
||||
package org.dromara.jpom.model.system;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.dromara.jpom.model.BaseJsonModel;
|
||||
import cn.keepbx.jpom.model.BaseJsonModel;
|
||||
|
||||
/**
|
||||
* 网络端口信息实体
|
||||
|
@ -31,11 +31,11 @@ import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.JpomApplication;
|
||||
import org.dromara.jpom.common.Const;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.model.EnvironmentMapBuilder;
|
||||
import org.dromara.jpom.model.data.NodeScriptModel;
|
||||
import org.dromara.jpom.service.system.AgentWorkspaceEnvVarService;
|
||||
|
@ -28,9 +28,9 @@ import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.cron.task.Task;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.keepbx.jpom.cron.ICron;
|
||||
import org.dromara.jpom.common.AgentConst;
|
||||
import org.dromara.jpom.cron.CronUtils;
|
||||
import org.dromara.jpom.cron.ICron;
|
||||
import org.dromara.jpom.model.data.NodeScriptExecLogModel;
|
||||
import org.dromara.jpom.model.data.NodeScriptModel;
|
||||
import org.dromara.jpom.script.NodeScriptProcessBuilder;
|
||||
|
@ -28,12 +28,12 @@ import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.io.LineHandler;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.fastjson2.TypeReference;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.JpomApplication;
|
||||
import org.dromara.jpom.common.Const;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.model.EnvironmentMapBuilder;
|
||||
import org.dromara.jpom.system.ExtConfigBean;
|
||||
import org.dromara.jpom.util.CommandUtil;
|
||||
|
@ -27,10 +27,10 @@ import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.common.Const;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.commander.CommandOpResult;
|
||||
import org.dromara.jpom.model.data.NodeProjectInfoModel;
|
||||
import org.dromara.jpom.service.manage.ConsoleService;
|
||||
|
@ -23,9 +23,9 @@
|
||||
package org.dromara.jpom.socket;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.model.data.NodeScriptModel;
|
||||
import org.dromara.jpom.script.NodeScriptProcessBuilder;
|
||||
import org.dromara.jpom.service.script.NodeScriptServer;
|
||||
|
@ -24,10 +24,10 @@ package org.dromara.jpom.socket;
|
||||
|
||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.common.Const;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.system.AgentConfig;
|
||||
import org.dromara.jpom.system.LogbackConfig;
|
||||
import org.dromara.jpom.util.SocketSessionUtil;
|
||||
|
@ -24,12 +24,12 @@ package org.dromara.jpom.socket;
|
||||
|
||||
import cn.hutool.core.lang.Tuple;
|
||||
import cn.keepbx.jpom.Type;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.JpomApplication;
|
||||
import org.dromara.jpom.common.Const;
|
||||
import org.dromara.jpom.common.JpomManifest;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.model.AgentFileModel;
|
||||
import org.dromara.jpom.model.UploadFileModel;
|
||||
import org.dromara.jpom.model.WebSocketMessageModel;
|
||||
|
@ -29,13 +29,13 @@
|
||||
<parent>
|
||||
<artifactId>jpom-parent</artifactId>
|
||||
<groupId>org.dromara.jpom</groupId>
|
||||
<version>2.10.41</version>
|
||||
<version>2.10.42.4</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<name>Jpom Common</name>
|
||||
<artifactId>common</artifactId>
|
||||
<version>2.10.41</version>
|
||||
<version>2.10.42.4</version>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@ -89,13 +89,13 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.22</version>
|
||||
<version>1.23.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.keepbx.jpom</groupId>
|
||||
<artifactId>jpom-core-common</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<version>1.0.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
@ -47,9 +47,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
@ -229,6 +227,12 @@ public class JpomApplication implements DisposableBean, InitializingBean {
|
||||
});
|
||||
}
|
||||
|
||||
public static ScheduledExecutorService getScheduledExecutorService() {
|
||||
return (ScheduledExecutorService) LINK_EXECUTOR_SERVICE.computeIfAbsent("jpom-system-task",
|
||||
s -> Executors.newScheduledThreadPool(4,
|
||||
r -> new Thread(r, "jpom-system-task")));
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册线程池
|
||||
*
|
||||
|
@ -24,6 +24,8 @@ package org.dromara.jpom.common;
|
||||
|
||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import cn.hutool.core.exceptions.ValidateException;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.controller.BaseMyErrorController;
|
||||
import org.dromara.jpom.system.JpomRuntimeException;
|
||||
@ -57,7 +59,7 @@ public abstract class BaseExceptionHandler {
|
||||
*/
|
||||
@ExceptionHandler({JpomRuntimeException.class, RuntimeException.class, Exception.class})
|
||||
@ResponseBody
|
||||
public JsonMessage<String> defExceptionHandler(HttpServletRequest request, Exception e) {
|
||||
public IJsonMessage<String> defExceptionHandler(HttpServletRequest request, Exception e) {
|
||||
if (e instanceof JpomRuntimeException) {
|
||||
log.error("global handle exception: {} {}", request.getRequestURI(), e.getMessage(), e.getCause());
|
||||
return new JsonMessage<>(500, e.getMessage());
|
||||
@ -73,7 +75,7 @@ public abstract class BaseExceptionHandler {
|
||||
|
||||
@ExceptionHandler({NullPointerException.class})
|
||||
@ResponseBody
|
||||
public JsonMessage<String> defNullPointerExceptionHandler(HttpServletRequest request, Exception e) {
|
||||
public IJsonMessage<String> defNullPointerExceptionHandler(HttpServletRequest request, Exception e) {
|
||||
log.error("global NullPointerException: {}", request.getRequestURI(), e);
|
||||
return new JsonMessage<>(500, "程序错误,空指针");
|
||||
}
|
||||
@ -86,7 +88,7 @@ public abstract class BaseExceptionHandler {
|
||||
*/
|
||||
@ExceptionHandler({IllegalArgumentException.class, IllegalStateException.class, ValidateException.class})
|
||||
@ResponseBody
|
||||
public JsonMessage<String> paramExceptionHandler(HttpServletRequest request, Exception e) {
|
||||
public IJsonMessage<String> paramExceptionHandler(HttpServletRequest request, Exception e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("controller {}", request.getRequestURI(), e);
|
||||
} else {
|
||||
@ -98,20 +100,20 @@ public abstract class BaseExceptionHandler {
|
||||
|
||||
@ExceptionHandler({HttpMessageNotReadableException.class, HttpMessageConversionException.class})
|
||||
@ResponseBody
|
||||
public JsonMessage<String> handleHttpMessageNotReadableException(HttpMessageNotReadableException e) {
|
||||
public IJsonMessage<String> handleHttpMessageNotReadableException(HttpMessageNotReadableException e) {
|
||||
log.warn("参数解析异常:{}", e.getMessage());
|
||||
return new JsonMessage<>(HttpStatus.EXPECTATION_FAILED.value(), "传入的参数格式不正确");
|
||||
}
|
||||
|
||||
@ExceptionHandler({HttpRequestMethodNotSupportedException.class, HttpMediaTypeNotSupportedException.class})
|
||||
@ResponseBody
|
||||
public JsonMessage<String> handleHttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e) {
|
||||
public IJsonMessage<String> handleHttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e) {
|
||||
return new JsonMessage<>(HttpStatus.METHOD_NOT_ALLOWED.value(), "不被支持的请求方式", e.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler({NoHandlerFoundException.class})
|
||||
@ResponseBody
|
||||
public JsonMessage<String> handleNoHandlerFoundException(NoHandlerFoundException e) {
|
||||
public IJsonMessage<String> handleNoHandlerFoundException(NoHandlerFoundException e) {
|
||||
return new JsonMessage<>(HttpStatus.NOT_FOUND.value(), "没有找到对应的资源", e.getMessage());
|
||||
}
|
||||
|
||||
@ -122,21 +124,21 @@ public abstract class BaseExceptionHandler {
|
||||
*/
|
||||
@ExceptionHandler({MaxUploadSizeExceededException.class})
|
||||
@ResponseBody
|
||||
public JsonMessage<String> handleMaxUploadSizeExceededException(MaxUploadSizeExceededException e) {
|
||||
public IJsonMessage<String> handleMaxUploadSizeExceededException(MaxUploadSizeExceededException e) {
|
||||
log.error("上传文件大小超出限制", e);
|
||||
return new JsonMessage<>(HttpStatus.NOT_ACCEPTABLE.value(), BaseMyErrorController.FILE_MAX_SIZE_MSG, e.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler({ConstructorException.class})
|
||||
@ResponseBody
|
||||
public JsonMessage<String> handleConstructorException(ConstructorException e) {
|
||||
public IJsonMessage<String> handleConstructorException(ConstructorException e) {
|
||||
log.warn("yml 配置内容错误", e);
|
||||
return new JsonMessage<>(HttpStatus.EXPECTATION_FAILED.value(), "yml 配置内容格式有误请检查后重新操作(请检查是否有非法字段):" + e.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler({ScannerException.class})
|
||||
@ResponseBody
|
||||
public JsonMessage<String> handleScannerException(ScannerException e) {
|
||||
public IJsonMessage<String> handleScannerException(ScannerException e) {
|
||||
log.warn("ScannerException", e);
|
||||
return new JsonMessage<>(HttpStatus.EXPECTATION_FAILED.value(), "yml 配置内容格式有误请检查后重新操作(不要使用 \\t(TAB) 缩进):" + e.getMessage());
|
||||
}
|
||||
|
@ -350,4 +350,7 @@ public abstract class BaseJpomController {
|
||||
response.setContentType(contentType);
|
||||
}
|
||||
|
||||
protected String getWorkspaceId() {
|
||||
return ServletUtil.getHeader(getRequest(), Const.WORKSPACE_ID_REQ_HEADER, CharsetUtil.CHARSET_UTF_8);
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,8 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.hutool.system.SystemUtil;
|
||||
import cn.keepbx.jpom.Type;
|
||||
import cn.keepbx.jpom.cron.ICron;
|
||||
import cn.keepbx.jpom.event.IAsyncLoad;
|
||||
import cn.keepbx.jpom.event.ICacheTask;
|
||||
import cn.keepbx.jpom.event.ISystemTask;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
@ -48,8 +50,6 @@ import lombok.Lombok;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.JpomApplication;
|
||||
import org.dromara.jpom.cron.CronUtils;
|
||||
import org.dromara.jpom.cron.IAsyncLoad;
|
||||
import org.dromara.jpom.cron.ICron;
|
||||
import org.dromara.jpom.system.ExtConfigBean;
|
||||
import org.dromara.jpom.util.JsonFileUtil;
|
||||
import org.springframework.beans.BeansException;
|
||||
|
@ -38,6 +38,7 @@ import cn.hutool.system.JavaInfo;
|
||||
import cn.hutool.system.OsInfo;
|
||||
import cn.hutool.system.SystemUtil;
|
||||
import cn.keepbx.jpom.Type;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.JpomApplication;
|
||||
|
@ -1,138 +0,0 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Code Technology Studio
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package org.dromara.jpom.common;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.keepbx.jpom.BaseJsonMessage;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONFactory;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONWriter;
|
||||
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
|
||||
import com.alibaba.fastjson2.writer.ObjectWriterProvider;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
/**
|
||||
* 通用的json 数据格式
|
||||
*
|
||||
* @author bwcx_jzy
|
||||
* @since 2017/2/6.
|
||||
* @since 1.0
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class JsonMessage<T> extends BaseJsonMessage<T> {
|
||||
|
||||
static {
|
||||
ObjectWriterProvider writerProvider = JSONFactory.getDefaultObjectWriterProvider();
|
||||
// long 类型自动转String
|
||||
writerProvider.register(Long.class, ObjectWriterImplToString.INSTANCE);
|
||||
writerProvider.register(long.class, ObjectWriterImplToString.INSTANCE);
|
||||
writerProvider.register(BigInteger.class, ObjectWriterImplToString.INSTANCE);
|
||||
writerProvider.register(Long.TYPE, ObjectWriterImplToString.INSTANCE);
|
||||
//
|
||||
JSONFactory.setUseJacksonAnnotation(false);
|
||||
// 枚举对象使用 枚举名称
|
||||
JSON.config(JSONWriter.Feature.WriteEnumsUsingName);
|
||||
}
|
||||
|
||||
|
||||
public JsonMessage(int code, String msg, T data) {
|
||||
super(code, msg, data);
|
||||
}
|
||||
|
||||
public JsonMessage(int code, String msg) {
|
||||
this(code, msg, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将data 转换为对应实体
|
||||
*
|
||||
* @param tClass 类
|
||||
* @param <E> 泛型
|
||||
* @return Object
|
||||
*/
|
||||
public <E> E getData(Class<E> tClass) {
|
||||
return JSON.to(tClass, this.data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return json
|
||||
* @author bwcx_jzy
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return JSONObject.toJSONString(this);
|
||||
}
|
||||
|
||||
public JSONObject toJson() {
|
||||
return (JSONObject) JSON.toJSON(this);
|
||||
}
|
||||
|
||||
public static JSONObject toJson(int code, String msg) {
|
||||
return toJson(code, msg, null);
|
||||
}
|
||||
|
||||
public static JSONObject toJson(int code, String msg, Object data) {
|
||||
JsonMessage<Object> jsonMessage = new JsonMessage<>(code, msg, data);
|
||||
return jsonMessage.toJson();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param code code
|
||||
* @param msg msg
|
||||
* @return json
|
||||
* @author bwcx_jzy
|
||||
*/
|
||||
public static String getString(int code, String msg) {
|
||||
return getString(code, msg, null);
|
||||
}
|
||||
|
||||
public static <T> JsonMessage<T> success(String msg) {
|
||||
return success(msg, (T) null);
|
||||
}
|
||||
|
||||
public static <T> JsonMessage<T> success(String template, Object... args) {
|
||||
return success(StrUtil.format(template, args), (T) null);
|
||||
}
|
||||
|
||||
public static <T> JsonMessage<T> success(String msg, T data) {
|
||||
return new JsonMessage<>(DEFAULT_SUCCESS_CODE, msg, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param code code
|
||||
* @param msg msg
|
||||
* @param data data
|
||||
* @return json
|
||||
* @author bwcx_jzy
|
||||
*/
|
||||
public static String getString(int code, String msg, Object data) {
|
||||
return toJson(code, msg, data).toString();
|
||||
}
|
||||
}
|
@ -26,6 +26,7 @@ import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.lang.Tuple;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.keepbx.jpom.Type;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
@ -28,9 +28,9 @@ import cn.hutool.core.util.ReflectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.hutool.http.HtmlUtil;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.common.BaseJpomController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.interceptor.HandlerMethodInterceptor;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.MethodParameter;
|
||||
|
@ -22,8 +22,8 @@
|
||||
*/
|
||||
package org.dromara.jpom.controller;
|
||||
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.error.AbstractErrorController;
|
||||
import org.springframework.boot.web.servlet.error.ErrorAttributes;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Code Technology Studio
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package org.dromara.jpom.cron;
|
||||
|
||||
/**
|
||||
* 异步 启动完成加载
|
||||
*
|
||||
* @author bwcx_jzy
|
||||
* @since 2022/1/26
|
||||
*/
|
||||
public interface IAsyncLoad {
|
||||
|
||||
/**
|
||||
* 开始加载
|
||||
*/
|
||||
void startLoad();
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Code Technology Studio
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package org.dromara.jpom.cron;
|
||||
|
||||
import org.dromara.jpom.model.BaseIdModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 需要启动定时任务的 服务接口
|
||||
*
|
||||
* @author bwcx_jzy
|
||||
* @since 2021/12/23
|
||||
*/
|
||||
public interface ICron<T extends BaseIdModel> {
|
||||
|
||||
/**
|
||||
* 查询启动中的 所有定时任务 列表
|
||||
*
|
||||
* @return list
|
||||
*/
|
||||
List<T> queryStartingList();
|
||||
|
||||
/**
|
||||
* 启动所有的定时任务
|
||||
*
|
||||
* @return 启动成功的任务数
|
||||
*/
|
||||
default int startCron() {
|
||||
List<T> startingList = this.queryStartingList();
|
||||
if (startingList == null) {
|
||||
return 0;
|
||||
}
|
||||
return (int) startingList.stream().map(ICron.this::checkCron).filter(aBoolean -> aBoolean).count();
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否启动定时
|
||||
*
|
||||
* @param data bean
|
||||
* @return true 开启定时、false 关闭定时
|
||||
*/
|
||||
boolean checkCron(T data);
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Code Technology Studio
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package org.dromara.jpom.model;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* json方法基础类
|
||||
*
|
||||
* @author bwcx_jzy
|
||||
* @since 2019/4/10
|
||||
*/
|
||||
public abstract class BaseJsonModel implements Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return JSONObject.toJSONString(this);
|
||||
}
|
||||
|
||||
public JSONObject toJson() {
|
||||
return (JSONObject) JSON.toJSON(this);
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@
|
||||
*/
|
||||
package org.dromara.jpom.model;
|
||||
|
||||
import cn.keepbx.jpom.model.BaseIdModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
*/
|
||||
package org.dromara.jpom.model;
|
||||
|
||||
import cn.keepbx.jpom.model.BaseJsonModel;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
|
||||
/**
|
||||
|
@ -29,10 +29,10 @@ import cn.hutool.core.text.StrSplitter;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.keepbx.jpom.model.BaseJsonModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.model.BaseJsonModel;
|
||||
import org.dromara.jpom.system.ExtConfigBean;
|
||||
import org.dromara.jpom.util.FileUtils;
|
||||
import org.springframework.util.Assert;
|
||||
|
@ -22,7 +22,7 @@
|
||||
*/
|
||||
package org.dromara.jpom.model.system;
|
||||
|
||||
import org.dromara.jpom.model.BaseJsonModel;
|
||||
import cn.keepbx.jpom.model.BaseJsonModel;
|
||||
|
||||
/**
|
||||
* agent 端自动生成的密码实体
|
||||
|
@ -24,11 +24,11 @@ package org.dromara.jpom.script;
|
||||
|
||||
import cn.hutool.core.lang.Opt;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.keepbx.jpom.model.BaseJsonModel;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONValidator;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.jpom.model.BaseJsonModel;
|
||||
import org.dromara.jpom.util.StringUtil;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -7,5 +7,5 @@
|
||||
| |
|
||||
|_|
|
||||
|
||||
➜ Jpom \ (•◡•) / (v2.10.41)
|
||||
➜ Jpom \ (•◡•) / (v2.10.42.4)
|
||||
|
||||
|
@ -29,7 +29,7 @@ LABEL maintainer="bwcx-jzy <bwcx_jzy@163.com>"
|
||||
LABEL documentation="https://jpom.top"
|
||||
|
||||
ENV JPOM_HOME /usr/local/jpom-server
|
||||
ENV JPOM_PKG_VERSION 2.10.41.3
|
||||
ENV JPOM_PKG_VERSION 2.10.42.4
|
||||
ENV JPOM_PKG server-${JPOM_PKG_VERSION}-release.tar.gz
|
||||
ENV SHA1_NAME server-${JPOM_PKG_VERSION}-release.tar.gz.sha1
|
||||
|
||||
|
71
modules/server/DockerfileBetaJdk17
Normal file
71
modules/server/DockerfileBetaJdk17
Normal file
@ -0,0 +1,71 @@
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2019 Code Technology Studio
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
# this software and associated documentation files (the "Software"), to deal in
|
||||
# the Software without restriction, including without limitation the rights to
|
||||
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
# the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
# subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
FROM maven:3.8.5-openjdk-17-slim
|
||||
|
||||
ARG BUILD_DATE
|
||||
LABEL build_info="dromara/Jpom build-date:- ${BUILD_DATE}"
|
||||
LABEL maintainer="bwcx-jzy <bwcx_jzy@163.com>"
|
||||
LABEL documentation="https://jpom.top"
|
||||
|
||||
ENV JPOM_HOME /usr/local/jpom-server
|
||||
ENV JPOM_PKG_VERSION 2.10.42.4
|
||||
ENV JPOM_PKG server-${JPOM_PKG_VERSION}-release.tar.gz
|
||||
ENV SHA1_NAME server-${JPOM_PKG_VERSION}-release.tar.gz.sha1
|
||||
|
||||
ENV JPOM_DATA_PATH ${JPOM_HOME}/data
|
||||
ENV JPOM_LOG_PATH ${JPOM_HOME}/logs
|
||||
# 数据目录
|
||||
ENV jpom.path ${JPOM_DATA_PATH}
|
||||
|
||||
WORKDIR ${JPOM_HOME}
|
||||
|
||||
RUN set -eux; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends git;
|
||||
|
||||
# 时区
|
||||
ENV TZ Asia/Shanghai
|
||||
RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime && echo ${TZ} > /etc/timezone
|
||||
|
||||
RUN mkdir -p ${JPOM_HOME}
|
||||
#
|
||||
RUN curl -LfSo ${JPOM_HOME}/${JPOM_PKG} https://download.jpom.top/beta/${JPOM_PKG_VERSION}/${JPOM_PKG}
|
||||
RUN curl -LfsSo ${JPOM_HOME}/${SHA1_NAME} https://download.jpom.top/beta/${JPOM_PKG_VERSION}/${SHA1_NAME} && \
|
||||
ESUM=`cat ${JPOM_HOME}/${SHA1_NAME}` && \
|
||||
echo "${ESUM} ${JPOM_HOME}/${JPOM_PKG}" | sha1sum -c -;
|
||||
RUN tar -zxvf ${JPOM_HOME}/${JPOM_PKG} -C ${JPOM_HOME}
|
||||
RUN rm -rf ${JPOM_HOME}/${JPOM_PKG}
|
||||
|
||||
# 将配置文件暂存默认目录,避免无法挂载
|
||||
RUN mv $JPOM_HOME/conf $JPOM_HOME/conf_default
|
||||
|
||||
# 健康检查
|
||||
HEALTHCHECK CMD curl -X POST -f http://localhost:2122/check-system || exit 1
|
||||
|
||||
EXPOSE 2122
|
||||
|
||||
ENTRYPOINT ["/bin/bash", "./bin/BlockListener.sh"]
|
||||
|
||||
|
||||
|
71
modules/server/DockerfileReleaseJdk17
Normal file
71
modules/server/DockerfileReleaseJdk17
Normal file
@ -0,0 +1,71 @@
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2019 Code Technology Studio
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
# this software and associated documentation files (the "Software"), to deal in
|
||||
# the Software without restriction, including without limitation the rights to
|
||||
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
# the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
# subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
FROM maven:3.8.6-jdk-8
|
||||
|
||||
ARG BUILD_DATE
|
||||
LABEL build_info="dromara/Jpom build-date:- ${BUILD_DATE}"
|
||||
LABEL maintainer="bwcx-jzy <bwcx_jzy@163.com>"
|
||||
LABEL documentation="https://jpom.top"
|
||||
|
||||
ENV JPOM_HOME /usr/local/jpom-server
|
||||
ENV JPOM_PKG_VERSION 2.10.41
|
||||
ENV JPOM_PKG server-${JPOM_PKG_VERSION}-release.tar.gz
|
||||
ENV SHA1_NAME server-${JPOM_PKG_VERSION}-release.tar.gz.sha1
|
||||
|
||||
ENV JPOM_DATA_PATH ${JPOM_HOME}/data
|
||||
ENV JPOM_LOG_PATH ${JPOM_HOME}/logs
|
||||
# 数据目录
|
||||
ENV jpom.path ${JPOM_DATA_PATH}
|
||||
|
||||
WORKDIR ${JPOM_HOME}
|
||||
|
||||
RUN set -eux; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends git;
|
||||
|
||||
# 时区
|
||||
ENV TZ Asia/Shanghai
|
||||
RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime && echo ${TZ} > /etc/timezone
|
||||
|
||||
RUN mkdir -p ${JPOM_HOME}
|
||||
#
|
||||
RUN curl -LfSo ${JPOM_HOME}/${JPOM_PKG} https://download.jpom.top/release/${JPOM_PKG_VERSION}/${JPOM_PKG}
|
||||
RUN curl -LfsSo ${JPOM_HOME}/${SHA1_NAME} https://download.jpom.top/release/${JPOM_PKG_VERSION}/${SHA1_NAME} && \
|
||||
ESUM=`cat ${JPOM_HOME}/${SHA1_NAME}` && \
|
||||
echo "${ESUM} ${JPOM_HOME}/${JPOM_PKG}" | sha1sum -c -;
|
||||
RUN tar -zxvf ${JPOM_HOME}/${JPOM_PKG} -C ${JPOM_HOME}
|
||||
RUN rm -rf ${JPOM_HOME}/${JPOM_PKG}
|
||||
|
||||
# 将配置文件暂存默认目录,避免无法挂载
|
||||
RUN mv $JPOM_HOME/conf $JPOM_HOME/conf_default
|
||||
|
||||
# 健康检查
|
||||
HEALTHCHECK CMD curl -X POST -f http://localhost:2122/check-system || exit 1
|
||||
|
||||
EXPOSE 2122
|
||||
|
||||
ENTRYPOINT ["/bin/bash", "./bin/BlockListener.sh"]
|
||||
|
||||
|
||||
|
@ -29,13 +29,13 @@
|
||||
<parent>
|
||||
<artifactId>jpom-parent</artifactId>
|
||||
<groupId>org.dromara.jpom</groupId>
|
||||
<version>2.10.41</version>
|
||||
<version>2.10.42.4</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<name>Jpom Server</name>
|
||||
<artifactId>server</artifactId>
|
||||
<version>2.10.41</version>
|
||||
<version>2.10.42.4</version>
|
||||
<properties>
|
||||
<start-class>org.dromara.jpom.JpomServerApplication</start-class>
|
||||
</properties>
|
||||
|
@ -31,12 +31,11 @@ import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.io.file.FileCopier;
|
||||
import cn.hutool.core.lang.Opt;
|
||||
import cn.hutool.core.lang.Tuple;
|
||||
import cn.hutool.core.net.url.UrlQuery;
|
||||
import cn.hutool.core.thread.ExecutorBuilder;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.EnumUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.*;
|
||||
import cn.keepbx.jpom.model.BaseIdModel;
|
||||
import cn.keepbx.jpom.plugins.IPlugin;
|
||||
import lombok.Builder;
|
||||
import lombok.Lombok;
|
||||
@ -46,7 +45,6 @@ import org.dromara.jpom.common.BaseServerController;
|
||||
import org.dromara.jpom.common.ServerConst;
|
||||
import org.dromara.jpom.func.assets.server.MachineDockerServer;
|
||||
import org.dromara.jpom.func.files.service.FileStorageService;
|
||||
import org.dromara.jpom.model.BaseIdModel;
|
||||
import org.dromara.jpom.model.data.BuildInfoModel;
|
||||
import org.dromara.jpom.model.data.RepositoryModel;
|
||||
import org.dromara.jpom.model.docker.DockerInfoModel;
|
||||
@ -86,7 +84,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Builder
|
||||
@Slf4j
|
||||
public class BuildInfoManage implements Runnable {
|
||||
public class BuildExecuteManage implements Runnable {
|
||||
|
||||
/**
|
||||
* 构建线程池
|
||||
@ -97,7 +95,7 @@ public class BuildInfoManage implements Runnable {
|
||||
/**
|
||||
* 缓存构建中
|
||||
*/
|
||||
public static final Map<String, BuildInfoManage> BUILD_MANAGE_MAP = new ConcurrentHashMap<>();
|
||||
public static final Map<String, BuildExecuteManage> BUILD_MANAGE_MAP = new ConcurrentHashMap<>();
|
||||
|
||||
private final TaskData taskData;
|
||||
private final BuildExtraModule buildExtraModule;
|
||||
@ -148,10 +146,10 @@ public class BuildInfoManage implements Runnable {
|
||||
executorBuilder.setHandler(new ThreadPoolExecutor.DiscardPolicy() {
|
||||
@Override
|
||||
public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
|
||||
if (r instanceof BuildInfoManage) {
|
||||
if (r instanceof BuildExecuteManage) {
|
||||
// 取消任务
|
||||
BuildInfoManage buildInfoManage = (BuildInfoManage) r;
|
||||
buildInfoManage.rejectedExecution();
|
||||
BuildExecuteManage buildExecuteManage = (BuildExecuteManage) r;
|
||||
buildExecuteManage.rejectedExecution();
|
||||
} else {
|
||||
log.warn("构建线程池拒绝了未知任务:{}", r.getClass());
|
||||
}
|
||||
@ -518,7 +516,15 @@ public class BuildInfoManage implements Runnable {
|
||||
// env file
|
||||
String attachEnv = this.buildExtraModule.getAttachEnv();
|
||||
Opt.ofBlankAble(attachEnv).ifPresent(s -> {
|
||||
logRecorder.system("读取附件变量:{}", attachEnv);
|
||||
UrlQuery of = UrlQuery.of(attachEnv, CharsetUtil.CHARSET_UTF_8);
|
||||
Map<CharSequence, CharSequence> queryMap = of.getQueryMap();
|
||||
logRecorder.system("读取附件变量:{} {}", attachEnv, CollUtil.size(queryMap));
|
||||
//
|
||||
Optional.ofNullable(queryMap).ifPresent(map -> {
|
||||
for (Map.Entry<CharSequence, CharSequence> entry : map.entrySet()) {
|
||||
taskData.environmentMapBuilder.put(String.valueOf(entry.getKey()), String.valueOf(entry.getValue()));
|
||||
}
|
||||
});
|
||||
Map<String, String> envFileMap = FileUtils.readEnvFile(this.gitFile, s);
|
||||
taskData.environmentMapBuilder.putStr(envFileMap);
|
||||
});
|
||||
@ -702,7 +708,7 @@ public class BuildInfoManage implements Runnable {
|
||||
|
||||
@Override
|
||||
public String execute() {
|
||||
return BuildInfoManage.this.startReady();
|
||||
return BuildExecuteManage.this.startReady();
|
||||
}
|
||||
});
|
||||
suppliers.put("pull", new IProcessItem() {
|
||||
@ -713,7 +719,7 @@ public class BuildInfoManage implements Runnable {
|
||||
|
||||
@Override
|
||||
public String execute() {
|
||||
return BuildInfoManage.this.pullAndCacheBuildEnv();
|
||||
return BuildExecuteManage.this.pullAndCacheBuildEnv();
|
||||
}
|
||||
});
|
||||
suppliers.put("executeCommand", new IProcessItem() {
|
||||
@ -724,7 +730,7 @@ public class BuildInfoManage implements Runnable {
|
||||
|
||||
@Override
|
||||
public String execute() {
|
||||
return BuildInfoManage.this.executeCommand();
|
||||
return BuildExecuteManage.this.executeCommand();
|
||||
}
|
||||
});
|
||||
suppliers.put("packageFile", new IProcessItem() {
|
||||
@ -735,7 +741,7 @@ public class BuildInfoManage implements Runnable {
|
||||
|
||||
@Override
|
||||
public String execute() {
|
||||
return BuildInfoManage.this.packageFile();
|
||||
return BuildExecuteManage.this.packageFile();
|
||||
}
|
||||
});
|
||||
suppliers.put("release", new IProcessItem() {
|
||||
@ -746,7 +752,7 @@ public class BuildInfoManage implements Runnable {
|
||||
|
||||
@Override
|
||||
public String execute() {
|
||||
return BuildInfoManage.this.release();
|
||||
return BuildExecuteManage.this.release();
|
||||
}
|
||||
});
|
||||
suppliers.put("finish", new IProcessItem() {
|
||||
@ -757,7 +763,7 @@ public class BuildInfoManage implements Runnable {
|
||||
|
||||
@Override
|
||||
public String execute() {
|
||||
return BuildInfoManage.this.finish();
|
||||
return BuildExecuteManage.this.finish();
|
||||
}
|
||||
});
|
||||
return suppliers;
|
||||
@ -991,8 +997,8 @@ public class BuildInfoManage implements Runnable {
|
||||
* @return bool
|
||||
*/
|
||||
public static boolean cancelTaskById(String id) {
|
||||
return Optional.ofNullable(BuildInfoManage.BUILD_MANAGE_MAP.get(id)).map(buildInfoManage1 -> {
|
||||
buildInfoManage1.cancelTask("手动取消任务");
|
||||
return Optional.ofNullable(BuildExecuteManage.BUILD_MANAGE_MAP.get(id)).map(buildExecuteManage1 -> {
|
||||
buildExecuteManage1.cancelTask("手动取消任务");
|
||||
return true;
|
||||
}).orElse(false);
|
||||
}
|
@ -26,8 +26,9 @@ import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.SystemClock;
|
||||
import cn.hutool.core.lang.Opt;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.func.assets.server.MachineDockerServer;
|
||||
import org.dromara.jpom.func.files.service.FileStorageService;
|
||||
import org.dromara.jpom.model.BaseEnum;
|
||||
@ -101,6 +102,9 @@ public class BuildExecuteService {
|
||||
* @return 错误消息
|
||||
*/
|
||||
public String checkStatus(BuildInfoModel buildInfoModel) {
|
||||
if (buildInfoModel == null) {
|
||||
return "不存在对应的构建信息";
|
||||
}
|
||||
Integer status = buildInfoModel.getStatus();
|
||||
if (status == null) {
|
||||
return null;
|
||||
@ -124,7 +128,7 @@ public class BuildExecuteService {
|
||||
* @param parametersEnv 外部环境变量
|
||||
* @return json
|
||||
*/
|
||||
public JsonMessage<Integer> start(String buildInfoId, UserModel userModel, Integer delay, int triggerBuildType, String buildRemark, Object... parametersEnv) {
|
||||
public IJsonMessage<Integer> start(String buildInfoId, UserModel userModel, Integer delay, int triggerBuildType, String buildRemark, Object... parametersEnv) {
|
||||
return this.start(buildInfoId, userModel, delay, triggerBuildType, buildRemark, null, parametersEnv);
|
||||
}
|
||||
|
||||
@ -140,7 +144,7 @@ public class BuildExecuteService {
|
||||
* @param parametersEnv 外部环境变量
|
||||
* @return json
|
||||
*/
|
||||
public JsonMessage<Integer> start(String buildInfoId, UserModel userModel, Integer delay,
|
||||
public IJsonMessage<Integer> start(String buildInfoId, UserModel userModel, Integer delay,
|
||||
int triggerBuildType, String buildRemark, String checkRepositoryDiff,
|
||||
Object... parametersEnv) {
|
||||
synchronized (buildInfoId.intern()) {
|
||||
@ -148,7 +152,7 @@ public class BuildExecuteService {
|
||||
String e = this.checkStatus(buildInfoModel);
|
||||
Assert.isNull(e, () -> e);
|
||||
//
|
||||
boolean containsKey = BuildInfoManage.BUILD_MANAGE_MAP.containsKey(buildInfoModel.getId());
|
||||
boolean containsKey = BuildExecuteManage.BUILD_MANAGE_MAP.containsKey(buildInfoModel.getId());
|
||||
Assert.state(!containsKey, "当前构建还在进行中");
|
||||
//
|
||||
BuildExtraModule buildExtraModule = StringUtil.jsonConvert(buildInfoModel.getExtraData(), BuildExtraModule.class);
|
||||
@ -196,7 +200,7 @@ public class BuildExecuteService {
|
||||
private void runTask(TaskData taskData, BuildExtraModule buildExtraModule) {
|
||||
String logId = this.insertLog(buildExtraModule, taskData);
|
||||
//
|
||||
BuildInfoManage.BuildInfoManageBuilder builder = BuildInfoManage.builder()
|
||||
BuildExecuteManage.BuildExecuteManageBuilder builder = BuildExecuteManage.builder()
|
||||
.taskData(taskData)
|
||||
.logId(logId)
|
||||
.scriptServer(scriptServer)
|
||||
|
@ -191,6 +191,11 @@ public class BuildExtraModule extends BaseModel {
|
||||
*/
|
||||
private Integer cloneDepth;
|
||||
|
||||
/**
|
||||
* 构建历史保留个数
|
||||
*/
|
||||
private Integer resultKeepCount;
|
||||
|
||||
public boolean strictlyEnforce() {
|
||||
return strictlyEnforce != null && strictlyEnforce;
|
||||
}
|
||||
|
@ -30,12 +30,12 @@ import cn.hutool.core.util.ReUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.*;
|
||||
import cn.hutool.setting.yaml.YamlUtil;
|
||||
import cn.keepbx.jpom.model.BaseJsonModel;
|
||||
import cn.keepbx.jpom.plugins.IPlugin;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.func.assets.server.MachineDockerServer;
|
||||
import org.dromara.jpom.model.BaseJsonModel;
|
||||
import org.dromara.jpom.model.docker.DockerInfoModel;
|
||||
import org.dromara.jpom.plugin.PluginFactory;
|
||||
import org.dromara.jpom.service.docker.DockerInfoService;
|
||||
|
@ -36,6 +36,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.hutool.extra.ssh.JschUtil;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import cn.keepbx.jpom.plugins.IPlugin;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
@ -46,7 +47,6 @@ import lombok.Lombok;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.JpomApplication;
|
||||
import org.dromara.jpom.common.BaseServerController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.forward.NodeForward;
|
||||
import org.dromara.jpom.common.forward.NodeUrl;
|
||||
import org.dromara.jpom.func.assets.model.MachineSshModel;
|
||||
|
@ -25,6 +25,7 @@ package org.dromara.jpom.common;
|
||||
import cn.hutool.cache.Cache;
|
||||
import cn.hutool.cache.CacheUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import org.dromara.jpom.common.forward.NodeForward;
|
||||
import org.dromara.jpom.common.forward.NodeUrl;
|
||||
import org.dromara.jpom.common.interceptor.LoginInterceptor;
|
||||
|
@ -22,6 +22,8 @@
|
||||
*/
|
||||
package org.dromara.jpom.common;
|
||||
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.system.AgentException;
|
||||
import org.dromara.jpom.system.AuthorizeException;
|
||||
@ -46,7 +48,7 @@ public class GlobalDefaultExceptionHandler extends BaseExceptionHandler {
|
||||
* @param e 异常
|
||||
*/
|
||||
@ExceptionHandler({AuthorizeException.class})
|
||||
public JsonMessage<String> delExceptionHandler(AuthorizeException e) {
|
||||
public IJsonMessage<String> delExceptionHandler(AuthorizeException e) {
|
||||
return e.getJsonMessage();
|
||||
}
|
||||
|
||||
@ -61,7 +63,7 @@ public class GlobalDefaultExceptionHandler extends BaseExceptionHandler {
|
||||
* @since 2021-08-01
|
||||
*/
|
||||
@ExceptionHandler({AgentException.class})
|
||||
public JsonMessage<String> agentExceptionHandler(HttpServletRequest request, AgentException e) {
|
||||
public IJsonMessage<String> agentExceptionHandler(HttpServletRequest request, AgentException e) {
|
||||
Throwable cause = e.getCause();
|
||||
if (cause != null) {
|
||||
log.error("controller {}", request.getRequestURI(), cause);
|
||||
|
@ -28,8 +28,6 @@ package org.dromara.jpom.common;
|
||||
*/
|
||||
public class ServerConst extends Const {
|
||||
|
||||
public static final String GROUP_STR = "group";
|
||||
|
||||
/**
|
||||
* h2 数据库表名字段
|
||||
*/
|
||||
@ -75,4 +73,6 @@ public class ServerConst extends Const {
|
||||
public static final int ACCOUNT_LOCKED = 802;
|
||||
public static final String LOGIN_TIP = "登录信息已失效,重新登录";
|
||||
public static final String ACCOUNT_LOCKED_TIP = "账号已经被禁用,不能使用";
|
||||
|
||||
public static final String CHECK_SYSTEM = "check-system";
|
||||
}
|
||||
|
@ -24,9 +24,9 @@ package org.dromara.jpom.common.forward;
|
||||
|
||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.TypeReference;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.system.AgentException;
|
||||
import org.dromara.jpom.transport.INodeInfo;
|
||||
import org.dromara.jpom.transport.TransformServer;
|
||||
|
@ -34,6 +34,8 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.keepbx.jpom.model.BaseIdModel;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.fastjson2.TypeReference;
|
||||
@ -41,10 +43,8 @@ import lombok.Lombok;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.common.BaseServerController;
|
||||
import org.dromara.jpom.common.Const;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.func.assets.model.MachineNodeModel;
|
||||
import org.dromara.jpom.func.assets.server.MachineNodeServer;
|
||||
import org.dromara.jpom.model.BaseIdModel;
|
||||
import org.dromara.jpom.model.data.NodeModel;
|
||||
import org.dromara.jpom.model.user.UserModel;
|
||||
import org.dromara.jpom.system.AgentException;
|
||||
@ -309,7 +309,20 @@ public class NodeForward {
|
||||
*/
|
||||
public static <T> JsonMessage<T> requestSharding(NodeModel nodeModel, NodeUrl nodeUrl, JSONObject jsonObject, File file, Function<JSONObject, JsonMessage<T>> doneCallback, BiConsumer<Long, Long> streamProgress) throws IOException {
|
||||
INodeInfo nodeInfo = parseNodeInfo(nodeModel);
|
||||
return requestSharding(nodeInfo, nodeModel.getWorkspaceId(), nodeUrl, jsonObject, file, doneCallback, streamProgress);
|
||||
return requestSharding(nodeInfo, nodeModel.getWorkspaceId(), nodeUrl, jsonObject, file, File::getName, doneCallback, streamProgress);
|
||||
}
|
||||
|
||||
/**
|
||||
* 普通消息转发
|
||||
*
|
||||
* @param nodeModel 节点
|
||||
* @param nodeUrl 节点的url
|
||||
* @param jsonObject 数据
|
||||
* @return JSON
|
||||
*/
|
||||
public static <T> JsonMessage<T> requestSharding(NodeModel nodeModel, NodeUrl nodeUrl, JSONObject jsonObject, File file, String fileName, Function<JSONObject, JsonMessage<T>> doneCallback, BiConsumer<Long, Long> streamProgress) throws IOException {
|
||||
INodeInfo nodeInfo = parseNodeInfo(nodeModel);
|
||||
return requestSharding(nodeInfo, nodeModel.getWorkspaceId(), nodeUrl, jsonObject, file, file1 -> fileName, doneCallback, streamProgress);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -322,7 +335,7 @@ public class NodeForward {
|
||||
*/
|
||||
public static <T> JsonMessage<T> requestSharding(MachineNodeModel machineNodeModel, NodeUrl nodeUrl, JSONObject jsonObject, File file, Function<JSONObject, JsonMessage<T>> doneCallback, BiConsumer<Long, Long> streamProgress) throws IOException {
|
||||
INodeInfo nodeInfo = coverNodeInfo(machineNodeModel);
|
||||
return requestSharding(nodeInfo, StrUtil.EMPTY, nodeUrl, jsonObject, file, doneCallback, streamProgress);
|
||||
return requestSharding(nodeInfo, StrUtil.EMPTY, nodeUrl, jsonObject, file, File::getName, doneCallback, streamProgress);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -335,12 +348,12 @@ public class NodeForward {
|
||||
* @param jsonObject 数据
|
||||
* @return JSON
|
||||
*/
|
||||
private static <T> JsonMessage<T> requestSharding(INodeInfo nodeInfo, String workspaceId, NodeUrl nodeUrl, JSONObject jsonObject, File file, Function<JSONObject, JsonMessage<T>> doneCallback, BiConsumer<Long, Long> streamProgress) throws IOException {
|
||||
private static <T> JsonMessage<T> requestSharding(INodeInfo nodeInfo, String workspaceId, NodeUrl nodeUrl, JSONObject jsonObject, File file, Function<File, String> fileNameFn, Function<JSONObject, JsonMessage<T>> doneCallback, BiConsumer<Long, Long> streamProgress) throws IOException {
|
||||
IUrlItem urlItem = parseUrlItem(nodeInfo, workspaceId, nodeUrl, DataContentType.FORM_URLENCODED);
|
||||
ServerConfig serverConfig = SpringUtil.getBean(ServerConfig.class);
|
||||
ServerConfig.NodeConfig nodeConfig = serverConfig.getNode();
|
||||
long length = file.length();
|
||||
String fileName = file.getName();
|
||||
String fileName = fileNameFn.apply(file);
|
||||
Assert.state(length > 0, "空文件不能上传");
|
||||
String md5 = SecureUtil.md5(file);
|
||||
int fileSliceSize = nodeConfig.getUploadFileSliceSize();
|
||||
|
@ -22,11 +22,13 @@
|
||||
*/
|
||||
package org.dromara.jpom.common.interceptor;
|
||||
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.net.Ipv4Util;
|
||||
import cn.hutool.core.net.NetUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.model.data.SystemIpConfigModel;
|
||||
import org.dromara.jpom.service.system.SystemParametersServer;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@ -44,6 +46,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
* @since 2021/4/18
|
||||
*/
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class IpInterceptor implements HandlerMethodInterceptor {
|
||||
|
||||
private static final int IP_ACCESS_CODE = 999;
|
||||
@ -55,7 +58,8 @@ public class IpInterceptor implements HandlerMethodInterceptor {
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, HandlerMethod handlerMethod) throws Exception {
|
||||
String clientIp = ServletUtil.getClientIP(request);
|
||||
if (StrUtil.equals(NetUtil.LOCAL_IP, clientIp)) {
|
||||
if (StrUtil.equals(NetUtil.LOCAL_IP, clientIp) || !Validator.isIpv4(clientIp)) {
|
||||
// 本地 或者 非 ipv4 直接放开
|
||||
return true;
|
||||
}
|
||||
SystemIpConfigModel config = systemParametersServer.getConfig(SystemIpConfigModel.ID, SystemIpConfigModel.class);
|
||||
@ -64,12 +68,17 @@ public class IpInterceptor implements HandlerMethodInterceptor {
|
||||
}
|
||||
// 判断不允许访问
|
||||
String prohibited = config.getProhibited();
|
||||
if (StrUtil.isNotEmpty(prohibited) && this.checkIp(prohibited, clientIp, false)) {
|
||||
ServletUtil.write(response, JsonMessage.getString(IP_ACCESS_CODE, "Prohibition of access"), MediaType.APPLICATION_JSON_VALUE);
|
||||
return false;
|
||||
}
|
||||
String allowed = config.getAllowed();
|
||||
if (StrUtil.isEmpty(allowed) || this.checkIp(allowed, clientIp, true)) {
|
||||
try {
|
||||
if (StrUtil.isNotEmpty(prohibited) && this.checkIp(prohibited, clientIp, false)) {
|
||||
ServletUtil.write(response, JsonMessage.getString(IP_ACCESS_CODE, "Prohibition of access"), MediaType.APPLICATION_JSON_VALUE);
|
||||
return false;
|
||||
}
|
||||
String allowed = config.getAllowed();
|
||||
if (StrUtil.isEmpty(allowed) || this.checkIp(allowed, clientIp, true)) {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("IP白名单拦截异常,请检查配置是否正确", e);
|
||||
return true;
|
||||
}
|
||||
ServletUtil.write(response, JsonMessage.getString(IP_ACCESS_CODE, "Prohibition of access"), MediaType.APPLICATION_JSON_VALUE);
|
||||
|
@ -26,8 +26,8 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.hutool.jwt.JWT;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import org.dromara.jpom.common.BaseServerController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.ServerConst;
|
||||
import org.dromara.jpom.common.ServerOpenApi;
|
||||
import org.dromara.jpom.model.user.UserModel;
|
||||
|
@ -26,8 +26,8 @@ import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import org.dromara.jpom.common.BaseServerController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.model.BaseNodeModel;
|
||||
import org.dromara.jpom.model.data.NodeModel;
|
||||
import org.dromara.jpom.model.user.UserBindWorkspaceModel;
|
||||
|
@ -35,12 +35,14 @@ import cn.hutool.core.util.*;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.hutool.http.ContentType;
|
||||
import cn.hutool.system.SystemUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import cn.keepbx.jpom.plugins.IPlugin;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.common.BaseServerController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.JpomManifest;
|
||||
import org.dromara.jpom.common.ServerConst;
|
||||
import org.dromara.jpom.common.UrlRedirectUtil;
|
||||
import org.dromara.jpom.common.interceptor.NotLogin;
|
||||
@ -164,7 +166,7 @@ public class IndexControl extends BaseServerController {
|
||||
*/
|
||||
@RequestMapping(value = "logo-image", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@NotLogin
|
||||
public JsonMessage<String> logoImage(HttpServletResponse response) {
|
||||
public IJsonMessage<String> logoImage(HttpServletResponse response) {
|
||||
String logoFile = webConfig.getLogoFile();
|
||||
String imageSrc = this.loadImageSrc(response, logoFile, "classpath:/logo/jpom.png", "jpg", "png", "gif");
|
||||
return JsonMessage.success("", imageSrc);
|
||||
@ -247,8 +249,8 @@ public class IndexControl extends BaseServerController {
|
||||
* @apiSuccess (222) {Object} data 系统还没有超级管理员需要初始化
|
||||
*/
|
||||
@NotLogin
|
||||
@RequestMapping(value = "check-system", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<JSONObject> checkSystem(HttpServletRequest request) {
|
||||
@RequestMapping(value = ServerConst.CHECK_SYSTEM, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public IJsonMessage<JSONObject> checkSystem(HttpServletRequest request) {
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("routerBase", UrlRedirectUtil.getHeaderProxyPath(request, ServerConst.PROXY_PATH));
|
||||
//
|
||||
@ -258,6 +260,7 @@ public class IndexControl extends BaseServerController {
|
||||
data.put("disabledGuide", webConfig.isDisabledGuide());
|
||||
//data.put("disabledCaptcha", webConfig.isDisabledCaptcha());
|
||||
data.put("notificationPlacement", webConfig.getNotificationPlacement());
|
||||
data.put("installId", JpomManifest.getInstance().getInstallId());
|
||||
// 用于判断是否属于容器部署
|
||||
boolean inDocker = StrUtil.isNotEmpty(SystemUtil.get("JPOM_PKG"));
|
||||
List<String> extendPlugins = new ArrayList<>();
|
||||
@ -292,7 +295,7 @@ public class IndexControl extends BaseServerController {
|
||||
* @apiSuccess {JSON} data 菜单相关字段
|
||||
*/
|
||||
@RequestMapping(value = "menus_data.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<List<Object>> menusData(HttpServletRequest request) {
|
||||
public IJsonMessage<List<Object>> menusData(HttpServletRequest request) {
|
||||
NodeModel nodeModel = tryGetNode();
|
||||
UserModel userModel = getUserModel();
|
||||
String workspaceId = nodeService.getCheckUserWorkspace(request);
|
||||
@ -342,7 +345,7 @@ public class IndexControl extends BaseServerController {
|
||||
*/
|
||||
@RequestMapping(value = "system_menus_data.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@SystemPermission
|
||||
public JsonMessage<List<Object>> systemMenusData(HttpServletRequest request) {
|
||||
public IJsonMessage<List<Object>> systemMenusData(HttpServletRequest request) {
|
||||
UserModel userModel = getUserModel();
|
||||
// 菜单
|
||||
InputStream inputStream = ResourceUtil.getStream("classpath:/menus/system.json");
|
||||
@ -417,7 +420,7 @@ public class IndexControl extends BaseServerController {
|
||||
* @return json
|
||||
*/
|
||||
@GetMapping(value = "generate-sharding-id", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<String> generateShardingId() {
|
||||
public IJsonMessage<String> generateShardingId() {
|
||||
Cache<String, String> shardingIds = BaseServerController.SHARDING_IDS;
|
||||
int size = shardingIds.size();
|
||||
Assert.state(size <= 100, "分片id最大同时使用 100 个");
|
||||
|
@ -24,11 +24,12 @@ package org.dromara.jpom.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.common.BaseServerController;
|
||||
import org.dromara.jpom.common.Const;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.interceptor.LoginInterceptor;
|
||||
import org.dromara.jpom.common.interceptor.NotLogin;
|
||||
import org.dromara.jpom.common.validator.ValidatorConfig;
|
||||
@ -84,7 +85,7 @@ public class InstallController extends BaseServerController {
|
||||
*/
|
||||
@PostMapping(value = "install_submit.json", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@NotLogin
|
||||
public JsonMessage<JSONObject> installSubmit(
|
||||
public IJsonMessage<JSONObject> installSubmit(
|
||||
@ValidatorConfig(value = {
|
||||
@ValidatorItem(value = ValidatorRule.NOT_EMPTY, msg = "登录名不能为空"),
|
||||
@ValidatorItem(value = ValidatorRule.NOT_BLANK, range = UserModel.USER_NAME_MIN_LEN + ":" + Const.ID_MAX_LEN, msg = "登录名长度范围" + UserModel.USER_NAME_MIN_LEN + "-" + Const.ID_MAX_LEN),
|
||||
|
@ -38,6 +38,8 @@ import cn.hutool.crypto.SecureUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.hutool.http.ContentType;
|
||||
import cn.hutool.jwt.JWT;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.zhyd.oauth.model.AuthCallback;
|
||||
@ -45,7 +47,6 @@ import me.zhyd.oauth.model.AuthResponse;
|
||||
import me.zhyd.oauth.model.AuthUser;
|
||||
import me.zhyd.oauth.request.AuthRequest;
|
||||
import org.dromara.jpom.common.BaseServerController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.ServerConst;
|
||||
import org.dromara.jpom.common.ServerOpenApi;
|
||||
import org.dromara.jpom.common.interceptor.LoginInterceptor;
|
||||
@ -117,7 +118,7 @@ public class LoginControl extends BaseServerController implements InitializingBe
|
||||
*/
|
||||
@RequestMapping(value = "rand-code", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@NotLogin
|
||||
public JsonMessage<String> randCode() {
|
||||
public IJsonMessage<String> randCode() {
|
||||
if (webConfig.isDisabledCaptcha()) {
|
||||
return new JsonMessage<>(400, "验证码已禁用");
|
||||
}
|
||||
@ -178,7 +179,7 @@ public class LoginControl extends BaseServerController implements InitializingBe
|
||||
*/
|
||||
@PostMapping(value = "userLogin", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@NotLogin
|
||||
public JsonMessage<Object> userLogin(@ValidatorItem(value = ValidatorRule.NOT_EMPTY, msg = "请输入登录信息") String loginName,
|
||||
public IJsonMessage<Object> userLogin(@ValidatorItem(value = ValidatorRule.NOT_EMPTY, msg = "请输入登录信息") String loginName,
|
||||
@ValidatorItem(value = ValidatorRule.NOT_EMPTY, msg = "请输入登录信息") String userPwd,
|
||||
String code,
|
||||
HttpServletRequest request) {
|
||||
@ -251,7 +252,7 @@ public class LoginControl extends BaseServerController implements InitializingBe
|
||||
*/
|
||||
@GetMapping(value = "oauth2-url", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@NotLogin
|
||||
public JsonMessage<JSONObject> oauth2LoginUrl(HttpServletRequest request, @ValidatorItem String provide) {
|
||||
public IJsonMessage<JSONObject> oauth2LoginUrl(HttpServletRequest request, @ValidatorItem String provide) {
|
||||
AuthRequest authRequest = Oauth2Factory.get(provide);
|
||||
String authorize = authRequest.authorize(null);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
@ -286,7 +287,7 @@ public class LoginControl extends BaseServerController implements InitializingBe
|
||||
*/
|
||||
@PostMapping(value = "oauth2/login", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@NotLogin
|
||||
public JsonMessage<UserLoginDto> oauth2Callback(@ValidatorItem String code,
|
||||
public IJsonMessage<UserLoginDto> oauth2Callback(@ValidatorItem String code,
|
||||
@ValidatorItem String provide,
|
||||
String state,
|
||||
HttpServletRequest request) {
|
||||
@ -355,7 +356,7 @@ public class LoginControl extends BaseServerController implements InitializingBe
|
||||
|
||||
@GetMapping(value = "mfa_verify", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@NotLogin
|
||||
public JsonMessage<UserLoginDto> mfaVerify(String token, String code, HttpServletRequest request) {
|
||||
public IJsonMessage<UserLoginDto> mfaVerify(String token, String code, HttpServletRequest request) {
|
||||
String userId = MFA_TOKEN.get(token);
|
||||
if (StrUtil.isEmpty(userId)) {
|
||||
return new JsonMessage<>(201, "登录信息已经过期请重新登录");
|
||||
@ -377,7 +378,7 @@ public class LoginControl extends BaseServerController implements InitializingBe
|
||||
*/
|
||||
@RequestMapping(value = "logout2", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@NotLogin
|
||||
public JsonMessage<Object> logout(HttpSession session) {
|
||||
public IJsonMessage<Object> logout(HttpSession session) {
|
||||
session.invalidate();
|
||||
return JsonMessage.success("退出成功");
|
||||
}
|
||||
@ -389,7 +390,7 @@ public class LoginControl extends BaseServerController implements InitializingBe
|
||||
*/
|
||||
@RequestMapping(value = "renewal", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@NotLogin
|
||||
public JsonMessage<UserLoginDto> renewalToken(HttpServletRequest request) {
|
||||
public IJsonMessage<UserLoginDto> renewalToken(HttpServletRequest request) {
|
||||
String token = request.getHeader(ServerOpenApi.HTTP_HEAD_AUTHORIZATION);
|
||||
if (StrUtil.isEmpty(token)) {
|
||||
return new JsonMessage<>(ServerConst.AUTHORIZE_TIME_OUT_CODE, "刷新token失败");
|
||||
@ -415,7 +416,7 @@ public class LoginControl extends BaseServerController implements InitializingBe
|
||||
*/
|
||||
@GetMapping(value = "login-config", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@NotLogin
|
||||
public JsonMessage<JSONObject> demoInfo() {
|
||||
public IJsonMessage<JSONObject> demoInfo() {
|
||||
String userDemoTip = userConfig.getDemoTip();
|
||||
userDemoTip = StringUtil.convertFileStr(userDemoTip, StrUtil.EMPTY);
|
||||
|
||||
|
@ -26,7 +26,8 @@ import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.cron.pattern.CronPatternUtil;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -46,7 +47,7 @@ import java.util.stream.Collectors;
|
||||
public class ToolsController {
|
||||
|
||||
@GetMapping(value = "cron", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JsonMessage<List<Long>> cron(@ValidatorItem String cron, @ValidatorItem int count, String date, boolean isMatchSecond) {
|
||||
public IJsonMessage<List<Long>> cron(@ValidatorItem String cron, @ValidatorItem int count, String date, boolean isMatchSecond) {
|
||||
Date startDate = null;
|
||||
Date endDate = null;
|
||||
if (StrUtil.isNotEmpty(date)) {
|
||||
|
@ -31,6 +31,8 @@ import cn.hutool.core.lang.Tuple;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import cn.keepbx.jpom.plugins.IPlugin;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
@ -39,7 +41,6 @@ import org.dromara.jpom.build.BuildUtil;
|
||||
import org.dromara.jpom.build.DockerYmlDsl;
|
||||
import org.dromara.jpom.build.ResultDirFileAction;
|
||||
import org.dromara.jpom.common.BaseServerController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.ServerConst;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.dromara.jpom.common.validator.ValidatorRule;
|
||||
@ -123,7 +124,7 @@ public class BuildInfoController extends BaseServerController {
|
||||
*/
|
||||
@RequestMapping(value = "/build/list", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<PageResultDto<BuildInfoModel>> getBuildList(HttpServletRequest request) {
|
||||
public IJsonMessage<PageResultDto<BuildInfoModel>> getBuildList(HttpServletRequest request) {
|
||||
// load list with page
|
||||
PageResultDto<BuildInfoModel> page = buildInfoService.listPage(request);
|
||||
page.each(buildInfoModel -> {
|
||||
@ -144,7 +145,7 @@ public class BuildInfoController extends BaseServerController {
|
||||
*/
|
||||
@GetMapping(value = "/build/get", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<BuildInfoModel> getBuildListAll(String id, HttpServletRequest request) {
|
||||
public IJsonMessage<BuildInfoModel> getBuildListAll(String id, HttpServletRequest request) {
|
||||
// load list with page
|
||||
BuildInfoModel buildInfoModel = buildInfoService.getByKey(id, request);
|
||||
Assert.notNull(buildInfoModel, "不存在对应的构建");
|
||||
@ -164,7 +165,7 @@ public class BuildInfoController extends BaseServerController {
|
||||
*/
|
||||
@GetMapping(value = "/build/list_group_all", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<List<String>> getBuildGroupAll(HttpServletRequest request) {
|
||||
public IJsonMessage<List<String>> getBuildGroupAll(HttpServletRequest request) {
|
||||
// load list with page
|
||||
List<String> group = buildInfoService.listGroup(request);
|
||||
return JsonMessage.success("", group);
|
||||
@ -188,7 +189,7 @@ public class BuildInfoController extends BaseServerController {
|
||||
*/
|
||||
@RequestMapping(value = "/build/edit", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
public JsonMessage<String> updateBuild(String id,
|
||||
public IJsonMessage<String> updateBuild(String id,
|
||||
@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "构建名称不能为空") String name,
|
||||
@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "仓库信息不能为空") String repositoryId,
|
||||
@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "构建产物目录不能为空,长度1-200", range = "1:200") String resultDirFile,
|
||||
@ -198,6 +199,7 @@ public class BuildInfoController extends BaseServerController {
|
||||
String extraData, String group,
|
||||
@ValidatorItem(value = ValidatorRule.POSITIVE_INTEGER, msg = "构建方式不正确") int buildMode,
|
||||
String aliasCode,
|
||||
@ValidatorItem(value = ValidatorRule.NUMBERS, msg = "请填写正确的保留天数") Integer resultKeepDay,
|
||||
HttpServletRequest request) {
|
||||
// 根据 repositoryId 查询仓库信息
|
||||
RepositoryModel repositoryModel = repositoryService.getByKey(repositoryId, request);
|
||||
@ -246,6 +248,7 @@ public class BuildInfoController extends BaseServerController {
|
||||
buildInfoModel.setResultDirFile(resultDirFile);
|
||||
buildInfoModel.setScript(script);
|
||||
buildInfoModel.setGroup(group);
|
||||
buildInfoModel.setResultKeepDay(resultKeepDay);
|
||||
buildInfoModel.setBuildMode(buildMode);
|
||||
// 发布方式
|
||||
BuildReleaseMethod releaseMethod1 = BaseEnum.getEnum(BuildReleaseMethod.class, releaseMethod);
|
||||
@ -437,7 +440,7 @@ public class BuildInfoController extends BaseServerController {
|
||||
*/
|
||||
@RequestMapping(value = "/build/branch-list", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<JSONObject> branchList(
|
||||
public IJsonMessage<JSONObject> branchList(
|
||||
@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "仓库ID不能为空") String repositoryId) throws Exception {
|
||||
// 根据 repositoryId 查询仓库信息
|
||||
RepositoryModel repositoryModel = repositoryService.getByKey(repositoryId, false);
|
||||
@ -464,7 +467,7 @@ public class BuildInfoController extends BaseServerController {
|
||||
*/
|
||||
@PostMapping(value = "/build/delete", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.DEL)
|
||||
public JsonMessage<Object> delete(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据id") String id, HttpServletRequest request) {
|
||||
public IJsonMessage<Object> delete(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据id") String id, HttpServletRequest request) {
|
||||
// 查询构建信息
|
||||
BuildInfoModel buildInfoModel = buildInfoService.getByKey(id, request);
|
||||
Objects.requireNonNull(buildInfoModel, "没有对应数据");
|
||||
@ -493,7 +496,7 @@ public class BuildInfoController extends BaseServerController {
|
||||
*/
|
||||
@PostMapping(value = "/build/clean-source", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EXECUTE)
|
||||
public JsonMessage<Object> cleanSource(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据id") String id, HttpServletRequest request) {
|
||||
public IJsonMessage<Object> cleanSource(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据id") String id, HttpServletRequest request) {
|
||||
// 查询构建信息
|
||||
BuildInfoModel buildInfoModel = buildInfoService.getByKey(id, request);
|
||||
Objects.requireNonNull(buildInfoModel, "没有对应数据");
|
||||
@ -515,7 +518,7 @@ public class BuildInfoController extends BaseServerController {
|
||||
*/
|
||||
@GetMapping(value = "/build/sort-item", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
public JsonMessage<String> sortItem(@ValidatorItem String id, @ValidatorItem String method, String compareId, HttpServletRequest request) {
|
||||
public IJsonMessage<String> sortItem(@ValidatorItem String id, @ValidatorItem String method, String compareId, HttpServletRequest request) {
|
||||
if (StrUtil.equalsIgnoreCase(method, "top")) {
|
||||
buildInfoService.sortToTop(id, request);
|
||||
} else if (StrUtil.equalsIgnoreCase(method, "up")) {
|
||||
|
@ -26,9 +26,10 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import org.dromara.jpom.build.BuildUtil;
|
||||
import org.dromara.jpom.common.BaseServerController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.validator.ValidatorConfig;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.dromara.jpom.common.validator.ValidatorRule;
|
||||
@ -132,7 +133,7 @@ public class BuildInfoHistoryController extends BaseServerController {
|
||||
|
||||
@RequestMapping(value = "/build/history/history_list.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<PageResultDto<BuildHistoryLog>> historyList() {
|
||||
public IJsonMessage<PageResultDto<BuildHistoryLog>> historyList() {
|
||||
PageResultDto<BuildHistoryLog> pageResultTemp = dbBuildHistoryLogService.listPage(getRequest());
|
||||
pageResultTemp.each(buildHistoryLog -> {
|
||||
File file = BuildUtil.getHistoryPackageFile(buildHistoryLog.getBuildDataId(), buildHistoryLog.getBuildNumberId(), buildHistoryLog.getResultDirFile());
|
||||
@ -152,11 +153,11 @@ public class BuildInfoHistoryController extends BaseServerController {
|
||||
*/
|
||||
@RequestMapping(value = "/build/history/delete_log.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.DEL)
|
||||
public JsonMessage<String> delete(@ValidatorConfig(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据")) String logId) {
|
||||
public IJsonMessage<String> delete(@ValidatorConfig(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据")) String logId) {
|
||||
List<String> strings = StrUtil.splitTrim(logId, StrUtil.COMMA);
|
||||
for (String itemId : strings) {
|
||||
BuildHistoryLog buildHistoryLog = dbBuildHistoryLogService.getByKey(itemId, getRequest());
|
||||
JsonMessage<String> jsonMessage = dbBuildHistoryLogService.deleteLogAndFile(buildHistoryLog);
|
||||
IJsonMessage<String> jsonMessage = dbBuildHistoryLogService.deleteLogAndFile(buildHistoryLog);
|
||||
if (!jsonMessage.success()) {
|
||||
return jsonMessage;
|
||||
}
|
||||
|
@ -26,11 +26,12 @@ import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.lang.Opt;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.fastjson2.TypeReference;
|
||||
import org.dromara.jpom.build.*;
|
||||
import org.dromara.jpom.common.BaseServerController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.validator.ValidatorConfig;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.dromara.jpom.common.validator.ValidatorRule;
|
||||
@ -105,7 +106,7 @@ public class BuildInfoManageController extends BaseServerController {
|
||||
*/
|
||||
@RequestMapping(value = "/build/manage/start", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EXECUTE)
|
||||
public JsonMessage<Integer> start(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据") String id,
|
||||
public IJsonMessage<Integer> start(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据") String id,
|
||||
String buildRemark,
|
||||
String resultDirFile,
|
||||
String branchName,
|
||||
@ -152,7 +153,7 @@ public class BuildInfoManageController extends BaseServerController {
|
||||
*/
|
||||
@RequestMapping(value = "/build/manage/cancel", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EXECUTE)
|
||||
public JsonMessage<String> cancel(@ValidatorConfig(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据")) String id) {
|
||||
public IJsonMessage<String> cancel(@ValidatorConfig(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据")) String id) {
|
||||
BuildInfoModel item = buildInfoService.getByKey(id, getRequest());
|
||||
Objects.requireNonNull(item, "没有对应数据");
|
||||
String checkStatus = buildExecuteService.checkStatus(item);
|
||||
@ -161,7 +162,7 @@ public class BuildInfoManageController extends BaseServerController {
|
||||
if (checkStatus == null) {
|
||||
return JsonMessage.success("当前状态不在进行中," + nowStatus.getDesc());
|
||||
}
|
||||
boolean status = BuildInfoManage.cancelTaskById(item.getId());
|
||||
boolean status = BuildExecuteManage.cancelTaskById(item.getId());
|
||||
if (!status) {
|
||||
// 缓存中可能不存在数据,还是需要执行取消
|
||||
buildInfoService.updateStatus(id, BuildStatus.Cancel, "手动取消");
|
||||
@ -177,7 +178,7 @@ public class BuildInfoManageController extends BaseServerController {
|
||||
*/
|
||||
@RequestMapping(value = "/build/manage/reRelease", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EXECUTE)
|
||||
public JsonMessage<Object> reRelease(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据") String logId,
|
||||
public IJsonMessage<Object> reRelease(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据") String logId,
|
||||
HttpServletRequest request) {
|
||||
String workspaceId = dbBuildHistoryLogService.getCheckUserWorkspace(request);
|
||||
BuildHistoryLog buildHistoryLog = dbBuildHistoryLogService.getByKey(logId, false, entity -> entity.set("workspaceId", workspaceId));
|
||||
@ -222,7 +223,7 @@ public class BuildInfoManageController extends BaseServerController {
|
||||
*/
|
||||
@RequestMapping(value = "/build/manage/get-now-log", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<JSONObject> getNowLog(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据") String id,
|
||||
public IJsonMessage<JSONObject> getNowLog(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据") String id,
|
||||
@ValidatorItem(value = ValidatorRule.POSITIVE_INTEGER, msg = "没有buildId") int buildId,
|
||||
@ValidatorItem(value = ValidatorRule.POSITIVE_INTEGER, msg = "line") int line) {
|
||||
BuildInfoModel item = buildInfoService.getByKey(id, getRequest());
|
||||
|
@ -24,7 +24,12 @@ package org.dromara.jpom.controller.build;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.dromara.jpom.common.*;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import org.dromara.jpom.common.BaseServerController;
|
||||
import org.dromara.jpom.common.ServerConst;
|
||||
import org.dromara.jpom.common.ServerOpenApi;
|
||||
import org.dromara.jpom.common.UrlRedirectUtil;
|
||||
import org.dromara.jpom.model.data.BuildInfoModel;
|
||||
import org.dromara.jpom.model.user.UserModel;
|
||||
import org.dromara.jpom.permission.ClassFeature;
|
||||
@ -67,7 +72,7 @@ public class BuildInfoTriggerController extends BaseServerController {
|
||||
*/
|
||||
@RequestMapping(value = "/build/trigger/url", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
public JsonMessage<Map<String, String>> getTriggerUrl(String id, String rest) {
|
||||
public IJsonMessage<Map<String, String>> getTriggerUrl(String id, String rest) {
|
||||
BuildInfoModel item = buildInfoService.getByKey(id, getRequest());
|
||||
UserModel user = getUser();
|
||||
BuildInfoModel updateInfo;
|
||||
|
@ -32,16 +32,20 @@ import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.lang.Tuple;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.text.csv.*;
|
||||
import cn.hutool.core.util.*;
|
||||
import cn.hutool.core.util.EnumUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.URLUtil;
|
||||
import cn.hutool.db.Entity;
|
||||
import cn.hutool.db.Page;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import cn.keepbx.jpom.plugins.IPlugin;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.build.BuildUtil;
|
||||
import org.dromara.jpom.common.BaseServerController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.ServerConst;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.dromara.jpom.controller.build.repository.ImportRepoUtil;
|
||||
@ -103,6 +107,19 @@ public class RepositoryController extends BaseServerController {
|
||||
return JsonMessage.success("获取成功", pageResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* load build list with params
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
@GetMapping(value = "/build/repository/list-group", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public IJsonMessage<List<String>> getBuildGroupAll() {
|
||||
// load list with page
|
||||
List<String> group = repositoryService.listGroup();
|
||||
return JsonMessage.success("", group);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载导入模板
|
||||
*/
|
||||
@ -129,7 +146,7 @@ public class RepositoryController extends BaseServerController {
|
||||
CsvWriter writer = CsvUtil.getWriter(response.getWriter());
|
||||
int pageInt = 0;
|
||||
Map<String, String> paramMap = ServletUtil.getParamMap(request);
|
||||
writer.writeLine("name", "address", "type", "protocol", "private rsa", "username", "password", "timeout(s)");
|
||||
writer.writeLine("name", "group", "address", "type", "protocol", "private rsa", "username", "password", "timeout(s)");
|
||||
while (true) {
|
||||
// 下一页
|
||||
paramMap.put("page", String.valueOf(++pageInt));
|
||||
@ -141,6 +158,7 @@ public class RepositoryController extends BaseServerController {
|
||||
.stream()
|
||||
.map((Function<RepositoryModel, List<Object>>) repositoryModel -> CollUtil.newArrayList(
|
||||
repositoryModel.getName(),
|
||||
repositoryModel.getGroup(),
|
||||
repositoryModel.getGitUrl(),
|
||||
EnumUtil.likeValueOf(RepositoryModel.RepoType.class, repositoryModel.getRepoType()),
|
||||
EnumUtil.likeValueOf(GitProtocolEnum.class, repositoryModel.getProtocol()),
|
||||
@ -167,7 +185,7 @@ public class RepositoryController extends BaseServerController {
|
||||
@PostMapping(value = "/build/repository/import-data", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.UPLOAD)
|
||||
@SystemPermission
|
||||
public JsonMessage<String> importData(MultipartFile file, HttpServletRequest request) throws IOException {
|
||||
public IJsonMessage<String> importData(MultipartFile file, HttpServletRequest request) throws IOException {
|
||||
Assert.notNull(file, "没有上传文件");
|
||||
String originalFilename = file.getOriginalFilename();
|
||||
String extName = FileUtil.extName(originalFilename);
|
||||
@ -191,6 +209,7 @@ public class RepositoryController extends BaseServerController {
|
||||
CsvRow csvRow = rows.get(i);
|
||||
String name = csvRow.getByName("name");
|
||||
Assert.hasText(name, () -> StrUtil.format("第 {} 行 name 字段不能位空", finalI + 1));
|
||||
String group = csvRow.getByName("group");
|
||||
String address = csvRow.getByName("address");
|
||||
Assert.hasText(address, () -> StrUtil.format("第 {} 行 address 字段不能位空", finalI + 1));
|
||||
String type = csvRow.getByName("type");
|
||||
@ -226,6 +245,7 @@ public class RepositoryController extends BaseServerController {
|
||||
RepositoryModel repositoryModel = repositoryService.queryByBean(where);
|
||||
//
|
||||
where.setName(name);
|
||||
where.setGroup(group);
|
||||
where.setTimeout(timeout);
|
||||
where.setPassword(password);
|
||||
where.setRsaPrv(privateRsa);
|
||||
@ -266,15 +286,22 @@ public class RepositoryController extends BaseServerController {
|
||||
*/
|
||||
@GetMapping(value = "/build/repository/get")
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<RepositoryModel> loadRepositoryGet(String id, HttpServletRequest request) {
|
||||
public IJsonMessage<RepositoryModel> loadRepositoryGet(String id, HttpServletRequest request) {
|
||||
RepositoryModel repositoryModel = repositoryService.getByKey(id, request);
|
||||
Assert.notNull(repositoryModel, "没有对应的仓库");
|
||||
return JsonMessage.success("", repositoryModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤前端多余避免核心字段被更新
|
||||
*
|
||||
* @param repositoryModelReq 仓库对象
|
||||
* @return 可以更新的对象
|
||||
*/
|
||||
private RepositoryModel convertRequest(RepositoryModel repositoryModelReq) {
|
||||
RepositoryModel repositoryModel = new RepositoryModel();
|
||||
repositoryModel.setName(repositoryModelReq.getName());
|
||||
repositoryModel.setGroup(repositoryModelReq.getGroup());
|
||||
repositoryModel.setUserName(repositoryModelReq.getUserName());
|
||||
repositoryModel.setId(repositoryModelReq.getId());
|
||||
repositoryModel.setProtocol(repositoryModelReq.getProtocol());
|
||||
@ -295,7 +322,7 @@ public class RepositoryController extends BaseServerController {
|
||||
*/
|
||||
@PostMapping(value = "/build/repository/edit")
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
public JsonMessage<String> editRepository(RepositoryModel req, HttpServletRequest request) {
|
||||
public IJsonMessage<String> editRepository(RepositoryModel req, HttpServletRequest request) {
|
||||
RepositoryModel repositoryModelReq = this.convertRequest(req);
|
||||
repositoryModelReq.setWorkspaceId(repositoryService.covertGlobalWorkspace(request));
|
||||
this.checkInfo(repositoryModelReq, request);
|
||||
@ -341,7 +368,7 @@ public class RepositoryController extends BaseServerController {
|
||||
*/
|
||||
@PostMapping(value = "/build/repository/rest_hide_field")
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
public JsonMessage<String> restHideField(@ValidatorItem String id, HttpServletRequest request) {
|
||||
public IJsonMessage<String> restHideField(@ValidatorItem String id, HttpServletRequest request) {
|
||||
RepositoryModel byKeyAndGlobal = repositoryService.getByKeyAndGlobal(id, request);
|
||||
RepositoryModel repositoryModel = new RepositoryModel();
|
||||
repositoryModel.setId(byKeyAndGlobal.getId());
|
||||
@ -354,14 +381,14 @@ public class RepositoryController extends BaseServerController {
|
||||
|
||||
@GetMapping(value = "/build/repository/provider_info")
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<Map<String, Map<String, Object>>> providerInfo() {
|
||||
public IJsonMessage<Map<String, Map<String, Object>>> providerInfo() {
|
||||
Map<String, Map<String, Object>> providerList = ImportRepoUtil.getProviderList();
|
||||
return JsonMessage.success(HttpStatus.OK.name(), providerList);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/build/repository/authorize_repos")
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<PageResultDto<JSONObject>> authorizeRepos(HttpServletRequest request,
|
||||
public IJsonMessage<PageResultDto<JSONObject>> authorizeRepos(HttpServletRequest request,
|
||||
@ValidatorItem String token,
|
||||
String address,
|
||||
@ValidatorItem String type,
|
||||
@ -510,7 +537,7 @@ public class RepositoryController extends BaseServerController {
|
||||
*/
|
||||
@GetMapping(value = "/build/repository/sort-item", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
public JsonMessage<String> sortItem(@ValidatorItem String id,
|
||||
public IJsonMessage<String> sortItem(@ValidatorItem String id,
|
||||
@ValidatorItem String method,
|
||||
String compareId, HttpServletRequest request) {
|
||||
if (StrUtil.equalsIgnoreCase(method, "top")) {
|
||||
|
@ -24,11 +24,12 @@ package org.dromara.jpom.controller.docker;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import cn.keepbx.jpom.plugins.IPlugin;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.common.BaseServerController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.dromara.jpom.func.assets.model.MachineDockerModel;
|
||||
import org.dromara.jpom.func.assets.server.MachineDockerServer;
|
||||
@ -74,7 +75,7 @@ public class DockerInfoController extends BaseServerController {
|
||||
*/
|
||||
@GetMapping(value = "api-versions", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<List<JSONObject>> apiVersions() throws Exception {
|
||||
public IJsonMessage<List<JSONObject>> apiVersions() throws Exception {
|
||||
IPlugin plugin = PluginFactory.getPlugin(DockerInfoService.DOCKER_CHECK_PLUGIN_NAME);
|
||||
List<JSONObject> data = (List<JSONObject>) plugin.execute("apiVersions");
|
||||
return JsonMessage.success("", data);
|
||||
@ -85,7 +86,7 @@ public class DockerInfoController extends BaseServerController {
|
||||
*/
|
||||
@PostMapping(value = "list", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<PageResultDto<DockerInfoModel>> list(HttpServletRequest request) {
|
||||
public IJsonMessage<PageResultDto<DockerInfoModel>> list(HttpServletRequest request) {
|
||||
// load list with page
|
||||
PageResultDto<DockerInfoModel> resultDto = dockerInfoService.listPage(request);
|
||||
resultDto.each(dockerInfoModel -> {
|
||||
@ -100,7 +101,7 @@ public class DockerInfoController extends BaseServerController {
|
||||
|
||||
@PostMapping(value = "edit", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
public JsonMessage<Object> edit(@ValidatorItem String id, @ValidatorItem String name, String tags, HttpServletRequest request) throws Exception {
|
||||
public IJsonMessage<Object> edit(@ValidatorItem String id, @ValidatorItem String name, String tags, HttpServletRequest request) throws Exception {
|
||||
DockerInfoModel dockerInfoModel = new DockerInfoModel();
|
||||
dockerInfoModel.setId(id);
|
||||
dockerInfoModel.setName(name);
|
||||
@ -116,7 +117,7 @@ public class DockerInfoController extends BaseServerController {
|
||||
|
||||
@GetMapping(value = "del", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.DEL)
|
||||
public JsonMessage<Object> del(@ValidatorItem String id, HttpServletRequest request) throws Exception {
|
||||
public IJsonMessage<Object> del(@ValidatorItem String id, HttpServletRequest request) throws Exception {
|
||||
dockerInfoService.delByKey(id, request);
|
||||
return JsonMessage.success("删除成功");
|
||||
}
|
||||
@ -132,7 +133,7 @@ public class DockerInfoController extends BaseServerController {
|
||||
@GetMapping(value = "sync-to-workspace", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
@SystemPermission()
|
||||
public JsonMessage<String> syncToWorkspace(@ValidatorItem String ids, @ValidatorItem String toWorkspaceId) {
|
||||
public IJsonMessage<String> syncToWorkspace(@ValidatorItem String ids, @ValidatorItem String toWorkspaceId) {
|
||||
String nowWorkspaceId = dockerInfoService.getCheckUserWorkspace(getRequest());
|
||||
//
|
||||
dockerInfoService.checkUserWorkspace(toWorkspaceId);
|
||||
|
@ -25,8 +25,9 @@ package org.dromara.jpom.controller.docker;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.dromara.jpom.controller.docker.base.BaseDockerSwarmInfoController;
|
||||
import org.dromara.jpom.func.assets.model.MachineDockerModel;
|
||||
@ -80,7 +81,7 @@ public class DockerSwarmInfoController extends BaseDockerSwarmInfoController {
|
||||
*/
|
||||
@PostMapping(value = "list", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<PageResultDto<DockerSwarmInfoMode>> list(HttpServletRequest request) {
|
||||
public IJsonMessage<PageResultDto<DockerSwarmInfoMode>> list(HttpServletRequest request) {
|
||||
// load list with page
|
||||
PageResultDto<DockerSwarmInfoMode> resultDto = dockerSwarmInfoService.listPage(request);
|
||||
resultDto.each(dockerSwarmInfoMode -> {
|
||||
@ -96,7 +97,7 @@ public class DockerSwarmInfoController extends BaseDockerSwarmInfoController {
|
||||
*/
|
||||
@GetMapping(value = "list-all", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<List<DockerSwarmInfoMode>> listAll(HttpServletRequest request) {
|
||||
public IJsonMessage<List<DockerSwarmInfoMode>> listAll(HttpServletRequest request) {
|
||||
// load list with all
|
||||
List<DockerSwarmInfoMode> swarmInfoModes = dockerSwarmInfoService.listByWorkspace(request);
|
||||
return JsonMessage.success("", swarmInfoModes);
|
||||
@ -104,7 +105,7 @@ public class DockerSwarmInfoController extends BaseDockerSwarmInfoController {
|
||||
|
||||
@PostMapping(value = "edit", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
public JsonMessage<Object> edit(@ValidatorItem String id,
|
||||
public IJsonMessage<Object> edit(@ValidatorItem String id,
|
||||
@ValidatorItem String name,
|
||||
@ValidatorItem String tag,
|
||||
HttpServletRequest request) throws Exception {
|
||||
@ -149,7 +150,7 @@ public class DockerSwarmInfoController extends BaseDockerSwarmInfoController {
|
||||
|
||||
@GetMapping(value = "del", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.DEL)
|
||||
public JsonMessage<Object> del(@ValidatorItem String id, HttpServletRequest request) throws Exception {
|
||||
public IJsonMessage<Object> del(@ValidatorItem String id, HttpServletRequest request) throws Exception {
|
||||
dockerSwarmInfoService.delByKey(id, request);
|
||||
return JsonMessage.success("删除成功");
|
||||
}
|
||||
|
@ -24,9 +24,12 @@ package org.dromara.jpom.controller.docker.base;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import cn.keepbx.jpom.plugins.IPlugin;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.dromara.jpom.permission.Feature;
|
||||
import org.dromara.jpom.permission.MethodFeature;
|
||||
@ -46,12 +49,13 @@ import java.util.Map;
|
||||
* @author bwcx_jzy
|
||||
* @since 2022/2/7
|
||||
*/
|
||||
@Slf4j
|
||||
public abstract class BaseDockerContainerController extends BaseDockerController {
|
||||
|
||||
|
||||
@GetMapping(value = "info", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<JSONObject> info(@ValidatorItem String id) throws Exception {
|
||||
public IJsonMessage<JSONObject> info(@ValidatorItem String id) throws Exception {
|
||||
IPlugin plugin = PluginFactory.getPlugin(DockerInfoService.DOCKER_CHECK_PLUGIN_NAME);
|
||||
Map<String, Object> parameter = this.toDockerParameter(id);
|
||||
JSONObject info = plugin.execute("info", parameter, JSONObject.class);
|
||||
@ -61,7 +65,7 @@ public abstract class BaseDockerContainerController extends BaseDockerController
|
||||
@PostMapping(value = "prune", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.DEL)
|
||||
@SystemPermission
|
||||
public JsonMessage<Object> prune(@ValidatorItem String id, @ValidatorItem String pruneType, String labels, String until, String dangling) throws Exception {
|
||||
public IJsonMessage<Object> prune(@ValidatorItem String id, @ValidatorItem String pruneType, String labels, String until, String dangling) throws Exception {
|
||||
IPlugin plugin = PluginFactory.getPlugin(DockerInfoService.DOCKER_PLUGIN_NAME);
|
||||
Map<String, Object> parameter = this.toDockerParameter(id);
|
||||
parameter.put("pruneType", pruneType);
|
||||
@ -79,7 +83,7 @@ public abstract class BaseDockerContainerController extends BaseDockerController
|
||||
*/
|
||||
@PostMapping(value = "list", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<List<JSONObject>> list(@ValidatorItem String id) throws Exception {
|
||||
public IJsonMessage<List<JSONObject>> list(@ValidatorItem String id) throws Exception {
|
||||
IPlugin plugin = PluginFactory.getPlugin(DockerInfoService.DOCKER_PLUGIN_NAME);
|
||||
Map<String, Object> parameter = this.toDockerParameter(id);
|
||||
parameter.put("name", getParameter("name"));
|
||||
@ -95,7 +99,7 @@ public abstract class BaseDockerContainerController extends BaseDockerController
|
||||
*/
|
||||
@PostMapping(value = "list-compose", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<List<JSONObject>> listCompose(@ValidatorItem String id) throws Exception {
|
||||
public IJsonMessage<List<JSONObject>> listCompose(@ValidatorItem String id) throws Exception {
|
||||
IPlugin plugin = PluginFactory.getPlugin(DockerInfoService.DOCKER_PLUGIN_NAME);
|
||||
Map<String, Object> parameter = this.toDockerParameter(id);
|
||||
parameter.put("name", getParameter("name"));
|
||||
@ -111,7 +115,7 @@ public abstract class BaseDockerContainerController extends BaseDockerController
|
||||
*/
|
||||
@GetMapping(value = "remove", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.DEL)
|
||||
public JsonMessage<Object> del(@ValidatorItem String id, String containerId) throws Exception {
|
||||
public IJsonMessage<Object> del(@ValidatorItem String id, String containerId) throws Exception {
|
||||
IPlugin plugin = PluginFactory.getPlugin(DockerInfoService.DOCKER_PLUGIN_NAME);
|
||||
Map<String, Object> parameter = this.toDockerParameter(id);
|
||||
parameter.put("containerId", containerId);
|
||||
@ -124,8 +128,7 @@ public abstract class BaseDockerContainerController extends BaseDockerController
|
||||
*/
|
||||
@GetMapping(value = "start", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EXECUTE)
|
||||
public JsonMessage<Object> start(@ValidatorItem String id, String containerId) throws Exception {
|
||||
|
||||
public IJsonMessage<Object> start(@ValidatorItem String id, String containerId) throws Exception {
|
||||
IPlugin plugin = PluginFactory.getPlugin(DockerInfoService.DOCKER_PLUGIN_NAME);
|
||||
Map<String, Object> parameter = this.toDockerParameter(id);
|
||||
parameter.put("containerId", containerId);
|
||||
@ -139,7 +142,7 @@ public abstract class BaseDockerContainerController extends BaseDockerController
|
||||
*/
|
||||
@GetMapping(value = "stop", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EXECUTE)
|
||||
public JsonMessage<Object> stop(@ValidatorItem String id, String containerId) throws Exception {
|
||||
public IJsonMessage<Object> stop(@ValidatorItem String id, String containerId) throws Exception {
|
||||
IPlugin plugin = PluginFactory.getPlugin(DockerInfoService.DOCKER_PLUGIN_NAME);
|
||||
Map<String, Object> parameter = this.toDockerParameter(id);
|
||||
parameter.put("containerId", containerId);
|
||||
@ -153,8 +156,7 @@ public abstract class BaseDockerContainerController extends BaseDockerController
|
||||
*/
|
||||
@GetMapping(value = "restart", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EXECUTE)
|
||||
public JsonMessage<Object> restart(@ValidatorItem String id, String containerId) throws Exception {
|
||||
|
||||
public IJsonMessage<Object> restart(@ValidatorItem String id, String containerId) throws Exception {
|
||||
IPlugin plugin = PluginFactory.getPlugin(DockerInfoService.DOCKER_PLUGIN_NAME);
|
||||
Map<String, Object> parameter = this.toDockerParameter(id);
|
||||
parameter.put("containerId", containerId);
|
||||
@ -167,8 +169,7 @@ public abstract class BaseDockerContainerController extends BaseDockerController
|
||||
*/
|
||||
@GetMapping(value = "stats", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EXECUTE)
|
||||
public JsonMessage<Map<String, JSONObject>> stats(@ValidatorItem String id, String containerId) throws Exception {
|
||||
|
||||
public IJsonMessage<Map<String, JSONObject>> stats(@ValidatorItem String id, String containerId) throws Exception {
|
||||
IPlugin plugin = PluginFactory.getPlugin(DockerInfoService.DOCKER_PLUGIN_NAME);
|
||||
Map<String, Object> parameter = this.toDockerParameter(id);
|
||||
parameter.put("containerId", containerId);
|
||||
@ -181,7 +182,7 @@ public abstract class BaseDockerContainerController extends BaseDockerController
|
||||
*/
|
||||
@GetMapping(value = "inspect-container", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EXECUTE)
|
||||
public JsonMessage<JSONObject> inspectContainer(@ValidatorItem String id, @ValidatorItem String containerId) throws Exception {
|
||||
public IJsonMessage<JSONObject> inspectContainer(@ValidatorItem String id, @ValidatorItem String containerId) throws Exception {
|
||||
IPlugin plugin = PluginFactory.getPlugin(DockerInfoService.DOCKER_PLUGIN_NAME);
|
||||
Map<String, Object> parameter = this.toDockerParameter(id);
|
||||
parameter.put("containerId", containerId);
|
||||
@ -197,7 +198,7 @@ public abstract class BaseDockerContainerController extends BaseDockerController
|
||||
*/
|
||||
@PostMapping(value = "update-container", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EXECUTE)
|
||||
public JsonMessage<JSONObject> updateContainer(@RequestBody JSONObject jsonObject) throws Exception {
|
||||
public IJsonMessage<JSONObject> updateContainer(@RequestBody JSONObject jsonObject) throws Exception {
|
||||
// @ValidatorItem String id, String containerId
|
||||
String id = jsonObject.getString("id");
|
||||
Assert.hasText(id, "id 不能为空");
|
||||
@ -208,4 +209,37 @@ public abstract class BaseDockerContainerController extends BaseDockerController
|
||||
JSONObject results = (JSONObject) plugin.execute("updateContainer", parameter);
|
||||
return JsonMessage.success("执行成功", results);
|
||||
}
|
||||
|
||||
/**
|
||||
* drop old container and create new container
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
@PostMapping(value = "rebuild-container", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EXECUTE)
|
||||
public IJsonMessage<Object> reBuildContainer(@RequestBody JSONObject jsonObject) throws Exception {
|
||||
String id = jsonObject.getString("id");
|
||||
String containerId = jsonObject.getString("containerId");
|
||||
Assert.hasText(id, "id 不能为空");
|
||||
Assert.hasText(jsonObject.getString("imageId"), "镜像不能为空");
|
||||
Assert.hasText(jsonObject.getString("name"), "容器名称不能为空");
|
||||
|
||||
IPlugin plugin = PluginFactory.getPlugin(DockerInfoService.DOCKER_PLUGIN_NAME);
|
||||
Map<String, Object> parameter = this.toDockerParameter(id);
|
||||
|
||||
// drop old container
|
||||
if (StrUtil.isNotEmpty(containerId)) {
|
||||
parameter.put("containerId", containerId);
|
||||
try {
|
||||
plugin.execute("removeContainer", parameter);
|
||||
} catch (com.github.dockerjava.api.exception.NotFoundException notFoundException) {
|
||||
log.warn(notFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// create new container
|
||||
parameter.putAll(jsonObject);
|
||||
plugin.execute("createContainer", parameter);
|
||||
return JsonMessage.success("重建成功");
|
||||
}
|
||||
}
|
||||
|
@ -25,9 +25,10 @@ package org.dromara.jpom.controller.docker.base;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import cn.keepbx.jpom.plugins.IPlugin;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.dromara.jpom.common.validator.ValidatorRule;
|
||||
import org.dromara.jpom.permission.Feature;
|
||||
@ -66,13 +67,13 @@ public abstract class BaseDockerImagesController extends BaseDockerController {
|
||||
*/
|
||||
@PostMapping(value = "list", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<List<JSONObject>> list(@ValidatorItem String id) throws Exception {
|
||||
|
||||
public IJsonMessage<List<JSONObject>> list(@ValidatorItem String id) throws Exception {
|
||||
IPlugin plugin = PluginFactory.getPlugin(DockerInfoService.DOCKER_PLUGIN_NAME);
|
||||
Map<String, Object> parameter = this.toDockerParameter(id);
|
||||
parameter.put("name", getParameter("name"));
|
||||
parameter.put("showAll", getParameter("showAll"));
|
||||
parameter.put("dangling", getParameter("dangling"));
|
||||
parameter.put("workspaceId", getWorkspaceId());
|
||||
List<JSONObject> listContainer = (List<JSONObject>) plugin.execute("listImages", parameter);
|
||||
return JsonMessage.success("", listContainer);
|
||||
}
|
||||
@ -83,11 +84,11 @@ public abstract class BaseDockerImagesController extends BaseDockerController {
|
||||
*/
|
||||
@GetMapping(value = "remove", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.DEL)
|
||||
public JsonMessage<Object> del(@ValidatorItem String id, String imageId) throws Exception {
|
||||
|
||||
public IJsonMessage<Object> del(@ValidatorItem String id, String imageId) throws Exception {
|
||||
IPlugin plugin = PluginFactory.getPlugin(DockerInfoService.DOCKER_PLUGIN_NAME);
|
||||
Map<String, Object> parameter = this.toDockerParameter(id);
|
||||
parameter.put("imageId", imageId);
|
||||
parameter.put("workspaceId", getWorkspaceId());
|
||||
plugin.execute("removeImage", parameter);
|
||||
return JsonMessage.success("执行成功");
|
||||
}
|
||||
@ -98,11 +99,11 @@ public abstract class BaseDockerImagesController extends BaseDockerController {
|
||||
*/
|
||||
@GetMapping(value = "batchRemove", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.DEL)
|
||||
public JsonMessage<Object> batchRemove(@ValidatorItem String id, String[] imagesIds) throws Exception {
|
||||
|
||||
public IJsonMessage<Object> batchRemove(@ValidatorItem String id, String[] imagesIds) throws Exception {
|
||||
IPlugin plugin = PluginFactory.getPlugin(DockerInfoService.DOCKER_PLUGIN_NAME);
|
||||
Map<String, Object> parameter = this.toDockerParameter(id);
|
||||
parameter.put("imagesIds", imagesIds);
|
||||
parameter.put("workspaceId", getWorkspaceId());
|
||||
plugin.execute("batchRemove", parameter);
|
||||
return JsonMessage.success("执行成功");
|
||||
}
|
||||
@ -112,11 +113,11 @@ public abstract class BaseDockerImagesController extends BaseDockerController {
|
||||
*/
|
||||
@GetMapping(value = "inspect", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<JSONObject> inspect(@ValidatorItem String id, String imageId) throws Exception {
|
||||
|
||||
public IJsonMessage<JSONObject> inspect(@ValidatorItem String id, String imageId) throws Exception {
|
||||
IPlugin plugin = PluginFactory.getPlugin(DockerInfoService.DOCKER_PLUGIN_NAME);
|
||||
Map<String, Object> parameter = this.toDockerParameter(id);
|
||||
parameter.put("imageId", imageId);
|
||||
parameter.put("workspaceId", getWorkspaceId());
|
||||
JSONObject inspectImage = (JSONObject) plugin.execute("inspectImage", parameter);
|
||||
return JsonMessage.success("", inspectImage);
|
||||
}
|
||||
@ -126,11 +127,11 @@ public abstract class BaseDockerImagesController extends BaseDockerController {
|
||||
*/
|
||||
@GetMapping(value = "pull-image", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EXECUTE)
|
||||
public JsonMessage<String> pullImage(@ValidatorItem String id, String repository) {
|
||||
|
||||
public IJsonMessage<String> pullImage(@ValidatorItem String id, String repository) {
|
||||
IPlugin plugin = PluginFactory.getPlugin(DockerInfoService.DOCKER_PLUGIN_NAME);
|
||||
Map<String, Object> parameter = this.toDockerParameter(id);
|
||||
parameter.put("repository", repository);
|
||||
parameter.put("workspaceId", getWorkspaceId());
|
||||
//
|
||||
String uuid = IdUtil.fastSimpleUUID();
|
||||
File file = FileUtil.file(serverConfig.getUserTempPath(), "docker-log", uuid + ".log");
|
||||
@ -158,7 +159,7 @@ public abstract class BaseDockerImagesController extends BaseDockerController {
|
||||
*/
|
||||
@GetMapping(value = "pull-image-log", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<JSONObject> getNowLog(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据") String id,
|
||||
public IJsonMessage<JSONObject> getNowLog(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据") String id,
|
||||
@ValidatorItem(value = ValidatorRule.POSITIVE_INTEGER, msg = "line") int line) {
|
||||
File file = FileUtil.file(serverConfig.getUserTempPath(), "docker-log", id + ".log");
|
||||
if (!file.exists()) {
|
||||
@ -173,7 +174,7 @@ public abstract class BaseDockerImagesController extends BaseDockerController {
|
||||
*/
|
||||
@PostMapping(value = "create-container", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EXECUTE)
|
||||
public JsonMessage<Object> createContainer(@RequestBody JSONObject jsonObject) throws Exception {
|
||||
public IJsonMessage<Object> createContainer(@RequestBody JSONObject jsonObject) throws Exception {
|
||||
String id = jsonObject.getString("id");
|
||||
Assert.hasText(id, "id 不能为空");
|
||||
Assert.hasText(jsonObject.getString("imageId"), "镜像不能为空");
|
||||
@ -182,6 +183,7 @@ public abstract class BaseDockerImagesController extends BaseDockerController {
|
||||
IPlugin plugin = PluginFactory.getPlugin(DockerInfoService.DOCKER_PLUGIN_NAME);
|
||||
Map<String, Object> parameter = this.toDockerParameter(id);
|
||||
parameter.putAll(jsonObject);
|
||||
parameter.put("workspaceId", getWorkspaceId());
|
||||
plugin.execute("createContainer", parameter);
|
||||
return JsonMessage.success("创建成功");
|
||||
}
|
||||
|
@ -22,9 +22,10 @@
|
||||
*/
|
||||
package org.dromara.jpom.controller.docker.base;
|
||||
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import cn.keepbx.jpom.plugins.IPlugin;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.dromara.jpom.permission.Feature;
|
||||
import org.dromara.jpom.permission.MethodFeature;
|
||||
@ -47,8 +48,7 @@ public abstract class BaseDockerNetworkController extends BaseDockerController {
|
||||
*/
|
||||
@PostMapping(value = "list", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<List<JSONObject>> list(@ValidatorItem String id, String name, String networkId) throws Exception {
|
||||
|
||||
public IJsonMessage<List<JSONObject>> list(@ValidatorItem String id, String name, String networkId) throws Exception {
|
||||
IPlugin plugin = PluginFactory.getPlugin(DockerInfoService.DOCKER_PLUGIN_NAME);
|
||||
Map<String, Object> parameter = this.toDockerParameter(id);
|
||||
parameter.put("name", name);
|
||||
|
@ -22,9 +22,10 @@
|
||||
*/
|
||||
package org.dromara.jpom.controller.docker.base;
|
||||
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import cn.keepbx.jpom.plugins.IPlugin;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.dromara.jpom.permission.Feature;
|
||||
import org.dromara.jpom.permission.MethodFeature;
|
||||
@ -44,7 +45,7 @@ public abstract class BaseDockerSwarmInfoController extends BaseDockerController
|
||||
|
||||
@PostMapping(value = "node-list", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<List<JSONObject>> nodeList(
|
||||
public IJsonMessage<List<JSONObject>> nodeList(
|
||||
@ValidatorItem String id,
|
||||
String nodeId, String nodeName, String nodeRole) throws Exception {
|
||||
//
|
||||
@ -66,7 +67,7 @@ public abstract class BaseDockerSwarmInfoController extends BaseDockerController
|
||||
*/
|
||||
@PostMapping(value = "update", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EXECUTE)
|
||||
public JsonMessage<String> update(@ValidatorItem String id,
|
||||
public IJsonMessage<String> update(@ValidatorItem String id,
|
||||
@ValidatorItem String nodeId,
|
||||
@ValidatorItem String availability,
|
||||
@ValidatorItem String role) throws Exception {
|
||||
|
@ -31,10 +31,11 @@ import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import cn.keepbx.jpom.plugins.IPlugin;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.dromara.jpom.common.validator.ValidatorRule;
|
||||
import org.dromara.jpom.permission.Feature;
|
||||
@ -90,7 +91,7 @@ public abstract class BaseDockerSwarmServiceController extends BaseDockerControl
|
||||
|
||||
@PostMapping(value = "list", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<List<JSONObject>> list(
|
||||
public IJsonMessage<List<JSONObject>> list(
|
||||
@ValidatorItem String id,
|
||||
String serviceId, String serviceName) throws Exception {
|
||||
//
|
||||
@ -104,7 +105,7 @@ public abstract class BaseDockerSwarmServiceController extends BaseDockerControl
|
||||
|
||||
@PostMapping(value = "task-list", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<List<JSONObject>> taskList(
|
||||
public IJsonMessage<List<JSONObject>> taskList(
|
||||
@ValidatorItem String id,
|
||||
String serviceId, String taskId, String taskName, String taskNode, String taskState) throws Exception {
|
||||
//
|
||||
@ -121,7 +122,7 @@ public abstract class BaseDockerSwarmServiceController extends BaseDockerControl
|
||||
|
||||
@GetMapping(value = "del", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.DEL)
|
||||
public JsonMessage<List<JSONObject>> del(@ValidatorItem String id, @ValidatorItem String serviceId) throws Exception {
|
||||
public IJsonMessage<List<JSONObject>> del(@ValidatorItem String id, @ValidatorItem String serviceId) throws Exception {
|
||||
//
|
||||
IPlugin plugin = PluginFactory.getPlugin(DockerSwarmInfoService.DOCKER_PLUGIN_NAME);
|
||||
Map<String, Object> map = this.toDockerParameter(id);
|
||||
@ -132,7 +133,7 @@ public abstract class BaseDockerSwarmServiceController extends BaseDockerControl
|
||||
|
||||
@PostMapping(value = "edit", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
public JsonMessage<List<JSONObject>> edit(@RequestBody JSONObject jsonObject) throws Exception {
|
||||
public IJsonMessage<List<JSONObject>> edit(@RequestBody JSONObject jsonObject) throws Exception {
|
||||
//
|
||||
String id = jsonObject.getString("id");
|
||||
IPlugin plugin = PluginFactory.getPlugin(DockerSwarmInfoService.DOCKER_PLUGIN_NAME);
|
||||
@ -148,7 +149,7 @@ public abstract class BaseDockerSwarmServiceController extends BaseDockerControl
|
||||
*/
|
||||
@GetMapping(value = "start-log", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EXECUTE)
|
||||
public JsonMessage<String> pullImage(@ValidatorItem String id, @ValidatorItem String type, @ValidatorItem String dataId) throws Exception {
|
||||
public IJsonMessage<String> pullImage(@ValidatorItem String id, @ValidatorItem String type, @ValidatorItem String dataId) throws Exception {
|
||||
IPlugin plugin = PluginFactory.getPlugin(DockerSwarmInfoService.DOCKER_PLUGIN_NAME);
|
||||
Map<String, Object> parameter = this.toDockerParameter(id);
|
||||
parameter.put(StrUtil.equalsIgnoreCase(type, "service") ? "serviceId" : "taskId", dataId);
|
||||
@ -186,8 +187,8 @@ public abstract class BaseDockerSwarmServiceController extends BaseDockerControl
|
||||
*/
|
||||
@GetMapping(value = "pull-log", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<JSONObject> getNowLog(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据") String id,
|
||||
@ValidatorItem(value = ValidatorRule.POSITIVE_INTEGER, msg = "line") int line) {
|
||||
public IJsonMessage<JSONObject> getNowLog(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据") String id,
|
||||
@ValidatorItem(value = ValidatorRule.POSITIVE_INTEGER, msg = "line") int line) {
|
||||
File file = FileUtil.file(serverConfig.getUserTempPath(), "docker-swarm-log", id + ".log");
|
||||
if (!file.exists()) {
|
||||
return new JsonMessage<>(201, "还没有日志文件");
|
||||
|
@ -22,9 +22,10 @@
|
||||
*/
|
||||
package org.dromara.jpom.controller.docker.base;
|
||||
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import cn.keepbx.jpom.plugins.IPlugin;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.dromara.jpom.permission.Feature;
|
||||
import org.dromara.jpom.permission.MethodFeature;
|
||||
@ -47,7 +48,7 @@ public abstract class BaseDockerVolumeController extends BaseDockerController {
|
||||
*/
|
||||
@PostMapping(value = "list", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<List<JSONObject>> list(@ValidatorItem String id) throws Exception {
|
||||
public IJsonMessage<List<JSONObject>> list(@ValidatorItem String id) throws Exception {
|
||||
IPlugin plugin = PluginFactory.getPlugin(DockerInfoService.DOCKER_PLUGIN_NAME);
|
||||
Map<String, Object> parameter = this.toDockerParameter(id);
|
||||
parameter.put("name", getParameter("name"));
|
||||
@ -62,8 +63,7 @@ public abstract class BaseDockerVolumeController extends BaseDockerController {
|
||||
*/
|
||||
@GetMapping(value = "remove", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.DEL)
|
||||
public JsonMessage<Object> del(@ValidatorItem String id, String volumeName) throws Exception {
|
||||
|
||||
public IJsonMessage<Object> del(@ValidatorItem String id, String volumeName) throws Exception {
|
||||
IPlugin plugin = PluginFactory.getPlugin(DockerInfoService.DOCKER_PLUGIN_NAME);
|
||||
Map<String, Object> parameter = this.toDockerParameter(id);
|
||||
parameter.put("volumeName", volumeName);
|
||||
|
@ -26,9 +26,10 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.RegexPool;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import org.dromara.jpom.common.BaseServerController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.dromara.jpom.common.validator.ValidatorRule;
|
||||
import org.dromara.jpom.model.PageResultDto;
|
||||
@ -84,7 +85,7 @@ public class MonitorListController extends BaseServerController {
|
||||
*/
|
||||
@RequestMapping(value = "getMonitorList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<PageResultDto<MonitorModel>> getMonitorList() {
|
||||
public IJsonMessage<PageResultDto<MonitorModel>> getMonitorList() {
|
||||
PageResultDto<MonitorModel> pageResultDto = monitorService.listPage(getRequest());
|
||||
return JsonMessage.success("", pageResultDto);
|
||||
}
|
||||
@ -97,7 +98,7 @@ public class MonitorListController extends BaseServerController {
|
||||
*/
|
||||
@RequestMapping(value = "deleteMonitor", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.DEL)
|
||||
public JsonMessage<Object> deleteMonitor(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "删除失败") String id) throws SQLException {
|
||||
public IJsonMessage<Object> deleteMonitor(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "删除失败") String id) throws SQLException {
|
||||
//
|
||||
HttpServletRequest request = getRequest();
|
||||
int delByKey = monitorService.delByKey(id, request);
|
||||
@ -119,7 +120,7 @@ public class MonitorListController extends BaseServerController {
|
||||
*/
|
||||
@RequestMapping(value = "updateMonitor", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
public JsonMessage<Object> updateMonitor(String id,
|
||||
public IJsonMessage<Object> updateMonitor(String id,
|
||||
@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "监控名称不能为空") String name,
|
||||
@ValidatorItem(msg = "请配置监控周期") String execCron,
|
||||
String notifyUser, String webhook) {
|
||||
|
@ -22,8 +22,9 @@
|
||||
*/
|
||||
package org.dromara.jpom.controller.monitor;
|
||||
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import org.dromara.jpom.common.BaseServerController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.model.PageResultDto;
|
||||
import org.dromara.jpom.model.log.MonitorNotifyLog;
|
||||
import org.dromara.jpom.permission.ClassFeature;
|
||||
@ -59,7 +60,7 @@ public class MonitorLogController extends BaseServerController {
|
||||
*/
|
||||
@RequestMapping(value = "list_data.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<PageResultDto<MonitorNotifyLog>> listData() {
|
||||
public IJsonMessage<PageResultDto<MonitorNotifyLog>> listData() {
|
||||
PageResultDto<MonitorNotifyLog> pageResult = dbMonitorNotifyLogService.listPage(getRequest());
|
||||
return JsonMessage.success("获取成功", pageResult);
|
||||
}
|
||||
|
@ -25,10 +25,11 @@ package org.dromara.jpom.controller.monitor;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.EnumUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.dromara.jpom.common.BaseServerController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.dromara.jpom.common.validator.ValidatorRule;
|
||||
import org.dromara.jpom.model.PageResultDto;
|
||||
@ -68,7 +69,7 @@ public class MonitorUserOptListController extends BaseServerController {
|
||||
|
||||
@RequestMapping(value = "list_data", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<PageResultDto<MonitorUserOptModel>> getMonitorList() {
|
||||
public IJsonMessage<PageResultDto<MonitorUserOptModel>> getMonitorList() {
|
||||
PageResultDto<MonitorUserOptModel> pageResultDto = monitorUserOptService.listPage(getRequest());
|
||||
return JsonMessage.success("", pageResultDto);
|
||||
}
|
||||
@ -80,7 +81,7 @@ public class MonitorUserOptListController extends BaseServerController {
|
||||
*/
|
||||
@RequestMapping(value = "type_data", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<JSONObject> getOperateTypeList() {
|
||||
public IJsonMessage<JSONObject> getOperateTypeList() {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
//
|
||||
List<JSONObject> classFeatureList = Arrays.stream(ClassFeature.values())
|
||||
@ -116,7 +117,7 @@ public class MonitorUserOptListController extends BaseServerController {
|
||||
*/
|
||||
@RequestMapping(value = "delete", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.DEL)
|
||||
public JsonMessage<Object> deleteMonitor(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "删除失败") String id) {
|
||||
public IJsonMessage<Object> deleteMonitor(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "删除失败") String id) {
|
||||
//
|
||||
monitorUserOptService.delByKey(id, getRequest());
|
||||
return JsonMessage.success("删除成功");
|
||||
@ -133,7 +134,7 @@ public class MonitorUserOptListController extends BaseServerController {
|
||||
*/
|
||||
@RequestMapping(value = "update", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
public JsonMessage<Object> updateMonitor(String id,
|
||||
public IJsonMessage<Object> updateMonitor(String id,
|
||||
@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "监控名称不能为空") String name,
|
||||
String notifyUser,
|
||||
String monitorUser,
|
||||
@ -208,7 +209,7 @@ public class MonitorUserOptListController extends BaseServerController {
|
||||
*/
|
||||
@RequestMapping(value = "changeStatus", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
public JsonMessage<Object> changeStatus(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "id不能为空") String id,
|
||||
public IJsonMessage<Object> changeStatus(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "id不能为空") String id,
|
||||
String status) {
|
||||
MonitorUserOptModel monitorModel = monitorUserOptService.getByKey(id);
|
||||
Assert.notNull(monitorModel, "不存在监控项啦");
|
||||
|
@ -23,10 +23,11 @@
|
||||
package org.dromara.jpom.controller.monitor;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import cn.keepbx.jpom.plugins.IPlugin;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import org.dromara.jpom.common.BaseServerController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.model.data.MailAccountModel;
|
||||
import org.dromara.jpom.monitor.EmailUtil;
|
||||
import org.dromara.jpom.permission.ClassFeature;
|
||||
@ -71,7 +72,7 @@ public class SystemMailConfigController extends BaseServerController {
|
||||
*/
|
||||
@PostMapping(value = "mail-config-data", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<MailAccountModel> mailConfigData() {
|
||||
public IJsonMessage<MailAccountModel> mailConfigData() {
|
||||
MailAccountModel item = systemParametersServer.getConfig(MailAccountModel.ID, MailAccountModel.class);
|
||||
if (item != null) {
|
||||
item.setPass(null);
|
||||
@ -81,7 +82,7 @@ public class SystemMailConfigController extends BaseServerController {
|
||||
|
||||
@PostMapping(value = "mailConfig_save.json", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
public JsonMessage<Object> listData(MailAccountModel mailAccountModel) throws Exception {
|
||||
public IJsonMessage<Object> listData(MailAccountModel mailAccountModel) throws Exception {
|
||||
Assert.notNull(mailAccountModel, "请填写信息,并检查是否填写合法");
|
||||
Assert.hasText(mailAccountModel.getHost(), "请填写host");
|
||||
Assert.hasText(mailAccountModel.getUser(), "请填写user");
|
||||
|
@ -23,8 +23,9 @@
|
||||
package org.dromara.jpom.controller.node;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import org.dromara.jpom.common.BaseServerController;
|
||||
import org.dromara.jpom.common.JsonMessage;
|
||||
import org.dromara.jpom.common.ServerConst;
|
||||
import org.dromara.jpom.common.validator.ValidatorItem;
|
||||
import org.dromara.jpom.model.PageResultDto;
|
||||
@ -90,7 +91,7 @@ public class NodeEditController extends BaseServerController {
|
||||
|
||||
@PostMapping(value = "list_data.json", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<PageResultDto<NodeModel>> listJson(HttpServletRequest request) {
|
||||
public IJsonMessage<PageResultDto<NodeModel>> listJson(HttpServletRequest request) {
|
||||
PageResultDto<NodeModel> nodeModelPageResultDto = nodeService.listPage(request);
|
||||
nodeModelPageResultDto.each(nodeModel -> nodeModel.setMachineNodeData(machineNodeServer.getByKey(nodeModel.getMachineId())));
|
||||
return JsonMessage.success("", nodeModelPageResultDto);
|
||||
@ -98,14 +99,14 @@ public class NodeEditController extends BaseServerController {
|
||||
|
||||
@GetMapping(value = "list_data_all.json", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<List<NodeModel>> listDataAll() {
|
||||
public IJsonMessage<List<NodeModel>> listDataAll() {
|
||||
List<NodeModel> list = nodeService.listByWorkspace(getRequest());
|
||||
return JsonMessage.success("", list);
|
||||
}
|
||||
|
||||
@GetMapping(value = "list_data_by_workspace_id.json", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<List<NodeModel>> listDataAll(@ValidatorItem String workspaceId) {
|
||||
public IJsonMessage<List<NodeModel>> listDataAll(@ValidatorItem String workspaceId) {
|
||||
nodeService.checkUserWorkspace(workspaceId);
|
||||
NodeModel nodeModel = new NodeModel();
|
||||
if (!StrUtil.equals(workspaceId, ServerConst.WORKSPACE_GLOBAL)) {
|
||||
@ -122,14 +123,14 @@ public class NodeEditController extends BaseServerController {
|
||||
*/
|
||||
@GetMapping(value = "list_group_all.json", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public JsonMessage<List<String>> listGroupAll() {
|
||||
List<String> listGroup = nodeService.listGroup(getRequest());
|
||||
public IJsonMessage<List<String>> listGroupAll(HttpServletRequest request) {
|
||||
List<String> listGroup = nodeService.listGroup(request);
|
||||
return JsonMessage.success("", listGroup);
|
||||
}
|
||||
|
||||
@PostMapping(value = "save.json", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
public JsonMessage<String> save(HttpServletRequest request) {
|
||||
public IJsonMessage<String> save(HttpServletRequest request) {
|
||||
nodeService.update(request);
|
||||
return JsonMessage.success("操作成功");
|
||||
}
|
||||
@ -143,7 +144,7 @@ public class NodeEditController extends BaseServerController {
|
||||
*/
|
||||
@PostMapping(value = "del.json", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.DEL)
|
||||
public JsonMessage<String> del(@ValidatorItem String id) {
|
||||
public IJsonMessage<String> del(@ValidatorItem String id) {
|
||||
HttpServletRequest request = getRequest();
|
||||
this.checkDataBind(id, request, "删除");
|
||||
//
|
||||
@ -197,7 +198,7 @@ public class NodeEditController extends BaseServerController {
|
||||
*/
|
||||
@GetMapping(value = "unbind.json", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.DEL)
|
||||
public JsonMessage<String> unbind(String id) {
|
||||
public IJsonMessage<String> unbind(String id) {
|
||||
HttpServletRequest request = getRequest();
|
||||
this.checkDataBind(id, request, "解绑");
|
||||
//
|
||||
@ -218,7 +219,7 @@ public class NodeEditController extends BaseServerController {
|
||||
@GetMapping(value = "sync-to-workspace", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
@SystemPermission()
|
||||
public JsonMessage<String> syncToWorkspace(@ValidatorItem String ids, @ValidatorItem String toWorkspaceId) {
|
||||
public IJsonMessage<String> syncToWorkspace(@ValidatorItem String ids, @ValidatorItem String toWorkspaceId) {
|
||||
String nowWorkspaceId = nodeService.getCheckUserWorkspace(getRequest());
|
||||
//
|
||||
nodeService.checkUserWorkspace(toWorkspaceId);
|
||||
@ -236,7 +237,7 @@ public class NodeEditController extends BaseServerController {
|
||||
*/
|
||||
@GetMapping(value = "sort-item", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.EDIT)
|
||||
public JsonMessage<String> sortItem(@ValidatorItem String id, @ValidatorItem String method, String compareId) {
|
||||
public IJsonMessage<String> sortItem(@ValidatorItem String id, @ValidatorItem String method, String compareId) {
|
||||
HttpServletRequest request = getRequest();
|
||||
if (StrUtil.equalsIgnoreCase(method, "top")) {
|
||||
nodeService.sortToTop(id, request);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user