From b63828da24cdf60204cea7e215e4e90eda6f4230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Misty=20De=20M=C3=A9o?= Date: Thu, 18 Jan 2024 11:02:31 -0800 Subject: [PATCH 01/14] Initial import --- .gitignore | 1 + Cargo.lock | 1542 +++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 25 + src/lib.rs | 359 ++++++++++++ src/main.rs | 21 + 5 files changed, 1948 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 src/lib.rs create mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..7712c53 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1542 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "axoasset" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e10564c39d77b20e377054a9bd70af4bab21ad2768d91567ba05096ba68e8f47" +dependencies = [ + "camino", + "image", + "miette", + "mime", + "serde", + "serde_json", + "thiserror", + "url", + "walkdir", +] + +[[package]] +name = "axoprocess" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41498f64097d1018019acba4ffe65acf502fbbce2310945d34c3c17c2d89fb1d" +dependencies = [ + "miette", + "thiserror", + "tracing", +] + +[[package]] +name = "axoupdater" +version = "0.1.0" +dependencies = [ + "axoasset", + "axoprocess", + "camino", + "homedir", + "miette", + "reqwest", + "serde", + "temp-dir", + "thiserror", +] + +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base64" +version = "0.21.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c79fed4cdb43e993fcdadc7e58a09fd0e3e649c4436fa11da71c9f1f3ee7feb9" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" + +[[package]] +name = "bumpalo" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" + +[[package]] +name = "bytemuck" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" + +[[package]] +name = "camino" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +dependencies = [ + "serde", +] + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "num-traits", + "serde", + "windows-targets 0.48.5", +] + +[[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" + +[[package]] +name = "encoding_rs" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-executor" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" + +[[package]] +name = "futures-macro" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "futures-sink" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" + +[[package]] +name = "h2" +version = "0.3.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" + +[[package]] +name = "hermit-abi" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" + +[[package]] +name = "homedir" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22074da8bba2ef26fc1737ae6c777b5baab5524c2dc403b5c6a76166766ccda5" +dependencies = [ + "cfg-if", + "nix", + "serde", + "widestring", + "windows-sys 0.48.0", + "wmi", +] + +[[package]] +name = "http" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.59" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "image" +version = "0.24.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f3dfdbdd72063086ff443e297b61695500514b1e41095b6fb9a5ab48a70a711" +dependencies = [ + "bytemuck", + "byteorder", + "color_quant", + "num-rational", + "num-traits", +] + +[[package]] +name = "indexmap" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "ipnet" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" + +[[package]] +name = "itoa" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" + +[[package]] +name = "js-sys" +version = "0.3.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.152" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" + +[[package]] +name = "linux-raw-sys" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "memchr" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" + +[[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] + +[[package]] +name = "miette" +version = "5.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59bb584eaeeab6bd0226ccf3509a69d7936d148cf3d036ad350abe35e8c6856e" +dependencies = [ + "miette-derive", + "once_cell", + "thiserror", + "unicode-width", +] + +[[package]] +name = "miette-derive" +version = "5.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.48.0", +] + +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "nix" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "libc", + "memoffset", + "pin-utils", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "openssl" +version = "0.10.62" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671" +dependencies = [ + "bitflags 2.4.2", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" + +[[package]] +name = "proc-macro2" +version = "1.0.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "reqwest" +version = "0.11.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "system-configuration", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustix" +version = "0.38.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" +dependencies = [ + "bitflags 2.4.2", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "ryu" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "security-framework" +version = "2.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "serde" +version = "1.0.195" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.195" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "serde_json" +version = "1.0.111" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "socket2" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "temp-dir" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd16aa9ffe15fe021c6ee3766772132c6e98dfa395a167e16864f61a9cfb71d6" + +[[package]] +name = "tempfile" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall", + "rustix", + "windows-sys 0.52.0", +] + +[[package]] +name = "thiserror" +version = "1.0.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.35.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "pin-project-lite", + "socket2", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "unicode-bidi" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-width" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" + +[[package]] +name = "url" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "walkdir" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.48", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" + +[[package]] +name = "web-sys" +version = "0.3.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "widestring" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.0", +] + +[[package]] +name = "windows-implement" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e2ee588991b9e7e6c8338edf3333fbe4da35dc72092643958ebb43f0ab2c49c" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "windows-interface" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6fb8df20c9bcaa8ad6ab513f7b40104840c8867d5751126e4df3b08388d0cc7" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "wmi" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced703d10188571ce53582c2932ce640ed3c413cff7ee6e2d961f9abdb6a63d1" +dependencies = [ + "chrono", + "futures", + "log", + "serde", + "thiserror", + "windows", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..ff22d9a --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "axoupdater" +version = "0.1.0" +edition = "2021" +license = "MIT OR Apache-2.0" +repository = "https://github.com/axodotdev/axoupdater" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[lib] +name = "axoupdater" +path = "src/lib.rs" + +[dependencies] +axoasset = { version = "0.6.1", default-features = false, features = ["json-serde"]} +axoprocess = "0.1.0" +camino = { version = "1.1.6", features = ["serde1"] } +homedir = "0.2.1" +reqwest = { version = "0.11", default-features = false, features = ["blocking", "default-tls", "json"] } +serde = "1.0.195" +temp-dir = "0.1.12" + +# errors +miette = "5.6.0" +thiserror = "1.0.56" diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..9b3becb --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,359 @@ +use std::{ + env::{self, args, current_dir}, + fs::File, +}; + +#[cfg(unix)] +use std::os::unix::fs::PermissionsExt; + +use axoasset::{AxoassetError, LocalAsset, SourceFile}; +use axoprocess::{AxoprocessError, Cmd}; +use camino::Utf8PathBuf; +use miette::Diagnostic; +use reqwest::{ + self, + header::{ACCEPT, USER_AGENT}, +}; +use serde::Deserialize; +use temp_dir::TempDir; +use thiserror::Error; + +pub struct AxoUpdater { + pub name: Option, + pub source: Option, + latest_release: Option, + current_version: Option, +} + +impl AxoUpdater { + pub fn new() -> AxoUpdater { + AxoUpdater { + name: None, + source: None, + latest_release: None, + current_version: None, + } + } + + pub fn new_for(app_name: &String) -> AxoUpdater { + AxoUpdater { + name: Some(app_name.to_owned()), + source: None, + latest_release: None, + current_version: None, + } + } + + pub fn new_for_updater_executable() -> AxoupdateResult { + let Some(app_name) = get_app_name() else { + return Err(AxoupdateError::NoAppName {}); + }; + + // Happens if the binary didn't get renamed properly + if app_name == "axoupdate" { + return Err(AxoupdateError::UpdateSelf {}); + }; + + Ok(AxoUpdater { + name: Some(app_name.to_owned()), + source: None, + latest_release: None, + current_version: None, + }) + } + + pub fn load_receipt(&mut self) -> AxoupdateResult<&mut AxoUpdater> { + let Some(app_name) = &self.name else { + return Err(AxoupdateError::NoAppNamePassed {}); + }; + + let receipt = load_receipt_for(app_name)?; + + self.source = Some(receipt.source.clone()); + self.current_version = Some(receipt.version.to_owned()); + + Ok(self) + } + + pub fn set_current_version(&mut self, version: &String) -> AxoupdateResult<&mut AxoUpdater> { + self.current_version = Some(version.to_owned()); + + Ok(self) + } + + pub fn is_update_needed(&mut self) -> AxoupdateResult { + let Some(current_version) = self.current_version.to_owned() else { + return Err(AxoupdateError::NotConfigured { + missing_field: "current_version".to_owned(), + }); + }; + + let release; + match &self.latest_release { + Some(r) => release = r, + None => { + self.fetch_latest_release()?; + release = self.latest_release.as_ref().unwrap(); + } + } + + Ok(current_version != release.version()) + } + + pub fn run(&mut self) -> AxoupdateResult<()> { + if !self.is_update_needed()? { + eprintln!("Up to date!"); + return Ok(()); + } + + let release; + match &self.latest_release { + Some(r) => release = r, + None => { + self.fetch_latest_release()?; + release = self.latest_release.as_ref().unwrap(); + } + } + let tempdir = TempDir::new()?; + + let installer_url = match env::consts::OS { + "macos" | "linux" => release + .assets + .iter() + .find(|asset| asset.name.ends_with("-installer.sh")), + "windows" => release + .assets + .iter() + .find(|asset| asset.name.ends_with("-installer.ps1")), + _ => unreachable!(), + }; + + let installer_url = if let Some(installer_url) = installer_url { + installer_url + } else { + return Err(AxoupdateError::NoInstallerForPackage {}); + }; + + let installer_path = Utf8PathBuf::try_from(tempdir.path().join("installer"))?; + let installer_file = File::create(&installer_path)?; + + if cfg!(unix) { + let mut perms = installer_file.metadata()?.permissions(); + perms.set_mode(0o744); + installer_file.set_permissions(perms)?; + } + + let client = reqwest::blocking::Client::new(); + let download = client + .get(&installer_url.browser_download_url) + .header(ACCEPT, "application/octet-stream") + .send()? + .text()?; + + LocalAsset::write_new_all(&download, &installer_path)?; + + Cmd::new(&installer_path, "installer").run()?; + + Ok(()) + } + + fn fetch_latest_release(&mut self) -> AxoupdateResult<()> { + let Some(app_name) = &self.name else { + return Err(AxoupdateError::NotConfigured { + missing_field: "app_name".to_owned(), + }); + }; + let Some(source) = &self.source else { + return Err(AxoupdateError::NotConfigured { + missing_field: "source".to_owned(), + }); + }; + + let Some(release) = get_latest_stable_release(&source.name, &source.owner)? else { + return Err(AxoupdateError::NoStableReleases { + app_name: app_name.to_owned(), + }); + }; + + self.latest_release = Some(release); + + Ok(()) + } +} + +pub type AxoupdateResult = std::result::Result; + +#[derive(Debug, Error, Diagnostic)] +pub enum AxoupdateError { + #[error(transparent)] + Reqwest(#[from] reqwest::Error), + + #[error(transparent)] + Io(#[from] std::io::Error), + + #[error(transparent)] + CaminoPathBuf(#[from] camino::FromPathBufError), + + #[error(transparent)] + Homedir(#[from] homedir::GetHomeError), + + #[error(transparent)] + Axoasset(#[from] AxoassetError), + + #[error(transparent)] + Axoprocess(#[from] AxoprocessError), + + #[error("Unable to determine config file path for app {app_name}!")] + #[diagnostic(help("This probably isn't your fault; please open an issue!"))] + ConfigFetchFailed { app_name: String }, + + #[error("Unable to determine the name of the app to update")] + #[diagnostic(help("This probably isn't your fault; please open an issue!"))] + NoAppName {}, + + #[error("No app name was configured for this updater")] + #[diagnostic(help("This isn't your fault; please open an issue!"))] + NoAppNamePassed {}, + + #[error("Unable to fetch your home directory")] + #[diagnostic(help("This may not be your fault; please open an issue!"))] + NoHome {}, + + #[error("Unable to find an installer for your OS")] + NoInstallerForPackage {}, + + #[error("There are no stable releases available for {app_name}")] + NoStableReleases { app_name: String }, + + #[error("App name calculated as `axoupdate'")] + #[diagnostic(help( + "This probably isn't what you meant to update; was the updater installed correctly?" + ))] + UpdateSelf {}, + + #[error("The updater isn't properly configured")] + #[diagnostic(help("Missing configuration value for {}", missing_field))] + NotConfigured { missing_field: String }, +} + +const GITHUB_API: &str = "https://api.github.com"; + +#[derive(Clone, Debug, Deserialize)] +pub struct Release { + pub tag_name: String, + pub name: String, + pub url: String, + pub assets: Vec, + pub prerelease: bool, +} + +impl Release { + pub fn version(&self) -> String { + if let Some(stripped) = self.tag_name.strip_prefix("v") { + stripped.to_owned() + } else { + self.tag_name.to_owned() + } + } +} + +#[derive(Clone, Debug, Deserialize)] +pub struct Asset { + pub url: String, + pub browser_download_url: String, + pub name: String, +} + +#[derive(Clone, Debug, Deserialize)] +#[serde(rename_all = "lowercase")] +pub enum ReleaseSourceType { + GitHub, + Axo, +} + +#[derive(Clone, Debug, Deserialize)] +pub struct ReleaseSource { + pub release_type: ReleaseSourceType, + pub owner: String, + pub name: String, +} + +#[derive(Clone, Debug, Deserialize)] +pub struct InstallReceipt { + pub install_prefix: Utf8PathBuf, + pub binaries: Vec, + pub source: ReleaseSource, + pub version: String, +} + +pub fn get_releases(name: &String, owner: &String) -> AxoupdateResult> { + let client = reqwest::blocking::Client::new(); + let resp: Vec = client + .get(format!("{GITHUB_API}/repos/{owner}/{name}/releases")) + .header(ACCEPT, "application/json") + .header( + USER_AGENT, + format!("axoupdate/{}", env!("CARGO_PKG_VERSION")), + ) + .send()? + .json()?; + + Ok(resp) +} + +pub fn get_latest_stable_release( + name: &String, + owner: &String, +) -> AxoupdateResult> { + let releases = get_releases(name, owner)?; + + Ok(releases.into_iter().find(|r| !r.prerelease)) +} + +pub fn get_app_name() -> Option { + if cfg!(debug_assertions) { + Some("cargo-dist".to_owned()) + } else { + if let Some(path) = args().next() { + Utf8PathBuf::from(path) + .file_name() + .and_then(|s| { + s.strip_suffix(".exe") + .and_then(|s| s.strip_prefix("-update")) + }) + .map(|s| s.to_owned()) + } else { + None + } + } +} + +pub fn get_config_path(app_name: &String) -> AxoupdateResult { + if cfg!(debug_assertions) { + Ok(Utf8PathBuf::try_from(current_dir()?)?) + } else { + let Some(home) = homedir::get_my_home()? else { + return Err(AxoupdateError::NoHome {}); + }; + + Ok(Utf8PathBuf::try_from(home)?.join(".config").join(app_name)) + } +} + +pub fn load_receipt_from_path( + install_receipt_path: &Utf8PathBuf, +) -> AxoupdateResult { + Ok(SourceFile::load_local(install_receipt_path)?.deserialize_json()?) +} + +pub fn load_receipt_for(app_name: &String) -> AxoupdateResult { + let Ok(receipt_prefix) = get_config_path(app_name) else { + return Err(AxoupdateError::ConfigFetchFailed { + app_name: app_name.to_owned(), + }); + }; + + let install_receipt_path = receipt_prefix.join(format!("{app_name}-receipt.json")); + + Ok(load_receipt_from_path(&install_receipt_path)?) +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..9d31de3 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,21 @@ +use std::process::exit; + +use axoupdater::{AxoUpdater, AxoupdateResult}; + +fn real_main() -> AxoupdateResult<()> { + AxoUpdater::new_for_updater_executable()? + .load_receipt()? + .run()?; + + Ok(()) +} + +fn main() -> std::io::Result<()> { + match real_main() { + Ok(_) => Ok(()), + Err(e) => { + eprintln!("{e}"); + exit(1) + } + } +} From 2c20fdfa39618699af235c0ed6badaac7cc1470b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Misty=20De=20M=C3=A9o?= Date: Thu, 18 Jan 2024 11:19:04 -0800 Subject: [PATCH 02/14] cargo clippy --- src/lib.rs | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 9b3becb..8ef4d3e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,6 +25,12 @@ pub struct AxoUpdater { current_version: Option, } +impl Default for AxoUpdater { + fn default() -> Self { + Self::new() + } +} + impl AxoUpdater { pub fn new() -> AxoUpdater { AxoUpdater { @@ -88,14 +94,13 @@ impl AxoUpdater { }); }; - let release; - match &self.latest_release { - Some(r) => release = r, + let release = match &self.latest_release { + Some(r) => r, None => { self.fetch_latest_release()?; - release = self.latest_release.as_ref().unwrap(); + self.latest_release.as_ref().unwrap() } - } + }; Ok(current_version != release.version()) } @@ -106,14 +111,13 @@ impl AxoUpdater { return Ok(()); } - let release; - match &self.latest_release { - Some(r) => release = r, + let release = match &self.latest_release { + Some(r) => r, None => { self.fetch_latest_release()?; - release = self.latest_release.as_ref().unwrap(); + self.latest_release.as_ref().unwrap() } - } + }; let tempdir = TempDir::new()?; let installer_url = match env::consts::OS { @@ -249,7 +253,7 @@ pub struct Release { impl Release { pub fn version(&self) -> String { - if let Some(stripped) = self.tag_name.strip_prefix("v") { + if let Some(stripped) = self.tag_name.strip_prefix('v') { stripped.to_owned() } else { self.tag_name.to_owned() @@ -313,18 +317,16 @@ pub fn get_latest_stable_release( pub fn get_app_name() -> Option { if cfg!(debug_assertions) { Some("cargo-dist".to_owned()) + } else if let Some(path) = args().next() { + Utf8PathBuf::from(path) + .file_name() + .and_then(|s| { + s.strip_suffix(".exe") + .and_then(|s| s.strip_prefix("-update")) + }) + .map(|s| s.to_owned()) } else { - if let Some(path) = args().next() { - Utf8PathBuf::from(path) - .file_name() - .and_then(|s| { - s.strip_suffix(".exe") - .and_then(|s| s.strip_prefix("-update")) - }) - .map(|s| s.to_owned()) - } else { - None - } + None } } @@ -355,5 +357,5 @@ pub fn load_receipt_for(app_name: &String) -> AxoupdateResult { let install_receipt_path = receipt_prefix.join(format!("{app_name}-receipt.json")); - Ok(load_receipt_from_path(&install_receipt_path)?) + load_receipt_from_path(&install_receipt_path) } From a68fd9943031749e226ad4cd50f7ae1a4c46de81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Misty=20De=20M=C3=A9o?= Date: Thu, 18 Jan 2024 11:19:36 -0800 Subject: [PATCH 03/14] chore: configure CI --- .github/workflows/ci.yml | 100 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..dc34bb7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,100 @@ +# The "Normal" CI for tests and linters and whatnot +name: Rust CI + +# Ci should be run on... +on: + # Every pull request (will need approval for new contributors) + pull_request: + # Every push to... + push: + branches: + # The main branch + - main + # And once a week? + # This can catch things like "rust updated and actually regressed something" + schedule: + - cron: "11 7 * * 1,4" + +# We want all these checks to fail if they spit out warnings +env: + RUSTFLAGS: -Dwarnings + +jobs: + # Check that rustfmt is a no-op + fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + components: rustfmt + - run: cargo fmt --all -- --check + + # Check that clippy is appeased + clippy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + components: clippy + - uses: swatinem/rust-cache@v2 + - uses: actions-rs/clippy-check@v1 + env: + PWD: ${{ env.GITHUB_WORKSPACE }} + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --workspace --tests --examples + + # Make sure the docs build without warnings + docs: + runs-on: ubuntu-latest + env: + RUSTDOCFLAGS: -Dwarnings + steps: + - uses: actions/checkout@master + - uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + components: rust-docs + - uses: swatinem/rust-cache@v2 + - run: cargo doc --workspace --no-deps + + # Build and run tests/doctests/examples on all platforms + # FIXME: look into `cargo-hack` which lets you more aggressively + # probe all your features and rust versions (see tracing's ci) + test: + runs-on: ${{ matrix.os }} + env: + # runtest the installer scripts + RUIN_MY_COMPUTER_WITH_INSTALLERS: true + strategy: + # Test the cross-product of these platforms+toolchains + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + rust: [stable] + steps: + # Setup tools + - uses: actions/checkout@master + - uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ matrix.rust }} + - uses: swatinem/rust-cache@v2 + # Run the tests/doctests (default features) + - run: cargo test --workspace + env: + PWD: ${{ env.GITHUB_WORKSPACE }} + # Run the tests/doctests (all features) + - run: cargo test --workspace --all-features + env: + PWD: ${{ env.GITHUB_WORKSPACE }} + # Test the examples (default features) + - run: cargo test --workspace --examples --bins + env: + PWD: ${{ env.GITHUB_WORKSPACE }} + # Test the examples (all features) + - run: cargo test --workspace --all-features --examples --bins + env: + PWD: ${{ env.GITHUB_WORKSPACE }} From 12ea5efd07338003a55aaef29098cbc100faecd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Misty=20De=20M=C3=A9o?= Date: Thu, 18 Jan 2024 11:42:33 -0800 Subject: [PATCH 04/14] fix: Windows compilation --- src/lib.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 8ef4d3e..475839a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,10 +1,7 @@ -use std::{ - env::{self, args, current_dir}, - fs::File, -}; +use std::env::{self, args, current_dir}; #[cfg(unix)] -use std::os::unix::fs::PermissionsExt; +use std::{fs::File, os::unix::fs::PermissionsExt}; use axoasset::{AxoassetError, LocalAsset, SourceFile}; use axoprocess::{AxoprocessError, Cmd}; @@ -139,9 +136,10 @@ impl AxoUpdater { }; let installer_path = Utf8PathBuf::try_from(tempdir.path().join("installer"))?; - let installer_file = File::create(&installer_path)?; - if cfg!(unix) { + #[cfg(unix)] + { + let installer_file = File::create(&installer_path)?; let mut perms = installer_file.metadata()?.permissions(); perms.set_mode(0o744); installer_file.set_permissions(perms)?; From 031348b981885c9456f267f0c963e3cb36a674ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Misty=20De=20M=C3=A9o?= Date: Thu, 18 Jan 2024 11:27:44 -0800 Subject: [PATCH 05/14] chore: mark helpers as private --- src/lib.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 475839a..3f01884 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -340,13 +340,11 @@ pub fn get_config_path(app_name: &String) -> AxoupdateResult { } } -pub fn load_receipt_from_path( - install_receipt_path: &Utf8PathBuf, -) -> AxoupdateResult { +fn load_receipt_from_path(install_receipt_path: &Utf8PathBuf) -> AxoupdateResult { Ok(SourceFile::load_local(install_receipt_path)?.deserialize_json()?) } -pub fn load_receipt_for(app_name: &String) -> AxoupdateResult { +fn load_receipt_for(app_name: &String) -> AxoupdateResult { let Ok(receipt_prefix) = get_config_path(app_name) else { return Err(AxoupdateError::ConfigFetchFailed { app_name: app_name.to_owned(), From 2bb1c06ae4887117c4caf1bd73da9bf962a289cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Misty=20De=20M=C3=A9o?= Date: Thu, 18 Jan 2024 15:13:37 -0800 Subject: [PATCH 06/14] fix: clean up print on no update --- src/lib.rs | 15 ++++++--------- src/main.rs | 9 +++++++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 3f01884..8e713d3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -102,10 +102,9 @@ impl AxoUpdater { Ok(current_version != release.version()) } - pub fn run(&mut self) -> AxoupdateResult<()> { + pub fn run(&mut self) -> AxoupdateResult { if !self.is_update_needed()? { - eprintln!("Up to date!"); - return Ok(()); + return Ok(false); } let release = match &self.latest_release { @@ -156,7 +155,7 @@ impl AxoUpdater { Cmd::new(&installer_path, "installer").run()?; - Ok(()) + Ok(true) } fn fetch_latest_release(&mut self) -> AxoupdateResult<()> { @@ -316,12 +315,10 @@ pub fn get_app_name() -> Option { if cfg!(debug_assertions) { Some("cargo-dist".to_owned()) } else if let Some(path) = args().next() { - Utf8PathBuf::from(path) + Utf8PathBuf::from(&path) .file_name() - .and_then(|s| { - s.strip_suffix(".exe") - .and_then(|s| s.strip_prefix("-update")) - }) + .map(|s| s.strip_suffix(".exe").unwrap_or(s)) + .map(|s| s.strip_suffix("-update").unwrap_or(s)) .map(|s| s.to_owned()) } else { None diff --git a/src/main.rs b/src/main.rs index 9d31de3..847e56a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,9 +3,14 @@ use std::process::exit; use axoupdater::{AxoUpdater, AxoupdateResult}; fn real_main() -> AxoupdateResult<()> { - AxoUpdater::new_for_updater_executable()? + if AxoUpdater::new_for_updater_executable()? .load_receipt()? - .run()?; + .run()? + { + eprintln!("New release installed!") + } else { + eprintln!("Already up to date; not upgrading"); + } Ok(()) } From 88eb3d662f919991369c437a008037fc8ee4ba71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Misty=20De=20M=C3=A9o?= Date: Mon, 22 Jan 2024 11:30:33 -0800 Subject: [PATCH 07/14] Use axocli --- Cargo.lock | 212 ++++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 8 ++ src/main.rs | 17 ++--- 3 files changed, 226 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7712c53..0ddb626 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -55,6 +55,23 @@ dependencies = [ "walkdir", ] +[[package]] +name = "axocli" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db877b2443883c767eb817ccffb00b20b28f456aa074740e211e952d6eec06f5" +dependencies = [ + "backtrace", + "backtrace-ext", + "console", + "miette", + "serde", + "serde_json", + "thiserror", + "tracing", + "tracing-subscriber", +] + [[package]] name = "axoprocess" version = "0.1.0" @@ -71,6 +88,7 @@ name = "axoupdater" version = "0.1.0" dependencies = [ "axoasset", + "axocli", "axoprocess", "camino", "homedir", @@ -96,6 +114,15 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "backtrace-ext" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" +dependencies = [ + "backtrace", +] + [[package]] name = "base64" version = "0.21.6" @@ -181,6 +208,19 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" +[[package]] +name = "console" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" +dependencies = [ + "encode_unicode", + "lazy_static", + "libc", + "unicode-width", + "windows-sys 0.52.0", +] + [[package]] name = "core-foundation" version = "0.9.4" @@ -197,6 +237,12 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + [[package]] name = "encoding_rs" version = "0.8.33" @@ -531,6 +577,23 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +[[package]] +name = "is-terminal" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" +dependencies = [ + "hermit-abi", + "rustix", + "windows-sys 0.52.0", +] + +[[package]] +name = "is_ci" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616cde7c720bb2bb5824a224687d8f77bfd38922027f01d825cd7453be5099fb" + [[package]] name = "itoa" version = "1.0.10" @@ -591,8 +654,17 @@ version = "5.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59bb584eaeeab6bd0226ccf3509a69d7936d148cf3d036ad350abe35e8c6856e" dependencies = [ + "backtrace", + "backtrace-ext", + "is-terminal", "miette-derive", "once_cell", + "owo-colors", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "terminal_size", + "textwrap", "thiserror", "unicode-width", ] @@ -665,6 +737,16 @@ dependencies = [ "pin-utils", ] +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num-integer" version = "0.1.45" @@ -764,6 +846,18 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "owo-colors" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" + [[package]] name = "percent-encoding" version = "2.3.1" @@ -962,6 +1056,15 @@ dependencies = [ "serde", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + [[package]] name = "slab" version = "0.4.9" @@ -971,6 +1074,18 @@ dependencies = [ "autocfg", ] +[[package]] +name = "smallvec" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" + +[[package]] +name = "smawk" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" + [[package]] name = "socket2" version = "0.5.5" @@ -981,6 +1096,34 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "supports-color" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6398cde53adc3c4557306a96ce67b302968513830a77a95b2b17305d9719a89" +dependencies = [ + "is-terminal", + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84231692eb0d4d41e4cdd0cabfdd2e6cd9e255e65f80c9aa7c98dd502b4233d" +dependencies = [ + "is-terminal", +] + +[[package]] +name = "supports-unicode" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f850c19edd184a205e883199a261ed44471c81e39bd95b1357f5febbef00e77a" +dependencies = [ + "is-terminal", +] + [[package]] name = "syn" version = "1.0.109" @@ -1043,6 +1186,27 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "terminal_size" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "textwrap" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7b3e525a49ec206798b40326a44121291b530c963cfb01018f63e135bac543d" +dependencies = [ + "smawk", + "unicode-linebreak", + "unicode-width", +] + [[package]] name = "thiserror" version = "1.0.56" @@ -1063,6 +1227,16 @@ dependencies = [ "syn 2.0.48", ] +[[package]] +name = "thread_local" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +dependencies = [ + "cfg-if", + "once_cell", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -1153,6 +1327,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "nu-ansi-term", + "sharded-slab", + "smallvec", + "thread_local", + "tracing-core", + "tracing-log", ] [[package]] @@ -1173,6 +1373,12 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +[[package]] +name = "unicode-linebreak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" + [[package]] name = "unicode-normalization" version = "0.1.22" @@ -1199,6 +1405,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "vcpkg" version = "0.2.15" diff --git a/Cargo.toml b/Cargo.toml index ff22d9a..1c08064 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,8 +11,12 @@ repository = "https://github.com/axodotdev/axoupdater" name = "axoupdater" path = "src/lib.rs" +[features] +standalone = ["axocli"] + [dependencies] axoasset = { version = "0.6.1", default-features = false, features = ["json-serde"]} +axocli = { version = "0.1.1", optional = true } axoprocess = "0.1.0" camino = { version = "1.1.6", features = ["serde1"] } homedir = "0.2.1" @@ -23,3 +27,7 @@ temp-dir = "0.1.12" # errors miette = "5.6.0" thiserror = "1.0.56" + +[[bin]] +name = "axoupdater" +required-features = ["axocli"] diff --git a/src/main.rs b/src/main.rs index 847e56a..74ba750 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,9 @@ -use std::process::exit; +use axocli::{CliApp, CliAppBuilder}; +use axoupdater::AxoUpdater; -use axoupdater::{AxoUpdater, AxoupdateResult}; +struct CliArgs {} -fn real_main() -> AxoupdateResult<()> { +fn real_main(_cli: &CliApp) -> Result<(), miette::Report> { if AxoUpdater::new_for_updater_executable()? .load_receipt()? .run()? @@ -15,12 +16,6 @@ fn real_main() -> AxoupdateResult<()> { Ok(()) } -fn main() -> std::io::Result<()> { - match real_main() { - Ok(_) => Ok(()), - Err(e) => { - eprintln!("{e}"); - exit(1) - } - } +fn main() { + CliAppBuilder::new("axoupdater").start(CliArgs {}, real_main); } From d9f0dcf40228bcf59d39d676df447f14c0cfd5e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Misty=20De=20M=C3=A9o?= Date: Mon, 22 Jan 2024 14:53:48 -0800 Subject: [PATCH 08/14] feat: add axo releases --- Cargo.lock | 327 ++++++++++++++++++++++++++++++++++++++++++++++++++++- Cargo.toml | 7 +- src/lib.rs | 74 +++++++++++- 3 files changed, 403 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0ddb626..b729e06 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -32,6 +32,19 @@ dependencies = [ "libc", ] +[[package]] +name = "async-compression" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a116f46a969224200a0a97f29cfd4c50e7534e4b4826bd23ea2c3c533039c82c" +dependencies = [ + "flate2", + "futures-core", + "memchr", + "pin-project-lite", + "tokio", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -48,6 +61,7 @@ dependencies = [ "image", "miette", "mime", + "reqwest", "serde", "serde_json", "thiserror", @@ -91,12 +105,26 @@ dependencies = [ "axocli", "axoprocess", "camino", + "gazenot", "homedir", "miette", "reqwest", "serde", "temp-dir", "thiserror", + "tokio", +] + +[[package]] +name = "backon" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1a6197b2120bb2185a267f6515038558b019e92b832bb0320e96d66268dcf9" +dependencies = [ + "fastrand 1.9.0", + "futures-core", + "pin-project", + "tokio", ] [[package]] @@ -237,6 +265,21 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "dyn-clone" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "545b22097d44f8a9581187cdf93de7a71e4722bf51200cfaba810865b49a495d" + [[package]] name = "encode_unicode" version = "0.3.6" @@ -268,12 +311,31 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + [[package]] name = "fastrand" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +[[package]] +name = "flate2" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + [[package]] name = "fnv" version = "1.0.7" @@ -393,6 +455,37 @@ dependencies = [ "slab", ] +[[package]] +name = "gazenot" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6089542424a1218a8637f37d066850bef5abdfda946464bce8c5865c18425dcb" +dependencies = [ + "axoasset", + "backon", + "camino", + "miette", + "reqwest", + "schemars", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "getrandom" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + [[package]] name = "gimli" version = "0.28.1" @@ -502,6 +595,20 @@ dependencies = [ "want", ] +[[package]] +name = "hyper-rustls" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +dependencies = [ + "futures-util", + "http", + "hyper", + "rustls", + "tokio", + "tokio-rustls", +] + [[package]] name = "hyper-tls" version = "0.5.0" @@ -571,6 +678,15 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + [[package]] name = "ipnet" version = "2.9.0" @@ -627,6 +743,16 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + [[package]] name = "log" version = "0.4.20" @@ -858,12 +984,55 @@ version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.48.5", +] + [[package]] name = "percent-encoding" version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +[[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 2.0.48", +] + [[package]] name = "pin-project-lite" version = "0.2.13" @@ -915,6 +1084,7 @@ version = "0.11.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" dependencies = [ + "async-compression", "base64", "bytes", "encoding_rs", @@ -924,6 +1094,7 @@ dependencies = [ "http", "http-body", "hyper", + "hyper-rustls", "hyper-tls", "ipnet", "js-sys", @@ -933,20 +1104,39 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", + "rustls", + "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", "system-configuration", "tokio", "tokio-native-tls", + "tokio-rustls", + "tokio-util", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", + "webpki-roots", "winreg", ] +[[package]] +name = "ring" +version = "0.17.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" +dependencies = [ + "cc", + "getrandom", + "libc", + "spin", + "untrusted", + "windows-sys 0.48.0", +] + [[package]] name = "rustc-demangle" version = "0.1.23" @@ -966,6 +1156,37 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rustls" +version = "0.21.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" +dependencies = [ + "log", + "ring", + "rustls-webpki", + "sct", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "ryu" version = "1.0.16" @@ -990,6 +1211,46 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "schemars" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45a28f4c49489add4ce10783f7911893516f15afe45d015608d41faca6bc4d29" +dependencies = [ + "dyn-clone", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c767fd6fa65d9ccf9cf026122c1b555f2ef9a4f0cea69da4d7dbc3e258d30967" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 1.0.109", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sct" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "security-framework" version = "2.9.2" @@ -1033,6 +1294,17 @@ dependencies = [ "syn 2.0.48", ] +[[package]] +name = "serde_derive_internals" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "serde_json" version = "1.0.111" @@ -1065,6 +1337,15 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + [[package]] name = "slab" version = "0.4.9" @@ -1096,6 +1377,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + [[package]] name = "supports-color" version = "2.1.0" @@ -1180,7 +1467,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" dependencies = [ "cfg-if", - "fastrand", + "fastrand 2.0.1", "redox_syscall", "rustix", "windows-sys 0.52.0", @@ -1263,11 +1550,25 @@ dependencies = [ "libc", "mio", "num_cpus", + "parking_lot", "pin-project-lite", + "signal-hook-registry", "socket2", + "tokio-macros", "windows-sys 0.48.0", ] +[[package]] +name = "tokio-macros" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "tokio-native-tls" version = "0.3.1" @@ -1278,6 +1579,16 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +dependencies = [ + "rustls", + "tokio", +] + [[package]] name = "tokio-util" version = "0.7.10" @@ -1304,6 +1615,7 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -1394,6 +1706,12 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" version = "2.5.0" @@ -1403,6 +1721,7 @@ dependencies = [ "form_urlencoded", "idna", "percent-encoding", + "serde", ] [[package]] @@ -1518,6 +1837,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki-roots" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" + [[package]] name = "widestring" version = "1.0.2" diff --git a/Cargo.toml b/Cargo.toml index 1c08064..e43dee4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ path = "src/lib.rs" [features] standalone = ["axocli"] +axo_releases = ["gazenot", "tokio"] [dependencies] axoasset = { version = "0.6.1", default-features = false, features = ["json-serde"]} @@ -24,10 +25,14 @@ reqwest = { version = "0.11", default-features = false, features = ["blocking", serde = "1.0.195" temp-dir = "0.1.12" +# axo releases +gazenot = { version = "0.2.1", features = ["client_lib"], optional = true } +tokio = { version = "1.12.0", features = ["full"], optional = true } + # errors miette = "5.6.0" thiserror = "1.0.56" [[bin]] name = "axoupdater" -required-features = ["axocli"] +required-features = ["axocli", "axo_releases"] diff --git a/src/lib.rs b/src/lib.rs index 8e713d3..ae92a7a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,6 +6,8 @@ use std::{fs::File, os::unix::fs::PermissionsExt}; use axoasset::{AxoassetError, LocalAsset, SourceFile}; use axoprocess::{AxoprocessError, Cmd}; use camino::Utf8PathBuf; +#[cfg(feature = "axo_releases")] +use gazenot::{error::GazenotError, Gazenot}; use miette::Diagnostic; use reqwest::{ self, @@ -170,7 +172,9 @@ impl AxoUpdater { }); }; - let Some(release) = get_latest_stable_release(&source.name, &source.owner)? else { + let Some(release) = + get_latest_stable_release(&source.name, &source.owner, &source.release_type)? + else { return Err(AxoupdateError::NoStableReleases { app_name: app_name.to_owned(), }); @@ -204,6 +208,14 @@ pub enum AxoupdateError { #[error(transparent)] Axoprocess(#[from] AxoprocessError), + #[cfg(feature = "axo_releases")] + #[error(transparent)] + Gazenot(#[from] GazenotError), + + #[error("Release is located on backend {backend}, but it's not enabled")] + #[diagnostic(help("This probably isn't your fault; please open an issue!"))] + BackendDisabled { backend: String }, + #[error("Unable to determine config file path for app {app_name}!")] #[diagnostic(help("This probably isn't your fault; please open an issue!"))] ConfigFetchFailed { app_name: String }, @@ -226,6 +238,9 @@ pub enum AxoupdateError { #[error("There are no stable releases available for {app_name}")] NoStableReleases { app_name: String }, + #[error("No releases were found for the app {app_name}")] + ReleaseNotFound { app_name: String }, + #[error("App name calculated as `axoupdate'")] #[diagnostic(help( "This probably isn't what you meant to update; was the updater installed correctly?" @@ -256,6 +271,25 @@ impl Release { self.tag_name.to_owned() } } + + #[cfg(feature = "axo_releases")] + pub fn from_gazenot(release: &gazenot::PublicRelease) -> Release { + Release { + tag_name: release.tag_name.to_owned(), + name: release.name.to_owned(), + url: String::new(), + assets: release + .assets + .iter() + .map(|asset| Asset { + url: asset.browser_download_url.to_owned(), + browser_download_url: asset.browser_download_url.to_owned(), + name: asset.name.to_owned(), + }) + .collect(), + prerelease: release.prerelease, + } + } } #[derive(Clone, Debug, Deserialize)] @@ -287,7 +321,7 @@ pub struct InstallReceipt { pub version: String, } -pub fn get_releases(name: &String, owner: &String) -> AxoupdateResult> { +pub fn get_github_releases(name: &String, owner: &String) -> AxoupdateResult> { let client = reqwest::blocking::Client::new(); let resp: Vec = client .get(format!("{GITHUB_API}/repos/{owner}/{name}/releases")) @@ -302,11 +336,45 @@ pub fn get_releases(name: &String, owner: &String) -> AxoupdateResult AxoupdateResult> { + let abyss = Gazenot::new_unauthed("github".to_string(), owner)?; + let release_lists = tokio::runtime::Builder::new_current_thread() + .worker_threads(1) + .max_blocking_threads(128) + .enable_all() + .build() + .expect("Initializing tokio runtime failed") + .block_on(abyss.list_releases_many(vec![name.to_owned()]))?; + let Some(our_release) = release_lists.iter().find(|rl| &rl.package_name == name) else { + return Err(AxoupdateError::ReleaseNotFound { + app_name: name.to_owned(), + }); + }; + + Ok(our_release + .releases + .iter() + .map(Release::from_gazenot) + .collect()) +} + pub fn get_latest_stable_release( name: &String, owner: &String, + release_type: &ReleaseSourceType, ) -> AxoupdateResult> { - let releases = get_releases(name, owner)?; + let releases = match release_type { + ReleaseSourceType::GitHub => get_github_releases(name, owner)?, + #[cfg(feature = "axo_releases")] + ReleaseSourceType::Axo => get_axo_releases(name, owner)?, + #[cfg(not(feature = "axo_releases"))] + ReleaseSourceType::Axo => { + return Err(AxoupdateError::BackendDisabled { + backend: "axodotdev".to_owned(), + }) + } + }; Ok(releases.into_iter().find(|r| !r.prerelease)) } From 8c885da4185ab9db9cc21419ccb546fa96317c58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Misty=20De=20M=C3=A9o?= Date: Mon, 22 Jan 2024 17:06:06 -0800 Subject: [PATCH 09/14] feat: make github optional --- Cargo.toml | 6 +++++- src/lib.rs | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index e43dee4..fcecd8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,8 +12,10 @@ name = "axoupdater" path = "src/lib.rs" [features] +default = ["axo_releases", "github_releases"] standalone = ["axocli"] axo_releases = ["gazenot", "tokio"] +github_releases = ["reqwest"] [dependencies] axoasset = { version = "0.6.1", default-features = false, features = ["json-serde"]} @@ -21,7 +23,6 @@ axocli = { version = "0.1.1", optional = true } axoprocess = "0.1.0" camino = { version = "1.1.6", features = ["serde1"] } homedir = "0.2.1" -reqwest = { version = "0.11", default-features = false, features = ["blocking", "default-tls", "json"] } serde = "1.0.195" temp-dir = "0.1.12" @@ -29,6 +30,9 @@ temp-dir = "0.1.12" gazenot = { version = "0.2.1", features = ["client_lib"], optional = true } tokio = { version = "1.12.0", features = ["full"], optional = true } +# github releases +reqwest = { version = "0.11", default-features = false, features = ["blocking", "default-tls", "json"], optional = true } + # errors miette = "5.6.0" thiserror = "1.0.56" diff --git a/src/lib.rs b/src/lib.rs index ae92a7a..fce7074 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,6 +9,7 @@ use camino::Utf8PathBuf; #[cfg(feature = "axo_releases")] use gazenot::{error::GazenotError, Gazenot}; use miette::Diagnostic; +#[cfg(feature = "github_releases")] use reqwest::{ self, header::{ACCEPT, USER_AGENT}, @@ -321,6 +322,7 @@ pub struct InstallReceipt { pub version: String, } +#[cfg(feature = "github_releases")] pub fn get_github_releases(name: &String, owner: &String) -> AxoupdateResult> { let client = reqwest::blocking::Client::new(); let resp: Vec = client @@ -365,7 +367,14 @@ pub fn get_latest_stable_release( release_type: &ReleaseSourceType, ) -> AxoupdateResult> { let releases = match release_type { + #[cfg(feature = "github_releases")] ReleaseSourceType::GitHub => get_github_releases(name, owner)?, + #[cfg(not(feature = "github_releases"))] + ReleaseSourceType::GitHub => { + return Err(AxoupdateError::BackendDisabled { + backend: "github".to_owned(), + }) + } #[cfg(feature = "axo_releases")] ReleaseSourceType::Axo => get_axo_releases(name, owner)?, #[cfg(not(feature = "axo_releases"))] From 5a0b22e63ecba1846f719547be855e6b1f0ab795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Misty=20De=20M=C3=A9o?= Date: Tue, 23 Jan 2024 12:57:53 -0800 Subject: [PATCH 10/14] fix: distinguish correct app from hosts --- src/lib.rs | 46 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index fce7074..8363afa 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -173,8 +173,12 @@ impl AxoUpdater { }); }; - let Some(release) = - get_latest_stable_release(&source.name, &source.owner, &source.release_type)? + let Some(release) = get_latest_stable_release( + &source.name, + &source.owner, + &source.app_name, + &source.release_type, + )? else { return Err(AxoupdateError::NoStableReleases { app_name: app_name.to_owned(), @@ -239,8 +243,8 @@ pub enum AxoupdateError { #[error("There are no stable releases available for {app_name}")] NoStableReleases { app_name: String }, - #[error("No releases were found for the app {app_name}")] - ReleaseNotFound { app_name: String }, + #[error("No releases were found for the app {app_name} in workspace {name}")] + ReleaseNotFound { name: String, app_name: String }, #[error("App name calculated as `axoupdate'")] #[diagnostic(help( @@ -312,6 +316,7 @@ pub struct ReleaseSource { pub release_type: ReleaseSourceType, pub owner: String, pub name: String, + pub app_name: String, } #[derive(Clone, Debug, Deserialize)] @@ -323,7 +328,11 @@ pub struct InstallReceipt { } #[cfg(feature = "github_releases")] -pub fn get_github_releases(name: &String, owner: &String) -> AxoupdateResult> { +pub fn get_github_releases( + name: &String, + owner: &String, + app_name: &String, +) -> AxoupdateResult> { let client = reqwest::blocking::Client::new(); let resp: Vec = client .get(format!("{GITHUB_API}/repos/{owner}/{name}/releases")) @@ -335,11 +344,22 @@ pub fn get_github_releases(name: &String, owner: &String) -> AxoupdateResult AxoupdateResult> { +pub fn get_axo_releases( + name: &String, + owner: &String, + app_name: &String, +) -> AxoupdateResult> { let abyss = Gazenot::new_unauthed("github".to_string(), owner)?; let release_lists = tokio::runtime::Builder::new_current_thread() .worker_threads(1) @@ -347,10 +367,11 @@ pub fn get_axo_releases(name: &String, owner: &String) -> AxoupdateResult AxoupdateResult AxoupdateResult> { let releases = match release_type { #[cfg(feature = "github_releases")] - ReleaseSourceType::GitHub => get_github_releases(name, owner)?, + ReleaseSourceType::GitHub => get_github_releases(name, owner, app_name)?, #[cfg(not(feature = "github_releases"))] ReleaseSourceType::GitHub => { return Err(AxoupdateError::BackendDisabled { @@ -376,7 +398,7 @@ pub fn get_latest_stable_release( }) } #[cfg(feature = "axo_releases")] - ReleaseSourceType::Axo => get_axo_releases(name, owner)?, + ReleaseSourceType::Axo => get_axo_releases(name, owner, app_name)?, #[cfg(not(feature = "axo_releases"))] ReleaseSourceType::Axo => { return Err(AxoupdateError::BackendDisabled { From 44ffb45b096a08a416862c944e5b39938dbd22b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Misty=20De=20M=C3=A9o?= Date: Tue, 23 Jan 2024 14:09:45 -0800 Subject: [PATCH 11/14] fix: filename for self check --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 8363afa..b6508f6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -56,7 +56,7 @@ impl AxoUpdater { }; // Happens if the binary didn't get renamed properly - if app_name == "axoupdate" { + if app_name == "axoupdater" { return Err(AxoupdateError::UpdateSelf {}); }; @@ -246,7 +246,7 @@ pub enum AxoupdateError { #[error("No releases were found for the app {app_name} in workspace {name}")] ReleaseNotFound { name: String, app_name: String }, - #[error("App name calculated as `axoupdate'")] + #[error("App name calculated as `axoupdater'")] #[diagnostic(help( "This probably isn't what you meant to update; was the updater installed correctly?" ))] From e67a961067d7e8b501bdac9bd8015cc6fb2f6884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Misty=20De=20M=C3=A9o?= Date: Wed, 24 Jan 2024 09:45:34 -0800 Subject: [PATCH 12/14] feat: use env vars for debug features Instead of branching behaviour based on debug assertions, check for environment variables and use those instead. --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index b6508f6..c838378 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -411,8 +411,8 @@ pub fn get_latest_stable_release( } pub fn get_app_name() -> Option { - if cfg!(debug_assertions) { - Some("cargo-dist".to_owned()) + if let Ok(name) = env::var("AXOUPDATER_APP_NAME") { + Some(name) } else if let Some(path) = args().next() { Utf8PathBuf::from(&path) .file_name() @@ -425,7 +425,7 @@ pub fn get_app_name() -> Option { } pub fn get_config_path(app_name: &String) -> AxoupdateResult { - if cfg!(debug_assertions) { + if env::var("AXOUPDATER_CONFIG_WORKING_DIR").is_ok() { Ok(Utf8PathBuf::try_from(current_dir()?)?) } else { let Some(home) = homedir::get_my_home()? else { From 06978629f71728eeb1bfd21266b60bc99650abc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Misty=20De=20M=C3=A9o?= Date: Wed, 24 Jan 2024 10:05:40 -0800 Subject: [PATCH 13/14] feat: windows receipt support --- src/lib.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index c838378..e8348c0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,7 @@ -use std::env::{self, args, current_dir}; +use std::{ + env::{self, args, current_dir}, + path::PathBuf, +}; #[cfg(unix)] use std::{fs::File, os::unix::fs::PermissionsExt}; @@ -428,11 +431,16 @@ pub fn get_config_path(app_name: &String) -> AxoupdateResult { if env::var("AXOUPDATER_CONFIG_WORKING_DIR").is_ok() { Ok(Utf8PathBuf::try_from(current_dir()?)?) } else { - let Some(home) = homedir::get_my_home()? else { + let home = if cfg!(windows) { + env::var("LOCALAPPDATA").map(PathBuf::from).ok() + } else { + homedir::get_my_home()?.map(|path| path.join(".config")) + }; + let Some(home) = home else { return Err(AxoupdateError::NoHome {}); }; - Ok(Utf8PathBuf::try_from(home)?.join(".config").join(app_name)) + Ok(Utf8PathBuf::try_from(home)?.join(app_name)) } } From a8a1150134b7858d10e2433b0fa6b9bcd3393a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Misty=20De=20M=C3=A9o?= Date: Wed, 24 Jan 2024 12:46:20 -0800 Subject: [PATCH 14/14] fix: running windows installer --- src/lib.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index e8348c0..9e86f4d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -140,7 +140,9 @@ impl AxoUpdater { return Err(AxoupdateError::NoInstallerForPackage {}); }; - let installer_path = Utf8PathBuf::try_from(tempdir.path().join("installer"))?; + let extension = if cfg!(windows) { ".ps1" } else { ".sh" }; + let installer_path = + Utf8PathBuf::try_from(tempdir.path().join(format!("installer{extension}")))?; #[cfg(unix)] { @@ -159,7 +161,16 @@ impl AxoUpdater { LocalAsset::write_new_all(&download, &installer_path)?; - Cmd::new(&installer_path, "installer").run()?; + let path = if cfg!(windows) { + "powershell" + } else { + installer_path.as_str() + }; + let mut command = Cmd::new(path, "installer"); + if cfg!(windows) { + command.arg(&installer_path); + } + command.run()?; Ok(true) }