Compare commits

..

4 Commits

Author SHA1 Message Date
4fa123baa8 🎨优化一下子 2024-08-22 14:16:33 +08:00
c7a56b1dde 🐛修复一个牛逼的bug 2024-08-22 11:43:23 +08:00
37446ea958 🎨 2024-08-22 11:14:28 +08:00
1b28b196a0 🎨打印日志看输出 2024-08-21 16:39:30 +08:00
3 changed files with 8 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ package api
import (
"fmt"
"github.com/gin-gonic/gin"
"strings"
"time"
"wireguard-ui/component"
"wireguard-ui/http/param"
@@ -77,6 +78,10 @@ func (DashboardApi) ConnectionList(c *gin.Context) {
for _, iaip := range peer.AllowedIPs {
ipAllocation += iaip.String() + ","
}
// 去除一下最右边的逗号
if len(ipAllocation) > 0 {
ipAllocation = strings.TrimRight(ipAllocation, ",")
}
connections = append(connections, vo.DataTraffic{
Name: clientInfo.Name,
Email: clientInfo.Email,

View File

@@ -50,13 +50,13 @@ func Authorization() gin.HandlerFunc {
// 查询用户
user, err := service.User().GetUserById(userClaims.ID)
if err != nil {
response.R(c).FailedWithError("用户不存在")
response.R(c).AuthorizationFailed("用户不存在")
c.Abort()
return
}
if user.Status != constant.Enabled {
response.R(c).FailedWithError("用户状态异常,请联系管理员处理!")
response.R(c).AuthorizationFailed("用户状态异常,请联系管理员处理!")
c.Abort()
return
}

View File

@@ -45,7 +45,7 @@ func (script) GenerateConfig() error {
Email: client.Email,
PublicKey: client.Keys.PublicKey,
PresharedKey: client.Keys.PresharedKey,
AllowedIPS: client.AllowedIpsStr,
AllowedIPS: client.IpAllocationStr,
Endpoint: client.Endpoint,
CreateUser: client.CreateUser,
Enabled: cast.ToBool(client.Enabled),