mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 04:50:52 +08:00
fix(client): Prevent overwriting auth file on update
This commit is contained in:
@@ -80,10 +80,9 @@ func (c *GeminiWebClient) unregisterClient(reason interfaces.UnregisterReason) {
|
||||
util.RemoveCookieSnapshots(c.tokenFilePath)
|
||||
}
|
||||
case interfaces.UnregisterReasonAuthFileUpdated:
|
||||
if c.snapshotManager != nil {
|
||||
if err := c.snapshotManager.Persist(); err != nil {
|
||||
log.Errorf("Failed to persist Gemini Web cookies for %s: %v", filepath.Base(c.tokenFilePath), err)
|
||||
}
|
||||
if c.snapshotManager != nil && c.tokenFilePath != "" {
|
||||
log.Debugf("skipping Gemini Web snapshot flush because auth file was updated: %s", filepath.Base(c.tokenFilePath))
|
||||
util.RemoveCookieSnapshots(c.tokenFilePath)
|
||||
}
|
||||
default:
|
||||
// Flush cookie snapshot to main token file and remove snapshot
|
||||
|
||||
@@ -525,8 +525,9 @@ func (c *QwenClient) unregisterClient(reason interfaces.UnregisterReason) {
|
||||
util.RemoveCookieSnapshots(c.tokenFilePath)
|
||||
}
|
||||
case interfaces.UnregisterReasonAuthFileUpdated:
|
||||
if err := c.snapshotManager.Persist(); err != nil {
|
||||
log.Errorf("Failed to persist Qwen cookies for %s: %v", filepath.Base(c.tokenFilePath), err)
|
||||
if c.tokenFilePath != "" {
|
||||
log.Debugf("skipping Qwen snapshot flush because auth file was updated: %s", filepath.Base(c.tokenFilePath))
|
||||
util.RemoveCookieSnapshots(c.tokenFilePath)
|
||||
}
|
||||
case interfaces.UnregisterReasonShutdown, interfaces.UnregisterReasonReload:
|
||||
if err := c.snapshotManager.Flush(); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user