mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 13:00:52 +08:00
refactor(gemini-web): Remove file-based PSIDTS cookie caching
This commit is contained in:
@@ -9,8 +9,6 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/http/cookiejar"
|
"net/http/cookiejar"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"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 {
|
if len(extraCookies) > 0 {
|
||||||
trySets = append(trySets, extraCookies)
|
trySets = append(trySets, extraCookies)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,16 +98,16 @@ func (s *GeminiWebState) Label() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *GeminiWebState) loadConversationCaches() {
|
func (s *GeminiWebState) loadConversationCaches() {
|
||||||
if path := s.convPath(); path != "" {
|
path := s.convPath()
|
||||||
if store, err := LoadConvStore(path); err == nil {
|
if path == "" {
|
||||||
s.convStore = store
|
return
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if path := s.convPath(); path != "" {
|
if store, err := LoadConvStore(path); err == nil {
|
||||||
if items, index, err := LoadConvData(path); err == nil {
|
s.convStore = store
|
||||||
s.convData = items
|
}
|
||||||
s.convIndex = index
|
if items, index, err := LoadConvData(path); err == nil {
|
||||||
}
|
s.convData = items
|
||||||
|
s.convIndex = index
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user