refactor: consolidate duplicate UA and header scrubbing into shared misc functions

This commit is contained in:
maplelove
2026-02-27 10:57:13 +08:00
parent f3c164d345
commit fc0257d6d9
5 changed files with 72 additions and 83 deletions

View File

@@ -13,7 +13,6 @@ import (
"io"
"net/http"
"os"
"runtime"
"strconv"
"strings"
"time"
@@ -21,6 +20,7 @@ import (
"github.com/router-for-me/CLIProxyAPI/v6/internal/auth/gemini"
"github.com/router-for-me/CLIProxyAPI/v6/internal/config"
"github.com/router-for-me/CLIProxyAPI/v6/internal/interfaces"
"github.com/router-for-me/CLIProxyAPI/v6/internal/misc"
sdkAuth "github.com/router-for-me/CLIProxyAPI/v6/sdk/auth"
cliproxyauth "github.com/router-for-me/CLIProxyAPI/v6/sdk/cliproxy/auth"
log "github.com/sirupsen/logrus"
@@ -33,7 +33,7 @@ const (
)
func getGeminiCLIUserAgent() string {
return fmt.Sprintf("GeminiCLI/1.0.0/unknown (%s; %s)", runtime.GOOS, runtime.GOARCH)
return misc.GeminiCLIUserAgent("")
}
type projectSelectionRequiredError struct{}