mirror of
https://github.com/2e3s/awatcher.git
synced 2025-06-06 11:35:46 +00:00
Bump aw-server-rust
This commit is contained in:
parent
13cea8bed6
commit
85972546f0
@ -8,6 +8,7 @@ extern crate log;
|
|||||||
mod bundle;
|
mod bundle;
|
||||||
mod config;
|
mod config;
|
||||||
|
|
||||||
|
use std::error::Error;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use tokio::signal::unix::{signal, SignalKind};
|
use tokio::signal::unix::{signal, SignalKind};
|
||||||
#[cfg(feature = "bundle")]
|
#[cfg(feature = "bundle")]
|
||||||
@ -15,7 +16,7 @@ use tokio::sync::mpsc;
|
|||||||
use watchers::{run_first_supported, ReportClient, WatcherType};
|
use watchers::{run_first_supported, ReportClient, WatcherType};
|
||||||
|
|
||||||
#[tokio::main(flavor = "current_thread")]
|
#[tokio::main(flavor = "current_thread")]
|
||||||
async fn main() -> anyhow::Result<()> {
|
async fn main() -> anyhow::Result<(), Box<dyn Error>> {
|
||||||
let config = config::from_cli()?;
|
let config = config::from_cli()?;
|
||||||
#[cfg(feature = "bundle")]
|
#[cfg(feature = "bundle")]
|
||||||
let no_tray = config.no_tray;
|
let no_tray = config.no_tray;
|
||||||
|
@ -14,7 +14,7 @@ rstest = "0.19.0"
|
|||||||
tempfile = "3.10.1"
|
tempfile = "3.10.1"
|
||||||
|
|
||||||
[dependencies]
|
[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-client = "0.31.1"
|
||||||
wayland-protocols = { version = "0.31.2", features = ["staging", "client" ]}
|
wayland-protocols = { version = "0.31.2", features = ["staging", "client" ]}
|
||||||
wayland-protocols-plasma = { version = "0.2.0", features = ["client"] }
|
wayland-protocols-plasma = { version = "0.2.0", features = ["client"] }
|
||||||
|
@ -7,7 +7,7 @@ pub use file_config::FileConfig;
|
|||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub port: u32,
|
pub port: u16,
|
||||||
pub host: String,
|
pub host: String,
|
||||||
pub idle_timeout: Duration,
|
pub idle_timeout: Duration,
|
||||||
pub poll_time_idle: Duration,
|
pub poll_time_idle: Duration,
|
||||||
|
@ -7,7 +7,7 @@ pub fn poll_time_idle_seconds() -> u32 {
|
|||||||
pub fn poll_time_window_seconds() -> u32 {
|
pub fn poll_time_window_seconds() -> u32 {
|
||||||
1
|
1
|
||||||
}
|
}
|
||||||
pub fn port() -> u32 {
|
pub fn port() -> u16 {
|
||||||
5600
|
5600
|
||||||
}
|
}
|
||||||
pub fn host() -> String {
|
pub fn host() -> String {
|
||||||
|
@ -52,7 +52,7 @@ pub fn default_config() -> String {
|
|||||||
#[derive(Deserialize, DefaultFromSerde)]
|
#[derive(Deserialize, DefaultFromSerde)]
|
||||||
pub struct ServerConfig {
|
pub struct ServerConfig {
|
||||||
#[serde(default = "defaults::port")]
|
#[serde(default = "defaults::port")]
|
||||||
pub port: u32,
|
pub port: u16,
|
||||||
#[serde(default = "defaults::host")]
|
#[serde(default = "defaults::host")]
|
||||||
pub host: String,
|
pub host: String,
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ use aw_client_rust::{AwClient, Event as AwEvent};
|
|||||||
use chrono::{DateTime, Duration, Utc};
|
use chrono::{DateTime, Duration, Utc};
|
||||||
use serde_json::{Map, Value};
|
use serde_json::{Map, Value};
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
|
use std::error::Error;
|
||||||
|
|
||||||
pub struct ReportClient {
|
pub struct ReportClient {
|
||||||
pub client: AwClient,
|
pub client: AwClient,
|
||||||
@ -13,8 +14,8 @@ pub struct ReportClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ReportClient {
|
impl ReportClient {
|
||||||
pub async fn new(config: Config) -> anyhow::Result<Self> {
|
pub async fn new(config: Config) -> anyhow::Result<Self, Box<dyn Error>> {
|
||||||
let client = AwClient::new(&config.host, &config.port.to_string(), "awatcher");
|
let client = AwClient::new(&config.host, config.port, "awatcher")?;
|
||||||
|
|
||||||
let hostname = gethostname::gethostname().into_string().unwrap();
|
let hostname = gethostname::gethostname().into_string().unwrap();
|
||||||
let idle_bucket_name = format!("aw-watcher-afk_{hostname}");
|
let idle_bucket_name = format!("aw-watcher-afk_{hostname}");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user