Skip to content

Commit db68b76

Browse files
committed
fix(linux): 增强白屏诊断日志
Refs #83
1 parent 1eda5cf commit db68b76

12 files changed

Lines changed: 993 additions & 334 deletions

File tree

.github/workflows/test-linux-build.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ jobs:
9898
run: pnpm tauri build --target x86_64-unknown-linux-gnu --bundles appimage,rpm,deb
9999
env:
100100
NODE_OPTIONS: '--max_old_space_size=4096'
101+
AQBOT_TEST_BUILD: '1'
101102
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
102103
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
103104

@@ -112,13 +113,19 @@ jobs:
112113
If AQBot still opens as a blank window, start it with:
113114
114115
```bash
115-
AQBOT_LOG_FILE="$HOME/aqbot-0.0.76.log" RUST_LOG=debug ./AQBot_0.0.76_amd64.AppImage
116+
AQBOT_LOG_FILE="$HOME/aqbot-${{ github.ref_name }}.log" RUST_LOG=debug AQBOT_ENABLE_DEVTOOLS=1 ./AQBot_0.0.76_amd64.AppImage
116117
```
117118
118119
For the RPM install:
119120
120121
```bash
121-
AQBOT_LOG_FILE="$HOME/aqbot-0.0.76.log" RUST_LOG=debug AQBot
122+
AQBOT_LOG_FILE="$HOME/aqbot-${{ github.ref_name }}-rpm.log" RUST_LOG=debug AQBOT_ENABLE_DEVTOOLS=1 AQBot
123+
```
124+
125+
If the log still stops around `builder.build(context)`, run the minimal-plugin diagnostic path:
126+
127+
```bash
128+
AQBOT_LOG_FILE="$HOME/aqbot-${{ github.ref_name }}-minimal.log" RUST_LOG=debug AQBOT_ENABLE_DEVTOOLS=1 AQBOT_LINUX_MINIMAL_PLUGINS=1 ./AQBot_0.0.76_amd64.AppImage
122129
```
123130
124131
Please attach the generated log file back to issue #83.

src-tauri/src/commands/desktop.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ pub async fn get_desktop_capabilities() -> Result<serde_json::Value, String> {
7474
{ "key": "global_shortcut", "supported": true },
7575
{ "key": "protocol_handler", "supported": true },
7676
{ "key": "mini_window", "supported": true },
77-
{ "key": "notification", "supported": true }
77+
{ "key": "notification", "supported": true },
78+
{
79+
"key": "devtools_context_menu",
80+
"supported": crate::startup_diagnostics::devtools_context_menu_enabled()
81+
}
7882
]))
7983
}
8084

@@ -96,6 +100,11 @@ pub async fn get_window_state() -> Result<serde_json::Value, String> {
96100

97101
#[tauri::command]
98102
pub async fn open_devtools(webview_window: tauri::WebviewWindow) -> Result<(), String> {
103+
tracing::info!(
104+
window = webview_window.label(),
105+
devtools_context_menu_enabled = crate::startup_diagnostics::devtools_context_menu_enabled(),
106+
"Opening AQBot WebView devtools"
107+
);
99108
webview_window.open_devtools();
100109
Ok(())
101110
}

src-tauri/src/diagnostics.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ impl Write for SharedLogFileWriter {
3232
.file
3333
.lock()
3434
.map_err(|_| io::Error::new(io::ErrorKind::Other, "log file lock poisoned"))?;
35-
file.write(buf)
35+
let written = file.write(buf)?;
36+
file.flush()?;
37+
Ok(written)
3638
}
3739

3840
fn flush(&mut self) -> io::Result<()> {
@@ -105,7 +107,14 @@ pub fn log_process_startup() {
105107
wayland_display = %env_value("WAYLAND_DISPLAY"),
106108
display = %env_value("DISPLAY"),
107109
gdk_backend = %env_value("GDK_BACKEND"),
110+
xdg_current_desktop = %env_value("XDG_CURRENT_DESKTOP"),
111+
desktop_session = %env_value("DESKTOP_SESSION"),
112+
webkit_disable_dmabuf_renderer = %env_value("WEBKIT_DISABLE_DMABUF_RENDERER"),
113+
webkit_disable_compositing_mode = %env_value("WEBKIT_DISABLE_COMPOSITING_MODE"),
108114
aqbot_linux_auto_window = %env_value(LINUX_AUTO_WINDOW_ENV),
115+
aqbot_linux_any_thread = %env_value(crate::startup_diagnostics::LINUX_ANY_THREAD_ENV),
116+
aqbot_linux_minimal_plugins = %env_value(crate::startup_diagnostics::LINUX_MINIMAL_PLUGINS_ENV),
117+
aqbot_enable_devtools = %env_value(crate::startup_diagnostics::ENABLE_DEVTOOLS_ENV),
109118
"AQBot process startup diagnostics"
110119
);
111120
}

0 commit comments

Comments
 (0)