diff --git a/html/spoolman.html b/html/spoolman.html
index 9b2bcca..365237a 100644
--- a/html/spoolman.html
+++ b/html/spoolman.html
@@ -52,11 +52,18 @@
if (spoolmanUrl && spoolmanUrl.trim() !== "") {
document.getElementById('spoolmanUrl').value = spoolmanUrl;
}
+
+ // Initialize OctoPrint fields visibility
+ toggleOctoFields();
};
function checkSpoolmanInstance() {
const url = document.getElementById('spoolmanUrl').value;
- fetch(`/api/checkSpoolman?url=${encodeURIComponent(url)}`)
+ const spoolmanOctoEnabled = document.getElementById('spoolmanOctoEnabled').checked;
+ const spoolmanOctoUrl = document.getElementById('spoolmanOctoUrl').value;
+ const spoolmanOctoToken = document.getElementById('spoolmanOctoToken').value;
+
+ fetch(`/api/checkSpoolman?url=${encodeURIComponent(url)}&octoEnabled=${spoolmanOctoEnabled}&octoUrl=${spoolmanOctoUrl}&octoToken=${spoolmanOctoToken}`)
.then(response => response.json())
.then(data => {
if (data.healthy) {
@@ -90,6 +97,15 @@
document.getElementById('bambuStatusMessage').innerText = 'Error while saving: ' + error.message;
});
}
+
+ /**
+ * Controls visibility of OctoPrint configuration fields based on checkbox state
+ * Called on page load and when checkbox changes
+ */
+ function toggleOctoFields() {
+ const octoEnabled = document.getElementById('spoolmanOctoEnabled').checked;
+ document.getElementById('octoFields').style.display = octoEnabled ? 'block' : 'none';
+ }