Fix issues from code review
- Fix project root path in test_webgui.py - Remove debug console.log from loadConfig in app.js - Remove duplicate screenshot button event listener in app.js - Fix redundant directory changes in startup batch script - Add trailing newlines to files
This commit is contained in:
1 parent
7eb72bd00e
commit
8368f1f3b7
4 files changed
+3
-37
No files matched your search
@@ -9,14 +9,6 @@ set "_ORIG_CP=%_ORIG_CP: =%"
|
||||
chcp 65001 >nul 2>&1
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
REM Change to script directory
|
||||
cd /d "%~dp0"
|
||||
if errorlevel 1 (
|
||||
echo [ERROR] Cannot change to script directory
|
||||
pause
|
||||
goto :cleanup
|
||||
)
|
||||
|
||||
REM Change to project root directory (parent of scripts)
|
||||
cd /d "%~dp0.."
|
||||
if errorlevel 1 (
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ import subprocess
|
||||
import threading
|
||||
|
||||
# Add project root to path
|
||||
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
project_root = os.path.dirname(os.path.abspath(__file__))
|
||||
if project_root not in sys.path:
|
||||
sys.path.insert(0, project_root)
|
||||
|
||||
@@ -38,4 +38,4 @@ def test_server():
|
||||
print(f"Error: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_server()
|
||||
test_server()
|
||||
@@ -623,15 +623,11 @@ function collectConfigFromUI() {
|
||||
}
|
||||
|
||||
async function loadConfig() {
|
||||
console.log('[DEBUG] loadConfig called');
|
||||
try {
|
||||
const cfg = await apiGet("/api/config");
|
||||
console.log('[DEBUG] Config loaded:', Object.keys(cfg).length, 'keys');
|
||||
applyConfigToUI(cfg);
|
||||
console.log('[DEBUG] Config applied to UI');
|
||||
appendLog(["[WEB] 配置已加载"]);
|
||||
} catch (e) {
|
||||
console.error('[DEBUG] loadConfig error:', e);
|
||||
appendLog(["[WEB] 配置加载失败: " + e.message]);
|
||||
}
|
||||
}
|
||||
@@ -1173,28 +1169,6 @@ window.addEventListener("DOMContentLoaded", async () => {
|
||||
$("btnStart").addEventListener("click", async () => { await startRun(); });
|
||||
$("btnStop").addEventListener("click", async () => { await stopRun(); });
|
||||
|
||||
// 截图按钮
|
||||
$("btnScreenshot").addEventListener("click", async () => {
|
||||
const deviceId = $("device").value || "";
|
||||
if (!deviceId) {
|
||||
appendLog(["[截图] 请先选择设备"]);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
appendLog(["[截图] 正在截图..."]);
|
||||
const result = await apiPost("/api/screenshot", { device_id: deviceId });
|
||||
if (result.ok) {
|
||||
appendLog(["[截图] 截图成功,已保存到 pic/screenshot.png"]);
|
||||
// 刷新截图显示
|
||||
pollShot();
|
||||
} else {
|
||||
appendLog([`[截图] 截图失败: ${result.error || "未知错误"}`]);
|
||||
}
|
||||
} catch (e) {
|
||||
appendLog([`[截图] 截图失败: ${e?.message || e}`]);
|
||||
}
|
||||
});
|
||||
|
||||
// 截图按钮
|
||||
$("btnScreenshot").addEventListener("click", async () => {
|
||||
const deviceId = $("device").value || "";
|
||||
|
||||
+1
-1
@@ -65,4 +65,4 @@
|
||||
testConfig();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
Reference in new issue
Block a user