Add /client-code endpoint

This commit is contained in:
Melledy committed 2025-12-03 22:34:29 -08:00
1 parent 357d12779b
commit 9c87d74ad7
2 files changed
+18 -8

No files matched your search

@@ -141,6 +141,9 @@ public class HttpServer {
if (this.getType().runGame()) { if (this.getType().runGame()) {
this.addGameServerRoutes(); this.addGameServerRoutes();
} }
// Custom api route(s)
getApp().post("/api/command", new RemoteHandler());
// Exception handler // Exception handler
getApp().exception(Exception.class, (e, c) -> { getApp().exception(Exception.class, (e, c) -> {
@@ -154,8 +157,8 @@ public class HttpServer {
private void addLoginServerRoutes() { private void addLoginServerRoutes() {
// https://en-sdk-api.yostarplat.com/ // https://en-sdk-api.yostarplat.com/
getApp().post("/common/config", new CommonConfigHandler(this)); getApp().post("/common/config", new CommonConfigHandler(this));
getApp().post("/common/version", new HttpJsonResponse( getApp().post("/common/client-code", new CommonClientCodeHandler());
"{\"Code\":200,\"Data\":{\"Agreement\":[{\"Version\":\"0.1\",\"Type\":\"user_agreement\",\"Title\":\"用户协议\",\"Content\":\"\",\"Lang\":\"en\"},{\"Version\":\"0.1\",\"Type\":\"privacy_agreement\",\"Title\":\"隐私政策\",\"Content\":\"\",\"Lang\":\"en\"}],\"ErrorCode\":\"4.4\"},\"Msg\":\"OK\"}")); getApp().post("/common/version", new HttpJsonResponse("{\"Code\":200,\"Data\":{\"Agreement\":[{\"Version\":\"0.1\",\"Type\":\"user_agreement\",\"Title\":\"用户协议\",\"Content\":\"\",\"Lang\":\"en\"},{\"Version\":\"0.1\",\"Type\":\"privacy_agreement\",\"Title\":\"隐私政策\",\"Content\":\"\",\"Lang\":\"en\"}],\"ErrorCode\":\"4.4\"},\"Msg\":\"OK\"}"));
getApp().post("/user/detail", new UserLoginHandler()); getApp().post("/user/detail", new UserLoginHandler());
getApp().post("/user/set", new UserSetDataHandler()); getApp().post("/user/set", new UserSetDataHandler());
@@ -163,16 +166,11 @@ public class HttpServer {
getApp().post("/user/quick-login", new UserLoginHandler()); getApp().post("/user/quick-login", new UserLoginHandler());
getApp().post("/yostar/get-auth", new GetAuthHandler()); getApp().post("/yostar/get-auth", new GetAuthHandler());
getApp().post("/yostar/send-code", new HttpJsonResponse("{\"Code\":200,\"Data\":{},\"Msg\":\"OK\"}")); // Dummy getApp().post("/yostar/send-code", new HttpJsonResponse("{\"Code\":200,\"Data\":{},\"Msg\":\"OK\"}")); // Dummy handler
// handler
// https://nova-static.stellasora.global/ // https://nova-static.stellasora.global/
getApp().get("/meta/serverlist.html", new MetaServerlistHandler(this)); getApp().get("/meta/serverlist.html", new MetaServerlistHandler(this));
getApp().get("/meta/win.html", new MetaWinHandler(this)); getApp().get("/meta/win.html", new MetaWinHandler(this));
getApp().post("/api/command", new RemoteHandler());
} }
private void addGameServerRoutes() { private void addGameServerRoutes() {
@@ -0,0 +1,12 @@
package emu.nebula.server.routes;
import lombok.Getter;
@Getter
public class CommonClientCodeHandler extends HttpJsonResponse {
public CommonClientCodeHandler() {
super("{\"Code\":200,\"Data\":{\"CodeList\":[{\"Code\":100150,\"Value\":\"Incorrect UID or Transfer Code\",\"Type\":\"toast\"},{\"Code\":100100,\"Value\":\"The device has been restricted.\",\"Type\":\"pop\"},{\"Code\":100131,\"Value\":\"The account has been in the cooling-off period for account deletion now.\",\"Type\":\"pop\"},{\"Code\":100130,\"Value\":\"The account has been banned.\",\"Type\":\"pop\"},{\"Code\":100140,\"Value\":\"Login failed, please try again.\",\"Type\":\"toast\"},{\"Code\":100141,\"Value\":\"The Yostar account is currently in the cooling-off period for account deletion.\",\"Type\":\"none\"},{\"Code\":0,\"Value\":\"Succeed.\",\"Type\":\"toast\"},{\"Code\":100120,\"Value\":\"Login failed. Please check your network and try again.\",\"Type\":\"pop\"},{\"Code\":100160,\"Value\":\"You have set your birth date and it can't be changed.\",\"Type\":\"toast\"},{\"Code\":100161,\"Value\":\"The birth date can't be later than today.\",\"Type\":\"toast\"},{\"Code\":100133,\"Value\":\"Login or payment are not allowed because you do not meet the minimum age requirement.\",\"Type\":\"pop\"},{\"Code\":100132,\"Value\":\"Login canceled.\",\"Type\":\"toast\"},{\"Code\":-1,\"Value\":\"Unknown Error.\",\"Type\":\"pop\"},{\"Code\":100110,\"Value\":\"Login failed, please try again.\",\"Type\":\"toast\"},{\"Code\":200519,\"Value\":\"An error occurred in Samsung Pay.\",\"Type\":\"pop\"},{\"Code\":200320,\"Value\":\"An error occurred in Google Pay.\",\"Type\":\"pop\"},{\"Code\":200602,\"Value\":\"An error occurred in ONE store payment.\",\"Type\":\"pop\"},{\"Code\":100226,\"Value\":\"Logging in, please wait.\",\"Type\":\"toast\"},{\"Code\":500301,\"Value\":\"Item ID of the game has existed.\",\"Type\":\"pop\"},{\"Code\":100180,\"Value\":\"No bindings found. Unable to unbind.\",\"Type\":\"toast\"},{\"Code\":100813,\"Value\":\"PGS Parameter configuration Error\",\"Type\":\"toast\"},{\"Code\":500401,\"Value\":\"Field format is incorrect.\",\"Type\":\"pop\"},{\"Code\":200617,\"Value\":\"An error occurred in ONE store payment.\",\"Type\":\"pop\"},{\"Code\":600310,\"Value\":\"A maximum of 500 allowlist accounts per application.\",\"Type\":\"pop\"},{\"Code\":100162,\"Value\":\"Account deleted. Transfer code login is unavailable.\",\"Type\":\"none\"},{\"Code\":100225,\"Value\":\"Login authorization canceled.\",\"Type\":\"toast\"},{\"Code\":400214,\"Value\":\"This account does not exist.\",\"Type\":\"pop\"},{\"Code\":100235,\"Value\":\"Account deletion is not available.\",\"Type\":\"pop\"},{\"Code\":200509,\"Value\":\"An error occurred in Samsung Pay.\",\"Type\":\"pop\"},{\"Code\":200150,\"Value\":\"Could not verify this purchase.\",\"Type\":\"pop\"},{\"Code\":200224,\"Value\":\"0\",\"Type\":\"pop\"},{\"Code\":400139,\"Value\":\"Data verification has expired. Please try again.\",\"Type\":\"toast\"},{\"Code\":902404,\"Value\":\"This error code does not exist.\",\"Type\":\"pop\"},{\"Code\":400300,\"Value\":\"This account has completed its migration and cannot be migrated again\",\"Type\":\"pop\"},{\"Code\":200253,\"Value\":\"0\",\"Type\":\"pop\"},{\"Code\":200161,\"Value\":\"Order refund failed.\",\"Type\":\"pop\"},{\"Code\":200209,\"Value\":\"0\",\"Type\":\"pop\"},{\"Code\":200181,\"Value\":\"Pending offline payment.\",\"Type\":\"toast\"},{\"Code\":200180,\"Value\":\"Payment succeeded. Now packing.\",\"Type\":\"toast\"},{\"Code\":200615,\"Value\":\"An error occurred in ONE store payment.\",\"Type\":\"pop\"},{\"Code\":400218,\"Value\":\"Binding failed. The Yostar account hasn't been bound to a third-party account.\",\"Type\":\"pop\"},{\"Code\":200218,\"Value\":\"0\",\"Type\":\"pop\"},{\"Code\":100240,\"Value\":\"Apple authorization failed.\",\"Type\":\"toast\"},{\"Code\":200236,\"Value\":\"0\",\"Type\":\"pop\"},{\"Code\":100814,\"Value\":\"PGS Parameter configuration Error\",\"Type\":\"toast\"},{\"Code\":200244,\"Value\":\"0\",\"Type\":\"pop\"},{\"Code\":200350,\"Value\":\"Order creation failed.\",\"Type\":\"pop\"},{\"Code\":200604,\"Value\":\"An error occurred in ONE store payment.\",\"Type\":\"pop\"},{\"Code\":200229,\"Value\":\"0\",\"Type\":\"pop\"},{\"Code\":300100,\"Value\":\"Failed to share.\",\"Type\":\"toast\"},{\"Code\":200610,\"Value\":\"Please upgrade ONE store payment and try again.\",\"Type\":\"pop\"},{\"Code\":200247,\"Value\":\"0\",\"Type\":\"pop\"},{\"Code\":200141,\"Value\":\"Order creation failed: Purchase currency is not supported\",\"Type\":\"pop\"},{\"Code\":300204,\"Value\":\"Client version outdated.\",\"Type\":\"pop\"},{\"Code\":200618,\"Value\":\"An error occurred in ONE store payment.\",\"Type\":\"pop\"},{\"Code\":200130,\"Value\":\"Order creation failed.\",\"Type\":\"pop\"},{\"Code\":200340,\"Value\":\"Payment canceled.\",\"Type\":\"toast\"},{\"Code\":200240,\"Value\":\"An error occurred in Google Pay.\",\"Type\":\"pop\"},{\"Code\":300203,\"Value\":\"Channel does not exist.\",\"Type\":\"pop\"},{\"Code\":100232,\"Value\":\"The account is not deleted. Unable to recover.\",\"Type\":\"pop\"},Line truncated
}
}