diff --git a/src/hub/main/java/org/comroid/mcsd/hub/controller/ApiController.java b/src/hub/main/java/org/comroid/mcsd/hub/controller/ApiController.java
index ff24577f..341d4fa9 100644
--- a/src/hub/main/java/org/comroid/mcsd/hub/controller/ApiController.java
+++ b/src/hub/main/java/org/comroid/mcsd/hub/controller/ApiController.java
@@ -215,7 +215,7 @@ public void playerEvent(
}
@ResponseBody
- @GetMapping("/module/state/{id}")
+ @GetMapping("/webapp/module/state/{id}")
public boolean moduleState(
@Autowired HttpSession session,
@PathVariable UUID id,
@@ -225,7 +225,7 @@ public boolean moduleState(
@Nullable @RequestParam(value = "fullReload", required = false) Boolean fullReload
) {
// check request validity; set and toggle must not both be present
- new Constraint.API(() -> set != null && toggle != null)
+ new Constraint.API(() -> !(set != null && toggle != null))
.setConstraint("request validity")
.setNameof("set and toggle param")
.setShouldBe("not both present")
diff --git a/src/hub/main/java/org/comroid/mcsd/hub/controller/GenericController.java b/src/hub/main/java/org/comroid/mcsd/hub/controller/GenericController.java
index 9cd3e65e..fc6018ff 100644
--- a/src/hub/main/java/org/comroid/mcsd/hub/controller/GenericController.java
+++ b/src/hub/main/java/org/comroid/mcsd/hub/controller/GenericController.java
@@ -131,6 +131,8 @@ public String entityEdit(HttpSession session, Model model,
.or(authorizationLinkRepo.validate(user, id, code, AbstractEntity.Permission.Modify).cast())
.orElseThrow(() -> new InsufficientPermissionsException(user, id, AbstractEntity.Permission.Modify));
var target = core.findEntity(type, id);
+ if (target instanceof Server)
+ model.addAttribute("modules", Streams.of(mcsd.getModules().findAllByServerId(target.getId())).toList());
model.addAttribute("user", user)
.addAttribute("edit", true)
.addAttribute("editKey", null)
diff --git a/src/hub/main/resources/static/common.js b/src/hub/main/resources/static/common.js
new file mode 100644
index 00000000..dcc9bdc0
--- /dev/null
+++ b/src/hub/main/resources/static/common.js
@@ -0,0 +1,4 @@
+function confirmAction(what, warn, action) {
+ if (window.confirm("Are you sure you want to "+what+"? "+warn+"!"))
+ action();
+}
diff --git a/src/hub/main/resources/static/modules.js b/src/hub/main/resources/static/modules.js
new file mode 100644
index 00000000..06beb270
--- /dev/null
+++ b/src/hub/main/resources/static/modules.js
@@ -0,0 +1,23 @@
+function load() {
+ document.querySelectorAll('.state-switch').forEach(checkbox => checkbox.addEventListener('click', switchModuleState))
+}
+
+function unload() {
+}
+
+function addModule() {
+}
+
+function switchModuleState(event) {
+ var id = event.target.id.substring('state_'.length);
+ fetch('/api/webapp/module/state/'+id+'?toggle=true')
+ .then(rsp => rsp.json())
+ .then(state => document.querySelector('#state_'+id).checked = state)
+ .catch(console.error);
+}
+
+function reload(full) {
+ let id = document.querySelector('[name=id]').value;
+ fetch('/api/webapp/module/state/'+id+'?fullReload='+full)
+ .catch(console.error);
+}
diff --git a/src/hub/main/resources/templates/dashboard.html b/src/hub/main/resources/templates/dashboard.html
index a8c07c1e..d3ad6c13 100644
--- a/src/hub/main/resources/templates/dashboard.html
+++ b/src/hub/main/resources/templates/dashboard.html
@@ -29,8 +29,10 @@
Servers
Host |
: |
Port |
- Edit
- Delete |
+
+ Edit
+ Delete
+ |
diff --git a/src/hub/main/resources/templates/server/view.html b/src/hub/main/resources/templates/server/view.html
index 801546e8..6a8b443d 100644
--- a/src/hub/main/resources/templates/server/view.html
+++ b/src/hub/main/resources/templates/server/view.html
@@ -2,7 +2,9 @@
-
+
+
+
@@ -85,59 +87,30 @@
Advanced configuration
th:value="${target.queryPort}"
type="number">
-
- Rcon Port |
- |
-
-
- Rcon Password |
- |
-
-
Discord Integration
-
Not configured
-