Spaces:
No application file
No application file
Update browser_automation_ui.html
Browse files- browser_automation_ui.html +12 -6
browser_automation_ui.html
CHANGED
|
@@ -146,15 +146,21 @@
|
|
| 146 |
|
| 147 |
function downloadCurrentScreenshot(){if(!lastScreenshot)return alert('No screenshot');const a=document.createElement('a');a.href=`data:image/png;base64,${lastScreenshot}`;a.download=`screenshot_${Date.now()}.png`;a.click();}
|
| 148 |
|
| 149 |
-
async function closeSession(id){
|
| 150 |
-
|
| 151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
|
| 153 |
async function closeAllSessions(){
|
| 154 |
const list=await listSessions(); if(!list.length) return alert("No sessions");
|
| 155 |
-
if(!confirm("Close ALL sessions? This cannot be undone.")) return;
|
| 156 |
-
for(const s of list){ try{ await apiPost('/browser/close', { session_id: ${s.session_id} });}catch(e){ appendLog(`❗ close ${s.session_id}: ${e.message}`);} }
|
| 157 |
-
sessionId=null; refreshSessions(); appendLog("All sessions closed");
|
| 158 |
}
|
| 159 |
|
| 160 |
async function refreshSessions(){try{
|
|
|
|
| 146 |
|
| 147 |
function downloadCurrentScreenshot(){if(!lastScreenshot)return alert('No screenshot');const a=document.createElement('a');a.href=`data:image/png;base64,${lastScreenshot}`;a.download=`screenshot_${Date.now()}.png`;a.click();}
|
| 148 |
|
| 149 |
+
async function closeSession(id){
|
| 150 |
+
if(!confirm(`Close session\n${id}?`))return;
|
| 151 |
+
// try{
|
| 152 |
+
// await apiPost('/browser/close', { session_id: id });log(`✖ closed ${id}`);if(id===currentSessionId){currentSessionId=null;document.getElementById('screenshot').src='';}
|
| 153 |
+
// await refreshSessions();
|
| 154 |
+
// }catch(e){
|
| 155 |
+
// handleErr(e)
|
| 156 |
+
// }
|
| 157 |
+
}
|
| 158 |
|
| 159 |
async function closeAllSessions(){
|
| 160 |
const list=await listSessions(); if(!list.length) return alert("No sessions");
|
| 161 |
+
// if(!confirm("Close ALL sessions? This cannot be undone.")) return;
|
| 162 |
+
// for(const s of list){ try{ await apiPost('/browser/close', { session_id: ${s.session_id} });}catch(e){ appendLog(`❗ close ${s.session_id}: ${e.message}`);} }
|
| 163 |
+
// sessionId=null; refreshSessions(); appendLog("All sessions closed");
|
| 164 |
}
|
| 165 |
|
| 166 |
async function refreshSessions(){try{
|