Skip to content
This repository was archived by the owner on Aug 30, 2026. It is now read-only.

Commit 903f521

Browse files
committed
fix: 修复微软账号会话切换和CI 缓存
1 parent 067b29c commit 903f521

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

.github/workflows/release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ jobs:
7575
node -e 'const fs = require("fs"); const path = "com/gtnewhorizons/retrofuturagradle/mcp/DecompileTask.class"; const oldValue = Buffer.from("-XX:+AggressiveOpts"); const newValue = Buffer.from("-XX:+AlwaysPreTouch"); let data = fs.readFileSync(path); const index = data.indexOf(oldValue); if (index < 0) throw new Error("RFG DecompileTask no longer contains -XX:+AggressiveOpts"); newValue.copy(data, index); fs.writeFileSync(path, data);'
7676
jar uf "$RFG_JAR" com/gtnewhorizons/retrofuturagradle/mcp/DecompileTask.class
7777
78+
- name: 清理 RFG 反编译缓存
79+
shell: bash
80+
run: |
81+
set -euo pipefail
82+
rm -rf "$GRADLE_USER_HOME/caches/retro_futura_gradle"
83+
7884
- name: 读取版本号
7985
id: version
8086
shell: bash

src/main/java/top/syshub/accountsx/forge/authlib/AuthlibAdapterImpl.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import top.syshub.accountsx.core.AccountsX;
77
import top.syshub.accountsx.core.accounts.BaseAccount;
88
import top.syshub.accountsx.core.accounts.model.context.AccountContext;
9-
import top.syshub.accountsx.core.accounts.impl.microsoft.MicrosoftConstants;
109
import top.syshub.accountsx.core.adapters.api.AuthlibAdapter;
1110

1211
import java.io.IOException;
@@ -18,7 +17,7 @@ public final class AuthlibAdapterImpl implements AuthlibAdapter<AccountSessionIm
1817
public AccountSessionImpl createAccountProfile(BaseAccount.AccountStorage storage, AccountContext context, Proxy proxy) throws IOException {
1918
YggdrasilAuthenticationService service = new YggdrasilAuthenticationService(proxy, UUID.randomUUID().toString());
2019
MinecraftSessionService defaultSessionService = service.createMinecraftSessionService();
21-
MinecraftSessionService sessionService = isCustomSessionServer(context)
20+
MinecraftSessionService sessionService = hasSessionServer(context)
2221
? new InjectorMinecraftSessionService(context, proxy)
2322
: defaultSessionService;
2423
if (sessionService instanceof InjectorMinecraftSessionService) {
@@ -28,17 +27,10 @@ public AccountSessionImpl createAccountProfile(BaseAccount.AccountStorage storag
2827
return new AccountSessionImpl(storage, service, sessionService, profile);
2928
}
3029

31-
private static boolean isCustomSessionServer(AccountContext context) {
30+
private static boolean hasSessionServer(AccountContext context) {
3231
if (context == null || context.server() == null || context.server().sessionURL() == null) {
3332
return false;
3433
}
35-
return !MicrosoftConstants.SESSION.equals(stripTrailingSlash(context.server().sessionURL()));
36-
}
37-
38-
private static String stripTrailingSlash(String url) {
39-
while (url.endsWith("/") && url.length() > 1) {
40-
url = url.substring(0, url.length() - 1);
41-
}
42-
return url;
34+
return !context.server().sessionURL().trim().isEmpty();
4335
}
4436
}

0 commit comments

Comments
 (0)