Skip to content

Commit

Permalink
fix userinfo header
Browse files Browse the repository at this point in the history
Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
  • Loading branch information
MHSanaei and alireza0 committed Apr 20, 2023
1 parent bbce1eb commit 5ff6f40
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion web/controller/sub.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (a *SUBController) subs(c *gin.Context) {
}

// Add subscription-userinfo
c.Writer.Header().Set("subscription-userinfo", header)
c.Writer.Header().Set("Subscription-Userinfo", header)

c.String(200, base64.StdEncoding.EncodeToString([]byte(result)))
}
Expand Down
8 changes: 1 addition & 7 deletions web/service/sub.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,7 @@ func (s *SubService) GetSubs(subId string, host string) ([]string, string, error
}
}
}
header = fmt.Sprintf("upload=%d;download=%d", traffic.Up, traffic.Down)
if traffic.Total > 0 {
header = header + fmt.Sprintf(";total=%d", traffic.Total)
}
if traffic.ExpiryTime > 0 {
header = header + fmt.Sprintf(";expire=%d", traffic.ExpiryTime)
}
header = fmt.Sprintf("upload=%d; download=%d; total=%d; expire=%d", traffic.Up, traffic.Down, traffic.Total, traffic.ExpiryTime/1000)
return result, header, nil
}

Expand Down

0 comments on commit 5ff6f40

Please sign in to comment.