Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump aw-server-rust #22

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ extern crate log;
mod bundle;
mod config;

use std::error::Error;
use std::sync::Arc;
use tokio::signal::unix::{signal, SignalKind};
#[cfg(feature = "bundle")]
use tokio::sync::mpsc;
use watchers::{run_first_supported, ReportClient, WatcherType};

#[tokio::main(flavor = "current_thread")]
async fn main() -> anyhow::Result<()> {
async fn main() -> anyhow::Result<(), Box<dyn Error>> {
let config = config::from_cli()?;
#[cfg(feature = "bundle")]
let no_tray = config.no_tray;
Expand Down
2 changes: 1 addition & 1 deletion watchers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rstest = "0.19.0"
tempfile = "3.10.1"

[dependencies]
aw-client-rust = { git = "https://github.com/ActivityWatch/aw-server-rust", rev = "448312d" }
aw-client-rust = { git = "https://github.com/ActivityWatch/aw-server-rust", rev = "9275009" }
wayland-client = "0.31.1"
wayland-protocols = { version = "0.31.2", features = ["staging", "client" ]}
wayland-protocols-plasma = { version = "0.2.0", features = ["client"] }
Expand Down
2 changes: 1 addition & 1 deletion watchers/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub use file_config::FileConfig;
use std::time::Duration;

pub struct Config {
pub port: u32,
pub port: u16,
pub host: String,
pub idle_timeout: Duration,
pub poll_time_idle: Duration,
Expand Down
2 changes: 1 addition & 1 deletion watchers/src/config/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub fn poll_time_idle_seconds() -> u32 {
pub fn poll_time_window_seconds() -> u32 {
1
}
pub fn port() -> u32 {
pub fn port() -> u16 {
5600
}
pub fn host() -> String {
Expand Down
2 changes: 1 addition & 1 deletion watchers/src/config/file_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub fn default_config() -> String {
#[derive(Deserialize, DefaultFromSerde)]
pub struct ServerConfig {
#[serde(default = "defaults::port")]
pub port: u32,
pub port: u16,
#[serde(default = "defaults::host")]
pub host: String,
}
Expand Down
5 changes: 3 additions & 2 deletions watchers/src/report_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use aw_client_rust::{AwClient, Event as AwEvent};
use chrono::{DateTime, Duration, Utc};
use serde_json::{Map, Value};
use std::future::Future;
use std::error::Error;

pub struct ReportClient {
pub client: AwClient,
Expand All @@ -13,8 +14,8 @@ pub struct ReportClient {
}

impl ReportClient {
pub async fn new(config: Config) -> anyhow::Result<Self> {
let client = AwClient::new(&config.host, &config.port.to_string(), "awatcher");
pub async fn new(config: Config) -> anyhow::Result<Self, Box<dyn Error>> {
let client = AwClient::new(&config.host, config.port, "awatcher")?;

let hostname = gethostname::gethostname().into_string().unwrap();
let idle_bucket_name = format!("aw-watcher-afk_{hostname}");
Expand Down
Loading