diff --git a/lan-mouse-gtk/resources/window.ui b/lan-mouse-gtk/resources/window.ui
index 7c96036..58dcbd0 100644
--- a/lan-mouse-gtk/resources/window.ui
+++ b/lan-mouse-gtk/resources/window.ui
@@ -213,6 +213,58 @@
+
+
+
+
+
+ Authorized Keys
+
+
+
+
+
+ list-add-symbolic
+ Add
+
+
+
+
+
+
+
+ none
+
+
+ no fingerprints!
+ add a public key fingerprint via the + button
+
+
+
+
+
+
+
diff --git a/lan-mouse-gtk/src/window/imp.rs b/lan-mouse-gtk/src/window/imp.rs
index b038242..fb67873 100644
--- a/lan-mouse-gtk/src/window/imp.rs
+++ b/lan-mouse-gtk/src/window/imp.rs
@@ -118,6 +118,11 @@ impl Window {
self.obj().request_capture();
}
+ #[template_callback]
+ fn handle_add_cert_fingerprint(&self, _button: &Button) {
+ log::info!("TODO: impl add certificate fingerprint");
+ }
+
pub fn set_port(&self, port: u16) {
self.port.set(port);
if port == DEFAULT_PORT {
diff --git a/src/emulation.rs b/src/emulation.rs
index 74dd4ac..74105df 100644
--- a/src/emulation.rs
+++ b/src/emulation.rs
@@ -3,7 +3,7 @@ use futures::StreamExt;
use input_emulation::{EmulationHandle, InputEmulation, InputEmulationError};
use input_event::Event;
use lan_mouse_ipc::Status;
-use lan_mouse_proto::ProtoEvent;
+use lan_mouse_proto::{Position, ProtoEvent};
use local_channel::mpsc::{channel, Receiver, Sender};
use std::{
collections::HashMap,
@@ -44,10 +44,11 @@ impl Emulation {
log::trace!("{event} <-<-<-<-<- {addr}");
last_response.insert(addr, Instant::now());
match event {
- ProtoEvent::Enter(_) => {
+ ProtoEvent::Enter(pos) => {
log::info!("{addr} entered this device");
server.release_capture();
listener.reply(addr, ProtoEvent::Ack(0)).await;
+ server.register_incoming(addr, to_ipc_pos(pos));
}
ProtoEvent::Leave(_) => {
emulation_proxy.release_keys(addr);
@@ -196,3 +197,12 @@ impl EmulationProxy {
let _ = (&mut self.task).await;
}
}
+
+fn to_ipc_pos(pos: Position) -> lan_mouse_ipc::Position {
+ match pos {
+ Position::Left => lan_mouse_ipc::Position::Left,
+ Position::Right => lan_mouse_ipc::Position::Right,
+ Position::Top => lan_mouse_ipc::Position::Top,
+ Position::Bottom => lan_mouse_ipc::Position::Bottom,
+ }
+}
diff --git a/src/server.rs b/src/server.rs
index f1fd7e7..92cbe0d 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -51,6 +51,7 @@ pub struct Server {
capture_status: Rc>,
pub(crate) emulation_status: Rc| >,
pub(crate) should_release: Rc>>,
+ incoming_conns: Rc>>,
}
#[derive(Default)]
@@ -101,6 +102,7 @@ impl Server {
pending_frontend_events: Rc::new(RefCell::new(VecDeque::new())),
capture_status: Default::default(),
emulation_status: Default::default(),
+ incoming_conns: Rc::new(RefCell::new(Vec::new())),
should_release: Default::default(),
}
}
@@ -503,6 +505,10 @@ impl Server {
pub(crate) fn get_active(&self) -> Option {
self.active.get()
}
+
+ pub(crate) fn register_incoming(&self, addr: SocketAddr, pos: Position) {
+ self.incoming_conns.borrow_mut().push((addr, pos));
+ }
}
fn to_capture_pos(pos: Position) -> input_capture::Position {
| |