| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="UTF-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| <title>Command Runner</title> |
| <style> |
| body { |
| font-family: Arial, sans-serif; |
| margin: 20px; |
| } |
| input[type="text"] { |
| width: 300px; |
| padding: 10px; |
| margin-right: 10px; |
| } |
| button { |
| padding: 10px 15px; |
| } |
| pre { |
| background-color: #f4f4f4; |
| padding: 10px; |
| border: 1px solid #ccc; |
| white-space: pre-wrap; |
| word-wrap: break-word; |
| } |
| </style> |
| </head> |
| <body> |
| <h1>Run a Command</h1> |
| <form id="command-form"> |
| <input type="text" id="command" name="command" placeholder="Enter command here" required> |
| <button type="submit">Run</button> |
| </form> |
| <h2>Output:</h2> |
| <pre id="output"></pre> |
|
|
| <script> |
| document.getElementById('command-form').addEventListener('submit', function(event) { |
| event.preventDefault(); |
| const command = document.getElementById('command').value; |
| fetch(`/run?command=${encodeURIComponent(command)}`) |
| .then(response => response.text()) |
| .then(data => { |
| document.getElementById('output').textContent = data; |
| }) |
| .catch(error => { |
| document.getElementById('output').textContent = `Error: ${error}`; |
| }); |
| }); |
| </script> |
| </body> |
| </html> |