From 03bea24f9de698375033af92a08762446d0e20cc Mon Sep 17 00:00:00 2001 From: FxQnLr Date: Sun, 25 Feb 2024 16:14:56 +0100 Subject: Closes #2. Config and setup stuff --- docker-compose.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'docker-compose.yml') diff --git a/docker-compose.yml b/docker-compose.yml index 3a0ade5..f41f4c9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,20 +1,20 @@ services: webol: - image: ghcr.io/fxqnlr/webol:dev-6 - container_name: webol + image: ghcr.io/fxqnlr/webol:dev-9 + container_name: webol-cli-server restart: no depends_on: - db environment: - RUST_LOG=info,webol=trace - WEBOL_DATABASE_URL=postgres://postgres:postgres@localhost:5432/webol - - WEBOL_APIKEY=aaa + - WEBOL_APIKEY=dev - WEBOL_SERVERADDR=127.0.0.1:7229 network_mode: host db: image: postgres - container_name: webol-db + container_name: webol-cli-db restart: no environment: POSTGRES_PASSWORD: postgres -- cgit v1.2.3 From 3a2dc1f2741f7bf4d72c1cbe0fd1993af157ceaa Mon Sep 17 00:00:00 2001 From: FxQnLr Date: Sun, 25 Feb 2024 20:50:50 +0100 Subject: Closes #5. Eta works --- docker-compose.yml | 2 +- src/main.rs | 6 +++--- src/requests/start.rs | 10 ++++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) (limited to 'docker-compose.yml') diff --git a/docker-compose.yml b/docker-compose.yml index f41f4c9..ea10db2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,7 +9,7 @@ services: - RUST_LOG=info,webol=trace - WEBOL_DATABASE_URL=postgres://postgres:postgres@localhost:5432/webol - WEBOL_APIKEY=dev - - WEBOL_SERVERADDR=127.0.0.1:7229 + - WEBOL_SERVERADDR=0.0.0.0:7229 network_mode: host db: diff --git a/src/main.rs b/src/main.rs index d76341f..5a0931d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,9 +16,9 @@ mod config; mod error; mod requests; -static OVERVIEW_STYLE: &str = "{spinner:.green} ({elapsed}{wide_msg}"; -static OVERVIEW_ERROR: &str = "✗ ({elapsed}) {wide_msg}"; -static OVERVIEW_DONE: &str = "✓ ({elapsed}) {wide_msg}"; +static OVERVIEW_STYLE: &str = "{spinner:.green} ({elapsed_precise}{wide_msg}"; +static OVERVIEW_ERROR: &str = "✗ ({elapsed_precise}) {wide_msg}"; +static OVERVIEW_DONE: &str = "✓ ({elapsed_precise}) {wide_msg}"; static DEFAULT_STYLE: &str = " {spinner:.green} {wide_msg}"; static DONE_STYLE: &str = " ✓ {wide_msg}"; static ERROR_STYLE: &str = " ✗ {wide_msg}"; diff --git a/src/requests/start.rs b/src/requests/start.rs index d07177e..3afbe3a 100644 --- a/src/requests/start.rs +++ b/src/requests/start.rs @@ -121,12 +121,18 @@ async fn status_socket( } } -fn get_eta(msg: &str, uuid: &str) -> Result { +fn get_eta(msg: &str, uuid: &str) -> Result { let spl: Vec<&str> = msg.split('_').collect(); if (spl[0] != "eta") || (spl[2] != uuid) { return Err(Error::WsResponse); }; - Ok(spl[1].parse()?) + let input: u64 = spl[1].parse()?; + + let sec = input % 60; + let min = (input / 60) % 60; + let hou = (input / (60 * 60)) % 60; + + Ok(format!("{hou:0>2}:{min:0>2}:{sec:0>2}")) } fn verify_response(res: &str, org_uuid: &str) -> Result { -- cgit v1.2.3