mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-09-22 00:02:23 +00:00
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:
+8
-5
@@ -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,
|
||||
|
||||
@@ -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)),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user