mirror of
https://github.com/Xtao-Labs/GCAuth-OAuth.git
synced 2024-11-29 02:57:19 +00:00
🐛 Fix Url error
This commit is contained in:
parent
7cbbd770a5
commit
c0ede83066
@ -38,12 +38,15 @@ public class GCAuth_OAuth extends Plugin {
|
|||||||
|
|
||||||
public void loadTwitterLogin() {
|
public void loadTwitterLogin() {
|
||||||
String folder_name = PLUGINS_FOLDER + "/GCAuth/OAuth/";
|
String folder_name = PLUGINS_FOLDER + "/GCAuth/OAuth/";
|
||||||
|
String Login_Url = ("http" + (DISPATCH_ENCRYPTION.useEncryption ? "s" : "") + "://"
|
||||||
|
+ lr(DISPATCH_INFO.accessAddress, DISPATCH_INFO.bindAddress) + ":"
|
||||||
|
+ lr(DISPATCH_INFO.accessPort, DISPATCH_INFO.bindPort) + "/gcauth_oauth/login.html");
|
||||||
Express app = Grasscutter.getDispatchServer().getServer();
|
Express app = Grasscutter.getDispatchServer().getServer();
|
||||||
|
|
||||||
app.get("/Api/twitter_login", new JsonHandler());
|
app.get("/Api/twitter_login", new JsonHandler());
|
||||||
|
|
||||||
app.get("/sdkTwitterLogin.html", new DispatchHttpJsonHandler(
|
app.get("/sdkTwitterLogin.html", new DispatchHttpJsonHandler(
|
||||||
"<meta http-equiv=\"refresh\" content=\"0;url=https://account.mihoyo.com/gcauth_oauth/login.html\">"
|
String.format("<meta http-equiv=\"refresh\" content=\"0;url=%s\">", Login_Url)
|
||||||
));
|
));
|
||||||
|
|
||||||
app.post("/gcauth_oauth/login", new RequestHandler());
|
app.post("/gcauth_oauth/login", new RequestHandler());
|
||||||
|
@ -6,16 +6,21 @@ import express.http.HttpContextHandler;
|
|||||||
import express.http.Request;
|
import express.http.Request;
|
||||||
import express.http.Response;
|
import express.http.Response;
|
||||||
|
|
||||||
|
import static emu.grasscutter.Configuration.*;
|
||||||
|
import static emu.grasscutter.Configuration.DISPATCH_INFO;
|
||||||
|
|
||||||
|
|
||||||
public final class JsonHandler implements HttpContextHandler {
|
public final class JsonHandler implements HttpContextHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handle(Request req, Response res) throws IOException {
|
public void handle(Request req, Response res) throws IOException {
|
||||||
String Login_Html_Url = "https://account.mihoyo.com/gcauth_oauth/login.html";
|
String Login_Url = ("http" + (DISPATCH_ENCRYPTION.useEncryption ? "s" : "") + "://"
|
||||||
|
+ lr(DISPATCH_INFO.accessAddress, DISPATCH_INFO.bindAddress) + ":"
|
||||||
|
+ lr(DISPATCH_INFO.accessPort, DISPATCH_INFO.bindPort) + "/gcauth_oauth/login.html");
|
||||||
res.set("server", "tsa_m");
|
res.set("server", "tsa_m");
|
||||||
res.set("Content-Type", "application/json; charset=utf-8");
|
res.set("Content-Type", "application/json; charset=utf-8");
|
||||||
res.set("access-control-allow-credentials", "true");
|
res.set("access-control-allow-credentials", "true");
|
||||||
res.set("access-control-allow-origin", "https://account.hoyoverse.com");
|
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}}",
|
res.send(String.format("{\"code\":200,\"data\":{\"auth_url\":\"%s\",\"info\":\"\",\"msg\":\"Success\",\"status\":1}}",
|
||||||
Login_Html_Url));
|
Login_Url));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user