Spaces:
Paused
Paused
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>WebSSH</title> | |
| <link href="static/img/favicon.png" rel="icon" type="image/png"> | |
| <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" rel="stylesheet"> | |
| <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet"> | |
| <style> | |
| body { | |
| background-color: #f8f9fa; | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| height: 100vh; | |
| } | |
| .container { | |
| background-color: #ffffff; | |
| padding: 30px; | |
| border-radius: 10px; | |
| box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); | |
| } | |
| .error-popup { | |
| display: none; | |
| color: #721c24; | |
| background-color: #f8d7da; | |
| border-color: #f5c6cb; | |
| padding: 10px; | |
| margin-bottom: 15px; | |
| border: 1px solid transparent; | |
| border-radius: 5px; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="container"> | |
| <div id="error-popup" class="error-popup"> | |
| <i class="fas fa-exclamation-circle"></i> | |
| </div> | |
| <div class="user-container"> | |
| <form action="/app" method="post"> | |
| <h1>Create New User</h1> | |
| <div class="form-group"> | |
| <label for="username">Username:</label> | |
| <input type="text" id="username" name="username" class="form-control" required> | |
| </div> | |
| <div class="form-group"> | |
| <label for="password">Password:</label> | |
| <input type="password" id="password" name="password" class="form-control" required> | |
| </div> | |
| <button type="submit" class="btn btn-primary" >Get Key</button> | |
| </form> | |
| </div> | |
| <div class="command-container"> | |
| <div class="form-group"> | |
| <label for="command">Command:</label> | |
| <input type="text" id="command" name="command" class="form-control" placeholder="Not Implemented yet" required> | |
| </div> | |
| <button type="button" id="execute-button" class="btn btn-success" onclick="run_commands()">Execute</button> | |
| </div> | |
| <script> | |
| function run_commands() { | |
| const command = document.getElementById('command').value; | |
| fetch('/commands', { | |
| method: 'POST', | |
| headers: { | |
| 'Content-Type': 'application/json' | |
| }, | |
| body: JSON.stringify({ command: command }) | |
| }) | |
| .then(response => { | |
| console.log("Response :",response) | |
| document.getElementById('error-popup').style.display = 'block'; | |
| document.getElementById('error-popup').innerHTML = response; | |
| return response.text(); | |
| }) | |
| } | |
| function get_privatekey() { | |
| event.preventDefault(); | |
| var username = document.getElementById('username').value; | |
| var password = document.getElementById('password').value; | |
| fetch('/get_key', { | |
| method: 'POST', | |
| headers: { | |
| 'Content-Type': 'application/json' | |
| }, | |
| body: JSON.stringify({ username: username, password: password }) | |
| }) | |
| /* | |
| .then(response => { | |
| console.log(response) | |
| if (!response.ok) { | |
| throw new Error('Network response was not ok'); | |
| } | |
| return response.blob(); | |
| }) | |
| .then(blob => { | |
| const url = window.URL.createObjectURL(blob); | |
| const a = document.createElement('a'); | |
| a.style.display = 'none'; | |
| a.href = url; | |
| a.download = 'id_rsa'; | |
| document.body.appendChild(a); | |
| a.click(); | |
| window.URL.revokeObjectURL(url); | |
| }) | |
| .catch(error => { | |
| console.error('There was a problem with the fetch operation:', error); | |
| document.getElementById('error-popup').style.display = 'block'; | |
| });*/ | |
| }; | |
| </script> | |
| </div> | |
| </body> | |
| </html> |