帳號頁連不上時「登出」被擠出視窗:「AnyBot 帳號」的連線狀態原本跟帳號、網址擠在同一行而且不換行,連不上時那段錯誤(「連不上帳號伺服器:找不到伺服器:…」)把整張卡片撐得比視窗還寬,右邊的「登出」跑到畫面外看不到(上一版只在狀態是空的時候看過,沒抓到)。現在狀態在帳號下面自己一行、太長就換行,帳號和網址太長就「…」;大腦卡片的「連不到大腦:…」也改成在卡片裡換行。版面檢查加一個畫面「設定 › 手機與帳號(已登入、連不上)」(長錯誤、螢幕電腦連不到大腦),舊的排法在這個畫面會被報成 51 個問題。

已驗證: cargo test 全綠(816 passed,含 layout_audit:: 新畫面、featuremap::、remote_ui::);把狀態放回同一行時 layout_audit 報「連不上帳號伺服器…被切掉 338px」「視窗被內容撐寬 356px」等 51 個問題(證明檢查抓得到);桌面截圖用跟使用者截圖一樣的狀態(連不上帳號伺服器、連不到大腦、wang、同一個帳號伺服器網址與主機名稱)在 1000/664 寬:「登出」在卡片裡看得到。
未驗證: 使用者自己那台 AnyBot 上的畫面(不能開使用者真的 AnyBot,要重開 App 換上新版才看得到);真的帳號伺服器連不上時的長連線狀態(截圖用暫時的覆寫給同一段字,已拿掉)。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
王性驊 2026-11-20 23:10:51 +08:00
parent 56763411bb
commit 44db2bab74
3 changed files with 50 additions and 6 deletions

View File

@ -2236,7 +2236,7 @@ computer_use_screenshot、click、mouse_move、mouse_button(按住/放開)
- **AnyBot 帳號**: - **AnyBot 帳號**:
- 填帳號伺服器網址、帳號、密碼,可以順便建立新帳號(有邀請碼時要填)。 - 填帳號伺服器網址、帳號、密碼,可以順便建立新帳號(有邀請碼時要填)。
- 登入後,這台電腦會拿到自己的金鑰,之後保持連線。顯示「已連線」或錯誤原因。 - 登入後,這台電腦會拿到自己的金鑰,之後保持連線。帳號下面一行顯示「已連線」或錯誤原因(長的錯誤自動換行,不會把卡片撐寬、把「登出」擠出視窗)。
- 電腦不會保存你的密碼,只保存由密碼算出的備份金鑰。 - 電腦不會保存你的密碼,只保存由密碼算出的備份金鑰。
- 可以設定這台電腦在手機上顯示的名字(欄位跟卡片一樣寬,長名字不會被切掉)。 - 可以設定這台電腦在手機上顯示的名字(欄位跟卡片一樣寬,長名字不會被切掉)。
- 備份下面隔一條線是「登出帳號」那一列,右邊「登出」按鈕(紅字):把這台從帳號移除;?說明會斷掉哪些。 - 備份下面隔一條線是「登出帳號」那一列,右邊「登出」按鈕(紅字):把這台從帳號移除;?說明會斷掉哪些。

View File

@ -110,6 +110,32 @@ fn scenes() -> Vec<(&'static str, Open)> {
), ),
("設定 › 一般", tab(SettingsTab::General)), ("設定 › 一般", tab(SettingsTab::General)),
("設定 › 手機與帳號", tab(SettingsTab::Remote)), ("設定 › 手機與帳號", tab(SettingsTab::Remote)),
(
// Signed in with the account server out of reach, as a screen of a brain it can't
// reach either: the long errors once pushed the cards wider than the window (登出 off
// its right edge).
"設定 › 手機與帳號(已登入、連不上)",
Box::new(|a: &mut App| {
a.show_settings = true;
a.settings_tab = SettingsTab::Remote;
let r = &mut a.state.remote;
// (Signed in, the page asks the account server for 團隊: a port here that refuses
// at once — no lookups, nothing leaves the computer.)
r.relay_url = "https://127.0.0.1:9/anybot-relay/customer-service-third-floor".into();
r.relay_user = "someone".into();
r.host_token = "audit".into();
r.host_name = "客戶服務部三樓的 MacBook Pro (2)".into();
r.last_backup = chrono::Utc::now().timestamp() - 3_600;
r.brain_id = "audit-brain".into();
r.brain_name = "雲端大腦".into();
a.rm.relay_status_shown = Some("連不上帳號伺服器:找不到伺服器:這台電腦可能沒連上網路,或伺服器網址打錯了".into());
a.mir.dir = std::env::temp_dir().join("anybot-layout-audit-screen");
a.mir.on = true;
a.mir.online = false;
*a.mir.status.lock().unwrap() = "連不到大腦:連不到帳號伺服器:網路連線出了問題(等太久沒有回應:網路很慢或斷斷續續)".into();
*a.rm.peers.lock().unwrap() = vec![("audit-brain".into(), "雲端大腦".into(), false)];
}),
),
("設定 › 模型", tab(SettingsTab::Providers)), ("設定 › 模型", tab(SettingsTab::Providers)),
("設定 › 整合 › 訊息管道", tab(SettingsTab::Channels)), ("設定 › 整合 › 訊息管道", tab(SettingsTab::Channels)),
( (

View File

@ -40,6 +40,9 @@ pub struct RemoteUi {
new_member: String, new_member: String,
new_admin: bool, new_admin: bool,
started: bool, started: bool,
/// The layout check's account connection state (a long error) instead of the live one.
#[cfg(test)]
pub(super) relay_status_shown: Option<String>,
} }
/// Approvals as the phone shows them. /// Approvals as the phone shows them.
@ -825,6 +828,15 @@ impl App {
}); });
} }
/// The account connection's state as the page shows it.
fn relay_status_now(&self) -> String {
#[cfg(test)]
if let Some(s) = &self.rm.relay_status_shown {
return s.clone();
}
remote::hub().relay_status()
}
pub(super) fn remote_page(&mut self, ui: &mut egui::Ui, _ctx: &egui::Context) { pub(super) fn remote_page(&mut self, ui: &mut egui::Ui, _ctx: &egui::Context) {
let p = self.pal; let p = self.pal;
let mut changed = false; let mut changed = false;
@ -836,16 +848,21 @@ impl App {
// ── 帳號(薄後端) ── // ── 帳號(薄後端) ──
setting_card(ui, p, |ui| { setting_card(ui, p, |ui| {
setting_title(ui, "AnyBot 帳號", "帳號伺服器保管帳號、裝置清單和加密備份,手機從外面連進來也靠它轉送。", p); setting_title(ui, "AnyBot 帳號", "帳號伺服器保管帳號、裝置清單和加密備份,手機從外面連進來也靠它轉送。", p);
let status = self.relay_status_now();
let s = &self.state.remote; let s = &self.state.remote;
if !s.host_token.is_empty() { if !s.host_token.is_empty() {
let status = remote::hub().relay_status();
ui.horizontal(|ui| { ui.horizontal(|ui| {
let ok = status == "已連線"; let ok = status == "已連線";
let (r, _) = ui.allocate_exact_size(vec2(10.0, 10.0), egui::Sense::hover()); let (r, _) = ui.allocate_exact_size(vec2(10.0, 10.0), egui::Sense::hover());
ui.painter().circle_filled(r.center(), 4.0, if ok { p.up } else { p.text3 }); ui.painter().circle_filled(r.center(), 4.0, if ok { p.up } else { p.text3 });
ui.label(RichText::new(format!("{} · {}", s.relay_user, s.relay_url)).size(FONT_BASE)); ui.add(egui::Label::new(RichText::new(format!("{} · {}", s.relay_user, s.relay_url)).size(FONT_BASE)).truncate());
ui.label(RichText::new(if status.is_empty() { "—".to_string() } else { status }).size(FONT_XS).color(p.text3));
}); });
// The connection's state on a line of its own, wrapped: beside the account on one
// line, an error (「連不上帳號伺服器:找不到伺服器:…」) pushed the card wider than
// the window, and 登出 off its right edge.
if !status.is_empty() {
ui.add(egui::Label::new(RichText::new(status).size(FONT_XS).color(p.text3)).wrap());
}
hint(ui, format!("手機打開 {} 用同一個帳號登入就能用。可以「加入主畫面」當成 App。", s.relay_url), p); hint(ui, format!("手機打開 {} 用同一個帳號登入就能用。可以「加入主畫面」當成 App。", s.relay_url), p);
// (A field as wide as the card: a long name like 「…的MacBook Pro (2)」 was cut off.) // (A field as wide as the card: a long name like 「…的MacBook Pro (2)」 was cut off.)
form_row(ui, "這台電腦在手機上叫", p, |ui| { form_row(ui, "這台電腦在手機上叫", p, |ui| {
@ -962,12 +979,13 @@ impl App {
ui.horizontal(|ui| { ui.horizontal(|ui| {
let (r, _) = ui.allocate_exact_size(vec2(10.0, 10.0), egui::Sense::hover()); let (r, _) = ui.allocate_exact_size(vec2(10.0, 10.0), egui::Sense::hover());
ui.painter().circle_filled(r.center(), 4.0, if self.mir.online { p.up } else { p.text3 }); ui.painter().circle_filled(r.center(), 4.0, if self.mir.online { p.up } else { p.text3 });
ui.label(RichText::new(status).size(FONT_SM).color(p.text2)); // (Wrapped inside the card: a long 「連不到大腦:…」 widened it, like the account's.)
ui.add(egui::Label::new(RichText::new(status).size(FONT_SM).color(p.text2)).wrap());
}); });
// Which leg: this computer ↔ the account server, the account server ↔ the // Which leg: this computer ↔ the account server, the account server ↔ the
// brain (as the account server last said), and the line's speed. // brain (as the account server last said), and the line's speed.
let brain_on = self.rm.peers.lock().unwrap().iter().find(|(id, _, _)| *id == s.brain_id).map(|x| x.2); let brain_on = self.rm.peers.lock().unwrap().iter().find(|(id, _, _)| *id == s.brain_id).map(|x| x.2);
let legs = remote_legs(&remote::hub().relay_status(), brain_on, &s.brain_name, *self.mir.last_sync.lock().unwrap()); let legs = remote_legs(&self.relay_status_now(), brain_on, &s.brain_name, *self.mir.last_sync.lock().unwrap());
for line in legs { for line in legs {
ui.add(egui::Label::new(RichText::new(line).size(FONT_XS).color(p.text3)).wrap()); ui.add(egui::Label::new(RichText::new(line).size(FONT_XS).color(p.text3)).wrap());
} }