[PR #2] [MERGED] fix: 修复自动打开管理页面状态无法落盘 #1

Closed
opened 2026-02-27 08:10:12 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/kitephp/CLIProxyAPI_Tray/pull/2
Author: @neavo
Created: 2/10/2026
Status: Merged
Merged: 2/11/2026
Merged by: @kitephp

Base: mainHead: fix/state-persist-autoopen


📝 Commits (1)

  • 8c07185 fix: 修复自动打开 WebUI 状态无法落盘

📊 Changes

1 file changed (+120 additions, -15 deletions)

View changed files

📝 cli-proxy-api.ps1 (+120 -15)

📄 Description

背景

右键菜单取消勾选“自动打开管理页面 / Auto Open WebUI”后,部分环境下 state.json 实际没有更新为 false

原因

  • state.json 默认写在脚本目录;当脚本目录不可写(例如放在 Program Files/受控目录)时,写盘会失败且用户侧难以感知。
  • 目录内残留旧的 state.json 时,启动优先读取旧文件,导致看起来“怎么改都不生效”。

修复

  • 写入失败时自动回退到用户目录(%LOCALAPPDATA%\\CLIProxyAPI_Tray\\state.json),并通过气泡提示告知实际写入位置与失败原因。
  • 启动时在脚本目录与用户目录之间选择更合理的状态文件(不可写优先用户目录;两份都存在时取最近更新)。
  • 减少 Update-TrayState 的频繁写盘:仅在通道实际变化时持久化。

验证

  • 菜单切换后 autoOpenWebUI 字段稳定写入到可写的 state.json
  • 重启托盘脚本后,勾选状态与文件内容一致。

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/kitephp/CLIProxyAPI_Tray/pull/2 **Author:** [@neavo](https://github.com/neavo) **Created:** 2/10/2026 **Status:** ✅ Merged **Merged:** 2/11/2026 **Merged by:** [@kitephp](https://github.com/kitephp) **Base:** `main` ← **Head:** `fix/state-persist-autoopen` --- ### 📝 Commits (1) - [`8c07185`](https://github.com/kitephp/CLIProxyAPI_Tray/commit/8c0718539d823ec6048e0e9560d8d82e302b5603) fix: 修复自动打开 WebUI 状态无法落盘 ### 📊 Changes **1 file changed** (+120 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `cli-proxy-api.ps1` (+120 -15) </details> ### 📄 Description ## 背景 右键菜单取消勾选“自动打开管理页面 / Auto Open WebUI”后,部分环境下 `state.json` 实际没有更新为 `false`。 ## 原因 - `state.json` 默认写在脚本目录;当脚本目录不可写(例如放在 Program Files/受控目录)时,写盘会失败且用户侧难以感知。 - 目录内残留旧的 `state.json` 时,启动优先读取旧文件,导致看起来“怎么改都不生效”。 ## 修复 - 写入失败时自动回退到用户目录(`%LOCALAPPDATA%\\CLIProxyAPI_Tray\\state.json`),并通过气泡提示告知实际写入位置与失败原因。 - 启动时在脚本目录与用户目录之间选择更合理的状态文件(不可写优先用户目录;两份都存在时取最近更新)。 - 减少 `Update-TrayState` 的频繁写盘:仅在通道实际变化时持久化。 ## 验证 - 菜单切换后 `autoOpenWebUI` 字段稳定写入到可写的 `state.json`。 - 重启托盘脚本后,勾选状态与文件内容一致。 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem closed this issue 2026-02-27 08:10:13 +03:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/CLIProxyAPI_Tray-kitephp#1
No description provided.