9
.github/workflows/build.yml
vendored
9
.github/workflows/build.yml
vendored
@@ -84,6 +84,15 @@ jobs:
|
|||||||
- name: tidy
|
- name: tidy
|
||||||
run: go mod tidy
|
run: go mod tidy
|
||||||
|
|
||||||
|
- name: Get tag version
|
||||||
|
run: |
|
||||||
|
TAG_VERSION="${GITHUB_REF##*/}"
|
||||||
|
VERSION="${TAG_VERSION#v}"
|
||||||
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Write version to resources/version
|
||||||
|
run: echo $VERSION > resources/version
|
||||||
|
|
||||||
- name: swag
|
- name: swag
|
||||||
run: |
|
run: |
|
||||||
go install github.com/swaggo/swag/cmd/swag@latest
|
go install github.com/swaggo/swag/cmd/swag@latest
|
||||||
|
|||||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,13 +1,8 @@
|
|||||||
.idea
|
.idea
|
||||||
runtime/*
|
runtime/*
|
||||||
!runtime
|
!runtime
|
||||||
!runtime/cache
|
|
||||||
!runtime/cache/.gitkeep
|
!runtime/cache/.gitkeep
|
||||||
go.sum
|
go.sum
|
||||||
resources/*
|
resources/admin
|
||||||
!resources/public/upload/.gitignore
|
|
||||||
!resources/web
|
|
||||||
!resources/web2
|
|
||||||
!resources/i18n
|
|
||||||
release
|
release
|
||||||
data
|
data
|
||||||
@@ -1252,6 +1252,35 @@ const docTemplateapi = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"/version": {
|
||||||
|
"get": {
|
||||||
|
"description": "版本",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"首页"
|
||||||
|
],
|
||||||
|
"summary": "版本",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/response.Response"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/response.Response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
|
|||||||
@@ -1245,6 +1245,35 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"/version": {
|
||||||
|
"get": {
|
||||||
|
"description": "版本",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"首页"
|
||||||
|
],
|
||||||
|
"summary": "版本",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/response.Response"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/response.Response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
|
|||||||
@@ -981,6 +981,25 @@ paths:
|
|||||||
summary: 用户列表
|
summary: 用户列表
|
||||||
tags:
|
tags:
|
||||||
- 群组
|
- 群组
|
||||||
|
/version:
|
||||||
|
get:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
description: 版本
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/response.Response'
|
||||||
|
"500":
|
||||||
|
description: Internal Server Error
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/response.Response'
|
||||||
|
summary: 版本
|
||||||
|
tags:
|
||||||
|
- 首页
|
||||||
securityDefinitions:
|
securityDefinitions:
|
||||||
BearerAuth:
|
BearerAuth:
|
||||||
in: header
|
in: header
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"Gwen/service"
|
"Gwen/service"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -61,3 +62,25 @@ func (i *Index) Heartbeat(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
c.JSON(http.StatusOK, gin.H{})
|
c.JSON(http.StatusOK, gin.H{})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Version 版本
|
||||||
|
// @Tags 首页
|
||||||
|
// @Summary 版本
|
||||||
|
// @Description 版本
|
||||||
|
// @Accept json
|
||||||
|
// @Produce json
|
||||||
|
// @Success 200 {object} response.Response
|
||||||
|
// @Failure 500 {object} response.Response
|
||||||
|
// @Router /version [get]
|
||||||
|
func (i *Index) Version(c *gin.Context) {
|
||||||
|
//读取resources/version文件
|
||||||
|
v, err := os.ReadFile("resources/version")
|
||||||
|
if err != nil {
|
||||||
|
response.Fail(c, 101, err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
response.Success(
|
||||||
|
c,
|
||||||
|
string(v),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
@@ -21,10 +21,13 @@ func ApiInit(g *gin.Engine) {
|
|||||||
|
|
||||||
frg := g.Group("/api")
|
frg := g.Group("/api")
|
||||||
|
|
||||||
i := &api.Index{}
|
{
|
||||||
frg.GET("/", i.Index)
|
i := &api.Index{}
|
||||||
|
frg.GET("/", i.Index)
|
||||||
|
frg.GET("/version", i.Version)
|
||||||
|
|
||||||
frg.POST("/heartbeat", i.Heartbeat)
|
frg.POST("/heartbeat", i.Heartbeat)
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
l := &api.Login{}
|
l := &api.Login{}
|
||||||
@@ -33,6 +36,7 @@ func ApiInit(g *gin.Engine) {
|
|||||||
frg.POST("/login", l.Login)
|
frg.POST("/login", l.Login)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
o := &api.Oauth{}
|
o := &api.Oauth{}
|
||||||
// [method:POST] [uri:/api/oidc/auth]
|
// [method:POST] [uri:/api/oidc/auth]
|
||||||
@@ -52,11 +56,15 @@ func ApiInit(g *gin.Engine) {
|
|||||||
if global.Config.App.WebClient == 1 {
|
if global.Config.App.WebClient == 1 {
|
||||||
WebClientRoutes(frg)
|
WebClientRoutes(frg)
|
||||||
}
|
}
|
||||||
au := &api.Audit{}
|
|
||||||
//[method:POST] [uri:/api/audit/conn]
|
{
|
||||||
frg.POST("/audit/conn", au.AuditConn)
|
au := &api.Audit{}
|
||||||
//[method:POST] [uri:/api/audit/file]
|
//[method:POST] [uri:/api/audit/conn]
|
||||||
frg.POST("/audit/file", au.AuditFile)
|
frg.POST("/audit/conn", au.AuditConn)
|
||||||
|
//[method:POST] [uri:/api/audit/file]
|
||||||
|
frg.POST("/audit/file", au.AuditFile)
|
||||||
|
}
|
||||||
|
|
||||||
frg.Use(middleware.RustAuth())
|
frg.Use(middleware.RustAuth())
|
||||||
{
|
{
|
||||||
u := &api.User{}
|
u := &api.User{}
|
||||||
|
|||||||
1
resources/version
Normal file
1
resources/version
Normal file
@@ -0,0 +1 @@
|
|||||||
|
v1.0.0
|
||||||
Reference in New Issue
Block a user