Update index.html
Browse files- index.html +21 -6
index.html
CHANGED
|
@@ -123,7 +123,7 @@
|
|
| 123 |
<h2>Setup</h2>
|
| 124 |
<input id="username" placeholder="Username">
|
| 125 |
<input id="password" type="password" placeholder="Password">
|
| 126 |
-
<input id="
|
| 127 |
<button onclick="saveSetup()">Save</button>
|
| 128 |
</div>
|
| 129 |
|
|
@@ -175,11 +175,26 @@
|
|
| 175 |
}
|
| 176 |
|
| 177 |
function startConsole() {
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
}
|
| 184 |
|
| 185 |
function stopConsole() {
|
|
|
|
| 123 |
<h2>Setup</h2>
|
| 124 |
<input id="username" placeholder="Username">
|
| 125 |
<input id="password" type="password" placeholder="Password">
|
| 126 |
+
<input id="filename" placeholder="Start command (e.g. python main.py)">
|
| 127 |
<button onclick="saveSetup()">Save</button>
|
| 128 |
</div>
|
| 129 |
|
|
|
|
| 175 |
}
|
| 176 |
|
| 177 |
function startConsole() {
|
| 178 |
+
const filename = document.getElementById("filename").value;
|
| 179 |
+
if (!filename) {
|
| 180 |
+
document.getElementById("output").textContent += ">>> No file selected.\n";
|
| 181 |
+
return;
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
fetch("/run", {
|
| 185 |
+
method: "POST",
|
| 186 |
+
headers: {
|
| 187 |
+
"Content-Type": "application/json"
|
| 188 |
+
},
|
| 189 |
+
body: JSON.stringify({ filename: filename })
|
| 190 |
+
})
|
| 191 |
+
.then(res => res.json())
|
| 192 |
+
.then(data => {
|
| 193 |
+
document.getElementById("output").textContent += `>>> Console started\n${data.output}\n`;
|
| 194 |
+
})
|
| 195 |
+
.catch(err => {
|
| 196 |
+
document.getElementById("output").textContent += `>>> Error: ${err}\n`;
|
| 197 |
+
});
|
| 198 |
}
|
| 199 |
|
| 200 |
function stopConsole() {
|