Skip to content

issue#8018: 重新登录频率放缓#8248

Open
0x1A5 wants to merge 5 commits intoMeloong-Git:mainfrom
0x1A5:main
Open

issue#8018: 重新登录频率放缓#8248
0x1A5 wants to merge 5 commits intoMeloong-Git:mainfrom
0x1A5:main

Conversation

@0x1A5
Copy link
Contributor

@0x1A5 0x1A5 commented Mar 3, 2026

issue#8018
如果是游玩时最小化时才有用。不然重新打开就又会刷新了。

将10分钟延长到了5小时,一般是一上午或一下午的时间。

只是延长了时间,.NET工程的JWT令牌有效期检测不知道怎么弄。我能想到的解决方案就是这样了。

@LinQingYuu LinQingYuu requested a review from LTCatt March 3, 2026 08:22
@LinQingYuu LinQingYuu added · 优化 等待确认 已经过社区确认,等待开发者确认 labels Mar 3, 2026
@LinQingYuu
Copy link
Collaborator

可以加一行 close #8018

有效期的话,可以在兑换 Minecraft 访问令牌那段改, API 有个 expires_in 字段

参考 https://zh.minecraft.wiki/w/Tutorial:%E7%BC%96%E5%86%99%E5%90%AF%E5%8A%A8%E5%99%A8#%E8%8E%B7%E5%BE%97Minecraft%E8%AE%BF%E9%97%AE%E4%BB%A4%E7%89%8C

@0x1A5
Copy link
Contributor Author

0x1A5 commented Mar 3, 2026

可以加一行 close #8018

有效期的话,可以在兑换 Minecraft 访问令牌那段改, API 有个 expires_in 字段

参考 https://zh.minecraft.wiki/w/Tutorial:%E7%BC%96%E5%86%99%E5%90%AF%E5%8A%A8%E5%99%A8#%E8%8E%B7%E5%BE%97Minecraft%E8%AE%BF%E9%97%AE%E4%BB%A4%E7%89%8C

没看懂写入ini文件和注册表的函数 没发现其他保存内容的地方 也不敢轻易修改注册表和ini。并且尝试修改还报错..所以还是不能达到下一次重新启动检测是否到期
现在将5小时精确到了令牌到期时间..如果中间不关闭的话可以正常运作,关闭了还是要重新登录

对于启动游戏后隐藏PCL的用户有效 我想这就够了

@0x1A5 0x1A5 changed the title issue#8018: 延长Token刷新时间 issue#8018: 重新登录频率放缓 Mar 3, 2026
@LTCatt LTCatt added 处理中 开发者正在调查或处理该项 🟨 中 优先度:中 and removed 等待确认 已经过社区确认,等待开发者确认 labels Mar 3, 2026
Copy link
Collaborator

@wyc-26 wyc-26 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LinQingYuu
Copy link
Collaborator

你可以去 ModSetup 找一个微软登录相关的配置项,然后复制一个改成 CacheMsOAuthExpires

然后就可以用 Setup 来保存配置项

Dim AccessToken As String = MsLoginStep4(Tokens)
Dim MinecraftAPI As String() = MsLoginStep4(Tokens) '更改了第4步验证的返回格式,第一项为Minecraft Access Token,第二项为Token有效期
Dim AccessToken As String = MinecraftAPI(0) 'Access Token
McLoginMsRefreshTime = GetTimeMs() + MinecraftAPI(1) 'Token 到期时间
Copy link
Collaborator

@wyc-26 wyc-26 Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

来源于 Minecraft Wiki

GetTimeMs() 获取的当前时间以毫秒为单位,而 API 返回的有效时间以秒为单位

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢提醒 差点酿成大祸了

@0x1A5
Copy link
Contributor Author

0x1A5 commented Mar 5, 2026

你可以去 ModSetup 找一个微软登录相关的配置项,然后复制一个改成 CacheMsOAuthExpires

然后就可以用 Setup 来保存配置项

明白。周末再研究研究,这两天还有功课。

2
理论上有效
@0x1A5
Copy link
Contributor Author

0x1A5 commented Mar 6, 2026

现在将失效时间保存到了注册表。所以重启也不会重新登录了(如果未过期)。
其中判断条件“如果此次启动未重新登录”删掉了,因为这样无论是否过期仍然会在启动后重新登录。

Co-authored-by: 薄奚梦灵 <[email protected]>
@LTCatt LTCatt added 🟥 高 优先度:高 and removed 🟨 中 优先度:中 labels Mar 7, 2026
@duya3895
Copy link

duya3895 commented Mar 7, 2026

👍

Copy link
Collaborator

@LinQingYuu LinQingYuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

· 优化 处理中 开发者正在调查或处理该项 🟥 高 优先度:高

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants