Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CNREL support #2076

Merged
merged 5 commits into from
Mar 12, 2023
Merged

CNREL support #2076

merged 5 commits into from
Mar 12, 2023

Conversation

rwx9032
Copy link
Contributor

@rwx9032 rwx9032 commented Mar 10, 2023

Description

Please carefully read the Contributing note and Code of conduct before making any pull requests.
And, Do not make a pull request to merge into stable unless it is a hotfix. Use the development branch instead.

Issues fixed by this PR

Fix CNREL client can't be played

Special thanks to @xlpmyxhdr

Type of changes

  • Bug fix
  • New feature
  • Enhancement
  • Documentation

Checklist:

  • My code follows the style guidelines of this project
  • My pull request is unique and no other pull requests have been opened for these changes
  • I have read the Contributing note and Code of conduct
  • I am responsible for any copyright issues with my code if it occurs in the future.

// Send response.
ctx.json(responseData);

// Log to console.
Grasscutter.getLogger().info(translate("messages.dispatch.account.login_attempt", ctx.ip()));
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Please leave the new line at the end of the file.

Copy link
Member

@KingRainbow44 KingRainbow44 left a comment

Choose a reason for hiding this comment

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

Consider removing the messages.status.versionos key from the languages file. As the message is more of a 'debug message' instead of a critical message for the server administrator, it makes more sense to keep this message hardcoded in existing places. (and to switch the log level for these messages from info to debug)

Comment on lines 120 to 121
.getSessionKeyAuthenticator()
.authenticate(AuthenticationSystem.fromComboTokenRequest(ctx, bodyData, tokenData));
Copy link
Member

Choose a reason for hiding this comment

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

Maintain spacing.

Comment on lines 94 to 95
.getTokenAuthenticator()
.authenticate(AuthenticationSystem.fromTokenRequest(ctx, bodyData));
Copy link
Member

Choose a reason for hiding this comment

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

Maintain spacing.

Comment on lines 71 to 72
.getPasswordAuthenticator()
.authenticate(AuthenticationSystem.fromPasswordRequest(ctx, bodyData));
Copy link
Member

Choose a reason for hiding this comment

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

Maintain spacing.

Comment on lines 40 to 54
.handleLogin(AuthenticationSystem.fromExternalRequest(ctx)));
javalin.post("/authentication/register", ctx -> Grasscutter.getAuthenticationSystem().getExternalAuthenticator()
.handleAccountCreation(AuthenticationSystem.fromExternalRequest(ctx)));
.handleAccountCreation(AuthenticationSystem.fromExternalRequest(ctx)));
javalin.post("/authentication/change_password", ctx -> Grasscutter.getAuthenticationSystem().getExternalAuthenticator()
.handlePasswordReset(AuthenticationSystem.fromExternalRequest(ctx)));
.handlePasswordReset(AuthenticationSystem.fromExternalRequest(ctx)));

// External login (from OAuth2).
javalin.post("/hk4e_global/mdk/shield/api/loginByThirdparty", ctx -> Grasscutter.getAuthenticationSystem().getOAuthAuthenticator()
.handleLogin(AuthenticationSystem.fromExternalRequest(ctx)));
.handleLogin(AuthenticationSystem.fromExternalRequest(ctx)));
javalin.get("/authentication/openid/redirect", ctx -> Grasscutter.getAuthenticationSystem().getOAuthAuthenticator()
.handleTokenProcess(AuthenticationSystem.fromExternalRequest(ctx)));
.handleTokenProcess(AuthenticationSystem.fromExternalRequest(ctx)));
javalin.get("/Api/twitter_login", ctx -> Grasscutter.getAuthenticationSystem().getOAuthAuthenticator()
.handleRedirection(AuthenticationSystem.fromExternalRequest(ctx), ClientType.DESKTOP));
.handleRedirection(AuthenticationSystem.fromExternalRequest(ctx), ClientType.DESKTOP));
javalin.get("/sdkTwitterLogin.html", ctx -> Grasscutter.getAuthenticationSystem().getOAuthAuthenticator()
.handleRedirection(AuthenticationSystem.fromExternalRequest(ctx), ClientType.MOBILE));
.handleRedirection(AuthenticationSystem.fromExternalRequest(ctx), ClientType.MOBILE));
Copy link
Member

Choose a reason for hiding this comment

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

Maintain spacing.

// Use the CN region list.
QueryAllRegionsEvent event = new QueryAllRegionsEvent(regionListResponsecn);
event.call();
logger.info(translate("messages.status.versioncn"));
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
logger.info(translate("messages.status.versioncn"));
logger.debug(translate("messages.status.versioncn"));

// Use the OS region list.
QueryAllRegionsEvent event = new QueryAllRegionsEvent(regionListResponse);
event.call();
logger.info(translate("messages.status.versionos"));
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
logger.info(translate("messages.status.versionos"));
logger.debug(translate("messages.status.versionos"));

// Use the default region list.
QueryAllRegionsEvent event = new QueryAllRegionsEvent(regionListResponse);
event.call();
logger.info(translate("messages.status.versionos"));
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
logger.info(translate("messages.status.versionos"));
logger.debug(translate("messages.status.versionos"));

// Use the default region list.
QueryAllRegionsEvent event = new QueryAllRegionsEvent(regionListResponse);
event.call();
logger.info(translate("messages.status.versionos"));
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
logger.info(translate("messages.status.versionos"));
logger.debug(translate("messages.status.versionos"));

@rwx9032
Copy link
Contributor Author

rwx9032 commented Mar 10, 2023

Already deleted the language keys and hardcoded the debug output

@KingRainbow44
Copy link
Member

can you/someone else test it and send a video of it working here? (with debug logs on preferably)

@rwx9032
Copy link
Contributor Author

rwx9032 commented Mar 11, 2023

CNREL.mp4

@KingRainbow44 KingRainbow44 merged commit fdaa487 into Grasscutters:development Mar 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants