fix(fix3): runtime env hardening and public endpoint source-of-truth
This commit is contained in:
@@ -64,7 +64,7 @@ func Hysteria2Url(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
url, err := service.Hysteria2Url(*hysteria2UrlDto.AccountId, *hysteria2UrlDto.Hostname)
|
||||
url, err := service.Hysteria2Url(*hysteria2UrlDto.AccountId)
|
||||
if err != nil {
|
||||
vo.Fail(err.Error(), c)
|
||||
return
|
||||
@@ -88,8 +88,7 @@ func Hysteria2SubscribeUrl(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
subscribeUrl, err := service.Hysteria2SubscribeUrl(*hysteria2SubscribeUrlDto.AccountId,
|
||||
*hysteria2SubscribeUrlDto.Protocol,
|
||||
*hysteria2SubscribeUrlDto.Host)
|
||||
*hysteria2SubscribeUrlDto.Protocol)
|
||||
if err != nil {
|
||||
vo.Fail(err.Error(), c)
|
||||
return
|
||||
@@ -114,12 +113,6 @@ func Hysteria2Subscribe(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
userAgent := strings.ToLower(c.Request.Header.Get("User-Agent"))
|
||||
host := c.Request.Host
|
||||
|
||||
if host == "" {
|
||||
vo.Fail("Host is empty", c)
|
||||
return
|
||||
}
|
||||
|
||||
var clientType string
|
||||
if strings.Contains(userAgent, constant.Shadowrocket) {
|
||||
@@ -134,7 +127,7 @@ func Hysteria2Subscribe(c *gin.Context) {
|
||||
clientType = constant.Clash
|
||||
}
|
||||
|
||||
userInfo, configStr, err := service.Hysteria2Subscribe(conPass, clientType, host)
|
||||
userInfo, configStr, err := service.Hysteria2Subscribe(conPass, clientType)
|
||||
if err != nil {
|
||||
vo.Fail(err.Error(), c)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user