Fixed redirect
This commit is contained in:
parent
82c2907606
commit
471d394a49
1 changed files with 9 additions and 2 deletions
|
@ -34,6 +34,7 @@ import sx.blah.discord.util.DiscordException;
|
||||||
import sx.blah.discord.util.EmbedBuilder;
|
import sx.blah.discord.util.EmbedBuilder;
|
||||||
import sx.blah.discord.util.MissingPermissionsException;
|
import sx.blah.discord.util.MissingPermissionsException;
|
||||||
import sx.blah.discord.util.RateLimitException;
|
import sx.blah.discord.util.RateLimitException;
|
||||||
|
import sx.blah.discord.util.RequestBuffer;
|
||||||
|
|
||||||
public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
||||||
private static final String SubredditURL = "https://www.reddit.com/r/ChromaGamers";
|
private static final String SubredditURL = "https://www.reddit.com/r/ChromaGamers";
|
||||||
|
@ -159,15 +160,21 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
||||||
.withSuccessHandler((rc, user) -> {
|
.withSuccessHandler((rc, user) -> {
|
||||||
rc.response().headers().add("Location",
|
rc.response().headers().add("Location",
|
||||||
"https://" + (TBMCCoreAPI.IsTestServer() ? "localhost" : "server.figytuna.com")
|
"https://" + (TBMCCoreAPI.IsTestServer() ? "localhost" : "server.figytuna.com")
|
||||||
+ ":8080/login?type=discord");
|
+ ":8080/login?type=discord&" + rc.request().query());
|
||||||
|
rc.response().setStatusCode(303);
|
||||||
|
rc.response().end("Redirecting");
|
||||||
rc.response().close();
|
rc.response().close();
|
||||||
}).withFailureHandler(rc -> {
|
}).withFailureHandler(rc -> {
|
||||||
rc.response().headers().add("Location",
|
rc.response().headers().add("Location",
|
||||||
"https://" + (TBMCCoreAPI.IsTestServer() ? "localhost" : "server.figytuna.com")
|
"https://" + (TBMCCoreAPI.IsTestServer() ? "localhost" : "server.figytuna.com")
|
||||||
+ ":8080/login?type=discord"); // TODO
|
+ ":8080/login?type=discord&" + rc.request().query());
|
||||||
|
rc.response().setStatusCode(303);
|
||||||
|
rc.response().end("Redirecting");
|
||||||
rc.response().close();
|
rc.response().close();
|
||||||
}).build();
|
}).build();
|
||||||
getLogger().info("Auth URL: " + doa.buildAuthUrl());
|
getLogger().info("Auth URL: " + doa.buildAuthUrl());
|
||||||
|
Void v = RequestBuffer.request(System.out::println).get(); // TODO: Remove
|
||||||
|
System.out.println(v);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
TBMCCoreAPI.SendException("An error occured while enabling DiscordPlugin!", e);
|
TBMCCoreAPI.SendException("An error occured while enabling DiscordPlugin!", e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue