mirror of
https://github.com/2e3s/awatcher.git
synced 2025-06-04 02:20:15 +00:00
Merge pull request #22 from wojnilowicz/bump-aw-server-rust
This commit is contained in:
commit
cfb3ad858d
@ -8,6 +8,7 @@ extern crate log;
|
||||
mod bundle;
|
||||
mod config;
|
||||
|
||||
use std::error::Error;
|
||||
use std::sync::Arc;
|
||||
use tokio::signal::unix::{signal, SignalKind};
|
||||
#[cfg(feature = "bundle")]
|
||||
@ -15,7 +16,7 @@ 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;
|
||||
|
@ -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"] }
|
||||
|
@ -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,
|
||||
|
@ -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 {
|
||||
|
@ -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,
|
||||
}
|
||||
|
@ -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,
|
||||
@ -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}");
|
||||
|
Loading…
x
Reference in New Issue
Block a user