From 8765cbf3a2e64de60435bbdd3e6491cba0022a7b Mon Sep 17 00:00:00 2001 From: marttcw Date: Mon, 1 Mar 2021 19:48:03 +0000 Subject: [PATCH] v0.0.4 RELEASE: Removed daemon option+usaged. Updated README. REMOVED: Daemonization. Daemonization causes the counter to not work, therefore it is removed. README: Updated for v0.0.4 release. --- Cargo.toml | 3 --- README.md | 33 ++++++++++++++++++++------------- src/cli.rs | 4 ---- src/count.rs | 2 ++ src/main.rs | 33 +-------------------------------- src/notify.rs | 9 --------- 6 files changed, 23 insertions(+), 61 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7385b39..d49fe6d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,3 @@ tokio = { version = "1", features = ["full"] } futures = "0.3" a2s = { git = "https://github.com/rumblefrog/a2s-rs.git" } -[target.'cfg(unix)'.dependencies] -daemonize = "0.4.1" - diff --git a/README.md b/README.md index a3de8a3..fc7c5c9 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,24 @@ # steamcountsnotifyd SteamCountsNotifyD is a notification daemon written in Rust that notifies you when your selected game(s) gets some player activity -* Development release: v0.0.4 - Alpha -* Current release: v0.0.2 - Alpha +* Current release: v0.0.4 - Alpha +* (In-Development) Next release: v0.0.5 - Alpha ## License SteamCountsNotifyD is released under a the [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.html) a free software copyleft license. ## Dependencies +* serde, serde\_json, toml, dirs-next, notify-rust, clap, reqwest, tokio, futures, a2s + * All apart from a2s are available on [crates.io](https://crates.io/) + * a2s: [a2s-rs repo](https://github.com/rumblefrog/a2s-rs) ## Requirements to build -* [rust](https://www.rust-lang.org/) +* [Rust](https://www.rust-lang.org/) + * Just install with the instructions straight from the site. The compiler and cargo should be provided by default. ## Instructions -### Compile -* `cd steamcountsnotifyd` -* `cargo build` -### Install -* `cargo install` +### Compile and Install +* `cargo install --path .` ### Uninstall * `cargo uninstall` @@ -27,6 +28,7 @@ SteamCountsNotifyD is released under a the [GNU General Public License v3.0](htt ## Configuration * Uses xdg directory: `$HOME/.config/steamcountsnotifyd/config.toml` * Program will generate the configuration file if user requested via `--generate-config` and is not available + ### Parameters CLI | Name | Description ---|---|--- @@ -35,8 +37,7 @@ CLI | Name | Description `-c` | `connection_timeout` | How long in seconds the connection stay puts. `-n` | `notify_timeout` | How long in seconds the notification stays shown. `-a` | `action_type` | Which type of clickable notification should use: 0 - click, 1 - button -`-d` | `daemonize` | This flag makes the program daemonize -`-g` | `generate` | Generates configuration file at default directory + ### Example ``` interval = 1 @@ -63,16 +64,19 @@ threshold = 0 ### systemd * Use the systemd daemon as under user control, more information: [systemd/User - ArchWiki](https://wiki.archlinux.org/index.php/systemd/User) -## TODO (Possible future features) -* SOON: Per server notification +## TODO +* Edit configuration via the CLI * Improving on the Windows port * Better documentation and comments * Making it work with systemd properly * Support reload function * Support runit and openrc also, sysvinit won't be however +* Configuration: More controls can be given for per game/server + * EX: Give interval for each game/server ## Releases -### v0.0.4 Alpha (Rust Rewrite) +### v0.0.4 Alpha (First Version of Rust Rewrite) +* 2021-03-01: Daemon option and forking/daemonization process removed * Using [a2s-rs](https://github.com/rumblefrog/a2s-rs) library to do Source A2S Queries * Can now query from each server * Roughly working and ported to Windows 10 @@ -82,10 +86,12 @@ threshold = 0 * NOTE: Daemon is there but counter notification not working and CLI flag different/switched * Non-daemon is by default * 2021-02-22: Initial rewrite to Rust + ### v0.0.3 Alpha (Final C++ Version, Unreleased) * Notification hint set to "resident", meaning the game launcher is clickable even if after the notification goes away * However only usable if only "default" (default anyway) is set * Notifies that the daemon started up + ### v0.0.2 Alpha * counts to count (grammar fix) * systemd service file available, but buggy at the moment (need `restart` after a `start`) @@ -94,6 +100,7 @@ threshold = 0 * Added the ability to launch the game (`default` or `clicked` options available) * Added `actiontype` to configuration and command-line paramter * 0 = default, 1 = clicked + ### v0.0.1 Alpha * First release * Basic daemon implementation implemented diff --git a/src/cli.rs b/src/cli.rs index b7571e5..6fc4e24 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -3,10 +3,6 @@ use clap::Clap; #[derive(Clap, Debug)] #[clap(version = "0.0.4 Alpha", author = "mtcw ")] pub struct Opts { - /// Run the program in daemonized/background mode - #[clap(short, long)] - pub daemonize: bool, - /// Generate default configuration file (if not available) #[clap(long)] pub generate_config: bool, diff --git a/src/count.rs b/src/count.rs index 3cc0908..d7542e5 100644 --- a/src/count.rs +++ b/src/count.rs @@ -109,5 +109,7 @@ pub async fn main_loop(cfg: &config::Config) -> Result<(), Box { - println!("Running in daemonize mode..."); - notify::daemon_startup(); - } - Err(why) => eprintln!("ERROR: Cannot daemonize: {}", why), - } -} - -#[cfg(windows)] -fn daemonize() {} - #[tokio::main] async fn main() -> std::io::Result<()> { let opts: cli::Opts = cli::parse(); @@ -89,10 +61,6 @@ async fn main() -> std::io::Result<()> { } } - if opts.daemonize { - daemonize(); - } - match block_on(count::main_loop(&cfg)) { Err(_) => { eprintln!("ERROR: An error in the main loop occured."); @@ -101,3 +69,4 @@ async fn main() -> std::io::Result<()> { Ok(_) => Ok(()), } } + diff --git a/src/notify.rs b/src/notify.rs index 3dacad4..93cb09b 100644 --- a/src/notify.rs +++ b/src/notify.rs @@ -109,12 +109,3 @@ pub fn server(info: &Info, timeout: u32, address: &str, action_type: ActionType) }); } -#[cfg(unix)] -pub fn daemon_startup() { - Notification::new() - .summary("steamcountsnotifyd") - .body("steamcountsnotifyd daemon started up") - .timeout(5000) - .show() - .unwrap(); -}