From 5d97b1a7d03aa78d04615121bfe6ae25949811cf Mon Sep 17 00:00:00 2001 From: ddotthomas Date: Thu, 19 Oct 2023 12:52:18 -0600 Subject: [PATCH 1/2] Fixed selecting Proton version erroring out No longer builds a github api request from a release tag. Now using one Github API call to get Download info Cleaned up main.rs; now it parses user data and starts a function Fixed some minor spelling mistakes and other errors --- .github/workflows/enforce_label.yaml | 2 +- Cargo.lock | 513 ++++++++++++++------------- libprotonup/src/apps.rs | 9 +- libprotonup/src/github.rs | 154 +++----- libprotonup/src/variants.rs | 20 +- protonup-rs/src/download.rs | 210 +++++++++-- protonup-rs/src/helper_menus.rs | 19 +- protonup-rs/src/main.rs | 307 ++-------------- protonup-rs/src/manage_apps.rs | 4 +- 9 files changed, 550 insertions(+), 688 deletions(-) diff --git a/.github/workflows/enforce_label.yaml b/.github/workflows/enforce_label.yaml index 585ddaa..d4d36ee 100644 --- a/.github/workflows/enforce_label.yaml +++ b/.github/workflows/enforce_label.yaml @@ -11,4 +11,4 @@ jobs: - uses: yogevbd/enforce-label-action@2.2.2 with: REQUIRED_LABELS_ANY: "๐Ÿš€ Feature,๐Ÿ’… Improvement,๐Ÿ› Bug,๐Ÿ“š Docs,๐Ÿงช Tests,โ˜๏ธ CI,๐Ÿšจ Security,๐Ÿค– Dependencies" - REQUIRED_LABELS_ANY_DESCRIPTION: "It is necessary to add a label to your PR. This will help to categorize it and add a note on the release. Chose one of [๐Ÿš€ Feature,๐Ÿ’… Improvement,๐Ÿ› Bug,๐Ÿ“š Docs,๐Ÿงช Tests,โ˜๏ธ CI,๐Ÿšจ Security,๐Ÿค– Dependencies]" + REQUIRED_LABELS_ANY_DESCRIPTION: "It is necessary to add a label to your PR. This will help to categorize it and add a note on the release. Choose one of [๐Ÿš€ Feature,๐Ÿ’… Improvement,๐Ÿ› Bug,๐Ÿ“š Docs,๐Ÿงช Tests,โ˜๏ธ CI,๐Ÿšจ Security,๐Ÿค– Dependencies]" diff --git a/Cargo.lock b/Cargo.lock index 9de3bf2..cdd38d1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,15 @@ # 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" @@ -19,30 +28,29 @@ dependencies = [ [[package]] name = "anstream" -version = "0.3.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", - "is-terminal", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.0" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" dependencies = [ "utf8parse", ] @@ -58,9 +66,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.1" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" dependencies = [ "anstyle", "windows-sys 0.48.0", @@ -68,9 +76,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.71" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "atty" @@ -89,11 +97,26 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[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.2" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" [[package]] name = "bitflags" @@ -112,21 +135,24 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cc" -version = "1.0.79" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] [[package]] name = "cfg-if" @@ -151,45 +177,43 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.4" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80672091db20273a15cf9fdd4e47ed43b5091ec9841bf4c6145c9dfbbcae09ed" +checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.3.4" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1458a1df40e1e2afebb7ab60ce55c1fa8f431146205aa5f4887e0b111c27636" +checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" dependencies = [ "anstream", "anstyle", - "bitflags", "clap_lex", "strsim 0.10.0", ] [[package]] name = "clap_derive" -version = "4.3.2" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" +checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.38", ] [[package]] name = "clap_lex" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" [[package]] name = "colorchoice" @@ -210,11 +234,27 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" + [[package]] name = "cpufeatures" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" dependencies = [ "libc", ] @@ -271,9 +311,9 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.11" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" +checksum = "23d2f3407d9a573d666de4b5bdf10569d73ca9478087346697dcbae6244bfbcd" [[package]] name = "encode_unicode" @@ -283,51 +323,30 @@ checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] name = "encoding_rs" -version = "0.8.32" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ "cfg-if", ] -[[package]] -name = "errno" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "filetime" -version = "0.2.21" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" +checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.3.5", "windows-sys 0.48.0", ] [[package]] name = "flate2" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ "crc32fast", "miniz_oxide", @@ -377,7 +396,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.38", ] [[package]] @@ -430,11 +449,17 @@ dependencies = [ "wasi", ] +[[package]] +name = "gimli" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" + [[package]] name = "h2" -version = "0.3.19" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d357c7ae988e7d2182f7d7871d0b963962420b0678b0997ce7de72001aeab782" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" dependencies = [ "bytes", "fnv", @@ -481,18 +506,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.3.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "hex" @@ -536,15 +552,15 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.26" +version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ "bytes", "futures-channel", @@ -557,7 +573,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2", + "socket2 0.4.9", "tokio", "tower-service", "tracing", @@ -566,10 +582,11 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.24.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0646026eb1b3eea4cd9ba47912ea5ce9cc07713d105b1a14698f4e6433d348b7" +checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" dependencies = [ + "futures-util", "http", "hyper", "rustls", @@ -599,9 +616,9 @@ dependencies = [ [[package]] name = "indicatif" -version = "0.17.5" +version = "0.17.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ff8cc23a7393a397ed1d7f56e6365cba772aba9f9912ab968b03043c395d057" +checksum = "fb28741c9db9a713d93deb3bb9515c20788cef5815265bee4980e87bde7e0f25" dependencies = [ "console", "instant", @@ -636,40 +653,17 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi 0.3.1", - "libc", - "windows-sys 0.48.0", -] - [[package]] name = "ipnet" -version = "2.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" - -[[package]] -name = "is-terminal" -version = "0.4.7" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" -dependencies = [ - "hermit-abi 0.3.1", - "io-lifetimes", - "rustix", - "windows-sys 0.48.0", -] +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "js-sys" @@ -688,9 +682,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.146" +version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] name = "libprotonup" @@ -712,17 +706,11 @@ dependencies = [ "xz2", ] -[[package]] -name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - [[package]] name = "log" -version = "0.4.19" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "lzma-sys" @@ -737,9 +725,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "mime" @@ -778,11 +766,11 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi 0.3.3", "libc", ] @@ -798,6 +786,15 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" +[[package]] +name = "object" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.18.0" @@ -818,9 +815,9 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -836,9 +833,9 @@ checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "portable-atomic" -version = "1.3.3" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "767eb9f07d4a5ebcb39bbf2d452058a93c011373abf6832e24194a1c3f004794" +checksum = "31114a898e107c51bb1609ffaf55a0e011cf6a4d7f1170d0015a165082c0338b" [[package]] name = "proc-macro-error" @@ -866,9 +863,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.60" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] @@ -877,7 +874,7 @@ dependencies = [ name = "protonup-rs" version = "0.6.0" dependencies = [ - "clap 4.3.4", + "clap 4.4.6", "indicatif", "inquire", "libprotonup", @@ -886,9 +883,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.28" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -902,13 +899,22 @@ dependencies = [ "bitflags", ] +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags", +] + [[package]] name = "redox_termios" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" dependencies = [ - "redox_syscall", + "redox_syscall 0.2.16", ] [[package]] @@ -918,15 +924,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ "getrandom", - "redox_syscall", + "redox_syscall 0.2.16", "thiserror", ] [[package]] name = "reqwest" -version = "0.11.18" +version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" +checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ "base64", "bytes", @@ -950,6 +956,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", + "system-configuration", "tokio", "tokio-rustls", "tokio-util", @@ -979,24 +986,16 @@ dependencies = [ ] [[package]] -name = "rustix" -version = "0.37.20" +name = "rustc-demangle" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" -dependencies = [ - "bitflags", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys", - "windows-sys 0.48.0", -] +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustls" -version = "0.21.2" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e32ca28af694bc1bbf399c33a516dbdf1c90090b8ab23c2bc24f834aa2247f5f" +checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" dependencies = [ "log", "ring", @@ -1006,18 +1005,18 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" +checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ "base64", ] [[package]] name = "rustls-webpki" -version = "0.100.1" +version = "0.101.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6207cd5ed3d8dca7816f8f3725513a34609c0c765bf652b8c3cb4cfd87db46b" +checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" dependencies = [ "ring", "untrusted", @@ -1025,9 +1024,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "sct" @@ -1041,29 +1040,29 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.164" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" +checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.164" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" +checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.38", ] [[package]] name = "serde_json" -version = "1.0.96" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" dependencies = [ "itoa", "ryu", @@ -1084,9 +1083,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -1095,9 +1094,9 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] @@ -1112,6 +1111,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "socket2" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "spin" version = "0.5.2" @@ -1167,20 +1176,41 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.18" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" 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", + "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 = "tar" -version = "0.4.38" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b55807c0344e1e6c04d7c965f5289c39a8d94ae23ed5c0b57aabac549f871c6" +checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb" dependencies = [ "filetime", "libc", @@ -1195,7 +1225,7 @@ checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" dependencies = [ "libc", "numtoa", - "redox_syscall", + "redox_syscall 0.2.16", "redox_termios", ] @@ -1210,22 +1240,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.40" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.38", ] [[package]] @@ -1245,17 +1275,17 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.28.2" +version = "1.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" +checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" dependencies = [ - "autocfg", + "backtrace", "bytes", "libc", "mio", "num_cpus", "pin-project-lite", - "socket2", + "socket2 0.5.4", "tokio-macros", "windows-sys 0.48.0", ] @@ -1268,7 +1298,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.38", ] [[package]] @@ -1283,9 +1313,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" dependencies = [ "bytes", "futures-core", @@ -1303,20 +1333,19 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "pin-project-lite", "tracing-core", ] [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", ] @@ -1329,9 +1358,9 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" @@ -1341,9 +1370,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.9" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" @@ -1362,9 +1391,9 @@ checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" [[package]] name = "unicode-width" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] name = "untrusted" @@ -1374,9 +1403,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", @@ -1437,7 +1466,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.38", "wasm-bindgen-shared", ] @@ -1471,7 +1500,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.38", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1484,9 +1513,9 @@ checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wasm-streams" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bbae3363c08332cadccd13b67db371814cd214c2524020932f0804b8cf7c078" +checksum = "b4609d447824375f43e1ffbc051b50ad8f4b3ae8219680c94452ea05eb240ac7" dependencies = [ "futures-util", "js-sys", @@ -1505,24 +1534,11 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "webpki-roots" -version = "0.22.6" +version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" -dependencies = [ - "webpki", -] +checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" [[package]] name = "winapi" @@ -1561,7 +1577,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.5", ] [[package]] @@ -1581,17 +1597,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "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]] @@ -1602,9 +1618,9 @@ checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" @@ -1614,9 +1630,9 @@ checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" @@ -1626,9 +1642,9 @@ checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" @@ -1638,9 +1654,9 @@ checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" @@ -1650,9 +1666,9 @@ checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" @@ -1662,9 +1678,9 @@ checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" @@ -1674,24 +1690,25 @@ checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winreg" -version = "0.10.1" +version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ - "winapi", + "cfg-if", + "windows-sys 0.48.0", ] [[package]] name = "xattr" -version = "0.2.3" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d1526bbe5aaeb5eb06885f4d987bcdfa5e23187055de9b83fe00156a821fabc" +checksum = "f4686009f71ff3e5c4dbcf1a282d0a44db3f021ba69350cd42086b3e5f1c6985" dependencies = [ "libc", ] diff --git a/libprotonup/src/apps.rs b/libprotonup/src/apps.rs index 0f9e19a..f97896e 100644 --- a/libprotonup/src/apps.rs +++ b/libprotonup/src/apps.rs @@ -24,14 +24,7 @@ impl fmt::Display for App { } impl App { - pub fn app_available_variants(&self) -> Vec { - match *self { - Self::Steam => vec![Variant::GEProton], - Self::Lutris => vec![Variant::WineGE, Variant::GEProton], - } - } - - pub fn app_default_variant(&self) -> Variant { + pub fn app_wine_version(&self) -> Variant { match *self { Self::Steam => Variant::GEProton, Self::Lutris => Variant::WineGE, diff --git a/libprotonup/src/github.rs b/libprotonup/src/github.rs index 152d195..7eed1db 100644 --- a/libprotonup/src/github.rs +++ b/libprotonup/src/github.rs @@ -1,5 +1,5 @@ use crate::constants; -use crate::variants::VariantParameters; +use crate::variants::VariantGithubParameters; use anyhow::Result; use serde::{Deserialize, Serialize}; @@ -7,25 +7,53 @@ pub type ReleaseList = Vec; #[derive(Serialize, Deserialize, Debug)] pub struct Release { - url: String, + /// API URL of the Release + url: Option, + /// Tag name of the Release, examples "8.7-GE-1-Lol" "GE-Proton8-5" pub tag_name: String, name: String, - published_at: String, + /// Asset list for each Release, usually the tar.gz/tar.xz file and a sha512sum file for integrity checking assets: Vec, } +impl std::fmt::Display for Release { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { + write!(f, "{}", self.tag_name) + } +} + +impl Release { + /// Returns a Download struct corresponding to the Release + pub fn get_download_info(&self) -> Download { + let mut download: Download = Download::default(); + download.version = self.tag_name.clone(); + for asset in &self.assets { + if asset.name.ends_with("sha512sum") { + download.sha512sum_url = asset.browser_download_url.clone(); + } else if asset.name.ends_with("tar.gz") || asset.name.ends_with("tar.xz") { + download.download_url = asset.browser_download_url.clone(); + download.size = asset.size as u64; + } + } + + download + } +} + #[derive(Serialize, Deserialize, Debug)] pub struct Asset { url: String, id: i64, name: String, size: i64, - created_at: String, updated_at: String, browser_download_url: String, } -pub async fn list_releases(source: &VariantParameters) -> Result { +/// Returns a Vec of Releases from a GitHub repository, the URL used for the request is built from the passed in VariantParameters +pub async fn list_releases( + source: &VariantGithubParameters, +) -> Result { let agent = format!("{}/v{}", constants::USER_AGENT, constants::VERSION,); let url = format!( @@ -43,57 +71,9 @@ pub async fn list_releases(source: &VariantParameters) -> Result Result { - let agent = format!("{}/v{}", constants::USER_AGENT, constants::VERSION,); - - let client = reqwest::Client::builder().user_agent(agent).build()?; - - let mut download = Download::default(); - let release = match tag { - "latest" => { - let url = format!( - "{}/{}/{}/releases/latest", - source.repository_url, source.repository_account, source.repository_name, - ); - let rel: Release = client.get(url).send().await?.json().await?; - rel - } - _ => { - let url = format!( - "{}/{}/{}/releases/tags/{}", - source.repository_url, source.repository_account, source.repository_name, &tag - ); - let rel: Release = client.get(url).send().await?.json().await?; - rel - } - }; - - download.version = release.tag_name; - for asset in &release.assets { - if asset.name.ends_with("sha512sum") { - download.sha512sum = asset.browser_download_url.as_str().to_string(); - } - if asset.name.ends_with("tar.gz") { - download.created_at = asset.created_at.clone(); - download.download = asset.browser_download_url.as_str().to_string(); - download.size = asset.size as u64; - } - if asset.name.ends_with("tar.xz") { - download.created_at = asset.created_at.clone(); - download.download = asset.browser_download_url.as_str().to_string(); - download.size = asset.size as u64; - } - } - Ok(download) } #[cfg(test)] mod tests { @@ -102,66 +82,24 @@ mod tests { use super::*; #[tokio::test] - async fn test_fetch_data_from_tag() { + async fn test_list_releases() { let conditions = &[ ( - variants::Variant::WineGE.parameters(), - "latest", - "Get Steam", + variants::Variant::WineGE.get_github_parameters(), + "List WineGE", ), ( - variants::Variant::GEProton.parameters(), - "latest", - "Download Lutris", + variants::Variant::GEProton.get_github_parameters(), + "List GEProton", ), ]; - for (source_parameters, tag, desc) in conditions { - let result = fetch_data_from_tag(tag, source_parameters).await; - - assert!( - result.is_ok(), - "case :{} test: fetch_data_from_tag returned error", - desc - ); - - let result = result.unwrap(); - - assert!( - result.download.len() > 5, - "case : '{}' test: fetch_data_from_tag returned an wrong download link", - desc - ); - assert!( - result.sha512sum.len() > 5, - "case : '{}' test: fetch_data_from_tag returned an wrong sha512sum", - desc - ); - assert!( - result.size > 100, - "case : '{}' test: fetch_data_from_tag returned an wrong sha512sum", - desc - ); - assert!( - result.version.len() > 2, - "case : '{}' test: fetch_data_from_tag returned an wrong version", - desc - ); - } - } - - #[tokio::test] - async fn test_list_releases() { - let conditions = &[ - (variants::Variant::WineGE.parameters(), "List WineGE"), - (variants::Variant::GEProton.parameters(), "List GEProton"), - ]; for (source_parameters, desc) in conditions { let result = list_releases(source_parameters).await; assert!( result.is_ok(), - "case : '{}' test: fetch_data_from_tag returned error", + "case : '{}' test: list_releases returned error", desc ); @@ -188,8 +126,14 @@ mod tests { }; let conditions = &[ - (variants::Variant::WineGE.parameters(), "Get WineGE"), - (variants::Variant::GEProton.parameters(), "Get GEProton"), + ( + variants::Variant::WineGE.get_github_parameters(), + "Get WineGE", + ), + ( + variants::Variant::GEProton.get_github_parameters(), + "Get GEProton", + ), ]; for (source_parameters, desc) in conditions { let url = format!( diff --git a/libprotonup/src/variants.rs b/libprotonup/src/variants.rs index d6fcf77..6602482 100644 --- a/libprotonup/src/variants.rs +++ b/libprotonup/src/variants.rs @@ -1,7 +1,9 @@ use super::constants::*; use std::{fmt, str::FromStr}; -// VariantParameters stores the parameters for a variant of Proton -pub struct VariantParameters { + +/// Struct used to build GitHub api request URLs. +/// Contains the GitHub URL, username for GE, the repository name for either Wine GE or Proton GE, and a Variant Enum for identifying the parameters type +pub struct VariantGithubParameters { /// this is a link back to the enum variant variant_ref: Variant, /// URL of the repository server (GitHub compatible URL only at the moment) @@ -12,15 +14,15 @@ pub struct VariantParameters { pub repository_name: String, } -impl VariantParameters { +impl VariantGithubParameters { /// new_custom is a generator for custom VariantParameters pub fn new_custom( variant: Variant, repository_url: String, repository_account: String, repository_name: String, - ) -> VariantParameters { - VariantParameters { + ) -> VariantGithubParameters { + VariantGithubParameters { variant_ref: variant, repository_url, repository_account, @@ -71,16 +73,16 @@ impl Variant { } } - /// returns the default parameters for this Variant. - pub fn parameters(&self) -> VariantParameters { + /// Returns the default parameters for this Variant, used to build the GitHub URL + pub fn get_github_parameters(&self) -> VariantGithubParameters { match self { - Variant::GEProton => VariantParameters { + Variant::GEProton => VariantGithubParameters { variant_ref: Variant::GEProton, repository_url: GITHUB_URL.to_owned(), repository_name: GEPROTON_GITHUB_REPO.to_owned(), repository_account: GE_GITHUB_ACCOUNT.to_owned(), }, - Variant::WineGE => VariantParameters { + Variant::WineGE => VariantGithubParameters { variant_ref: Variant::WineGE, repository_url: GITHUB_URL.to_owned(), repository_name: WINEGE_GITHUB_REPO.to_owned(), diff --git a/protonup-rs/src/download.rs b/protonup-rs/src/download.rs index f67b23b..4290fa9 100644 --- a/protonup-rs/src/download.rs +++ b/protonup-rs/src/download.rs @@ -1,5 +1,7 @@ use indicatif::{ProgressBar, ProgressDrawTarget, ProgressStyle}; +use inquire::{Select, Text}; + use std::fs; use std::path::{Path, PathBuf}; use std::{ @@ -8,32 +10,28 @@ use std::{ time::Duration, }; -use libprotonup::{constants, files, github, utils, variants}; +use crate::{file_path, helper_menus}; -pub(crate) async fn download_file( - tag: &str, - source: &variants::VariantParameters, -) -> Result { - let mut temp_dir = utils::expand_tilde(constants::TEMP_DIR).unwrap(); +use libprotonup::{ + apps, constants, files, + github::{self, Download, Release}, + utils, + variants::{self, Variant}, +}; - let download = match github::fetch_data_from_tag(tag, source).await { - Ok(data) => data, - Err(e) => { - eprintln!("Failed to fetch GitHub data, make sure you're connected to the internet\nError: {}", e); - std::process::exit(1) - } - }; +pub(crate) async fn download_file(download: Download) -> Result { + let mut temp_dir = utils::expand_tilde(constants::TEMP_DIR).unwrap(); - temp_dir.push(if download.download.ends_with("tar.gz") { + temp_dir.push(if download.download_url.ends_with("tar.gz") { format!("{}.tar.gz", &download.version) - } else if download.download.ends_with("tar.xz") { + } else if download.download_url.ends_with("tar.xz") { format!("{}.tar.xz", &download.version) } else { eprintln!("Downloaded file wasn't of the expected type. (tar.(gz/xz)"); std::process::exit(1) }); - let git_hash = files::download_file_into_memory(&download.sha512sum) + let git_hash = files::download_file_into_memory(&download.sha512sum_url) .await .unwrap(); @@ -44,7 +42,7 @@ pub(crate) async fn download_file( let (progress, done) = files::create_progress_trackers(); let progress_read = Arc::clone(&progress); let done_read = Arc::clone(&done); - let url = String::from(&download.download); + let url = String::from(&download.download_url); let tmp_dir = String::from(temp_dir.to_str().unwrap()); // start ProgressBar in another thread @@ -73,7 +71,7 @@ pub(crate) async fn download_file( }); files::download_file_progress( - download.download, + download.download_url, download.size, temp_dir.clone().as_path(), progress, @@ -92,7 +90,7 @@ pub(crate) async fn download_file( pub(crate) async fn unpack_file( dowaload_path: &Path, install_path: &str, - source: &variants::VariantParameters, + wine_version: &Variant, ) -> Result<(), String> { let install_dir = utils::expand_tilde(install_path).unwrap(); @@ -100,12 +98,180 @@ pub(crate) async fn unpack_file( println!("Unpacking files into install location. Please wait"); files::decompress(dowaload_path, install_dir.as_path()).unwrap(); - let source_type = source.variant_type(); println!( "Done! Restart {}. {} installed in {}", - source_type.intended_application(), - source_type, + wine_version.intended_application(), + wine_version, install_dir.to_string_lossy(), ); Ok(()) } + +pub async fn run_quick_downloads() { + let found_apps = apps::list_installed_apps(); + if found_apps.is_empty() { + println!("No apps found. Please install at least one app before using this feature."); + return; + } + println!( + "Found the following apps: {}", + found_apps + .iter() + .map(|app| app.to_string()) + .collect::>() + .join(", ") + ); + + for app_inst in &found_apps { + let wine_version = app_inst.into_app().app_wine_version(); + let destination = app_inst.default_install_dir().to_string(); + println!( + "\nQuick Download: {} for {} into -> {}", + wine_version, + app_inst.into_app(), + destination + ); + + // Get the latest Download info for the wine_version + let download = match github::list_releases(&wine_version.get_github_parameters()).await { + // Get the Download info from the first item on the list, the latest version + Ok(release_list) => release_list[0].get_download_info(), + Err(e) => { + eprintln!("Failed to fetch Github data, make sure you're connected to the internet.\nError: {}", e); + std::process::exit(1) + } + }; + + let file = download_file(download).await.unwrap(); + unpack_file(&file, &destination, &wine_version) + .await + .unwrap_or_else(|e| { + eprintln!( + "Failed unpacking file {} into {}. Error: {}", + file.to_string_lossy(), + destination, + e + ); + }); + } +} + +/// Start the Download for the selected app +/// If no app is provided, the user is prompted for which version of Wine/Proton to use and what directory to extract to +pub async fn download_to_selected_app(app: Option) { + // Get the version of Wine/Proton to install + let wine_version = match app { + // Use the default for the app + Some(app) => app.app_wine_version(), + // Or have the user select which one + None => Select::new( + "Choose the variant you want to install:", + variants::ALL_VARIANTS.to_vec(), + ) + .prompt() + .unwrap_or_else(|_| std::process::exit(0)), + }; + + // Get the folder to install Wine/Proton into + let install_dir: String = match app { + // If the user selected an app (Steam/Lutris)... + Some(app) => match app.detect_installation_method() { + // Figure out which versions of the App the user has (Native/Flatpak) + installed_apps if installed_apps.len() == 1 => { + println!( + "Detected {}. Installing to {}", + installed_apps[0], + installed_apps[0].default_install_dir() + ); + installed_apps[0].default_install_dir().to_string() + } + // If the user has more than one installation method, ask them which one they would like to use + installed_apps => Select::new( + "Detected several app versions, which would you like to use?", + installed_apps, + ) + .prompt() + .unwrap_or_else(|_| std::process::exit(0)) + .default_install_dir() + .to_string(), + }, + // If the user didn't select an app, ask them what directory they want to install to + None => Text::new("Installation path:") + .with_autocomplete(file_path::FilePathCompleter::default()) + .with_help_message(&format!( + "Current directory: {}", + &std::env::current_dir() + .unwrap_or_else(|_| std::process::exit(0)) + .to_string_lossy() + )) + .with_default( + &std::env::current_dir() + .unwrap_or_else(|_| std::process::exit(0)) + .to_string_lossy(), + ) + .prompt() + .unwrap_or_else(|_| std::process::exit(0)), + }; + + let release_list = match github::list_releases(&wine_version.get_github_parameters()).await { + Ok(data) => data, + Err(e) => { + eprintln!("Failed to fetch Github data, make sure you're connected to the internet.\nError: {}", e); + std::process::exit(1) + } + }; + + // versions_to_install = vec![]; + + // Let the user choose which releases they want to use + let mut release_list = match helper_menus::multiple_select_menu( + "Select the versions you want to download :", + release_list, + ) { + Ok(release_list) => release_list, + Err(e) => { + eprintln!("The tag list could not be processed.\nError: {}", e); + vec![] + } + }; + + // Check if the versions the user selected are already on the disk + check_if_already_downloaded(&mut release_list, &install_dir).await; + + // Prepare the download for the user's chosen releases/versions + // TODO Look into using async in a way to download multiple files at once, would need to .join all the download_file() 'Futures' + for release in &release_list { + match download_file(release.get_download_info()).await { + Ok(file) => { + // TODO: should just upack once and copy to all folders + unpack_file(&file, &install_dir, &wine_version) + .await + .unwrap(); + } + Err(e) => { + eprintln!( + "Error downloading {}, make sure you're connected to the internet\nError: {}", + release.tag_name, e + ) + } + } + } +} + +/// Checks if the selected Release/version is already installed. +/// Will prompt the user to overwrite existing files +async fn check_if_already_downloaded(release_list: &mut Vec, install_dir: &str) { + release_list.retain(|release| { + // Check if versions exist in disk. + // If they do, ask the user if it should be overwritten + !(files::check_if_exists(&install_dir, &release.tag_name) + && !helper_menus::confirm_menu( + format!( + "Version {} exists in the installation path. Overwrite?", + &release.tag_name + ), + String::from("If you choose yes, you will re-install it."), + false, + )) + }); +} diff --git a/protonup-rs/src/helper_menus.rs b/protonup-rs/src/helper_menus.rs index d6721fe..db8c9dd 100644 --- a/protonup-rs/src/helper_menus.rs +++ b/protonup-rs/src/helper_menus.rs @@ -1,18 +1,15 @@ use inquire::{Confirm, InquireError, MultiSelect}; -use libprotonup::apps::AppInstallations; -pub(crate) fn tag_menu(message: &str, options: Vec) -> Result, InquireError> { - MultiSelect::new(message, options) - .with_default(&[0_usize]) - .prompt() -} - -pub(crate) fn variants_menu( +/// Creates a inquire::MultiSelect menu with the first option selected +pub(crate) fn multiple_select_menu( message: &str, - options: Vec, -) -> Result, InquireError> { + options: Vec, +) -> Result, InquireError> +where + T: std::fmt::Display, +{ MultiSelect::new(message, options) - .with_default(&[0_usize]) + .with_default(&[0]) .prompt() } diff --git a/protonup-rs/src/main.rs b/protonup-rs/src/main.rs index 325fcb3..c12f8cb 100644 --- a/protonup-rs/src/main.rs +++ b/protonup-rs/src/main.rs @@ -1,18 +1,16 @@ use clap::Parser; -use inquire::{Select, Text}; +use inquire::Select; use std::fmt; -use libprotonup::{apps, files, github, variants}; +use libprotonup::apps::App; mod download; mod file_path; mod helper_menus; mod manage_apps; -use download::{download_file, unpack_file}; -use helper_menus::{confirm_menu, tag_menu, variants_menu}; use manage_apps::manage_apps_routine; #[derive(Debug, Parser)] @@ -26,8 +24,8 @@ struct Opt { #[allow(clippy::upper_case_acronyms)] enum InitialMenu { QuickUpdate, - DoanloadForSteam, - DoanloadForLutris, + DownloadForSteam, + DownloadForLutris, DownloadIntoCustomLocation, ManageExistingInstallations, } @@ -36,8 +34,8 @@ impl InitialMenu { // could be generated by macro const VARIANTS: &'static [InitialMenu] = &[ Self::QuickUpdate, - Self::DoanloadForSteam, - Self::DoanloadForLutris, + Self::DownloadForSteam, + Self::DownloadForLutris, Self::DownloadIntoCustomLocation, Self::ManageExistingInstallations, ]; @@ -47,8 +45,8 @@ impl fmt::Display for InitialMenu { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { Self::QuickUpdate => write!(f, "Quick Update (detect apps and auto download)"), - Self::DoanloadForSteam => write!(f, "Download GE-Proton for Steam"), - Self::DoanloadForLutris => write!(f, "Download GE-Proton/Wine-GE for Lutris"), + Self::DownloadForSteam => write!(f, "Download GE-Proton for Steam"), + Self::DownloadForLutris => write!(f, "Download GE-Proton/Wine-GE for Lutris"), Self::DownloadIntoCustomLocation => { write!(f, "Download GE-Proton/Wine-GE into custom location") } @@ -60,280 +58,25 @@ impl fmt::Display for InitialMenu { #[tokio::main] async fn main() { // run quick downloads and skip InitialMenu - if run_quick_downloads().await { - return; - } - - // Default Parameters - let source: variants::VariantParameters; - let mut install_dirs: Vec = vec![]; - let mut tags: Vec = vec![]; - - let mut should_open_tag_selector = false; - let mut should_open_dir_selector = false; - let mut manage_existing_versions = false; - let mut should_detect_apps = false; - let mut apps_to_use: Vec = vec![]; - let mut selected_app: Option = None; - - let answer: InitialMenu = Select::new( - "ProtonUp Menu: Chose your action:", - InitialMenu::VARIANTS.to_vec(), - ) - .with_page_size(10) - .prompt() - .unwrap_or_else(|_| std::process::exit(0)); - - // Set parameters based on users choice - match answer { - InitialMenu::QuickUpdate => { - should_detect_apps = true; - } - InitialMenu::DoanloadForSteam => { - selected_app = Some(apps::App::Steam); - should_open_tag_selector = true; - } - InitialMenu::DoanloadForLutris => { - selected_app = Some(apps::App::Lutris); - should_open_tag_selector = true; - } - InitialMenu::DownloadIntoCustomLocation => { - should_open_dir_selector = true; - should_open_tag_selector = true; - } - InitialMenu::ManageExistingInstallations => manage_existing_versions = true, - } - - // This is where the execution happens - - // If the user wants to manage existing installations, we skip the rest of the menu - if manage_existing_versions { - manage_apps_routine(); - return; - } - - if should_detect_apps { - apps_to_use = apps::list_installed_apps(); - if apps_to_use.is_empty() { - println!("Could not find any version of Steam or Lutris. Please install at least one app before using this feature."); - return; - } - println!( - "Found the following apps: {}", - apps_to_use - .iter() - .map(|app| app.to_string()) - .collect::>() - .join(", ") - ); - - // TODO: this should be done in a single place. But here we use the default for every app, and in the other part we install all selected tags for all selected apps - for app_inst in &apps_to_use { - let variant = app_inst.into_app().app_default_variant(); - let destination = app_inst.default_install_dir().to_string(); - println!( - "\nQuick Download: {} for {} into -> {}\n", - variant, - app_inst.into_app(), - destination - ); - let file = download_file("latest", &variant.parameters()) - .await - .unwrap(); - unpack_file(&file, &destination, &variant.parameters()) - .await - .unwrap_or_else(|_| std::process::exit(0)); - } - return; - } - - // the rest of th execution is for updating/installing new versions - if should_open_dir_selector { - let current_dir = std::env::current_dir().unwrap_or_else(|_| std::process::exit(0)); - let help_message = format!("Current directory: {}", ¤t_dir.to_string_lossy()); - let answer = Text::new("Installation path:") - .with_autocomplete(file_path::FilePathCompleter::default()) - .with_help_message(&help_message) - .with_default(¤t_dir.to_string_lossy()) - .prompt(); - - match answer { - Ok(path) => { - println!("Will use the custom path: {}", path); - install_dirs.push(path) - } - Err(error) => { - println!("Error choosing custom path. Using the default. Error: {error:?}"); - } - }; - } - - let source_options = match selected_app { - Some(app) => app.app_available_variants(), - None => variants::ALL_VARIANTS.to_vec(), - }; - - if source_options.len() == 1 { - source = source_options[0].parameters(); - } else { - source = Select::new("Chose the variant you want to install:", source_options) - .prompt() - .map(|variant| variant.parameters()) - .unwrap_or_else(|_| std::process::exit(0)); - }; - - // if empty, no apps were detected, so we ask the user to chose one - if apps_to_use.is_empty() && selected_app.is_some() { - apps_to_use = apps::list_installed_apps(); - if !apps_to_use.is_empty() { - // filter detected app installations that match selected app - apps_to_use.retain(|app_inst| app_inst.into_app() == selected_app.unwrap()); - apps_to_use.retain(|app_inst| { - confirm_menu( - format!("Detected {app_inst} installation. Use it?"), - String::from("If you have multiple install options, you can chose all of them"), - true, - ) - }) - } - - // if apps_to_use is empty, list default options - if apps_to_use.is_empty() { - apps_to_use = variants_menu( - "Chose the app you want to install for:", - selected_app.unwrap().app_installations(), - ) - .unwrap_or_else(|_| std::process::exit(0)); - } - } - - // if still no apps were selected - if apps_to_use.is_empty() && selected_app.is_some() { - return; - } - - // past this point, either a path was manually selected or selected_app is not empty - if install_dirs.is_empty() { - install_dirs = apps_to_use - .iter() - .map(|app_inst| app_inst.default_install_dir().to_string()) - .collect(); - } - - if should_open_tag_selector { - tags = vec![]; - let release_list = match github::list_releases(&source).await { - Ok(data) => data, - Err(e) => { - eprintln!("Failed to fetch Github data, make sure you're connected to the internet.\nError: {}", e); - std::process::exit(1) - } - }; - let tag_list: Vec = release_list.into_iter().map(|r| (r.tag_name)).collect(); - let list = match tag_menu("Select the versions you want to download :", tag_list) { - Ok(tags) => tags, - Err(e) => { - eprintln!("The tag list could not be processed.\nError: {}", e); - vec![] - } - }; - for tag_iter in list.iter() { - let tag = String::from(tag_iter); - tags.push(tag); - } - } else { - let tag = match github::fetch_data_from_tag("latest", &source).await { - Ok(data) => data, - Err(e) => { - eprintln!("Failed to fetch Github data, make sure you're connected to the internet.\nError: {}", e); - std::process::exit(1) - } - }; - tags.push(tag.version) - } - - tags.retain(|tag_name| { - // Check if versions exist in disk. - // If they do, ask the user if it should be overwritten - !(install_dirs - .iter() - .any(|install_dir| files::check_if_exists(install_dir, tag_name)) - && !confirm_menu( - format!("Version {tag_name} exists in the installation path. Overwrite?"), - String::from("If you choose yes, you will re-install it."), - false, - )) - }); - - // install the versions that are in the tags array, into the locations that are in the install_dirs array - for tag_name in tags.clone() { - let tag = match github::fetch_data_from_tag(&tag_name, &source).await { - Ok(data) => data, - Err(e) => { - eprintln!("Failed to fetch Github data, make sure you're connected to the internet.\nError: {}", e); - std::process::exit(1) - } - }; - - match download_file(&tag_name, &source).await { - Ok(file) => { - // TODO: should just upack once and copy to all folders - for install_path in &install_dirs { - unpack_file(&file, install_path, &source).await.unwrap(); - } - } - Err(e) => { - eprintln!( - "Error downloading {}, make sure you're connected to the internet\nError: {}", - tag.version, e - ) - } - } - } -} - -async fn run_quick_downloads() -> bool { let Opt { quick_download } = Opt::parse(); - if quick_download { - let found_apps = apps::list_installed_apps(); - if found_apps.is_empty() { - println!("No apps found. Please install at least one app before using this feature."); - return false; - } - println!( - "Found the following apps: {}", - found_apps - .iter() - .map(|app| app.to_string()) - .collect::>() - .join(", ") - ); - - for app_inst in &found_apps { - let variant = app_inst.into_app().app_default_variant(); - let destination = app_inst.default_install_dir().to_string(); - println!( - "\nQuick Download: {} for {} into -> {}", - variant, - app_inst.into_app(), - destination - ); - let file = download_file("latest", &variant.parameters()) - .await - .unwrap(); - unpack_file(&file, &destination, &variant.parameters()) - .await - .unwrap_or_else(|e| { - eprintln!( - "Failed unpacking file {} into {}. Error: {}", - file.to_string_lossy(), - destination, - e - ); - }); + download::run_quick_downloads().await + } else { + let answer: InitialMenu = Select::new( + "ProtonUp Menu: Choose your action:", + InitialMenu::VARIANTS.to_vec(), + ) + .with_page_size(10) + .prompt() + .unwrap_or_else(|_| std::process::exit(0)); + + // Set parameters based on users choice + match answer { + InitialMenu::QuickUpdate => download::run_quick_downloads().await, + InitialMenu::DownloadForSteam => download::download_to_selected_app(Some(App::Steam)).await, + InitialMenu::DownloadForLutris => download::download_to_selected_app(Some(App::Lutris)).await, + InitialMenu::DownloadIntoCustomLocation => download::download_to_selected_app(None).await, + InitialMenu::ManageExistingInstallations => manage_apps_routine(), } } - - quick_download } diff --git a/protonup-rs/src/manage_apps.rs b/protonup-rs/src/manage_apps.rs index 7a5d04f..d419c56 100644 --- a/protonup-rs/src/manage_apps.rs +++ b/protonup-rs/src/manage_apps.rs @@ -2,7 +2,7 @@ use inquire::MultiSelect; use libprotonup::{apps, files}; use std::fmt; -use super::helper_menus::{confirm_menu, tag_menu}; +use super::helper_menus::{confirm_menu, multiple_select_menu}; #[derive(Debug, PartialEq, Eq, Clone)] pub(crate) enum ManageAppsMenuOptions { @@ -66,7 +66,7 @@ pub(crate) fn manage_apps_routine() { println!("No versions found for {}, skipping... ", app); continue; } - let delete_versions = match tag_menu( + let delete_versions = match multiple_select_menu( &format!("Select the versions you want to DELETE from {}", app), versions, ) { From 8c2c605235e91f4b3cbbcf40824bcca0d4b448d3 Mon Sep 17 00:00:00 2001 From: Rafael Passos Date: Thu, 14 Dec 2023 16:30:38 -0300 Subject: [PATCH 2/2] Adds exit point for folder not found --- protonup-rs/src/download.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/protonup-rs/src/download.rs b/protonup-rs/src/download.rs index 4290fa9..7cd3487 100644 --- a/protonup-rs/src/download.rs +++ b/protonup-rs/src/download.rs @@ -176,6 +176,12 @@ pub async fn download_to_selected_app(app: Option) { let install_dir: String = match app { // If the user selected an app (Steam/Lutris)... Some(app) => match app.detect_installation_method() { + installed_apps if installed_apps.len() == 0 => { + println!("Install location for selected app(s) not found. Exiting."); + std::process::exit(0); + } + + // Figure out which versions of the App the user has (Native/Flatpak) installed_apps if installed_apps.len() == 1 => { println!(