Compare commits

...

7 Commits

297
Cargo.lock generated

@ -4,9 +4,9 @@ version = 3
[[package]] [[package]]
name = "addr2line" name = "addr2line"
version = "0.20.0" version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb"
dependencies = [ dependencies = [
"gimli", "gimli",
] ]
@ -17,6 +17,15 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "aho-corasick"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c378d78423fdad8089616f827526ee33c19f2fddbd5de1629152c9593ba4783"
dependencies = [
"memchr",
]
[[package]] [[package]]
name = "android-tzdata" name = "android-tzdata"
version = "0.1.1" version = "0.1.1"
@ -88,9 +97,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]] [[package]]
name = "backtrace" name = "backtrace"
version = "0.3.68" version = "0.3.69"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837"
dependencies = [ dependencies = [
"addr2line", "addr2line",
"cc", "cc",
@ -103,9 +112,9 @@ dependencies = [
[[package]] [[package]]
name = "base64" name = "base64"
version = "0.21.2" version = "0.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
@ -127,9 +136,9 @@ checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1"
[[package]] [[package]]
name = "bytes" name = "bytes"
version = "1.4.0" version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
[[package]] [[package]]
name = "cc" name = "cc"
@ -148,35 +157,55 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "chrono" name = "chrono"
version = "0.4.26" version = "0.4.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" checksum = "defd4e7873dbddba6c7c91e199c7fcb946abc4a6a4ac3195400bcfb01b5de877"
dependencies = [ dependencies = [
"android-tzdata", "android-tzdata",
"iana-time-zone", "iana-time-zone",
"js-sys", "js-sys",
"num-traits", "num-traits",
"time 0.1.45",
"wasm-bindgen", "wasm-bindgen",
"winapi", "windows-targets",
]
[[package]]
name = "chrono-tz"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1369bc6b9e9a7dfdae2055f6ec151fe9c554a9d23d357c0237cee2e25eaabb7"
dependencies = [
"chrono",
"chrono-tz-build",
"phf",
]
[[package]]
name = "chrono-tz-build"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2f5ebdc942f57ed96d560a6d1a459bae5851102a25d5bf89dc04ae453e31ecf"
dependencies = [
"parse-zoneinfo",
"phf",
"phf_codegen",
] ]
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.4.0" version = "4.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d5f1946157a96594eb2d2c10eb7ad9a2b27518cb3000209dec700c35df9197d" checksum = "6a13b88d2c62ff462f88e4a121f17a82c1af05693a2f192b5c38d14de73c19f6"
dependencies = [ dependencies = [
"clap_builder", "clap_builder",
"clap_derive", "clap_derive",
"once_cell",
] ]
[[package]] [[package]]
name = "clap_builder" name = "clap_builder"
version = "4.4.0" version = "4.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78116e32a042dd73c2901f0dc30790d20ff3447f3e3472fad359e8c3d282bcd6" checksum = "2bb9faaa7c2ef94b2743a21f5a29e6f0010dff4caa69ac8e9d6cf8b6fa74da08"
dependencies = [ dependencies = [
"anstream", "anstream",
"anstyle", "anstyle",
@ -186,9 +215,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_derive" name = "clap_derive"
version = "4.4.0" version = "4.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9fd1a5729c4548118d7d70ff234a44868d00489a4b6597b0b020918a0e91a1a" checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",
@ -232,9 +261,9 @@ checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946"
[[package]] [[package]]
name = "encoding_rs" name = "encoding_rs"
version = "0.8.32" version = "0.8.33"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
] ]
@ -247,9 +276,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]] [[package]]
name = "errno" name = "errno"
version = "0.3.2" version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd"
dependencies = [ dependencies = [
"errno-dragonfly", "errno-dragonfly",
"libc", "libc",
@ -352,15 +381,15 @@ dependencies = [
[[package]] [[package]]
name = "gimli" name = "gimli"
version = "0.27.3" version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
[[package]] [[package]]
name = "h2" name = "h2"
version = "0.3.20" version = "0.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833"
dependencies = [ dependencies = [
"bytes", "bytes",
"fnv", "fnv",
@ -558,9 +587,9 @@ checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
[[package]] [[package]]
name = "linux-raw-sys" name = "linux-raw-sys"
version = "0.4.5" version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128"
[[package]] [[package]]
name = "log" name = "log"
@ -570,9 +599,9 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.5.0" version = "2.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c"
[[package]] [[package]]
name = "mime" name = "mime"
@ -596,7 +625,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2"
dependencies = [ dependencies = [
"libc", "libc",
"wasi 0.11.0+wasi-snapshot-preview1", "wasi",
"windows-sys", "windows-sys",
] ]
@ -648,9 +677,9 @@ dependencies = [
[[package]] [[package]]
name = "object" name = "object"
version = "0.31.1" version = "0.32.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
@ -663,11 +692,11 @@ checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
[[package]] [[package]]
name = "openssl" name = "openssl"
version = "0.10.56" version = "0.10.57"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "729b745ad4a5575dd06a3e1af1414bd330ee561c01b3899eb584baeaa8def17e" checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 2.4.0",
"cfg-if", "cfg-if",
"foreign-types", "foreign-types",
"libc", "libc",
@ -695,9 +724,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]] [[package]]
name = "openssl-sys" name = "openssl-sys"
version = "0.9.91" version = "0.9.93"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "866b5f16f90776b9bb8dc1e1802ac6f0513de3a7a7465867bfbc563dc737faac" checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d"
dependencies = [ dependencies = [
"cc", "cc",
"libc", "libc",
@ -705,17 +734,64 @@ dependencies = [
"vcpkg", "vcpkg",
] ]
[[package]]
name = "parse-zoneinfo"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c705f256449c60da65e11ff6626e0c16a0a0b96aaa348de61376b249bc340f41"
dependencies = [
"regex",
]
[[package]] [[package]]
name = "percent-encoding" name = "percent-encoding"
version = "2.3.0" version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
[[package]]
name = "phf"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"
dependencies = [
"phf_shared",
]
[[package]]
name = "phf_codegen"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a"
dependencies = [
"phf_generator",
"phf_shared",
]
[[package]]
name = "phf_generator"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0"
dependencies = [
"phf_shared",
"rand",
]
[[package]]
name = "phf_shared"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b"
dependencies = [
"siphasher",
]
[[package]] [[package]]
name = "pin-project-lite" name = "pin-project-lite"
version = "0.2.12" version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
[[package]] [[package]]
name = "pin-utils" name = "pin-utils"
@ -747,6 +823,21 @@ dependencies = [
"proc-macro2", "proc-macro2",
] ]
[[package]]
name = "rand"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"rand_core",
]
[[package]]
name = "rand_core"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.3.5" version = "0.3.5"
@ -756,11 +847,40 @@ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
] ]
[[package]]
name = "regex"
version = "1.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da"
[[package]] [[package]]
name = "reqwest" name = "reqwest"
version = "0.11.18" version = "0.11.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1"
dependencies = [ dependencies = [
"base64", "base64",
"bytes", "bytes",
@ -801,9 +921,9 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
[[package]] [[package]]
name = "rustix" name = "rustix"
version = "0.38.8" version = "0.38.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" checksum = "bdf14a7a466ce88b5eac3da815b53aefc208ce7e74d1c263aabb04d88c4abeb1"
dependencies = [ dependencies = [
"bitflags 2.4.0", "bitflags 2.4.0",
"errno", "errno",
@ -852,18 +972,18 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.184" version = "1.0.188"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c911f4b04d7385c9035407a4eff5903bf4fe270fa046fda448b69e797f4fff0" checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.184" version = "1.0.188"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1df27f5b29406ada06609b2e2f77fb34f6dbb104a457a671cc31dbed237e09e" checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -872,9 +992,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.105" version = "1.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" checksum = "2cc66a619ed80bf7a0f6b17dd063a84b88f6dea1813737cf469aef1d081142c2"
dependencies = [ dependencies = [
"itoa", "itoa",
"ryu", "ryu",
@ -910,14 +1030,20 @@ checksum = "acee08041c5de3d5048c8b3f6f13fafb3026b24ba43c6a695a0c76179b844369"
dependencies = [ dependencies = [
"log", "log",
"termcolor", "termcolor",
"time 0.3.27", "time",
] ]
[[package]]
name = "siphasher"
version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
[[package]] [[package]]
name = "slab" name = "slab"
version = "0.4.8" version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
dependencies = [ dependencies = [
"autocfg", "autocfg",
] ]
@ -964,9 +1090,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.29" version = "2.0.31"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -997,20 +1123,9 @@ dependencies = [
[[package]] [[package]]
name = "time" name = "time"
version = "0.1.45" version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a"
dependencies = [
"libc",
"wasi 0.10.0+wasi-snapshot-preview1",
"winapi",
]
[[package]]
name = "time"
version = "0.3.27"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bb39ee79a6d8de55f48f2293a830e040392f1c5f16e336bdd1788cd0aadce07" checksum = "17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48"
dependencies = [ dependencies = [
"deranged", "deranged",
"itoa", "itoa",
@ -1029,13 +1144,28 @@ checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb"
[[package]] [[package]]
name = "time-macros" name = "time-macros"
version = "0.2.13" version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "733d258752e9303d392b94b75230d07b0b9c489350c69b851fc6c065fde3e8f9" checksum = "1a942f44339478ef67935ab2bbaec2fb0322496cf3cbe84b261e06ac3814c572"
dependencies = [ dependencies = [
"time-core", "time-core",
] ]
[[package]]
name = "time_tracker"
version = "0.1.0"
dependencies = [
"chrono",
"chrono-tz",
"clap",
"log",
"reqwest",
"serde",
"serde_json",
"simplelog",
"toml",
]
[[package]] [[package]]
name = "tinyvec" name = "tinyvec"
version = "1.6.0" version = "1.6.0"
@ -1093,9 +1223,9 @@ dependencies = [
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.7.6" version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257"
dependencies = [ dependencies = [
"serde", "serde",
"serde_spanned", "serde_spanned",
@ -1114,9 +1244,9 @@ dependencies = [
[[package]] [[package]]
name = "toml_edit" name = "toml_edit"
version = "0.19.14" version = "0.19.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
dependencies = [ dependencies = [
"indexmap 2.0.0", "indexmap 2.0.0",
"serde", "serde",
@ -1180,9 +1310,9 @@ dependencies = [
[[package]] [[package]]
name = "url" name = "url"
version = "2.4.0" version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5"
dependencies = [ dependencies = [
"form_urlencoded", "form_urlencoded",
"idna", "idna",
@ -1210,12 +1340,6 @@ dependencies = [
"try-lock", "try-lock",
] ]
[[package]]
name = "wasi"
version = "0.10.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
[[package]] [[package]]
name = "wasi" name = "wasi"
version = "0.11.0+wasi-snapshot-preview1" version = "0.11.0+wasi-snapshot-preview1"
@ -1415,9 +1539,10 @@ dependencies = [
[[package]] [[package]]
name = "winreg" name = "winreg"
version = "0.10.1" version = "0.50.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1"
dependencies = [ dependencies = [
"winapi", "cfg-if",
"windows-sys",
] ]

@ -1,4 +1,5 @@
[workspace] [workspace]
members = [ members = [
"status_cloud" "status_cloud",
"time_tracker"
] ]

@ -61,7 +61,7 @@ rust-project TODO: write shell script for automatically updating `cargoHash`
pname = "status_cloud"; pname = "status_cloud";
version = "0.1.0"; version = "0.1.0";
buildAndTestSubdir = "status_cloud"; buildAndTestSubdir = "status_cloud";
cargoHash = "sha256-mMxHI/rU1Gd5UR+hZ+5+FnBrff8uF+SrEvGJT7wh5tI="; cargoHash = "sha256-JIiUtHqppZkOa77NRmu+e47JXwZZUluk3jPoJsAusas=";
preBuild = '' preBuild = ''
sed -i 's/Command::new("hddtemp")/Command::new("${nixpkgs.lib.escape [ "/" ] "${pkgs.hddtemp}"}")/g' status_cloud/src/main.rs sed -i 's/Command::new("hddtemp")/Command::new("${nixpkgs.lib.escape [ "/" ] "${pkgs.hddtemp}"}")/g' status_cloud/src/main.rs
''; '';
@ -69,6 +69,15 @@ rust-project TODO: write shell script for automatically updating `cargoHash`
description = "Server status saved to a nextcloud note service."; description = "Server status saved to a nextcloud note service.";
}; };
}); });
time_tracker = pkgs.rustPlatform.buildRustPackage (rustSettings // {
pname = "time_tracker";
version = "0.1.0";
buildAndTestSubdir = "time_tracker";
cargoHash = "sha256-b8qbOh7ATsQnswgFkbeES8VHGhs1OCYCcuyJ4m0bGMs=";
meta = meta // {
description = "Using nextcloud notes to track time usage.";
};
});
}; };
nixosModules.default = { config, ... }: let nixosModules.default = { config, ... }: let
lib = nixpkgs.lib; lib = nixpkgs.lib;
@ -97,6 +106,7 @@ rust-project TODO: write shell script for automatically updating `cargoHash`
''; '';
}; };
}; };
config.systemd.services.status_cloud = let config.systemd.services.status_cloud = let
cfg = config.services.status_cloud; cfg = config.services.status_cloud;
pkg = self.packages.${system}.status_cloud; pkg = self.packages.${system}.status_cloud;
@ -106,7 +116,7 @@ rust-project TODO: write shell script for automatically updating `cargoHash`
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
ExecStart = '' ExecStart = ''
${cfg.package}/bin/status_cloud --config-file ${builtins.toString cfg.config_path} ${cfg.package}/bin/status_cloud --config-file ${builtins.toString cfg.config_path}
''; '';
}; };
}; };
@ -120,6 +130,54 @@ rust-project TODO: write shell script for automatically updating `cargoHash`
timerConfig.OnCalendar = [ "*:0/${builtins.toString cfg.frequency}" ]; timerConfig.OnCalendar = [ "*:0/${builtins.toString cfg.frequency}" ];
}; };
# Time Tracker
options.services.time_tracker = {
enable = lib.mkEnableOption (lib.mdDoc "time tracker service");
package = lib.mkOption {
type = lib.types.package;
default = self.packages.${system}.time_tracker;
defaultText = "pkgs.time_tracker";
description = lib.mdDoc ''
The time_tracker package that should be used
'';
};
config_path = lib.mkOption {
type = lib.types.path;
description = lib.mkDoc ''
The file path to the toml that contains user information secrets
'';
};
frequency = lib.mkOption {
type = lib.types.int;
description = lib.mdDoc ''
The number of minutes to wait between updates
'';
};
};
config.systemd.services.time_tracker = let
cfg = config.services.time_tracker;
pkg = self.packages.${system}.time_tracker;
in lib.mkIf cfg.enable {
description = "Nextcloud Time Tracker";
serviceConfig = {
Type = "oneshot";
ExecStart = ''
${cfg.package}/bin/time_tracker --config-file ${builtins.toString cfg.config_path}
'';
};
};
config.systemd.timers.time_tracker = let
cfg = config.services.time_tracker;
pkg = self.packages.${system}.time_tracker;
in lib.mkIf cfg.enable {
wantedBy = [ "timers.target" ];
partOf = [ "time_tracker.service" ];
timerConfig.OnCalendar = [ "*:0/${builtins.toString cfg.frequency}" ];
};
}; };
}; };
} }

@ -2,7 +2,7 @@ use clap::Parser;
use log::{debug, error, warn}; use log::{debug, error, warn};
use reqwest::blocking::Client; use reqwest::blocking::Client;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::{process::Command, path::PathBuf}; use std::{path::PathBuf, process::Command};
fn main() -> Result<(), Box<dyn std::error::Error>> { fn main() -> Result<(), Box<dyn std::error::Error>> {
let args = CliArgs::parse(); let args = CliArgs::parse();
@ -63,11 +63,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut drive_temps: Vec<String> = vec![]; let mut drive_temps: Vec<String> = vec![];
for drive in drives { for drive in drives {
let output = match Command::new("hddtemp") let output = match Command::new("hddtemp").arg("--unit=F").arg(&drive).output() {
.arg("--unit=F")
.arg(&drive)
.output()
{
Ok(val) => String::from_utf8_lossy(&val.stdout).into_owned(), Ok(val) => String::from_utf8_lossy(&val.stdout).into_owned(),
Err(e) => { Err(e) => {
warn!("Error running hddtemp: {e}"); warn!("Error running hddtemp: {e}");
@ -89,17 +85,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
Client::new() Client::new()
.put(format!( .put(format!(
"https://{}/index.php/apps/notes/api/v1/notes/{}", "https://{}/index.php/apps/notes/api/v1/notes/{}",
&cfg.server_url, &cfg.server_url, &cfg.note_id
&cfg.note_id
)) ))
.header("Accept", "application/json") .header("Accept", "application/json")
.header("Content-Type", "application/json") .header("Content-Type", "application/json")
.basic_auth(&cfg.user, Some(&cfg.pswd)) .basic_auth(&cfg.user, Some(&cfg.pswd))
.body( .body(serde_json::to_string(&NoteUpdate {
serde_json::to_string(&NoteUpdate { content: body_content,
content: body_content, })?)
})?,
)
.send()?; .send()?;
Ok(()) Ok(())

@ -0,0 +1,17 @@
[package]
name = "time_tracker"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
chrono = "0.4.26"
chrono-tz = "0.8.3"
clap = { version = "4.4.0", features = ["derive"] }
log = "0.4.20"
reqwest = { version = "0.11.18", features = ["blocking", "json"] }
serde = { version = "1.0.184", features = ["serde_derive"] }
serde_json = "1.0.105"
simplelog = "0.12.1"
toml = "0.7.6"

@ -0,0 +1,222 @@
use chrono::{DateTime, Datelike, Utc};
use chrono_tz::US::Central;
use clap::Parser;
use log::{debug, error};
use reqwest::blocking::Client;
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// --- Loading and setup ---
let args = CliArgs::parse();
simplelog::SimpleLogger::init(
match args.debug {
true => simplelog::LevelFilter::Debug,
false => simplelog::LevelFilter::Info,
},
simplelog::Config::default(),
)?;
debug!("Opening Config file: {}", args.config_file.display());
debug!(
"Config file exists: {}",
std::fs::metadata(&args.config_file).is_ok()
);
let file_contents = match std::fs::read_to_string(&args.config_file) {
Ok(val) => val,
Err(e) => {
error!("Could not read config file: {e}");
panic!("{e}");
}
};
let cfg: Config = match toml::from_str(&file_contents) {
Ok(val) => val,
Err(e) => {
error!("Could not parse config file: {e}");
panic!("{e}");
}
};
// --- END Loading and setup ---
// --- Get checked and unchecked ---
let primary_note = Client::new()
.get(format!(
"https://{}/index.php/apps/notes/api/v1/notes/{}",
&cfg.server_url, &cfg.primary_note_id
))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.basic_auth(&cfg.user, Some(&cfg.pswd))
.send()?
.json::<Note>()?;
let primary_note_lines: Vec<&str> = primary_note.content.lines().collect();
let mut unchecked: Vec<String> = vec![];
let mut checked: Vec<String> = vec![];
for line in primary_note_lines.iter() {
// if line is a checkbox
if line.starts_with("- [") {
if line.starts_with("- [ ] ") {
unchecked.push(line.replace("- [ ] ", ""));
} else if line.starts_with("- [x] ") {
checked.push(line.replace("- [x] ", ""));
}
}
}
// --- END Get checked and unchecked ---
// --- Get current log ---
let logging_note = Client::new()
.get(format!(
"https://{}/index.php/apps/notes/api/v1/notes/{}",
&cfg.server_url, &cfg.logging_note_id
))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.basic_auth(&cfg.user, Some(&cfg.pswd))
.send()?
.json::<Note>()?;
let now = Utc::now().with_timezone(&Central);
let mut body_content: Vec<String> = vec![format!(
"*Last Updated:* {} Central Time",
now.format("%D - %H:%M:%S")
)];
let logging_note_lines: Vec<&str> = logging_note.content.lines().collect();
for line in logging_note_lines {
if line.starts_with("*Last Updated") {
continue;
}
if line.starts_with("# ") {
body_content.push(line.to_string());
continue;
}
if line.starts_with("### ") {
body_content.push(line.to_string());
continue;
}
// --- Assume it is a started log ---
let split: Vec<&str> = line.split('|').collect();
let item = match split.first() {
Some(val) => val,
None => {
error!("Couldn't split correctly, item 1");
panic!("Couldn't split correctly, item 1");
}
}
.replace('#', "")
.trim()
.to_string();
if unchecked.contains(&item) {
let timestamp = match split.get(1) {
Some(val) => val,
None => {
error!("Couldn't split correctly, item 2");
panic!("Couldn't split correctly, item 2");
}
};
let start_time = match DateTime::parse_from_rfc2822(timestamp) {
Ok(val) => val.with_timezone(&Central),
Err(e) => {
error!("Error parsing time: '{timestamp}' : {e}");
panic!("Error parsing time: '{timestamp}' : {e}");
}
};
let elapsed_time: chrono::Duration = now - start_time;
body_content.push(format!(
"### {item} | {}h {}m | {}/{}/{}",
elapsed_time.num_hours(),
elapsed_time.num_minutes(),
now.month(),
now.day(),
now.year()
));
} else if !line.is_empty() {
body_content.push(line.to_string());
}
checked.retain(|val| val != &item);
}
checked = checked
.into_iter()
.map(|val| {
format!(
"## {val} | {}",
Utc::now().with_timezone(&Central).to_rfc2822()
)
})
.collect();
debug!("checked: {:#?}", checked);
debug!("unchecked: {:#?}", unchecked);
body_content.splice(2..2, checked);
debug!("{:#?}", body_content);
Client::new()
.put(format!(
"https://{}/index.php/apps/notes/api/v1/notes/{}",
&cfg.server_url, &cfg.logging_note_id
))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.basic_auth(&cfg.user, Some(&cfg.pswd))
.body(serde_json::to_string(&NoteUpdate {
content: body_content.join("\n"),
})?)
.send()?;
Ok(())
}
#[derive(Serialize, Deserialize, Debug)]
struct Note {
id: usize,
etag: String,
readonly: bool,
modified: u64,
title: String,
category: String,
content: String,
favorite: bool,
}
#[derive(Serialize, Deserialize, Debug)]
struct NoteUpdate {
content: String,
}
#[derive(Serialize, Deserialize, Default)]
struct Config {
user: String,
pswd: String,
primary_note_id: String,
logging_note_id: String,
server_url: String,
}
#[derive(Parser, Debug)]
#[command(author, version, about, long_about=None)]
struct CliArgs {
/// Path to config .toml file
#[arg(short, long)]
config_file: PathBuf,
#[arg(short, long)]
debug: bool,
}
Loading…
Cancel
Save