diff --git a/.github/release-body.md b/.github/release-body.md index da727a8..99e2656 100644 --- a/.github/release-body.md +++ b/.github/release-body.md @@ -1,7 +1,18 @@ -### 2023-08-25 +### 2023-09-24 + +### Chores ++ dependencies updated, [315c775a98a21272a0f9fd7b1ab189afa6a6eb45], [235e2eb436ad2e7114c8914cdfd33800c5fb51c4] + +### Docs ++ README build for gnu, [7e0f1694f56a62b63931aa5762b7ef1dffe4894f] + +### Fixes ++ remove camera deadlock, [5f1a06c44f5607fde3b9c4e571f1f38f93c2eb17] + +### Refactors ++ improved systemd procedure, [6efa8213b5a469d99eaa1713b8b0650774f2c7b1] ++ systemd install error handling improvement, [1009893af32c69072afda20f545819d9692c439e] -### Features -+ swap base64 crate for data-encoding, [2895a0c89c263fc8cfae58bc0d408b93beb6f5b9] see CHANGELOG.md for more details diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d279e9..6ae8950 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +# v0.2.7 +### 2023-09-24 + +### Chores ++ dependencies updated,[315c775a](https://github.com/mrjackwills/leafcast_pi/commit/315c775a98a21272a0f9fd7b1ab189afa6a6eb45),[235e2eb4](https://github.com/mrjackwills/leafcast_pi/commit/235e2eb436ad2e7114c8914cdfd33800c5fb51c4) + +### Docs ++ README build for gnu,[7e0f1694](https://github.com/mrjackwills/leafcast_pi/commit/7e0f1694f56a62b63931aa5762b7ef1dffe4894f) + +### Fixes ++ remove camera deadlock,[5f1a06c4](https://github.com/mrjackwills/leafcast_pi/commit/5f1a06c44f5607fde3b9c4e571f1f38f93c2eb17) + +### Refactors ++ improved systemd procedure,[6efa8213](https://github.com/mrjackwills/leafcast_pi/commit/6efa8213b5a469d99eaa1713b8b0650774f2c7b1) ++ systemd install error handling improvement,[1009893a](https://github.com/mrjackwills/leafcast_pi/commit/1009893af32c69072afda20f545819d9692c439e) + + # v0.2.6 ### 2023-08-25 diff --git a/Cargo.lock b/Cargo.lock index f62ae7b..d07b5c8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aho-corasick" -version = "1.0.4" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a" +checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" dependencies = [ "memchr", ] @@ -57,9 +57,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" +checksum = "b84bf0a05bbb2a83e5eb6fa36bb6e87baa08193c35ff52bbf6b38d8af2890e46" [[package]] name = "anstyle-parse" @@ -91,9 +91,9 @@ dependencies = [ [[package]] name = "async-compression" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b74f44609f0f91493e3082d3734d98497e094777144380ea4db9f9905dd5b6" +checksum = "bb42b2197bf15ccb092b62c74515dbd8b86d0effd934795f6687c93b6e679a2c" dependencies = [ "brotli", "flate2", @@ -126,9 +126,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.2" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" [[package]] name = "bit_field" @@ -174,15 +174,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "bytemuck" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" +checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" [[package]] name = "byteorder" @@ -192,9 +192,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cc" @@ -214,20 +214,19 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.4.0" +version = "4.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d5f1946157a96594eb2d2c10eb7ad9a2b27518cb3000209dec700c35df9197d" +checksum = "b1d7b8d5ec32af0fadc644bf1fd509a688c2103b185644bb1e29d164e0703136" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.4.0" +version = "4.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78116e32a042dd73c2901f0dc30790d20ff3447f3e3472fad359e8c3d282bcd6" +checksum = "5179bb514e4d7c2051749d8fcefa2ed6d06a9f4e6d69faf3805f5d80b8cf8d56" dependencies = [ "anstream", "anstyle", @@ -239,9 +238,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.4.0" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9fd1a5729c4548118d7d70ff234a44868d00489a4b6597b0b020918a0e91a1a" +checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" dependencies = [ "heck", "proc-macro2", @@ -405,9 +404,9 @@ dependencies = [ [[package]] name = "exr" -version = "1.7.0" +version = "1.71.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1e481eb11a482815d3e9d618db8c42a93207134662873809335a92327440c18" +checksum = "832a761f35ab3e6664babfbdc6cef35a4860e816ec3916dcfd0882954e98a8a8" dependencies = [ "bit_field", "flume", @@ -446,14 +445,10 @@ dependencies = [ [[package]] name = "flume" -version = "0.10.14" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" +checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" dependencies = [ - "futures-core", - "futures-sink", - "nanorand", - "pin-project", "spin 0.9.8", ] @@ -542,10 +537,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", - "js-sys", "libc", "wasi", - "wasm-bindgen", ] [[package]] @@ -612,9 +605,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "http" @@ -775,7 +768,7 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "leafcast" -version = "0.2.6" +version = "0.2.7" dependencies = [ "clap", "data-encoding", @@ -795,7 +788,6 @@ dependencies = [ "tracing", "tracing-appender", "tracing-subscriber", - "users", ] [[package]] @@ -806,15 +798,15 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" [[package]] name = "libwebp-sys" -version = "0.9.2" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5df1e76f0acef0058aa2164ccf74e610e716e7f9eeb3ee2283de7d43659d823" +checksum = "3e0df0a0f9444d52aee6335cd724d21a2ee3285f646291799a72be518ec8ee3c" dependencies = [ "cc", "glob", @@ -838,9 +830,9 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" [[package]] name = "memoffset" @@ -878,15 +870,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "nanorand" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" -dependencies = [ - "getrandom", -] - [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -948,9 +931,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ "memchr", ] @@ -1049,26 +1032,6 @@ dependencies = [ "siphasher", ] -[[package]] -name = "pin-project" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "pin-project-lite" version = "0.2.13" @@ -1102,9 +1065,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" dependencies = [ "unicode-ident", ] @@ -1159,9 +1122,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" dependencies = [ "either", "rayon-core", @@ -1169,14 +1132,12 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" dependencies = [ - "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "num_cpus", ] [[package]] @@ -1190,9 +1151,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.3" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" +checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47" dependencies = [ "aho-corasick", "memchr", @@ -1202,9 +1163,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.6" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" +checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795" dependencies = [ "aho-corasick", "memchr", @@ -1213,9 +1174,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "reqwest" @@ -1281,9 +1242,9 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustls" -version = "0.21.6" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1feddffcfcc0b33f5c6ce9a29e341e4cd59c3f78e7ee45f4a40c038b1d6cbb" +checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" dependencies = [ "log", "ring", @@ -1314,9 +1275,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.4" +version = "0.101.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d93931baf2d282fff8d3a532bbfd7653f734643161b87e3e01e59a04439bf0d" +checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" dependencies = [ "ring", "untrusted", @@ -1378,9 +1339,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.187" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30a7fe14252655bd1e578af19f5fa00fe02fd0013b100ca6b49fde31c41bae4c" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" dependencies = [ "serde_derive", ] @@ -1399,9 +1360,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.187" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e46b2a6ca578b3f1d4501b12f78ed4692006d79d82a1a7c561c12dbc3d625eb8" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", @@ -1410,9 +1371,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.105" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" dependencies = [ "itoa", "ryu", @@ -1433,9 +1394,9 @@ dependencies = [ [[package]] name = "sha1" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", @@ -1483,9 +1444,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "socket2" @@ -1499,9 +1460,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" dependencies = [ "libc", "windows-sys", @@ -1540,9 +1501,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.29" +version = "2.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8" dependencies = [ "proc-macro2", "quote", @@ -1551,18 +1512,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.47" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" +checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.47" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" +checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" dependencies = [ "proc-macro2", "quote", @@ -1592,9 +1553,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.27" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb39ee79a6d8de55f48f2293a830e040392f1c5f16e336bdd1788cd0aadce07" +checksum = "426f806f4089c493dcac0d24c29c01e2c38baf8e30f1b716ee37e83d200b18fe" dependencies = [ "deranged", "itoa", @@ -1608,15 +1569,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.13" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "733d258752e9303d392b94b75230d07b0b9c489350c69b851fc6c065fde3e8f9" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" dependencies = [ "time-core", ] @@ -1666,7 +1627,7 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.3", + "socket2 0.5.4", "tokio-macros", "windows-sys", ] @@ -1694,9 +1655,9 @@ dependencies = [ [[package]] name = "tokio-tungstenite" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2dbec703c26b00d74844519606ef15d09a7d6857860f84ad223dec002ddea2" +checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" dependencies = [ "futures-util", "log", @@ -1709,9 +1670,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" dependencies = [ "bytes", "futures-core", @@ -1817,9 +1778,9 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "tungstenite" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e862a1c4128df0112ab625f55cd5c934bcb4312ba80b39ae4b4835a3fd58e649" +checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9" dependencies = [ "byteorder", "bytes", @@ -1837,9 +1798,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicase" @@ -1858,9 +1819,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" @@ -1873,9 +1834,9 @@ dependencies = [ [[package]] name = "unicode-width" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] name = "untrusted" @@ -1885,25 +1846,15 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", "percent-encoding", ] -[[package]] -name = "users" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24cc0f6d6f267b73e5a2cadf007ba8f9bc39c6a6f9666f8cf25ea809a153b032" -dependencies = [ - "libc", - "log", -] - [[package]] name = "utf-8" version = "0.7.6" @@ -2021,9 +1972,9 @@ dependencies = [ [[package]] name = "webp" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ff0ebb440d1db63b778cb609db8a8abfda825a7841664a76a70b628502c7e1" +checksum = "4bb5d8e7814e92297b0e1c773ce43d290bef6c17452dafd9fc49e5edb5beba71" dependencies = [ "libwebp-sys", ] @@ -2134,9 +2085,9 @@ dependencies = [ [[package]] name = "xml-rs" -version = "0.8.16" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47430998a7b5d499ccee752b41567bc3afc57e1327dc855b1a2aa44ce29b5fa1" +checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" [[package]] name = "zune-inflate" diff --git a/Cargo.toml b/Cargo.toml index 10f959b..1501a54 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "leafcast" -version = "0.2.6" +version = "0.2.7" edition = "2021" authors = ["Jack Wills "] description = "leafcast pi client" @@ -26,11 +26,11 @@ tokio-tungstenite={version= "0.20", features = ["rustls-tls-native-roots"]} tracing = "0.1" tracing-appender = "0.2" tracing-subscriber = {version="0.3", features = ["json"]} -users = "0.11" [profile.release] lto = true codegen-units = 1 panic = 'abort' -strip=true +strip =true debug = false +opt-level = "s" diff --git a/README.md b/README.md index 94a5aa2..2f11a53 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,9 @@ ip address gets updated every 5 minutes, so write to a ramdrive rather than caus requires docker & cross-rs -1) ```cross build --target aarch64-unknown-linux-musl --release``` +1) ```cross build --target aarch64-unknown-linux-musl --release``` or ```cross build --target aarch64-unknown-linux-gnu --release``` + + ## Tests diff --git a/src/camera.rs b/src/camera.rs index d6ad6fa..7894491 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -156,7 +156,7 @@ impl Camera { photo_buffer } - // maybe store the image as web64 instead of &[u8] + // store the image as web64 instead of &[u8] pub fn get_webp(&self) -> &[u8] { &self.image_webp } diff --git a/src/main.rs b/src/main.rs index 9fafe1c..c78ce5c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -33,8 +33,10 @@ use tracing_subscriber::{fmt, prelude::__tracing_subscriber_SubscriberExt}; use word_art::Intro; use ws::open_connection; +const LOGS_NAME: &str = "leafcast.log"; + fn setup_tracing(app_env: &AppEnv) -> Result<(), AppError> { - let logfile = tracing_appender::rolling::never(&app_env.location_log, "leafcast.log"); + let logfile = tracing_appender::rolling::never(&app_env.location_log, LOGS_NAME); let log_fmt = fmt::Layer::default() .json() @@ -62,7 +64,7 @@ async fn main() -> Result<(), AppError> { let app_envs = AppEnv::get(); let cli = CliArgs::new(); setup_tracing(&app_envs)?; - systemd::check(&cli); + systemd::check(&cli, &app_envs); Intro::new(&app_envs).show(); let camera = Arc::new(Mutex::new(Camera::init(&app_envs).await)); Croner::init(Arc::clone(&camera)); diff --git a/src/systemd.rs b/src/systemd.rs index 3e64287..5e77192 100644 --- a/src/systemd.rs +++ b/src/systemd.rs @@ -1,10 +1,12 @@ -use crate::app_error::AppError; +use crate::app_env::AppEnv; use crate::parse_cli::CliArgs; -use std::{env, fs, io::Write, os::unix::fs::PermissionsExt, path::Path, process::Command}; +use crate::{app_error::AppError, LOGS_NAME}; +use std::{env, fs, io::Write, path::Path, process::Command}; use tracing::{error, info}; -const SC: &str = "systemctl"; +const SYSTEMCTL: &str = "systemctl"; const APP_NAME: &str = env!("CARGO_PKG_NAME"); +const CHOWN: &str = "chown"; enum Code { Valid, @@ -31,40 +33,44 @@ fn check_sudo() { } /// Get user name, to check if is sudo -fn get_user_name() -> String { - let mut user_name: Option = None; - for i in env::vars() { - if i.0 == "SUDO_USER" { - user_name = Some(i.1); +fn get_user_name() -> Option { + std::env::var("SUDO_USER").map_or(None, |user_name| { + if user_name == "root" || user_name.is_empty() { + None + } else { + Some(user_name) } - } - if user_name.is_none() { - exit("unable to get username", &Code::Invalid); - } - let user_name = user_name.unwrap_or_default(); - if user_name == "ROOT" || user_name.is_empty() { - exit("invalid username", &Code::Invalid); - } - user_name + }) } /// Check if unit file in systemd, and delete if true -fn uninstall_service() -> Result<(), AppError> { - let service = get_service_name(); +fn uninstall_service(app_envs: &AppEnv) -> Result<(), AppError> { + if let Some(user_name) = get_user_name() { + let service = get_service_name(); + + let path = get_dot_service(); - let path = get_dot_service(); - if Path::new(&path).exists() { - info!("Stopping service"); - Command::new(SC).args(["stop", &service]).output()?; + if Path::new(&path).exists() { + info!("Stopping service"); + Command::new(SYSTEMCTL).args(["stop", &service]).output()?; - info!("Disabling service"); - Command::new(SC).args(["disable", &service]).output()?; + info!("Disabling service"); + Command::new(SYSTEMCTL) + .args(["disable", &service]) + .output()?; - info!("Removing service file"); - fs::remove_file(path)?; + info!("Removing service file"); + fs::remove_file(path)?; - info!("Reload daemon-service"); - Command::new(SC).arg("daemon-reload").output()?; + info!("Reload daemon-service"); + Command::new(SYSTEMCTL).arg("daemon-reload").output()?; + + info!("Change logs ownership"); + let logs_path = format!("{}/{}", app_envs.location_log, LOGS_NAME); + Command::new(CHOWN) + .args([&format!("{user_name}:{user_name}"), &logs_path]) + .output()?; + } } Ok(()) } @@ -97,7 +103,7 @@ SyslogIdentifier={APP_NAME} User={user_name} Group={user_name} Restart=always -RestartSec=1 +RestartSec=5 [Install] WantedBy=multi-user.target @@ -105,48 +111,50 @@ WantedBy=multi-user.target )) } /// If is sudo, and able to get a user name (which isn't root), install leafcast as a service -fn install_service() -> Result<(), AppError> { - let user_name = get_user_name(); - - let dot_service = create_service_file(&user_name); - - let path = get_dot_service(); - - info!("Create service file"); - let mut file = fs::File::create(path)?; - - info!("Write unit text to file"); - file.write_all(dot_service?.as_bytes())?; - - info!("Set correct service file permissions"); - let metadata = file.metadata()?; - let mut permissions = metadata.permissions(); - permissions.set_mode(0o644); - - info!("Reload systemctl daemon"); - Command::new(SC).arg("daemon-reload").output()?; - - let service_name = get_service_name(); - info!("Enable service"); - Command::new(SC).args(["enable", &service_name]).output()?; - - info!("Start service"); - Command::new(SC).args(["start", &service_name]).output()?; - +fn install_service(app_envs: &AppEnv) -> Result<(), AppError> { + if let Some(user_name) = get_user_name() { + info!("Create service file"); + let mut file = fs::File::create(get_dot_service())?; + + info!("Write unit text to file"); + file.write_all(create_service_file(&user_name)?.as_bytes())?; + + info!("Reload systemctl daemon"); + Command::new(SYSTEMCTL).arg("daemon-reload").output()?; + + let service_name = get_service_name(); + info!("Enable service"); + Command::new(SYSTEMCTL) + .args(["enable", &service_name]) + .output()?; + + info!("Change logs ownership"); + let logs_path = format!("{}/{}", app_envs.location_log, LOGS_NAME); + Command::new(CHOWN) + .args([&format!("{APP_NAME}:{APP_NAME}"), &logs_path]) + .output()?; + + info!("Start service"); + Command::new(SYSTEMCTL) + .args(["start", &service_name]) + .output()?; + } else { + exit("invalid user", &Code::Invalid); + } Ok(()) } /// if cli argument provided, (un)install service in systemd -pub fn check(cli: &CliArgs) { +pub fn check(cli: &CliArgs, app_envs: &AppEnv) { if cli.install { check_sudo(); - uninstall_service() + uninstall_service(app_envs) .unwrap_or_else(|_| exit("uninstall old service failure", &Code::Invalid)); - install_service().unwrap_or_else(|_| exit("install failure", &Code::Invalid)); + install_service(app_envs).unwrap_or_else(|_| exit("install failure", &Code::Invalid)); exit("Installed service", &Code::Valid); } else if cli.uninstall { check_sudo(); - uninstall_service() + uninstall_service(app_envs) .unwrap_or_else(|_| exit("uninstall old service failure", &Code::Invalid)); exit("Uninstalled service", &Code::Valid); } diff --git a/src/ws/ws_sender.rs b/src/ws/ws_sender.rs index a5d7b69..3a0f0ee 100644 --- a/src/ws/ws_sender.rs +++ b/src/ws/ws_sender.rs @@ -49,14 +49,13 @@ impl WSSender { MessageValues::Valid(data, unique) => match data { ParsedMessage::ForceUpdate => { self.camera.lock().await.take_photo().await; - let response = self - .generate_response(self.camera.lock().await.get_webp().to_owned()) - .await; + let webp = self.camera.lock().await.get_webp().to_owned(); + let response = self.generate_response(&webp).await; self.send_ws_response(response, unique, Some(true)).await; } ParsedMessage::Photo => { let webp = self.camera.lock().await.get_webp().to_owned(); - let response = self.generate_response(webp).await; + let response = self.generate_response(&webp).await; self.send_ws_response(response, unique, Some(true)).await; } }, @@ -65,7 +64,7 @@ impl WSSender { } /// Create a photo response, is the only response this app sends (other than pongs) - async fn generate_response(&self, photo_buffer: Vec) -> Response { + async fn generate_response(&self, photo_buffer: &[u8]) -> Response { let camera = self.camera.lock().await; let date_time = OffsetDateTime::from(camera.get_timestamp()) .to_offset(self.app_envs.timezone.get_offset()); @@ -83,10 +82,7 @@ impl WSSender { let pi_info = SysInfo::new(&self.app_envs, connected_at).await; Response::Photo(Photo { - image: format!( - "data:image/webp;base64,{}", - BASE64.encode(photo_buffer.as_slice()) - ), + image: format!("data:image/webp;base64,{}", BASE64.encode(photo_buffer)), pi_info, timestamp, size_converted,