From 66e3f61203744df5b415dbf1be3299245d2a05c0 Mon Sep 17 00:00:00 2001
From: Rsl1122
Date: Wed, 7 Feb 2018 14:36:12 +0200
Subject: [PATCH] Fixed 401 response to all css and js queries. Added reason to
"cancel"
---
.../databases/sql/operation/SQLFetchOps.java | 9 +++++++++
.../plan/system/webserver/ResponseHandler.java | 13 +++++++------
.../response/PromptAuthorizationResponse.java | 2 +-
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/operation/SQLFetchOps.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/operation/SQLFetchOps.java
index 68212d002..3526307cd 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/operation/SQLFetchOps.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/operation/SQLFetchOps.java
@@ -407,4 +407,13 @@ public class SQLFetchOps extends SQLOps implements FetchOperations {
Collections.sort(servers);
return servers;
}
+
+ @Override
+ public List getServerUUIDs() throws DBException {
+ try {
+ return serverTable.getServerUUIDs();
+ } catch (SQLException e) {
+ throw SQLErrorUtil.getExceptionFor(e);
+ }
+ }
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/ResponseHandler.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/ResponseHandler.java
index 61adeaa53..2f5c178d7 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/ResponseHandler.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/ResponseHandler.java
@@ -87,6 +87,13 @@ public class ResponseHandler extends TreePageHandler {
private Response getResponse(Request request, String targetString, List target) throws WebException {
Optional authentication = Optional.empty();
+
+ if (targetString.endsWith(".css")) {
+ return ResponseCache.loadResponse(PageId.CSS.of(targetString), () -> new CSSResponse(targetString));
+ }
+ if (targetString.endsWith(".js")) {
+ return ResponseCache.loadResponse(PageId.JS.of(targetString), () -> new JavaScriptResponse(targetString));
+ }
if (webServer.isAuthRequired()) {
authentication = request.getAuth();
if (!authentication.isPresent()) {
@@ -97,12 +104,6 @@ public class ResponseHandler extends TreePageHandler {
}
}
}
- if (targetString.endsWith(".css")) {
- return ResponseCache.loadResponse(PageId.CSS.of(targetString), () -> new CSSResponse(targetString));
- }
- if (targetString.endsWith(".js")) {
- return ResponseCache.loadResponse(PageId.JS.of(targetString), () -> new JavaScriptResponse(targetString));
- }
PageHandler pageHandler = getPageHandler(target);
if (pageHandler == null) {
return DefaultResponses.NOT_FOUND.get();
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/PromptAuthorizationResponse.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/PromptAuthorizationResponse.java
index dbd93bfee..a5cc4f0c6 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/PromptAuthorizationResponse.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/PromptAuthorizationResponse.java
@@ -49,7 +49,7 @@ public class PromptAuthorizationResponse extends ErrorResponse {
reason += errorBuilder.toString();
}
- response.setParagraph("Authentication Failed.
Reason: " + reason + TIPS);
+ response.setParagraph("Authentication Failed.
Reason: " + reason + "
" + TIPS);
response.replacePlaceholders();
return response;
}