Skip to content

Commit

Permalink
Revert error page changes, fix DatabaseRecreation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
theotherp committed Dec 1, 2024
1 parent 1bcb516 commit 3c40107
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
import org.flywaydb.core.Flyway;
import org.nzbhydra.NzbHydra;
import org.nzbhydra.springnative.ReflectionMarker;
import org.nzbhydra.webaccess.HydraOkHttp3ClientHttpRequestFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.client.ClientHttpRequest;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.http.client.SimpleClientHttpRequestFactory;

import java.io.File;
import java.io.FileReader;
Expand Down Expand Up @@ -198,7 +198,8 @@ private static void runH2Command(List<String> updatePassCommand, String errorMes
}

private static File downloadJarFile(String url) throws IOException {
final ClientHttpRequest request = new HydraOkHttp3ClientHttpRequestFactory().createRequest(URI.create(url), HttpMethod.GET);
//Can't use Hydra request factory as no config was loaded
final ClientHttpRequest request = new SimpleClientHttpRequestFactory().createRequest(URI.create(url), HttpMethod.GET);
final File jarFile;
try (ClientHttpResponse response = request.execute()) {
jarFile = Files.createTempFile("nzbhydra", ".jar").toFile();
Expand Down
30 changes: 23 additions & 7 deletions core/src/main/resources/templates/error.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,49 @@

<br>Some details:
<table>
<tr th:if="${#vars.containsVariable('jakarta.servlet.forward.servlet_path')}">
<tr>
<td>Path</td>
<td th:text="${#vars.getVariable('jakarta.servlet.forward.servlet_path')}"></td>
</tr>
<tr th:if="${#vars.containsVariable('jakarta.servlet.forward.query_string')}">
<tr>
<td>Query parameters</td>
<td th:text="${#vars.getVariable('jakarta.servlet.forward.query_string')}"></td>
</tr>
<tr th:if="${#vars.containsVariable('status')}">
<tr>
<td>Status</td>
<td th:text="${#vars.getVariable('status')}"></td>
</tr>
<tr th:if="${#vars.containsVariable('timestamp')}">
<tr>
<td>Timestamp</td>
<td th:text="${#vars.getVariable('timestamp')}"></td>
</tr>
<tr th:if="${#vars.containsVariable('error')}">
<tr>
<td>Error</td>
<td th:text="${#vars.getVariable('error')}"></td>
</tr>
<tr th:if="${#vars.containsVariable('exception')}">
<tr>
<td>Exception</td>
<td th:text="${#vars.getVariable('exception')}"></td>
</tr>
</table>


<!--Print available variables-->
<!--
Session
<table>
<tr th:each="var : ${session}">
<td th:text="${var.key}"></td>
<td th:text="${var.value}"></td>
</tr>
</table>
Vars
<table>
<tr th:each="var : ${#vars.getVariableNames()}">
<td th:text="${var}"></td>
<td th:text="${#vars.getVariable(var)}"></td>
</tr>
</table>
-->
</body>
</html>

0 comments on commit 3c40107

Please sign in to comment.