Change the way HTML is served after authentication

This commit is contained in:
KingRainbow44 2023-05-30 14:29:55 -04:00
parent a3bbfd4c5d
commit 2009a90e66
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE
2 changed files with 4 additions and 3 deletions

View File

@ -11,6 +11,7 @@ public interface HandbookAuthenticator {
class Response {
private final int status;
private final String body;
@Builder.Default private boolean html = false;
}
/**

View File

@ -1,7 +1,5 @@
package emu.grasscutter.server.http.documentation;
import static emu.grasscutter.config.Configuration.HANDBOOK;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.auth.AuthenticationSystem.AuthenticationRequest;
import emu.grasscutter.server.http.Router;
@ -13,6 +11,8 @@ import io.javalin.Javalin;
import io.javalin.http.ContentType;
import io.javalin.http.Context;
import static emu.grasscutter.config.Configuration.HANDBOOK;
/** Handles requests for the new GM Handbook. */
public final class HandbookHandler implements Router {
private final byte[] handbook;
@ -103,7 +103,7 @@ public final class HandbookHandler implements Router {
ctx.status(result.getStatus())
.result(result.getBody())
.contentType(
result.getBody().contains("html") ? ContentType.TEXT_HTML : ContentType.TEXT_PLAIN);
result.isHtml() ? ContentType.TEXT_HTML : ContentType.TEXT_PLAIN);
}
}
}