Repository navigation
🐛 修复加速项目勾选状态在重启后被服务端默认值覆盖 - #4144
Open
shadowxhero wants to merge 1 commit into
Open
shadowxhero wants to merge 1 commit into
shadowxhero wants to merge 1 commit into
Conversation
ProxyService.RestoreAccelerateEnableAllIds 之前只会把本地记录中的项目置为 true,不会把用户已取消的项目置为 false。由于服务端返回的加速项目默认 Checked 为 true,用户取消的勾选在每次启动时都会被默认值重新勾上。 改为按本地保存的勾选记录双向恢复 ThreeStateEnable。
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
在
网络加速 -> Steam 服务中取消掉不需要的加速项(例如只保留Steam 社区与Steam 商店),关闭软件重新打开后,被取消的项目又全部勾上了,用户的选择无法持久生效。
复现
网络加速 -> Steam 服务,只勾选Steam 社区和Steam 商店,其余的(Steam 图片、Steam 静态资源、Steam 更新、Steam 讨论/留言 修复项、Steam 社区视频封面加载)取消勾选;AppData/Plugins/Accelerator/Settings/ProxySettings.json中的SupportProxyServicesStatus已只包含所选项目的 Id(说明写回本身是成功的);
Steam 服务:第 1 步取消的项目又变成勾选状态。根因
两件事叠加:
服务端返回的加速项目数据里,
Steam 服务分组内的项目默认AccelerateProjectDTO.Checked = true(实测:启动时写入的
LOCAL_ACCELERATE.json中该分组 8 个顶层项有 7 项Checked = true,唯一为
false的是Steam 白山云CDN 修复,与界面表现一致);而Checked的变化会同步到界面绑定的
ThreeStateEnable,因此这些项目一加载进内存就是"已勾选"。ProxyService.RestoreAccelerateEnableAllIds只做"加法":启动顺序是
client.All()(服务端数据,默认勾选)→RestoreAccelerateEnableAllIds(恢复本地记录),由于恢复逻辑永远不会把不在记录里的叶子项置为
false,用户的取消操作每次启动都会被服务端默认值覆盖。修复
把该项恢复改为按本地记录的双向赋值:
RestoreAccelerateEnableAllIds只对叶子项目赋值(分组节点仍走递归、其状态由子项推导),并且在
SupportProxyServicesStatus为空(用户从未自定义过勾选)时不会被调用,因此不影响首次安装时的服务端默认勾选行为。
影响与权衡
需要用户手动勾选一次。这与"用户取消过的项目不应被重新勾上"是一致的语义;
若维护者更希望新项目保持服务端默认,可改为在记录中额外保存"已取消项目"集合来区分,
但那样需要变更设置结构,本 PR 采用与现有数据结构兼容的最小改动。
验证
网络加速 -> Steam 服务只勾选本地记录中的项目,取消状态可在重启后保持;补丁版与官方版逐方法比对,
3233 个方法中仅有该方法变化,IL 通过 JIT 编译校验。