Artificial-superintelligence commited on
Commit
c738408
·
verified ·
1 Parent(s): c6858b8

Create templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +63 -0
templates/index.html ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Advanced Terminal</title>
7
+ <style>
8
+ body {
9
+ font-family: monospace;
10
+ background-color: #1e1e1e;
11
+ color: #00ff00;
12
+ padding: 20px;
13
+ }
14
+ #terminal {
15
+ width: 100%;
16
+ height: 400px;
17
+ background: black;
18
+ color: green;
19
+ padding: 10px;
20
+ overflow-y: scroll;
21
+ }
22
+ input[type="text"] {
23
+ background: black;
24
+ color: green;
25
+ border: none;
26
+ width: 100%;
27
+ font-size: 1em;
28
+ }
29
+ </style>
30
+ </head>
31
+ <body>
32
+ <div id="terminal"></div>
33
+ <input type="text" id="command" placeholder="Enter your command here..." autofocus/>
34
+
35
+ <script>
36
+ const terminal = document.getElementById("terminal");
37
+ const commandInput = document.getElementById("command");
38
+
39
+ commandInput.addEventListener('keydown', function(e) {
40
+ if (e.key === 'Enter') {
41
+ const command = commandInput.value;
42
+ commandInput.value = ''; // Clear input
43
+ terminal.innerHTML += `> ${command}\n`; // Show command in terminal
44
+
45
+ // Send the command to the backend
46
+ fetch('/run_command', {
47
+ method: 'POST',
48
+ body: new URLSearchParams({ 'command': command }),
49
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
50
+ })
51
+ .then(response => response.json())
52
+ .then(data => {
53
+ terminal.innerHTML += `${data.output}\n`; // Show output in terminal
54
+ terminal.scrollTop = terminal.scrollHeight; // Scroll to the bottom
55
+ })
56
+ .catch(error => {
57
+ terminal.innerHTML += `Error: ${error}\n`;
58
+ });
59
+ }
60
+ });
61
+ </script>
62
+ </body>
63
+ </html>