mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-18 01:46:44 +01:00
Change the way HTML is served after authentication
This commit is contained in:
@@ -11,6 +11,7 @@ public interface HandbookAuthenticator {
|
|||||||
class Response {
|
class Response {
|
||||||
private final int status;
|
private final int status;
|
||||||
private final String body;
|
private final String body;
|
||||||
|
@Builder.Default private boolean html = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package emu.grasscutter.server.http.documentation;
|
package emu.grasscutter.server.http.documentation;
|
||||||
|
|
||||||
import static emu.grasscutter.config.Configuration.HANDBOOK;
|
|
||||||
|
|
||||||
import emu.grasscutter.Grasscutter;
|
import emu.grasscutter.Grasscutter;
|
||||||
import emu.grasscutter.auth.AuthenticationSystem.AuthenticationRequest;
|
import emu.grasscutter.auth.AuthenticationSystem.AuthenticationRequest;
|
||||||
import emu.grasscutter.server.http.Router;
|
import emu.grasscutter.server.http.Router;
|
||||||
@@ -13,6 +11,8 @@ import io.javalin.Javalin;
|
|||||||
import io.javalin.http.ContentType;
|
import io.javalin.http.ContentType;
|
||||||
import io.javalin.http.Context;
|
import io.javalin.http.Context;
|
||||||
|
|
||||||
|
import static emu.grasscutter.config.Configuration.HANDBOOK;
|
||||||
|
|
||||||
/** Handles requests for the new GM Handbook. */
|
/** Handles requests for the new GM Handbook. */
|
||||||
public final class HandbookHandler implements Router {
|
public final class HandbookHandler implements Router {
|
||||||
private final byte[] handbook;
|
private final byte[] handbook;
|
||||||
@@ -103,7 +103,7 @@ public final class HandbookHandler implements Router {
|
|||||||
ctx.status(result.getStatus())
|
ctx.status(result.getStatus())
|
||||||
.result(result.getBody())
|
.result(result.getBody())
|
||||||
.contentType(
|
.contentType(
|
||||||
result.getBody().contains("html") ? ContentType.TEXT_HTML : ContentType.TEXT_PLAIN);
|
result.isHtml() ? ContentType.TEXT_HTML : ContentType.TEXT_PLAIN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user