From 84e3f12e6c1b3258defab2a08497489c25f48c65 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Mon, 15 Sep 2025 14:59:12 +0800 Subject: feat: use typed network task --- src/client/connector/httpconnector.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/client/connector') diff --git a/src/client/connector/httpconnector.rs b/src/client/connector/httpconnector.rs index b8369fe..d8c0027 100644 --- a/src/client/connector/httpconnector.rs +++ b/src/client/connector/httpconnector.rs @@ -1,5 +1,5 @@ use crate::{connector::Connection, executor::Executor}; -use remote_control_rs::tasks::TASKS; +use remote_control_rs::tasks::NETWORK_T; use reqwest::{ Error, StatusCode, Url, blocking::{Client, RequestBuilder}, @@ -21,10 +21,8 @@ impl HTTPConnector { ntfy_url: &str, ip_getter_url: &str, ) -> std::result::Result { - // TODO: proper type - assert_eq!(TASKS[2].name, "network"); Ok(Self { - network_enforcer: Executor::new(&TASKS[2], ["on".to_string()]).unwrap(), // .unwrap() should never panic + network_enforcer: Executor::new(&NETWORK_T, ["on".to_string()]).unwrap(), // .unwrap() should never panic prev: String::new(), pull_url: Url::parse(pull_url)?, ntfy_url: Url::parse(ntfy_url)?, -- cgit v1.2.3