mirror of
https://github.com/Xtao-Labs/GCAuth-OAuth.git
synced 2024-11-25 09:37:35 +00:00
✨ Support android
This commit is contained in:
parent
645436a0e4
commit
309b9ceffb
@ -2,9 +2,9 @@ package com.xtaolabs.gcauth_oauth;
|
|||||||
|
|
||||||
import emu.grasscutter.Grasscutter;
|
import emu.grasscutter.Grasscutter;
|
||||||
import emu.grasscutter.plugin.Plugin;
|
import emu.grasscutter.plugin.Plugin;
|
||||||
import emu.grasscutter.server.dispatch.DispatchHttpJsonHandler;
|
|
||||||
import static emu.grasscutter.Configuration.*;
|
import static emu.grasscutter.Configuration.*;
|
||||||
|
|
||||||
|
import com.xtaolabs.gcauth_oauth.handler.JsonHandler;
|
||||||
import com.xtaolabs.gcauth_oauth.handler.VerifyHandler;
|
import com.xtaolabs.gcauth_oauth.handler.VerifyHandler;
|
||||||
import com.xtaolabs.gcauth_oauth.handler.RequestHandler;
|
import com.xtaolabs.gcauth_oauth.handler.RequestHandler;
|
||||||
|
|
||||||
@ -39,12 +39,7 @@ public class GCAuth_OAuth extends Plugin {
|
|||||||
String folder_name = PLUGINS_FOLDER + "/GCAuth/OAuth/";
|
String folder_name = PLUGINS_FOLDER + "/GCAuth/OAuth/";
|
||||||
Express app = Grasscutter.getDispatchServer().getServer();
|
Express app = Grasscutter.getDispatchServer().getServer();
|
||||||
|
|
||||||
app.get("/Api/twitter_login", new DispatchHttpJsonHandler(
|
app.get("/Api/twitter_login", new JsonHandler());
|
||||||
String.format("{\"code\":200,\"data\":{\"auth_url\":\"%s\",\"info\":\"\",\"msg\":\"Success\",\"status\":1}}",
|
|
||||||
"http" + (DISPATCH_ENCRYPTION.useEncryption ? "s" : "") + "://"
|
|
||||||
+ lr(DISPATCH_INFO.accessAddress, DISPATCH_INFO.bindAddress) + ":"
|
|
||||||
+ lr(DISPATCH_INFO.accessPort, DISPATCH_INFO.bindPort) + "/gcauth_oauth/login.html")
|
|
||||||
));
|
|
||||||
|
|
||||||
app.post("/gcauth_oauth/login", new RequestHandler());
|
app.post("/gcauth_oauth/login", new RequestHandler());
|
||||||
|
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.xtaolabs.gcauth_oauth.handler;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import express.http.HttpContextHandler;
|
||||||
|
import express.http.Request;
|
||||||
|
import express.http.Response;
|
||||||
|
|
||||||
|
|
||||||
|
public final class JsonHandler implements HttpContextHandler {
|
||||||
|
@Override
|
||||||
|
public void handle(Request req, Response res) throws IOException {
|
||||||
|
String Login_Html_Url = "https://account.mihoyo.com/gcauth_oauth/login.html";
|
||||||
|
res.set("server", "tsa_m");
|
||||||
|
res.set("Content-Type", "application/json; charset=utf-8");
|
||||||
|
res.set("access-control-allow-credentials", "true");
|
||||||
|
res.set("access-control-allow-origin", "https://account.hoyoverse.com");
|
||||||
|
res.send(String.format("{\"code\":200,\"data\":{\"auth_url\":\"%s\",\"info\":\"\",\"msg\":\"Success\",\"status\":1}}",
|
||||||
|
Login_Html_Url));
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,7 @@ package com.xtaolabs.gcauth_oauth.json;
|
|||||||
public final class VerifyJson {
|
public final class VerifyJson {
|
||||||
public String thirdparty;
|
public String thirdparty;
|
||||||
public String access_token;
|
public String access_token;
|
||||||
|
public String game_key;
|
||||||
public String cb_url;
|
public String cb_url;
|
||||||
public Boolean no_regist;
|
public Boolean no_regist;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user