fix: terminal, restore, cross users (#12335)

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou
2025-07-18 16:25:53 +08:00
committed by GitHub
parent bdd3bb946e
commit e91f4fc104
2 changed files with 12 additions and 5 deletions

View File

@@ -2551,7 +2551,7 @@ impl LoginConfigHandler {
}),
ConnType::TERMINAL => {
let mut terminal = Terminal::new();
terminal.service_id = self.get_option("terminal-service-id");
terminal.service_id = self.get_option(self.get_key_terminal_service_id());
lr.set_terminal(terminal);
}
_ => {}
@@ -2602,6 +2602,14 @@ impl LoginConfigHandler {
pub fn get_id(&self) -> &str {
&self.id
}
pub fn get_key_terminal_service_id(&self) -> &'static str {
if self.is_terminal_admin {
"terminal-admin-service-id"
} else {
"terminal-service-id"
}
}
}
/// Media data.

View File

@@ -1944,10 +1944,9 @@ impl<T: InvokeUiSession> Remote<T> {
use hbb_common::message_proto::terminal_response::Union;
if let Some(Union::Opened(opened)) = &response.union {
if opened.success && !opened.service_id.is_empty() {
self.handler.lc.write().unwrap().set_option(
"terminal-service-id".to_owned(),
opened.service_id.clone(),
);
let mut lc = self.handler.lc.write().unwrap();
let key = lc.get_key_terminal_service_id().to_owned();
lc.set_option(key, opened.service_id.clone());
}
}
self.handler.handle_terminal_response(response);