From f155278db783770b4fc44931e9ac0cb14131f981 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sun, 21 Sep 2025 15:03:21 +0800 Subject: finish ctx --- src/client/connector.rs | 12 +++++++++--- src/client/connector/httpconnector.rs | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'src/client') diff --git a/src/client/connector.rs b/src/client/connector.rs index f48b039..32c9cae 100644 --- a/src/client/connector.rs +++ b/src/client/connector.rs @@ -7,7 +7,13 @@ use std::{ }; use crate::client::Client; -use remote_control_rs::{executor::Executor, tasks::client::NETWORK_T}; +use remote_control_rs::{ + executor::Executor, + tasks::{ + IntoTaskErr, + client::{NETWORK_T, Task}, + }, +}; pub type Result = result::Result; @@ -28,7 +34,7 @@ pub trait Connection { fn get_ip(&self) -> Option; fn force_network(&mut self) { - _ = Executor::new(NETWORK_T.as_ref(), ["true"]); + _ = Executor::new(NETWORK_T.as_ref(), ["true"], ()); } fn init<'a>(&self, c: &Client<'a, Self>) -> std::result::Result<(), Self::Err> @@ -67,7 +73,7 @@ pub trait Connection { None => return, }; // FIXME: handle the errors... peak prod code - self.ntfy(Executor::new(task.try_into().unwrap(), it).unwrap().run().as_ref().unwrap().clone()).unwrap(); + self.ntfy(Executor::new((task.try_into() as result::Result).unwrap().as_ref(), it, ()).unwrap().run().as_ref().unwrap().clone()).unwrap(); } Result::Err(e) => { #[cfg(debug_assertions)] diff --git a/src/client/connector/httpconnector.rs b/src/client/connector/httpconnector.rs index eb5ebe3..d668ce5 100644 --- a/src/client/connector/httpconnector.rs +++ b/src/client/connector/httpconnector.rs @@ -37,7 +37,7 @@ pub struct HTTPConnector { impl HTTPConnector { pub fn new(pull_url: &str, ntfy_url: &str, ip_getter_url: &str) -> result::Result { Ok(Self { - network_enforcer: Executor::new(NETWORK_T.as_ref(), ["true"]).unwrap(), // .unwrap() should never panic + network_enforcer: Executor::new(NETWORK_T.as_ref(), ["true"], ()).unwrap(), // .unwrap() should never panic prev: String::new(), pull_url: Url::parse(pull_url)?, ntfy_url: Url::parse(ntfy_url)?, -- cgit v1.2.3