fix26: полный прод-фикс auth/jwt, import-export peer и frontend flow
This commit is contained in:
@@ -2,6 +2,7 @@ package controller
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/sirupsen/logrus"
|
||||
"hy2xs-admin/model/dto"
|
||||
"hy2xs-admin/model/vo"
|
||||
"hy2xs-admin/service"
|
||||
@@ -27,8 +28,7 @@ func Hysteria2Auth(c *gin.Context) {
|
||||
// Обновление времени последнего подключения
|
||||
now := time.Now().UnixMilli()
|
||||
if err = service.UpdatePeerLastConnectionAt(id, now); err != nil {
|
||||
vo.Fail(err.Error(), c)
|
||||
return
|
||||
logrus.WithError(err).Warnf("failed to update peer last_connection_at: peer_id=%d", id)
|
||||
}
|
||||
vo.Hysteria2AuthSuccess(username, c)
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"hy2xs-admin/model/bo"
|
||||
"hy2xs-admin/model/constant"
|
||||
"hy2xs-admin/model/dto"
|
||||
"hy2xs-admin/model/entity"
|
||||
"hy2xs-admin/model/vo"
|
||||
"hy2xs-admin/service"
|
||||
"hy2xs-admin/util"
|
||||
@@ -147,12 +147,12 @@ func ImportPeer(c *gin.Context) {
|
||||
vo.Fail("json file read err", c)
|
||||
return
|
||||
}
|
||||
var accounts []entity.Account
|
||||
if err = json.Unmarshal(content, &accounts); err != nil {
|
||||
var peerExports []bo.PeerExport
|
||||
if err = json.Unmarshal(content, &peerExports); err != nil {
|
||||
vo.Fail("content Unmarshal err", c)
|
||||
return
|
||||
}
|
||||
if err = service.UpsertPeerLegacy(accounts); err != nil {
|
||||
if err = service.UpsertPeerExport(peerExports); err != nil {
|
||||
vo.Fail(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user