init
This commit is contained in:
80
html/spoolman.html
Normal file
80
html/spoolman.html
Normal file
@ -0,0 +1,80 @@
|
||||
{{header}}
|
||||
<script>
|
||||
window.onload = function() {
|
||||
if (spoolmanUrl && spoolmanUrl.trim() !== "") {
|
||||
document.getElementById('spoolmanUrl').value = spoolmanUrl;
|
||||
}
|
||||
};
|
||||
|
||||
function checkSpoolmanInstance() {
|
||||
const url = document.getElementById('spoolmanUrl').value;
|
||||
fetch(`/api/checkSpoolman?url=${encodeURIComponent(url)}`)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.healthy) {
|
||||
document.getElementById('statusMessage').innerText = 'Spoolman-Instance is availabe and healthy!';
|
||||
} else {
|
||||
document.getElementById('statusMessage').innerText = 'Spoolman-Instance not available.';
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
document.getElementById('statusMessage').innerText = 'Error while connecting to Spoolman-Instance: ' + error.message;
|
||||
});
|
||||
}
|
||||
|
||||
function saveBambuCredentials() {
|
||||
const ip = document.getElementById('bambuIp').value;
|
||||
const serial = document.getElementById('bambuSerial').value;
|
||||
const code = document.getElementById('bambuCode').value;
|
||||
|
||||
fetch(`/api/bambu?bambu_ip=${encodeURIComponent(ip)}&bambu_serialnr=${encodeURIComponent(serial)}&bambu_accesscode=${encodeURIComponent(code)}`)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.healthy) {
|
||||
document.getElementById('bambuStatusMessage').innerText = 'Bambu Credentials saved!';
|
||||
// Erstelle und zeige den Reboot-Button
|
||||
const rebootBtn = document.createElement('button');
|
||||
rebootBtn.innerText = 'Reboot now';
|
||||
rebootBtn.className = 'reboot-button';
|
||||
rebootBtn.onclick = () => window.location.href = '/reboot';
|
||||
document.getElementById('bambuStatusMessage').appendChild(rebootBtn);
|
||||
} else {
|
||||
document.getElementById('bambuStatusMessage').innerText = 'Error while saving Bambu Credentials.';
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
document.getElementById('bambuStatusMessage').innerText = 'Error while saving: ' + error.message;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
var spoolmanUrl = "{{spoolmanUrl}}";
|
||||
</script>
|
||||
|
||||
<div class="content">
|
||||
<h1>Spoolman API URL / Bambu Credentials</h1>
|
||||
<label for="spoolmanUrl">Set URL/IP to your Spoolman-Instanz:</label>
|
||||
<input type="text" id="spoolmanUrl" placeholder="http://ip-or-url-of-your-spoolman-instanz:port">
|
||||
<button onclick="checkSpoolmanInstance()">Save Spoolman URL</button>
|
||||
<p id="statusMessage"></p>
|
||||
|
||||
<h2>Bambu Lab Printer Credentials</h2>
|
||||
<div class="bambu-settings">
|
||||
<div class="input-group">
|
||||
<label for="bambuIp">Bambu Drucker IP-Adresse:</label>
|
||||
<input type="text" id="bambuIp" placeholder="192.168.1.xxx" value="{{bambuIp}}">
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<label for="bambuSerial">Drucker Seriennummer:</label>
|
||||
<input type="text" id="bambuSerial" placeholder="BBLXXXXXXXX" value="{{bambuSerial}}">
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<label for="bambuCode">Access Code:</label>
|
||||
<input type="text" id="bambuCode" placeholder="Access Code vom Drucker" value="{{bambuCode}}">
|
||||
</div>
|
||||
<button onclick="saveBambuCredentials()">Save Bambu Credentials</button>
|
||||
<p id="bambuStatusMessage"></p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user