[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); Request.addAllExtendedToken(params.extendedTokens);
} }
} else if (params.session != null) { } else if (params.session != null) {
LogHelper.info("Using Sessions"); throw new UnsupportedOperationException("Legacy session not supported");
Request.setSession(params.session);
} }
checkJVMBitsAndVersion(params.profile.getMinJavaVersion(), params.profile.getRecommendJavaVersion(), params.profile.getMaxJavaVersion(), params.profile.isWarnMissJavaVersion()); checkJVMBitsAndVersion(params.profile.getMinJavaVersion(), params.profile.getRecommendJavaVersion(), params.profile.getMaxJavaVersion(), params.profile.isWarnMissJavaVersion());
LauncherEngine.modulesManager.invokeEvent(new ClientProcessInitPhase(engine, params)); LauncherEngine.modulesManager.invokeEvent(new ClientProcessInitPhase(engine, params));

View file

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

View file

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

View file

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