mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-06 15:44:49 +08:00
Added support for the new web files
This commit is contained in:
parent
86e48f6377
commit
783083fbb3
@ -134,9 +134,13 @@ public class ResponseHandler extends TreePageHandler {
|
||||
if (target.endsWith(".js")) {
|
||||
return ResponseCache.loadResponse(PageId.JS.of(resource), () -> responseFactory.javaScriptResponse(resource));
|
||||
}
|
||||
if (target.endsWith(".png")) {
|
||||
return responseFactory.imageResponse(resource);
|
||||
}
|
||||
if (target.endsWith("favicon.ico")) {
|
||||
return ResponseCache.loadResponse(PageId.FAVICON.id(), responseFactory::faviconResponse);
|
||||
}
|
||||
|
||||
boolean isNotInfoRequest = target.isEmpty() || !target.get(0).equals("info");
|
||||
boolean isAuthRequired = webServer.get().isAuthRequired() && isNotInfoRequest;
|
||||
if (isAuthRequired && !authentication.isPresent()) {
|
||||
|
@ -40,7 +40,7 @@ public class FileResponse extends Response {
|
||||
int i;
|
||||
for (i = 0; i < split.length; i++) {
|
||||
String s = split[i];
|
||||
if (Verify.equalsOne(s, "css", "js", "plugins", "scss")) {
|
||||
if (Verify.equalsOne(s, "css", "js", "vendor", "img")) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -128,6 +128,10 @@ public class ResponseFactory {
|
||||
}
|
||||
}
|
||||
|
||||
public Response imageResponse(String fileName) {
|
||||
return new ByteResponse(ResponseType.IMAGE, FileResponse.format(fileName), files);
|
||||
}
|
||||
|
||||
public Response redirectResponse(String location) {
|
||||
return new RedirectResponse(location);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user