Полная зачистка legacy + закрытие fix24.1/fix24.2 + обновление логотипа
This commit is contained in:
@@ -4,12 +4,25 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/skip2/go-qrcode"
|
||||
"hy2xs-admin/model/dto"
|
||||
"hy2xs-admin/model/entity"
|
||||
"hy2xs-admin/model/vo"
|
||||
"hy2xs-admin/service"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func resolvePeerID(c *gin.Context) (*int64, bool) {
|
||||
raw := strings.TrimSpace(c.Param("id"))
|
||||
if raw == "" {
|
||||
return nil, false
|
||||
}
|
||||
parsed, err := strconv.ParseInt(raw, 10, 64)
|
||||
if err != nil || parsed <= 0 {
|
||||
return nil, false
|
||||
}
|
||||
return &parsed, true
|
||||
}
|
||||
|
||||
func Hysteria2Auth(c *gin.Context) {
|
||||
var req dto.Hysteria2AuthDto
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
@@ -28,10 +41,7 @@ func Hysteria2Auth(c *gin.Context) {
|
||||
|
||||
// Обновление времени последнего подключения
|
||||
now := time.Now().UnixMilli()
|
||||
if err = service.UpdateAccount(entity.Account{
|
||||
BaseEntity: entity.BaseEntity{Id: &id},
|
||||
ConAt: &now,
|
||||
}); err != nil {
|
||||
if err = service.UpdatePeerLastConnectionAt(id, now); err != nil {
|
||||
vo.Fail(err.Error(), c)
|
||||
return
|
||||
}
|
||||
@@ -60,9 +70,15 @@ func ListRelease(c *gin.Context) {
|
||||
}
|
||||
|
||||
func Hysteria2Url(c *gin.Context) {
|
||||
hysteria2UrlDto, err := validateField(c, dto.Hysteria2UrlDto{})
|
||||
if err != nil {
|
||||
return
|
||||
hysteria2UrlDto := dto.Hysteria2UrlDto{}
|
||||
if id, ok := resolvePeerID(c); ok {
|
||||
hysteria2UrlDto.AccountId = id
|
||||
} else {
|
||||
var err error
|
||||
hysteria2UrlDto, err = validateField(c, dto.Hysteria2UrlDto{})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
url, err := service.Hysteria2Url(*hysteria2UrlDto.AccountId)
|
||||
@@ -82,11 +98,3 @@ func Hysteria2Url(c *gin.Context) {
|
||||
}
|
||||
vo.Success(hysteria2UrlVo, c)
|
||||
}
|
||||
|
||||
func Hysteria2SubscribeUrl(c *gin.Context) {
|
||||
vo.Fail("subscription delivery is out of scope in HY2XS baseline", c)
|
||||
}
|
||||
|
||||
func Hysteria2Subscribe(c *gin.Context) {
|
||||
vo.Fail("subscription delivery is out of scope in HY2XS baseline", c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user