Skip to content

Commit

Permalink
fix: fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
SpikeHD committed Dec 21, 2024
1 parent 5b60026 commit 140d1b8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
9 changes: 5 additions & 4 deletions src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ impl ActivityCmd {
}

pub fn fix_timestamps(&mut self) {
if let Some(timestamps) = self.args
if let Some(timestamps) = self
.args
.as_mut()
.and_then(|args| args.activity.as_mut())
.and_then(|activity| activity.timestamps.as_mut())
Expand Down Expand Up @@ -138,11 +139,11 @@ pub struct Activity {
pub metadata: Option<Metadata>,
}

#[skip_serializing_none]
#[skip_serializing_none]
#[derive(Clone, Serialize, Deserialize, Debug, Default)]
pub struct TimeoutValue(i64);

#[skip_serializing_none]
#[skip_serializing_none]
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct Timestamps {
#[serde(default)]
Expand All @@ -151,7 +152,7 @@ pub struct Timestamps {
pub end: Option<TimeoutValue>,
}

#[skip_serializing_none]
#[skip_serializing_none]
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct Button {
pub label: String,
Expand Down
27 changes: 18 additions & 9 deletions src/server/client_connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ use std::{

use simple_websockets::{Event, EventHub, Message, Responder};

use crate::{cmd::{ActivityCmd, ActivityPayload}, log};
use crate::{
cmd::{ActivityCmd, ActivityPayload},
log,
};

use super::process::ProcessDetectedEvent;

Expand Down Expand Up @@ -136,19 +139,22 @@ impl ClientConnector {
let activity = args.activity.as_mut();

if let Some(activity) = activity {
activity.application_id= ipc_activity.application_id;
activity.application_id = ipc_activity.application_id;

let payload = ActivityPayload {
activity: Some(activity.clone()),
pid: args.pid,
socket_id: Some("0".to_string()),
};

match serde_json::to_string(&payload) {
Ok(payload) => {
log!("[Client Connector] Sending payload for IPC activity: {:?}", payload);
log!(
"[Client Connector] Sending payload for IPC activity: {:?}",
payload
);
ipc_clone.send_data(payload)
},
}
Err(err) => log!("[Client Connector] Error serializing IPC activity: {}", err),
};
} else {
Expand Down Expand Up @@ -291,19 +297,22 @@ impl ClientConnector {
let activity = args.activity.as_mut();

if let Some(activity) = activity {
activity.application_id= ws_event.application_id;
activity.application_id = ws_event.application_id;

let payload = ActivityPayload {
activity: Some(activity.clone()),
pid: args.pid,
socket_id: Some("0".to_string()),
};

match serde_json::to_string(&payload) {
Ok(payload) => {
log!("[Client Connector] Sending payload for IPC activity: {:?}", payload);
log!(
"[Client Connector] Sending payload for IPC activity: {:?}",
payload
);
ws_clone.send_data(payload)
},
}
Err(err) => log!("[Client Connector] Error serializing IPC activity: {}", err),
};
} else {
Expand Down
8 changes: 5 additions & 3 deletions src/server/process.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use rayon::prelude::*;
use sysinfo::UpdateKind;
use std::path::Path;
use std::sync::atomic::AtomicBool;
use std::sync::mpsc;
use std::sync::Arc;
use std::sync::Mutex;
use std::time::Duration;
use std::vec;
use sysinfo::UpdateKind;
use sysinfo::{ProcessRefreshKind, RefreshKind, System};

use crate::log;
Expand Down Expand Up @@ -207,8 +207,10 @@ impl ProcessServer {

pub fn process_list() -> Vec<Exec> {
let mut processes = Vec::new();
let sys =
System::new_with_specifics(RefreshKind::nothing().with_processes(ProcessRefreshKind::nothing().with_exe(UpdateKind::Always)));
let sys = System::new_with_specifics(
RefreshKind::nothing()
.with_processes(ProcessRefreshKind::nothing().with_exe(UpdateKind::Always)),
);

for proc in sys.processes() {
processes.push(Exec {
Expand Down

0 comments on commit 140d1b8

Please sign in to comment.