mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-18 04:10:51 +08:00
Merge pull request #1067 from router-for-me/auth-files
refactor(auth): simplify filename prefixes for qwen and iflow tokens
This commit is contained in:
@@ -1703,7 +1703,7 @@ func (h *Handler) RequestQwenToken(c *gin.Context) {
|
|||||||
// Create token storage
|
// Create token storage
|
||||||
tokenStorage := qwenAuth.CreateTokenStorage(tokenData)
|
tokenStorage := qwenAuth.CreateTokenStorage(tokenData)
|
||||||
|
|
||||||
tokenStorage.Email = fmt.Sprintf("qwen-%d", time.Now().UnixMilli())
|
tokenStorage.Email = fmt.Sprintf("%d", time.Now().UnixMilli())
|
||||||
record := &coreauth.Auth{
|
record := &coreauth.Auth{
|
||||||
ID: fmt.Sprintf("qwen-%s.json", tokenStorage.Email),
|
ID: fmt.Sprintf("qwen-%s.json", tokenStorage.Email),
|
||||||
Provider: "qwen",
|
Provider: "qwen",
|
||||||
@@ -1808,7 +1808,7 @@ func (h *Handler) RequestIFlowToken(c *gin.Context) {
|
|||||||
tokenStorage := authSvc.CreateTokenStorage(tokenData)
|
tokenStorage := authSvc.CreateTokenStorage(tokenData)
|
||||||
identifier := strings.TrimSpace(tokenStorage.Email)
|
identifier := strings.TrimSpace(tokenStorage.Email)
|
||||||
if identifier == "" {
|
if identifier == "" {
|
||||||
identifier = fmt.Sprintf("iflow-%d", time.Now().UnixMilli())
|
identifier = fmt.Sprintf("%d", time.Now().UnixMilli())
|
||||||
tokenStorage.Email = identifier
|
tokenStorage.Email = identifier
|
||||||
}
|
}
|
||||||
record := &coreauth.Auth{
|
record := &coreauth.Auth{
|
||||||
@@ -1893,15 +1893,17 @@ func (h *Handler) RequestIFlowCookieToken(c *gin.Context) {
|
|||||||
fileName := iflowauth.SanitizeIFlowFileName(email)
|
fileName := iflowauth.SanitizeIFlowFileName(email)
|
||||||
if fileName == "" {
|
if fileName == "" {
|
||||||
fileName = fmt.Sprintf("iflow-%d", time.Now().UnixMilli())
|
fileName = fmt.Sprintf("iflow-%d", time.Now().UnixMilli())
|
||||||
|
} else {
|
||||||
|
fileName = fmt.Sprintf("iflow-%s", fileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
tokenStorage.Email = email
|
tokenStorage.Email = email
|
||||||
timestamp := time.Now().Unix()
|
timestamp := time.Now().Unix()
|
||||||
|
|
||||||
record := &coreauth.Auth{
|
record := &coreauth.Auth{
|
||||||
ID: fmt.Sprintf("iflow-%s-%d.json", fileName, timestamp),
|
ID: fmt.Sprintf("%s-%d.json", fileName, timestamp),
|
||||||
Provider: "iflow",
|
Provider: "iflow",
|
||||||
FileName: fmt.Sprintf("iflow-%s-%d.json", fileName, timestamp),
|
FileName: fmt.Sprintf("%s-%d.json", fileName, timestamp),
|
||||||
Storage: tokenStorage,
|
Storage: tokenStorage,
|
||||||
Metadata: map[string]any{
|
Metadata: map[string]any{
|
||||||
"email": email,
|
"email": email,
|
||||||
|
|||||||
Reference in New Issue
Block a user