mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-18 20:30:51 +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)
|
util.RemoveCookieSnapshots(c.tokenFilePath)
|
||||||
}
|
}
|
||||||
case interfaces.UnregisterReasonAuthFileUpdated:
|
case interfaces.UnregisterReasonAuthFileUpdated:
|
||||||
if c.snapshotManager != nil {
|
if c.snapshotManager != nil && c.tokenFilePath != "" {
|
||||||
if err := c.snapshotManager.Persist(); err != nil {
|
log.Debugf("skipping Gemini Web snapshot flush because auth file was updated: %s", filepath.Base(c.tokenFilePath))
|
||||||
log.Errorf("Failed to persist Gemini Web cookies for %s: %v", filepath.Base(c.tokenFilePath), err)
|
util.RemoveCookieSnapshots(c.tokenFilePath)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
// Flush cookie snapshot to main token file and remove snapshot
|
// 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)
|
util.RemoveCookieSnapshots(c.tokenFilePath)
|
||||||
}
|
}
|
||||||
case interfaces.UnregisterReasonAuthFileUpdated:
|
case interfaces.UnregisterReasonAuthFileUpdated:
|
||||||
if err := c.snapshotManager.Persist(); err != nil {
|
if c.tokenFilePath != "" {
|
||||||
log.Errorf("Failed to persist Qwen cookies for %s: %v", filepath.Base(c.tokenFilePath), err)
|
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:
|
case interfaces.UnregisterReasonShutdown, interfaces.UnregisterReasonReload:
|
||||||
if err := c.snapshotManager.Flush(); err != nil {
|
if err := c.snapshotManager.Flush(); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user