summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-09-21 15:03:21 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-09-21 15:03:21 +0800
commitf155278db783770b4fc44931e9ac0cb14131f981 (patch)
tree4f6acf6e9b0944713ded17398168bcdee91859dd /src/client
parent3fa4e33421e3fa94ca63ceb99856f97f9aac741a (diff)
finish ctx
Diffstat (limited to 'src/client')
-rw-r--r--src/client/connector.rs12
-rw-r--r--src/client/connector/httpconnector.rs2
2 files changed, 10 insertions, 4 deletions
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<T: Display, E: Debug> = result::Result<T, E>;
@@ -28,7 +34,7 @@ pub trait Connection {
fn get_ip(&self) -> Option<IpAddr>;
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<Task, IntoTaskErr>).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<Self, HTTPConnectorError> {
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)?,