mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-18 12:20:52 +08:00
fix(auth): normalize Gemini credential file prefix for consistency
This commit is contained in:
@@ -71,17 +71,17 @@ func (ts *GeminiTokenStorage) SaveTokenToFile(authFilePath string) error {
|
|||||||
|
|
||||||
// CredentialFileName returns the filename used to persist Gemini CLI credentials.
|
// CredentialFileName returns the filename used to persist Gemini CLI credentials.
|
||||||
// When projectID represents multiple projects (comma-separated or literal ALL),
|
// When projectID represents multiple projects (comma-separated or literal ALL),
|
||||||
// the suffix is normalized to "all" and a "geminicli-" prefix is enforced to keep
|
// the suffix is normalized to "all" and a "gemini-" prefix is enforced to keep
|
||||||
// web and CLI generated files consistent.
|
// web and CLI generated files consistent.
|
||||||
func CredentialFileName(email, projectID string, includeProviderPrefix bool) string {
|
func CredentialFileName(email, projectID string, includeProviderPrefix bool) string {
|
||||||
email = strings.TrimSpace(email)
|
email = strings.TrimSpace(email)
|
||||||
project := strings.TrimSpace(projectID)
|
project := strings.TrimSpace(projectID)
|
||||||
if strings.EqualFold(project, "all") || strings.Contains(project, ",") {
|
if strings.EqualFold(project, "all") || strings.Contains(project, ",") {
|
||||||
return fmt.Sprintf("geminicli-%s-all.json", email)
|
return fmt.Sprintf("gemini-%s-all.json", email)
|
||||||
}
|
}
|
||||||
prefix := ""
|
prefix := ""
|
||||||
if includeProviderPrefix {
|
if includeProviderPrefix {
|
||||||
prefix = "geminicli-"
|
prefix = "gemini-"
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("%s%s-%s.json", prefix, email, project)
|
return fmt.Sprintf("%s%s-%s.json", prefix, email, project)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user