diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/connector/httpconnector.rs | 6 | ||||
| -rw-r--r-- | src/tasks.rs | 10 |
2 files changed, 8 insertions, 8 deletions
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<Self, url::ParseError> { - // 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)?, diff --git a/src/tasks.rs b/src/tasks.rs index 3d9d940..e9ce6bd 100644 --- a/src/tasks.rs +++ b/src/tasks.rs @@ -18,12 +18,14 @@ pub const TASKS: &[Task] = &[ name: "exec", exec: exec, }, - Task { - name: "network", - exec: network, - }, + NETWORK_T, ]; +pub const NETWORK_T: Task = Task { + name: "network", + exec: network, +}; + fn no_op(_: &[String]) -> Result<String, String> { Ok("".to_string()) } |
