fix(ui): replace remote server binary from the mismatch dialog (#352)

* fix(install): prefer bundled server over release download for SSH remotes

SSH remote installs used , which only checks
 and ignores the server binary already shipped next
to the Windows executable. WSL already uses
to find that bundled binary.

Add  to auto-discover the bundled server and
fall back to the GitHub release download only when no matching local asset
exists. Switch  and  to use it.

This lets the Windows installer/zip (which already stages server binaries
under <exe>/server/) satisfy SSH remote installs without hitting the network.
The explicit  path keeps its strict no-fallback behavior, and WSL
remains bundled-only.

Refs: future issue/PR for bundling server binaries into Windows releases.

* style(install): fix rustfmt formatting in bundled-server tests

* fix(ui): replace remote server binary from the mismatch dialog

The version/protocol mismatch dialog previously offered a 'Restart Server'
button that only restarted the existing daemon without replacing the
incompatible binary. This left users stuck on the same mismatch after the
restart.

- Change restart_mismatched_remote_server to call replace_remote_server
  (replace binary + restart daemon) instead of restart_remote_server.
- Add a dedicated L10nKey::RemoteMismatchReplaceServer ('Update Server' /
  '更新服务器端') and use it for the dialog's action button and detail text.
- Update the mismatch title/detail copy so it describes replacing the server
  binary rather than restarting it.

Refs: #351

---------

Co-authored-by: l0ng-ai <ysdpk123@gmail.com>
This commit is contained in:
Hongwei Qin
2026-08-05 12:39:49 +08:00
committed by GitHub
co-authored by l0ng-ai
parent 8a7b2f3bea
commit 257d13e607
3 changed files with 11 additions and 8 deletions
+8 -5
View File
@@ -726,6 +726,7 @@ pub enum L10nKey {
RemoteMismatchDetail,
RemoteMismatchUnknownBuild,
RemoteMismatchUnknownBuildFromExe,
RemoteMismatchReplaceServer,
RemoteDaemonStartFailed,
RemoteDaemonUnreachable,
RemoteDaemonTooOld,
@@ -2371,23 +2372,24 @@ fn translate(locale: Locale, key: L10nKey) -> &'static str {
),
L10nKey::RemoteInstallBytes => ("bytes", "字节"),
L10nKey::RemoteMismatchTitle => (
"Restart tty7's server on \"{machine}\"?",
"重启 \"{machine}\" 上的 tty7 服务器?",
"Update tty7's server on \"{machine}\"?",
"更新 \"{machine}\" 上的 tty7 服务器",
),
L10nKey::RemoteMismatchDetail => (
"{machine} is serving tty7 sessions from {running}, which speaks a protocol \
this client ({wanted}) cannot. tty7 has installed a matching server there, \
but the one already running is the one your sessions are on.\n\
\n\
{restart_server}\u{2003}starts {wanted} there and ends every session it is hosting.\n\
{replace_server}\u{2003}replaces it with {wanted} and ends every session it is hosting.\n\
{cancel}\u{2003}leaves {machine} exactly as it is. This window will not connect.",
"{machine} 正在使用 {running} 提供 tty7 会话,该版本使用的协议无法被\
此客户端({wanted})识别。tty7 已在那里安装了匹配的服务器,\
此客户端({wanted})识别。tty7 已在那里安装了匹配的服务器\
但正在运行的是你当前会话所在的版本。\n\
\n\
{restart_server}\u{2003}在该机器上启动 {wanted} 并结束其托管的所有会话。\n\
{replace_server}\u{2003}将其替换为 {wanted} 并结束其托管的所有会话。\n\
{cancel}\u{2003}会保持 {machine} 现状不变。此窗口将不会连接。",
),
L10nKey::RemoteMismatchReplaceServer => ("Update Server", "更新服务器端"),
L10nKey::RemoteMismatchUnknownBuild => ("an unknown build", "未知构建"),
L10nKey::RemoteMismatchUnknownBuildFromExe => {
("an unknown build (from {exe})", "未知构建(来自 {exe}")
@@ -3686,6 +3688,7 @@ mod tests {
L10nKey::RemoteMismatchDetail,
L10nKey::RemoteMismatchUnknownBuild,
L10nKey::RemoteMismatchUnknownBuildFromExe,
L10nKey::RemoteMismatchReplaceServer,
L10nKey::RemoteDaemonStartFailed,
L10nKey::RemoteDaemonUnreachable,
L10nKey::RemoteDaemonTooOld,
+2 -2
View File
@@ -641,7 +641,7 @@ pub(crate) fn claim_mailbox() -> std::sync::MutexGuard<'static, ()> {
}
pub fn mismatch_answers() -> [&'static str; 2] {
[t(L10nKey::Cancel), t(L10nKey::RestartServer)]
[t(L10nKey::Cancel), t(L10nKey::RemoteMismatchReplaceServer)]
}
pub fn mismatch_detail(m: &MismatchedRemoteDaemon) -> String {
@@ -660,7 +660,7 @@ pub fn mismatch_detail(m: &MismatchedRemoteDaemon) -> String {
("machine", &m.host),
("running", &running),
("wanted", &m.wanted_version),
("restart_server", t(L10nKey::RestartServer)),
("replace_server", t(L10nKey::RemoteMismatchReplaceServer)),
("cancel", t(L10nKey::Cancel)),
],
)
+1 -1
View File
@@ -492,7 +492,7 @@ impl Tty7App {
match remote_connect::mismatch_target(&mismatch)
.ok_or_else(|| t_fmt(L10nKey::RemoteNoRouteToHost, &[("machine", &label)]))
{
Ok(target) => self.restart_remote_server(target, label, window, cx),
Ok(target) => self.replace_remote_server(target, label, window, cx),
Err(e) => Tty7App::report_restart_failure(&label, &e, window, cx),
}
}