[FIX] Deprecate Request.session

This commit is contained in:
Gravita 2022-03-18 19:22:03 +07:00
parent 96915b0f78
commit dd3fd101f4
4 changed files with 7 additions and 6 deletions

View file

@ -108,8 +108,7 @@ public static void main(String[] args) throws Throwable {
Request.addAllExtendedToken(params.extendedTokens);
}
} else if (params.session != null) {
LogHelper.info("Using Sessions");
Request.setSession(params.session);
throw new UnsupportedOperationException("Legacy session not supported");
}
checkJVMBitsAndVersion(params.profile.getMinJavaVersion(), params.profile.getRecommendJavaVersion(), params.profile.getMaxJavaVersion(), params.profile.isWarnMissJavaVersion());
LauncherEngine.modulesManager.invokeEvent(new ClientProcessInitPhase(engine, params));

View file

@ -121,7 +121,7 @@ private void applyClientProfile() {
}
this.params.oauth = Request.getOAuth();
if (this.params.oauth == null) {
this.params.session = Request.getSession();
throw new UnsupportedOperationException("Legacy session not supported");
} else {
this.params.authId = Request.getAuthId();
this.params.oauthExpiredTime = Request.getTokenExpiredTime();

View file

@ -24,6 +24,7 @@ public class AuthRequestEvent extends RequestEvent {
@LauncherNetworkAPI
public String protectToken;
@LauncherNetworkAPI
@Deprecated // Always null
public UUID session;
@LauncherNetworkAPI
public OAuthRequestEvent oauth;

View file

@ -22,6 +22,7 @@ public abstract class Request<R extends WebSocketEvent> implements WebSocketRequ
@Deprecated
public static StdWebSocketService service;
private static RequestService requestService;
@Deprecated
private static UUID session;
private static AuthRequestEvent.OAuthRequestEvent oauth;
private static Map<String, String> extendedTokens;
@ -46,10 +47,12 @@ public static boolean isAvailable() {
return requestService != null;
}
@Deprecated
public static UUID getSession() {
return Request.session;
}
@Deprecated
public static void setSession(UUID session) {
Request.session = session;
}
@ -146,9 +149,7 @@ public RequestRestoreReport(boolean legacySession, boolean refreshed, List<Strin
public static RequestRestoreReport restore() throws Exception {
if (session != null) {
RestoreSessionRequest request = new RestoreSessionRequest(session);
request.request();
return new RequestRestoreReport(true, false, null);
throw new UnsupportedOperationException("Legacy session system not supported");
} else {
boolean refreshed = false;
RestoreRequest request;