refactor(gemini-web): Remove file-based PSIDTS cookie caching

This commit is contained in:
hkfires
2025-09-25 14:36:31 +08:00
parent c63dc7fe2f
commit 7a30e65175
2 changed files with 9 additions and 24 deletions

View File

@@ -9,8 +9,6 @@ import (
"net/http"
"net/http/cookiejar"
"net/url"
"os"
"path/filepath"
"regexp"
"strings"
"time"
@@ -126,19 +124,6 @@ func getAccessToken(baseCookies map[string]string, proxy string, verbose bool, i
}
}
cacheDir := "temp"
_ = os.MkdirAll(cacheDir, 0o755)
if v1, ok1 := baseCookies["__Secure-1PSID"]; ok1 {
cacheFile := filepath.Join(cacheDir, ".cached_1psidts_"+v1+".txt")
if b, err := os.ReadFile(cacheFile); err == nil {
cv := strings.TrimSpace(string(b))
if cv != "" {
merged := map[string]string{"__Secure-1PSID": v1, "__Secure-1PSIDTS": cv}
trySets = append(trySets, merged)
}
}
}
if len(extraCookies) > 0 {
trySets = append(trySets, extraCookies)
}

View File

@@ -98,16 +98,16 @@ func (s *GeminiWebState) Label() string {
}
func (s *GeminiWebState) loadConversationCaches() {
if path := s.convPath(); path != "" {
if store, err := LoadConvStore(path); err == nil {
s.convStore = store
}
path := s.convPath()
if path == "" {
return
}
if path := s.convPath(); path != "" {
if items, index, err := LoadConvData(path); err == nil {
s.convData = items
s.convIndex = index
}
if store, err := LoadConvStore(path); err == nil {
s.convStore = store
}
if items, index, err := LoadConvData(path); err == nil {
s.convData = items
s.convIndex = index
}
}