vortexa64 commited on
Commit
826d11e
·
verified ·
1 Parent(s): 48b9358

Update index.html

Browse files
Files changed (1) hide show
  1. 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="startcmd" placeholder="Start command (e.g. python main.py)">
127
  <button onclick="saveSetup()">Save</button>
128
  </div>
129
 
@@ -175,11 +175,26 @@
175
  }
176
 
177
  function startConsole() {
178
- fetch("/console/start", { method: "POST" })
179
- .then(res => res.json())
180
- .then(data => {
181
- document.getElementById("output").textContent += ">>> Console started\n";
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() {