Skip to content

Commit

Permalink
5.3.9 didn't start properly. Sorry...
Browse files Browse the repository at this point in the history
Closes #926

Closes #927
  • Loading branch information
theotherp committed Mar 18, 2024
1 parent 4787bcc commit 1468363
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
14 changes: 8 additions & 6 deletions core/src/main/java/org/nzbhydra/DevEndpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import java.util.List;

@SuppressWarnings("unchecked")
@Secured({"ROLE_ADMIN"})
@RestController
public class DevEndpoint {

Expand All @@ -54,37 +53,39 @@ public class DevEndpoint {
private ConfigProvider configProvider;
@Autowired
private ApplicationEventPublisher applicationEventPublisher;
@Value("${nzbhydra.devMode}")
@Value("${nzbhydra.devMode:false}")
private boolean devMode;

private static final Logger logger = LoggerFactory.getLogger(DevEndpoint.class);


@Secured({"ROLE_ADMIN"})
@RequestMapping(value = "/dev/countDanglingIndexersearches", method = RequestMethod.GET)
public BigInteger countDanglingIndexersearches() throws Exception {
final List<BigInteger> resultList = entityManager.createNativeQuery("select count(*) from SEARCHRESULT x where x.INDEXERSEARCHENTITY not in (select y.id from INDEXERSEARCH y)").getResultList();
return resultList.get(0);
}


@Secured({"ROLE_ADMIN"})
@RequestMapping(value = "/dev/throwException", method = RequestMethod.GET)
public BigInteger throwException() throws Exception {
throw new RuntimeException("test");
}


@Secured({"ROLE_ADMIN"})
@RequestMapping(value = "/dev/throwAccessDeniedException", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public BigInteger throwAccessDeniedException() throws Exception {
throw new AccessDeniedException("test");
}


@Secured({"ROLE_ADMIN"})
@Transactional
@RequestMapping(value = "/dev/deleteDanglingIndexersearches", method = RequestMethod.GET)
public String deleteDanglingIndexersearches() throws Exception {
return "Deleted " + entityManager.createNativeQuery("delete from SEARCHRESULT where INDEXERSEARCHENTITY not in (select y.id from INDEXERSEARCH y)").executeUpdate() + " entries";
}

@Secured({"ROLE_ADMIN"})
@RequestMapping(value = "/dev/testAddToSonarr", method = RequestMethod.GET)
public String testAddToSonarr() throws Exception {
if (!devMode) {
Expand All @@ -102,7 +103,7 @@ public String testAddToSonarr() throws Exception {
return "OK";
}


@Secured({"ROLE_ADMIN"})
@RequestMapping(value = "/dev/sendIndexerDisabledNotification", method = RequestMethod.GET)
public void sendIndexerDisabledNotification() {
applicationEventPublisher.publishEvent(new IndexerDisabledNotificationEvent(configProvider.getBaseConfig().getIndexers().get(0).getName(), IndexerConfig.State.DISABLED_SYSTEM_TEMPORARY, "Some message generated by hydra"));
Expand All @@ -115,6 +116,7 @@ public void sendIndexerDisabledNotification() {
applicationEventPublisher.publishEvent(new IndexerDisabledNotificationEvent(configProvider.getBaseConfig().getIndexers().get(0).getName(), IndexerConfig.State.DISABLED_SYSTEM_TEMPORARY, "Some message generated by hydra8"));
}

@Secured({"ROLE_ADMIN"})
@RequestMapping(value = "/dev/crash", method = RequestMethod.GET)
public void crashHard() throws Exception {
if (!devMode) {
Expand Down
6 changes: 6 additions & 0 deletions core/src/main/resources/changelog.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#@formatter:off
- version: "v5.3.10"
date: "2024-03-18"
changes:
- type: "fix"
text: "5.3.9 didn't start properly. Sorry..."
final: true
- version: "v5.3.9"
date: "2024-03-18"
changes:
Expand Down

0 comments on commit 1468363

Please sign in to comment.