125 lines
		
	
	
		
			5.1 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			125 lines
		
	
	
		
			5.1 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <!-- head --><!DOCTYPE html>
 | |
| <html lang="en">
 | |
| <head>
 | |
|     <meta charset="UTF-8">
 | |
|     <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | |
|     <title>FilaMan - Filament Management Tool</title>
 | |
|     <link rel="icon" type="image/png" href="/favicon.ico">
 | |
|     <link rel="stylesheet" href="style.css">
 | |
|     <script>
 | |
|         fetch('/api/version')
 | |
|             .then(response => response.json())
 | |
|             .then(data => {
 | |
|                 const versionSpan = document.querySelector('.version');
 | |
|                 if (versionSpan) {
 | |
|                     versionSpan.textContent = 'v' + data.version;
 | |
|                 }
 | |
|             })
 | |
|             .catch(error => console.error('Error fetching version:', error));
 | |
|     </script>
 | |
| </head>
 | |
| <body>
 | |
|     <div class="navbar">
 | |
|         <div style="display: flex; align-items: center; gap: 2rem;">
 | |
|             <img src="/logo.png" alt="FilaMan Logo" class="logo">
 | |
|             <div class="logo-text">
 | |
|                 <h1>FilaMan<span class="version"></span></h1>
 | |
|                 <h4>Filament Management Tool</h4>
 | |
|             </div>
 | |
|         </div>
 | |
|         <nav style="display: flex; gap: 1rem;">
 | |
|             <a href="/">Start</a>
 | |
|             <a href="/waage">Scale</a>
 | |
|             <a href="/spoolman">Spoolman/Bambu</a>
 | |
|             <a href="/about">About</a>
 | |
|             <a href="/upgrade">Upgrade</a>
 | |
|         </nav>
 | |
|         <div class="status-container">
 | |
|             <div class="status-item">
 | |
|                 <span class="status-dot" id="bambuDot"></span>B
 | |
|             </div>
 | |
|             <div class="status-item">
 | |
|                 <span class="status-dot" id="spoolmanDot"></span>S
 | |
|             </div>
 | |
|             <div class="ram-status" id="ramStatus"></div>
 | |
|         </div>
 | |
|     </div>
 | |
| </body>
 | |
| </html>
 | |
| 
 | |
| <!-- head -->
 | |
| 
 | |
|     <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!';
 | |
|                     } 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>
 |