From 1e78a7b6a88b1d662d5a2392201b35ae6ca45181 Mon Sep 17 00:00:00 2001 From: Geometrically <18202329+Geometrically@users.noreply.github.com> Date: Mon, 19 Jun 2023 14:59:06 -0700 Subject: [PATCH] Analytics + more bug fixes (#144) * Analytics + more bug fixes * debug deadlock * Fix mostly everything * merge fixes * fix rest * final fixeS --- Cargo.lock | 417 +++++++++++++++++- theseus/Cargo.toml | 4 +- theseus/src/api/logs.rs | 37 +- theseus/src/api/pack.rs | 3 +- theseus/src/api/process.rs | 37 +- theseus/src/api/profile.rs | 12 +- theseus/src/api/profile_create.rs | 6 +- theseus/src/event/mod.rs | 2 +- theseus/src/launcher/args.rs | 7 +- theseus/src/launcher/mod.rs | 41 +- theseus/src/state/children.rs | 49 +- theseus/src/state/mod.rs | 11 +- theseus/src/state/profiles.rs | 32 +- theseus/src/state/settings.rs | 6 + theseus_gui/package.json | 3 +- theseus_gui/pnpm-lock.yaml | 15 +- theseus_gui/src-tauri/Cargo.toml | 4 +- theseus_gui/src-tauri/build.rs | 107 ----- theseus_gui/src-tauri/src/api/logs.rs | 13 +- theseus_gui/src-tauri/src/api/process.rs | 10 +- theseus_gui/src-tauri/src/api/profile.rs | 1 + theseus_gui/src-tauri/src/main.rs | 24 +- theseus_gui/src/App.vue | 54 ++- theseus_gui/src/components/GridDisplay.vue | 48 +- theseus_gui/src/components/RowDisplay.vue | 33 +- .../src/components/ui/AccountsCard.vue | 3 + .../ui/IncompatibilityWarningModal.vue | 38 +- .../src/components/ui/InstallConfirmModal.vue | 19 +- theseus_gui/src/components/ui/Instance.vue | 42 +- .../components/ui/InstanceCreationModal.vue | 29 +- .../components/ui/InstanceInstallModal.vue | 89 +++- .../src/components/ui/JavaDetectionModal.vue | 12 +- .../src/components/ui/JavaSelector.vue | 11 + .../src/components/ui/RunningAppBar.vue | 7 + theseus_gui/src/components/ui/SearchCard.vue | 38 +- theseus_gui/src/helpers/fetch.js | 4 +- theseus_gui/src/helpers/logs.js | 9 +- theseus_gui/src/helpers/process.js | 10 +- theseus_gui/src/helpers/utils.js | 10 +- theseus_gui/src/pages/Browse.vue | 6 +- theseus_gui/src/pages/Settings.vue | 44 ++ theseus_gui/src/pages/instance/Index.vue | 78 ++-- theseus_gui/src/pages/instance/Logs.vue | 16 +- theseus_gui/src/pages/instance/Mods.vue | 44 +- theseus_gui/src/pages/instance/Options.vue | 25 +- theseus_gui/src/pages/project/Description.vue | 4 + theseus_gui/src/pages/project/Gallery.vue | 14 + theseus_gui/src/pages/project/Index.vue | 132 ++++-- theseus_gui/src/pages/project/Version.vue | 67 ++- theseus_gui/src/store/theme.js | 1 + theseus_playground/src/main.rs | 48 +- 51 files changed, 1285 insertions(+), 491 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ddc15d8f..7b183f28 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -616,7 +616,7 @@ dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", - "num-traits", + "num-traits 0.2.15", "serde", "time 0.1.45", "wasm-bindgen", @@ -800,6 +800,31 @@ dependencies = [ "libc", ] +[[package]] +name = "crash-context" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf7e754a5156db1e23c2126b45082d23b197f08ed047b656e6103da67459e2e6" +dependencies = [ + "cfg-if", + "libc", + "mach2", +] + +[[package]] +name = "crash-handler" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37571ca6b1166c54bdde2b482eea4c935207d5d82889382b327ad6fcf88ce656" +dependencies = [ + "cfg-if", + "crash-context", + "libc", + "mach2", + "parking_lot", + "windows-sys 0.42.0", +] + [[package]] name = "crc32fast" version = "1.3.2" @@ -927,9 +952,9 @@ dependencies = [ [[package]] name = "daedalus" -version = "0.1.21" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a66b666b316919af243d8684f225b56aed72a83db52a93d61da89e2f588a7c7" +checksum = "d14d655650f5f0fd5b88946d4add0f1b02d866e40632304cfe1427240bfd2430" dependencies = [ "bincode 2.0.0-rc.2", "bytes", @@ -1018,6 +1043,16 @@ version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23d8666cb01533c39dde32bcbab8e227b4ed6679b2c925eba05feabea39508fb" +[[package]] +name = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +dependencies = [ + "serde", + "uuid", +] + [[package]] name = "derivative" version = "2.2.0" @@ -1197,6 +1232,17 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "enum-primitive-derive" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c375b9c5eadb68d0a6efee2999fef292f45854c3444c86f09d8ab086ba942b0e" +dependencies = [ + "num-traits 0.2.15", + "quote", + "syn 1.0.109", +] + [[package]] name = "enumflags2" version = "0.7.7" @@ -1286,6 +1332,18 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "findshlibs" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40b9e59cd0f7e0806cca4be089683ecb6434e602038df21fe6bf6711b2f07f64" +dependencies = [ + "cc", + "lazy_static", + "libc", + "winapi", +] + [[package]] name = "flate2" version = "1.0.25" @@ -1700,6 +1758,17 @@ dependencies = [ "system-deps 6.0.4", ] +[[package]] +name = "goblin" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7666983ed0dd8d21a6f6576ee00053ca0926fb281a5522577a4dbd0f1b54143" +dependencies = [ + "log", + "plain", + "scroll", +] + [[package]] name = "gtk" version = "0.15.5" @@ -1825,6 +1894,17 @@ dependencies = [ "digest 0.10.6", ] +[[package]] +name = "hostname" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +dependencies = [ + "libc", + "match_cfg", + "winapi", +] + [[package]] name = "html5ever" version = "0.25.2" @@ -1994,7 +2074,7 @@ dependencies = [ "byteorder", "color_quant", "num-rational", - "num-traits", + "num-traits 0.2.15", ] [[package]] @@ -2299,6 +2379,15 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" +[[package]] +name = "mach2" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d0d1830bcd151a6fc4aea1369af235b36c1528fe976b8ff678683c9995eade8" +dependencies = [ + "libc", +] + [[package]] name = "malloc_buf" version = "0.0.6" @@ -2322,6 +2411,12 @@ dependencies = [ "tendril", ] +[[package]] +name = "match_cfg" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" + [[package]] name = "matchers" version = "0.0.1" @@ -2352,6 +2447,24 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +[[package]] +name = "memmap2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg", +] + [[package]] name = "memoffset" version = "0.7.1" @@ -2376,6 +2489,75 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "minidump-common" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97dbaf56dfe28d07e1fecffce410976774dcac1f0d7f6d797b437468e989e687" +dependencies = [ + "bitflags 1.3.2", + "debugid", + "enum-primitive-derive", + "num-traits 0.2.15", + "range-map", + "scroll", + "smart-default", + "tracing", +] + +[[package]] +name = "minidump-writer" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c8c8fcc3823f1f4eec257a24990ab4c6a20ef9bcbc515400d0eb4a99620b943" +dependencies = [ + "byteorder", + "cfg-if", + "crash-context", + "goblin", + "libc", + "mach2", + "memmap2", + "memoffset 0.6.5", + "minidump-common", + "nix 0.25.1", + "scroll", + "tempfile", + "thiserror", + "windows-sys 0.42.0", +] + +[[package]] +name = "minidumper" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8e7577424f7abeacef16980ed8e200c84e74aaabb799c3ee30159ea877534fb" +dependencies = [ + "cfg-if", + "crash-context", + "libc", + "log", + "minidump-writer", + "parking_lot", + "polling", + "scroll", + "thiserror", + "uds", + "windows-sys 0.42.0", +] + +[[package]] +name = "minidumper-child" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f6a7c1a63d65dd21fa335135e5a614a7adb03560b2feb9fcb70eef34439bc8" +dependencies = [ + "crash-handler", + "minidumper", + "thiserror", + "uuid", +] + [[package]] name = "minisign-verify" version = "0.2.1" @@ -2483,6 +2665,18 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" +[[package]] +name = "nix" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" +dependencies = [ + "autocfg", + "bitflags 1.3.2", + "cfg-if", + "libc", +] + [[package]] name = "nix" version = "0.26.2" @@ -2546,7 +2740,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ "autocfg", - "num-traits", + "num-traits 0.2.15", ] [[package]] @@ -2557,7 +2751,16 @@ checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", "num-integer", - "num-traits", + "num-traits 0.2.15", +] + +[[package]] +name = "num-traits" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" +dependencies = [ + "num-traits 0.2.15", ] [[package]] @@ -3015,6 +3218,12 @@ version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" + [[package]] name = "plist" version = "1.4.3" @@ -3223,6 +3432,15 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "range-map" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87dc8ff3b0f3e32dbba6e49c592c0191a3a2cabbf6f7e5a78e1010050b9a42e1" +dependencies = [ + "num-traits 0.1.43", +] + [[package]] name = "raw-window-handle" version = "0.5.0" @@ -3433,6 +3651,26 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" +[[package]] +name = "scroll" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04c565b551bafbef4157586fa379538366e4385d42082f255bfd96e4fe8519da" +dependencies = [ + "scroll_derive", +] + +[[package]] +name = "scroll_derive" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdbda6ac5cd1321e724fa9cee216f3a61885889b896f073b8f82322789c5250e" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "security-framework" version = "2.8.2" @@ -3485,6 +3723,112 @@ dependencies = [ "serde", ] +[[package]] +name = "sentry" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5ce6d3512e2617c209ec1e86b0ca2fea06454cd34653c91092bf0f3ec41f8e3" +dependencies = [ + "httpdate", + "native-tls", + "reqwest", + "sentry-backtrace", + "sentry-contexts", + "sentry-core", + "sentry-debug-images", + "sentry-panic", + "tokio", + "ureq", +] + +[[package]] +name = "sentry-backtrace" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7fe408d4d1f8de188a9309916e02e129cbe51ca19e55badea5a64899399b1a" +dependencies = [ + "backtrace", + "once_cell", + "regex", + "sentry-core", +] + +[[package]] +name = "sentry-contexts" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5695096a059a89973ec541062d331ff4c9aeef9c2951416c894f0fff76340e7d" +dependencies = [ + "hostname", + "libc", + "os_info", + "rustc_version", + "sentry-core", + "uname", +] + +[[package]] +name = "sentry-core" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b22828bfd118a7b660cf7a155002a494755c0424cebb7061e4743ecde9c7dbc" +dependencies = [ + "once_cell", + "rand 0.8.5", + "sentry-types", + "serde", + "serde_json", +] + +[[package]] +name = "sentry-debug-images" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a9164d44a2929b1b7670afd7e87552514b70d3ae672ca52884639373d912a3d" +dependencies = [ + "findshlibs", + "once_cell", + "sentry-core", +] + +[[package]] +name = "sentry-panic" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f4ced2a7a8c14899d58eec402d946f69d5ed26a3fc363a7e8b1e5cb88473a01" +dependencies = [ + "sentry-backtrace", + "sentry-core", +] + +[[package]] +name = "sentry-rust-minidump" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a489204e5cb676310d7ef1506eefb76d006a82f27b648f5477ea74733467d5a1" +dependencies = [ + "minidumper-child", + "sentry", + "thiserror", +] + +[[package]] +name = "sentry-types" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "360ee3270f7a4a1eee6c667f7d38360b995431598a73b740dfe420da548d9cc9" +dependencies = [ + "debugid", + "getrandom 0.2.8", + "hex", + "serde", + "serde_json", + "thiserror", + "time 0.3.15", + "url", + "uuid", +] + [[package]] name = "serde" version = "1.0.159" @@ -3713,6 +4057,17 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +[[package]] +name = "smart-default" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "133659a15339456eeeb07572eb02a91c91e9815e9cbc89566944d2c8d3efdbf6" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "socket2" version = "0.4.9" @@ -4245,6 +4600,7 @@ dependencies = [ "tracing-subscriber 0.3.17", "url", "uuid", + "whoami", "winreg 0.50.0", "zip", ] @@ -4286,7 +4642,8 @@ dependencies = [ "futures", "objc", "os_info", - "regex", + "sentry", + "sentry-rust-minidump", "serde", "serde_json", "tauri", @@ -4530,6 +4887,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -4688,6 +5046,15 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +[[package]] +name = "uds" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "343758ccc8a17c1663182d780f68b52021d68b9a43d4b912b0a01f48b526e4f0" +dependencies = [ + "libc", +] + [[package]] name = "uds_windows" version = "1.0.2" @@ -4698,6 +5065,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "uname" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b72f89f0ca32e4db1c04e2a72f5345d59796d4866a1ee0609084569f73683dc8" +dependencies = [ + "libc", +] + [[package]] name = "unicode-bidi" version = "0.3.13" @@ -4731,6 +5107,19 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +[[package]] +name = "ureq" +version = "2.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "338b31dd1314f68f3aabf3ed57ab922df95ffcd902476ca7ba3c4ce7b908c46d" +dependencies = [ + "base64 0.13.1", + "log", + "native-tls", + "once_cell", + "url", +] + [[package]] name = "url" version = "2.3.1" @@ -5047,6 +5436,16 @@ dependencies = [ "windows-metadata", ] +[[package]] +name = "whoami" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c70234412ca409cc04e864e89523cb0fc37f5e1344ebed5a3ebf4192b6b9f68" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + [[package]] name = "widestring" version = "0.5.1" @@ -5480,7 +5879,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2769203cd13a0c6015d515be729c526d041e9cf2c0cc478d57faee85f40c6dcd" dependencies = [ - "nix", + "nix 0.26.2", "winapi", ] @@ -5516,7 +5915,7 @@ dependencies = [ "futures-sink", "futures-util", "hex", - "nix", + "nix 0.26.2", "once_cell", "ordered-stream", "rand 0.8.5", diff --git a/theseus/Cargo.toml b/theseus/Cargo.toml index e25c8b65..40cae641 100644 --- a/theseus/Cargo.toml +++ b/theseus/Cargo.toml @@ -22,7 +22,7 @@ async_zip = { version = "0.0.13", features = ["full"] } tempfile = "3.5.0" chrono = { version = "0.4.19", features = ["serde"] } -daedalus = { version = "0.1.21" } +daedalus = { version = "0.1.23" } dirs = "5.0.1" regex = "1.5" @@ -49,6 +49,8 @@ notify-debouncer-mini = { version = "0.2.1", default-features = false } lazy_static = "1.4.0" dunce = "1.0.3" +whoami = "1.4.0" + [target.'cfg(windows)'.dependencies] winreg = "0.50.0" diff --git a/theseus/src/api/logs.rs b/theseus/src/api/logs.rs index faa8fc22..0936ad0c 100644 --- a/theseus/src/api/logs.rs +++ b/theseus/src/api/logs.rs @@ -5,8 +5,7 @@ use tokio::fs::read_to_string; #[derive(Serialize, Deserialize, Debug)] pub struct Logs { pub datetime_string: String, - pub stdout: Option, - pub stderr: Option, + pub output: Option, } impl Logs { async fn build( @@ -15,19 +14,11 @@ impl Logs { clear_contents: Option, ) -> crate::Result { Ok(Self { - stdout: if clear_contents.unwrap_or(false) { + output: if clear_contents.unwrap_or(false) { None } else { Some( - get_stdout_by_datetime(profile_uuid, &datetime_string) - .await?, - ) - }, - stderr: if clear_contents.unwrap_or(false) { - None - } else { - Some( - get_stderr_by_datetime(profile_uuid, &datetime_string) + get_output_by_datetime(profile_uuid, &datetime_string) .await?, ) }, @@ -74,18 +65,15 @@ pub async fn get_logs_by_datetime( datetime_string: String, ) -> crate::Result { Ok(Logs { - stdout: Some( - get_stdout_by_datetime(profile_uuid, &datetime_string).await?, - ), - stderr: Some( - get_stderr_by_datetime(profile_uuid, &datetime_string).await?, + output: Some( + get_output_by_datetime(profile_uuid, &datetime_string).await?, ), datetime_string, }) } #[tracing::instrument] -pub async fn get_stdout_by_datetime( +pub async fn get_output_by_datetime( profile_uuid: uuid::Uuid, datetime_string: &str, ) -> crate::Result { @@ -97,19 +85,6 @@ pub async fn get_stdout_by_datetime( ) } -#[tracing::instrument] -pub async fn get_stderr_by_datetime( - profile_uuid: uuid::Uuid, - datetime_string: &str, -) -> crate::Result { - let state = State::get().await?; - let logs_folder = state.directories.profile_logs_dir(profile_uuid); - Ok( - read_to_string(logs_folder.join(datetime_string).join("stderr.log")) - .await?, - ) -} - #[tracing::instrument] pub async fn delete_logs(profile_uuid: uuid::Uuid) -> crate::Result<()> { let state = State::get().await?; diff --git a/theseus/src/api/pack.rs b/theseus/src/api/pack.rs index f1553497..4e9860e0 100644 --- a/theseus/src/api/pack.rs +++ b/theseus/src/api/pack.rs @@ -335,7 +335,6 @@ async fn install_pack( async { Ok(()) } }) .await?; - State::sync().await?; let profile = profile.clone(); let result = async { @@ -487,6 +486,8 @@ async fn install_pack( Some(loading_bar), ) .await?; + + State::sync().await?; } Ok::(profile.clone()) diff --git a/theseus/src/api/process.rs b/theseus/src/api/process.rs index 848ef4e4..ef455a19 100644 --- a/theseus/src/api/process.rs +++ b/theseus/src/api/process.rs @@ -69,9 +69,9 @@ pub async fn get_uuids_by_profile_path( children.running_keys_with_profile(profile_path).await } -// Gets stdout of a child process stored in the state by UUID, as a string +// Gets output of a child process stored in the state by UUID, as a string #[tracing::instrument] -pub async fn get_stdout_by_uuid(uuid: &Uuid) -> crate::Result { +pub async fn get_output_by_uuid(uuid: &Uuid) -> crate::Result { let state = State::get().await?; // Get stdout from child let children = state.children.read().await; @@ -79,7 +79,7 @@ pub async fn get_stdout_by_uuid(uuid: &Uuid) -> crate::Result { // Extract child or return crate::Error if let Some(child) = children.get(uuid) { let child = child.read().await; - Ok(child.stdout.get_output().await?) + Ok(child.output.get_output().await?) } else { Err(crate::ErrorKind::LauncherError(format!( "No child process by UUID {}", @@ -89,26 +89,6 @@ pub async fn get_stdout_by_uuid(uuid: &Uuid) -> crate::Result { } } -// Gets stderr of a child process stored in the state by UUID, as a string -#[tracing::instrument] -pub async fn get_stderr_by_uuid(uuid: &Uuid) -> crate::Result { - let state = State::get().await?; - // Get stdout from child - let children = state.children.read().await; - - // Extract child or return crate::Error - if let Some(child) = children.get(uuid) { - let child = child.read().await; - Ok(child.stderr.get_output().await?) - } else { - Err(crate::ErrorKind::LauncherError(format!( - "No child process with UUID {}", - uuid - )) - .as_error()) - } -} - // Kill a child process stored in the state by UUID, as a string #[tracing::instrument] pub async fn kill_by_uuid(uuid: &Uuid) -> crate::Result<()> { @@ -150,7 +130,7 @@ pub async fn kill(running: &mut MinecraftChild) -> crate::Result<()> { pub async fn wait_for(running: &mut MinecraftChild) -> crate::Result<()> { // We do not wait on the Child directly, but wait on the thread manager. // This way we can still run all cleanup hook functions that happen after. - let result = running + running .manager .take() .ok_or_else(|| { @@ -166,12 +146,5 @@ pub async fn wait_for(running: &mut MinecraftChild) -> crate::Result<()> { )) })?; - match result.success() { - false => Err(crate::ErrorKind::LauncherError(format!( - "Minecraft exited with non-zero code {}", - result.code().unwrap_or(-1) - )) - .as_error()), - true => Ok(()), - } + Ok(()) } diff --git a/theseus/src/api/profile.rs b/theseus/src/api/profile.rs index eb12e7d2..0612a49b 100644 --- a/theseus/src/api/profile.rs +++ b/theseus/src/api/profile.rs @@ -120,6 +120,7 @@ pub async fn edit_icon( ProfilePayloadType::Edited, ) .await?; + State::sync().await?; Ok(()) } @@ -133,7 +134,10 @@ pub async fn edit_icon( profile.metadata.icon = None; async { Ok(()) } }) - .await + .await?; + State::sync().await?; + + Ok(()) } } @@ -288,6 +292,7 @@ pub async fn update_all( ProfilePayloadType::Edited, ) .await?; + State::sync().await?; Ok(Arc::try_unwrap(map).unwrap().into_inner()) } else { @@ -344,6 +349,7 @@ pub async fn update_project( ProfilePayloadType::Edited, ) .await?; + State::sync().await?; } return Ok(path); @@ -378,6 +384,7 @@ pub async fn add_project_from_version( ProfilePayloadType::Edited, ) .await?; + State::sync().await?; Ok(path) } else { @@ -418,6 +425,7 @@ pub async fn add_project_from_path( ProfilePayloadType::Edited, ) .await?; + State::sync().await?; Ok(path) } else { @@ -444,6 +452,7 @@ pub async fn toggle_disable_project( ProfilePayloadType::Edited, ) .await?; + State::sync().await?; Ok(res) } else { @@ -470,6 +479,7 @@ pub async fn remove_project( ProfilePayloadType::Edited, ) .await?; + State::sync().await?; Ok(()) } else { diff --git a/theseus/src/api/profile_create.rs b/theseus/src/api/profile_create.rs index 8f970daf..87840fdf 100644 --- a/theseus/src/api/profile_create.rs +++ b/theseus/src/api/profile_create.rs @@ -164,7 +164,11 @@ pub(crate) async fn get_loader_version_from_loader( let filter = |it: &LoaderVersion| match version.as_str() { "latest" => true, "stable" => it.stable, - id => it.id == *id || format!("{}-{}", game_version, id) == it.id, + id => { + it.id == *id + || format!("{}-{}", game_version, id) == it.id + || format!("{}-{}-{}", game_version, id, game_version) == it.id + } }; let loader_data = match loader { diff --git a/theseus/src/event/mod.rs b/theseus/src/event/mod.rs index deae448f..a3d550aa 100644 --- a/theseus/src/event/mod.rs +++ b/theseus/src/event/mod.rs @@ -124,7 +124,7 @@ impl Drop for LoadingBarId { // Emit event to indicatif progress bar arc #[cfg(feature = "cli")] { - let cli_progress_bar = bar.cli_progress_bar.clone(); + let cli_progress_bar = bar.cli_progress_bar; cli_progress_bar.finish(); } } diff --git a/theseus/src/launcher/args.rs b/theseus/src/launcher/args.rs index c06d0fb2..c953f7d0 100644 --- a/theseus/src/launcher/args.rs +++ b/theseus/src/launcher/args.rs @@ -262,12 +262,17 @@ fn parse_minecraft_argument( resolution: WindowSize, ) -> crate::Result { Ok(argument + .replace("${accessToken}", access_token) .replace("${auth_access_token}", access_token) .replace("${auth_session}", access_token) .replace("${auth_player_name}", username) + // TODO: add auth xuid eventually + .replace("${auth_xuid}", "0") .replace("${auth_uuid}", &uuid.hyphenated().to_string()) + .replace("${uuid}", &uuid.hyphenated().to_string()) + .replace("${clientid}", "c4502edb-87c6-40cb-b595-64a280cf8906") .replace("${user_properties}", "{}") - .replace("${user_type}", "mojang") + .replace("${user_type}", "msa") .replace("${version_name}", version) .replace("${assets_index_name}", asset_index_name) .replace( diff --git a/theseus/src/launcher/mod.rs b/theseus/src/launcher/mod.rs index 7b080d77..8c84e563 100644 --- a/theseus/src/launcher/mod.rs +++ b/theseus/src/launcher/mod.rs @@ -14,6 +14,7 @@ use daedalus as d; use daedalus::minecraft::VersionInfo; use dunce::canonicalize; use st::Profile; +use std::collections::HashMap; use std::fs; use std::{process::Stdio, sync::Arc}; use tokio::process::Command; @@ -36,9 +37,12 @@ pub fn parse_rule(rule: &d::minecraft::Rule, java_version: &str) -> bool { features: Some(ref features), .. } => { - features.has_demo_resolution.unwrap_or(false) - || (features.has_demo_resolution.is_none() - && features.is_demo_user.is_none()) + !features.is_demo_user.unwrap_or(true) + || features.has_custom_resolution.unwrap_or(false) + || !features.has_quick_plays_support.unwrap_or(true) + || !features.is_quick_play_multiplayer.unwrap_or(true) + || !features.is_quick_play_realms.unwrap_or(true) + || !features.is_quick_play_singleplayer.unwrap_or(true) } _ => false, }; @@ -431,7 +435,6 @@ pub async fn launch_minecraft( fs::create_dir_all(&logs_dir)?; let stdout_log_path = logs_dir.join("stdout.log"); - let stderr_log_path = logs_dir.join("stderr.log"); crate::api::profile::edit(&profile.path, |prof| { prof.metadata.last_played = Some(Utc::now()); @@ -439,6 +442,34 @@ pub async fn launch_minecraft( async { Ok(()) } }) .await?; + State::sync().await?; + + let mut censor_strings = HashMap::new(); + let username = whoami::username(); + censor_strings.insert( + format!("/{}/", username), + "/{COMPUTER_USERNAME}/".to_string(), + ); + censor_strings.insert( + format!("\\{}\\", username), + "\\{COMPUTER_USERNAME}\\".to_string(), + ); + censor_strings.insert( + credentials.access_token.clone(), + "{MINECRAFT_ACCESS_TOKEN}".to_string(), + ); + censor_strings.insert( + credentials.username.clone(), + "{MINECRAFT_USERNAME}".to_string(), + ); + censor_strings.insert( + credentials.id.as_simple().to_string(), + "{MINECRAFT_UUID}".to_string(), + ); + censor_strings.insert( + credentials.id.as_hyphenated().to_string(), + "{MINECRAFT_UUID}".to_string(), + ); // Create Minecraft child by inserting it into the state // This also spawns the process and prepares the subsequent processes @@ -448,9 +479,9 @@ pub async fn launch_minecraft( Uuid::new_v4(), instance_path.to_path_buf(), stdout_log_path, - stderr_log_path, command, post_exit_hook, + censor_strings, ) .await } diff --git a/theseus/src/state/children.rs b/theseus/src/state/children.rs index 33d04aa0..19a5304a 100644 --- a/theseus/src/state/children.rs +++ b/theseus/src/state/children.rs @@ -26,8 +26,7 @@ pub struct MinecraftChild { pub profile_path: PathBuf, //todo: make UUID when profiles are recognized by UUID pub manager: Option>>, // None when future has completed and been handled pub current_child: Arc>, - pub stdout: SharedOutput, - pub stderr: SharedOutput, + pub output: SharedOutput, } impl Children { @@ -45,27 +44,27 @@ impl Children { &mut self, uuid: Uuid, profile_path: PathBuf, - stdout_log_path: PathBuf, - stderr_log_path: PathBuf, + log_path: PathBuf, mut mc_command: Command, post_command: Option, // Command to run after minecraft. + censor_strings: HashMap, ) -> crate::Result>> { // Takes the first element of the commands vector and spawns it let mut child = mc_command.spawn()?; // Create std watcher threads for stdout and stderr - let stdout = SharedOutput::build(&stdout_log_path).await?; + let shared_output = + SharedOutput::build(&log_path, censor_strings).await?; if let Some(child_stdout) = child.stdout.take() { - let stdout_clone = stdout.clone(); + let stdout_clone = shared_output.clone(); tokio::spawn(async move { if let Err(e) = stdout_clone.read_stdout(child_stdout).await { error!("Stdout process died with error: {}", e); } }); } - let stderr = SharedOutput::build(&stderr_log_path).await?; if let Some(child_stderr) = child.stderr.take() { - let stderr_clone = stderr.clone(); + let stderr_clone = shared_output.clone(); tokio::spawn(async move { if let Err(e) = stderr_clone.read_stderr(child_stderr).await { error!("Stderr process died with error: {}", e); @@ -100,8 +99,7 @@ impl Children { uuid, profile_path, current_child, - stdout, - stderr, + output: shared_output, manager, }; @@ -293,13 +291,18 @@ impl Default for Children { pub struct SharedOutput { output: Arc>, log_file: Arc>, + censor_strings: HashMap, } impl SharedOutput { - async fn build(log_file_path: &Path) -> crate::Result { + async fn build( + log_file_path: &Path, + censor_strings: HashMap, + ) -> crate::Result { Ok(SharedOutput { output: Arc::new(RwLock::new(String::new())), log_file: Arc::new(RwLock::new(File::create(log_file_path).await?)), + censor_strings, }) } @@ -317,14 +320,17 @@ impl SharedOutput { let mut line = String::new(); while buf_reader.read_line(&mut line).await? > 0 { + let val_line = self.censor_log(line.clone()); + { let mut output = self.output.write().await; - output.push_str(&line); + output.push_str(&val_line); } { let mut log_file = self.log_file.write().await; - log_file.write_all(line.as_bytes()).await?; + log_file.write_all(val_line.as_bytes()).await?; } + line.clear(); } Ok(()) @@ -338,12 +344,27 @@ impl SharedOutput { let mut line = String::new(); while buf_reader.read_line(&mut line).await? > 0 { + let val_line = self.censor_log(line.clone()); + { let mut output = self.output.write().await; - output.push_str(&line); + output.push_str(&val_line); } + { + let mut log_file = self.log_file.write().await; + log_file.write_all(val_line.as_bytes()).await?; + } + line.clear(); } Ok(()) } + + fn censor_log(&self, mut val: String) -> String { + for (find, replace) in &self.censor_strings { + val = val.replace(find, replace); + } + + val + } } diff --git a/theseus/src/state/mod.rs b/theseus/src/state/mod.rs index c7114da6..a51dd9d1 100644 --- a/theseus/src/state/mod.rs +++ b/theseus/src/state/mod.rs @@ -266,7 +266,16 @@ async fn init_watcher() -> crate::Result> { } } - if !visited_paths.contains(&new_path) { + if e.path + .components() + .any(|x| x.as_os_str() == "crash-reports") + && e.path + .extension() + .map(|x| x == "txt") + .unwrap_or(false) + { + Profile::crash_task(new_path); + } else if !visited_paths.contains(&new_path) { Profile::sync_projects_task(new_path.clone()); visited_paths.push(new_path); } diff --git a/theseus/src/state/profiles.rs b/theseus/src/state/profiles.rs index 5dbfe395..337760e1 100644 --- a/theseus/src/state/profiles.rs +++ b/theseus/src/state/profiles.rs @@ -1,7 +1,7 @@ use super::settings::{Hooks, MemorySettings, WindowSize}; use crate::config::MODRINTH_API_URL; use crate::data::DirectoryInfo; -use crate::event::emit::emit_profile; +use crate::event::emit::{emit_profile, emit_warning}; use crate::event::ProfilePayloadType; use crate::prelude::JavaVersion; use crate::state::projects::Project; @@ -198,6 +198,30 @@ impl Profile { Ok(()) } + pub fn crash_task(path: PathBuf) { + tokio::task::spawn(async move { + let res = async { + let profile = crate::api::profile::get(&path, None).await?; + + if let Some(profile) = profile { + emit_warning(&format!("Profile {} has crashed! Visit the logs page to see a crash report.", profile.metadata.name)).await?; + } + + Ok::<(), crate::Error>(()) + } + .await; + + match res { + Ok(()) => {} + Err(err) => { + tracing::warn!( + "Unable to send crash report to frontend: {err}" + ) + } + }; + }); + } + pub fn sync_projects_task(path: PathBuf) { tokio::task::spawn(async move { let res = async { @@ -306,6 +330,7 @@ impl Profile { .await?; watch_path(profile_path, watcher, ProjectType::DataPack.get_folder()) .await?; + watch_path(profile_path, watcher, "crash-reports").await?; Ok(()) } @@ -575,6 +600,11 @@ impl Profiles { )) .await?; + { + let profiles = state.profiles.read().await; + profiles.sync().await?; + } + Ok::<(), crate::Error>(()) } .await; diff --git a/theseus/src/state/settings.rs b/theseus/src/state/settings.rs index 647e6690..b88702dc 100644 --- a/theseus/src/state/settings.rs +++ b/theseus/src/state/settings.rs @@ -28,6 +28,10 @@ pub struct Settings { pub collapsed_navigation: bool, #[serde(default)] pub developer_mode: bool, + #[serde(default)] + pub opt_out_analytics: bool, + #[serde(default)] + pub advanced_rendering: bool, } impl Default for Settings { @@ -46,6 +50,8 @@ impl Default for Settings { version: CURRENT_FORMAT_VERSION, collapsed_navigation: false, developer_mode: false, + opt_out_analytics: false, + advanced_rendering: true, } } } diff --git a/theseus_gui/package.json b/theseus_gui/package.json index 9454c045..bd845eb3 100644 --- a/theseus_gui/package.json +++ b/theseus_gui/package.json @@ -16,8 +16,9 @@ "@tauri-apps/api": "^1.3.0", "dayjs": "^1.11.7", "floating-vue": "^2.0.0-beta.20", + "mixpanel-browser": "^2.47.0", "ofetch": "^1.0.1", - "omorphia": "^0.4.27", + "omorphia": "^0.4.28", "pinia": "^2.1.3", "vite-svg-loader": "^4.0.0", "vue": "^3.3.4", diff --git a/theseus_gui/pnpm-lock.yaml b/theseus_gui/pnpm-lock.yaml index 737267d7..73e185d4 100644 --- a/theseus_gui/pnpm-lock.yaml +++ b/theseus_gui/pnpm-lock.yaml @@ -10,12 +10,15 @@ dependencies: floating-vue: specifier: ^2.0.0-beta.20 version: 2.0.0-beta.20(vue@3.3.4) + mixpanel-browser: + specifier: ^2.47.0 + version: 2.47.0 ofetch: specifier: ^1.0.1 version: 1.0.1 omorphia: - specifier: ^0.4.27 - version: 0.4.27 + specifier: ^0.4.28 + version: 0.4.28 pinia: specifier: ^2.1.3 version: 2.1.3(vue@3.3.4) @@ -1291,6 +1294,10 @@ packages: brace-expansion: 1.1.11 dev: true + /mixpanel-browser@2.47.0: + resolution: {integrity: sha512-Ldrva0fRBEIFWmEibBQO1PulfpJVF3pf28Guk09lDirDaSQqqU/xs9zQLwN2rL5VwVtsP1aD3JaCgaa98EjojQ==} + dev: false + /ms@2.1.2: resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} dev: true @@ -1326,8 +1333,8 @@ packages: ufo: 1.1.2 dev: false - /omorphia@0.4.27: - resolution: {integrity: sha512-DvT8jTAE0RW9qAD2LAIkztVmhZkkITZ3ER587guK69KD2iErm+ZRSKCUJIOXFet94B9+d8+M3eM2pIiBnAkD9Q==} + /omorphia@0.4.28: + resolution: {integrity: sha512-ZTUgBD3ZL+aymS7u5pLaPo8I5FUI8fkoz2dZLtAS5ksGRI5wrWkwIi/kxjpC95A2oDxNQvZaylfwUTK3Z6a2Sw==} dependencies: dayjs: 1.11.7 floating-vue: 2.0.0-beta.20(vue@3.3.4) diff --git a/theseus_gui/src-tauri/Cargo.toml b/theseus_gui/src-tauri/Cargo.toml index 33a5c11c..c1401056 100644 --- a/theseus_gui/src-tauri/Cargo.toml +++ b/theseus_gui/src-tauri/Cargo.toml @@ -12,7 +12,6 @@ build = "build.rs" [build-dependencies] tauri-build = { version = "1.3", features = [] } -regex = "1.5" [dependencies] theseus = { path = "../../theseus", features = ["tauri"] } @@ -37,6 +36,9 @@ tracing = "0.1.37" tracing-subscriber = "0.2" tracing-error = "0.1" +sentry = "0.30" +sentry-rust-minidump = "0.5" + [target.'cfg(target_os = "macos")'.dependencies] cocoa = "0.24.1" objc = "0.2.7" diff --git a/theseus_gui/src-tauri/build.rs b/theseus_gui/src-tauri/build.rs index 3ca95448..26e675eb 100644 --- a/theseus_gui/src-tauri/build.rs +++ b/theseus_gui/src-tauri/build.rs @@ -1,111 +1,4 @@ -use std::fs; - -use regex::Regex; - fn main() { // Build the Tauri app tauri_build::build(); - - // Check that all JavaScript 'invoke' Tauri functions have a corresponding tagged Rust function - // This is to prevent the app from crashing if a JavaScript function is invoked but the corresponding Rust function is not tagged - // This only allows simple functions, but functions in theseus_gui should be kept simple - check_invoke_sanity(); -} - -fn check_invoke_sanity() { - let js_files = read_js_files("../src/helpers"); - let rust_files = read_rust_files("src"); - - let js_function_names = extract_js_function_names(&js_files); - let rust_function_names = extract_rust_function_names(&rust_files); - - let mut missing_functions = Vec::new(); - for js_fn_name in js_function_names { - if !rust_function_names.contains(&js_fn_name) { - missing_functions.push(js_fn_name); - } - } - if !missing_functions.is_empty() { - panic!( - "The following invoked Tauri functions do not have corresponding Rust functions with #[tauri::command] attribute :\n{}", - missing_functions.join("\n") - ); - } -} - -fn read_js_files(directory: &str) -> Vec { - let mut files = Vec::new(); - read_files_recursively(directory, "js", &mut files); - files -} - -fn read_rust_files(directory: &str) -> Vec { - let mut files = Vec::new(); - read_files_recursively(directory, "rs", &mut files); - files -} - -// Recursive in case we make the helpers directory more complex -fn read_files_recursively( - directory: &str, - extension: &str, - files: &mut Vec, -) { - for entry in fs::read_dir(directory).unwrap() { - let entry = entry.unwrap(); - let path = entry.path(); - if path.is_dir() { - read_files_recursively(&path.to_string_lossy(), extension, files); - } else if path.extension().map_or(false, |ext| ext == extension) { - let content = fs::read_to_string(path).unwrap(); - files.push(content); - } - } -} - -fn extract_rust_function_names(rust_files: &[String]) -> Vec { - // Matches #[tauri::command] attribute - let re_tauri_command = Regex::new(r"(?m)#\[tauri::command\]").unwrap(); - // Matches function name following the #[tauri::command] attribute - // Matches up to the first (, to allow for function arguments and comments in that area - let re_function_name = - Regex::new(r"fn\s+([a-zA-Z_][a-zA-Z0-9_]*)\s*\(").unwrap(); - let mut function_names = Vec::new(); - - for file in rust_files { - let mut start = 0; - while let Some(command_match) = re_tauri_command.find_at(file, start) { - if let Some(function_name_cap) = - re_function_name.captures(&file[command_match.end()..]) - { - function_names.push(function_name_cap[1].to_string()); - start = command_match.start() + 1; - } else { - break; - } - } - } - - function_names -} - -fn extract_js_function_names(js_files: &[String]) -> Vec { - // Matches functions of the form: invoke('function_name', { ... }) (or invoke('function_name') ) - let re_invoke = Regex::new( - r"(?m)invoke\(\s*'([a-zA-Z_][a-zA-Z0-9_]*)'\s*(?:,\s*\{.*?\})?\s*\)", - ) - .unwrap(); - let mut function_names = Vec::new(); - - for file in js_files { - let mut start = 0; - while let Some(invoke_match) = re_invoke.find_at(file, start) { - if let Some(captures) = re_invoke.captures(invoke_match.as_str()) { - function_names.push(captures[1].to_string()); - } - start = invoke_match.start() + 1; - } - } - - function_names } diff --git a/theseus_gui/src-tauri/src/api/logs.rs b/theseus_gui/src-tauri/src/api/logs.rs index 2c41bb94..f9b8fe54 100644 --- a/theseus_gui/src-tauri/src/api/logs.rs +++ b/theseus_gui/src-tauri/src/api/logs.rs @@ -34,20 +34,11 @@ pub async fn logs_get_logs_by_datetime( /// Get the stdout for a profile by profile id and datetime string #[tauri::command] -pub async fn logs_get_stdout_by_datetime( +pub async fn logs_get_output_by_datetime( profile_uuid: Uuid, datetime_string: String, ) -> Result { - Ok(logs::get_stdout_by_datetime(profile_uuid, &datetime_string).await?) -} - -/// Get the stderr for a profile by profile id and datetime string -#[tauri::command] -pub async fn logs_get_stderr_by_datetime( - profile_uuid: Uuid, - datetime_string: String, -) -> Result { - Ok(logs::get_stderr_by_datetime(profile_uuid, &datetime_string).await?) + Ok(logs::get_output_by_datetime(profile_uuid, &datetime_string).await?) } /// Delete all logs for a profile by profile id diff --git a/theseus_gui/src-tauri/src/api/process.rs b/theseus_gui/src-tauri/src/api/process.rs index 87cd0813..1c106598 100644 --- a/theseus_gui/src-tauri/src/api/process.rs +++ b/theseus_gui/src-tauri/src/api/process.rs @@ -52,14 +52,8 @@ pub async fn process_get_all_running_profiles() -> Result> { // Gets process stderr by process UUID #[tauri::command] -pub async fn process_get_stderr_by_uuid(uuid: Uuid) -> Result { - Ok(process::get_stderr_by_uuid(&uuid).await?) -} - -// Gets process stdout by process UUID -#[tauri::command] -pub async fn process_get_stdout_by_uuid(uuid: Uuid) -> Result { - Ok(process::get_stdout_by_uuid(&uuid).await?) +pub async fn process_get_output_by_uuid(uuid: Uuid) -> Result { + Ok(process::get_output_by_uuid(&uuid).await?) } // Kill a process by process UUID diff --git a/theseus_gui/src-tauri/src/api/profile.rs b/theseus_gui/src-tauri/src/api/profile.rs index 5ae4cb5e..b7b76b25 100644 --- a/theseus_gui/src-tauri/src/api/profile.rs +++ b/theseus_gui/src-tauri/src/api/profile.rs @@ -233,6 +233,7 @@ pub async fn profile_edit( async { Ok(()) } }) .await?; + State::sync().await?; Ok(()) } diff --git a/theseus_gui/src-tauri/src/main.rs b/theseus_gui/src-tauri/src/main.rs index 84a164d5..2c410f42 100644 --- a/theseus_gui/src-tauri/src/main.rs +++ b/theseus_gui/src-tauri/src/main.rs @@ -21,6 +21,15 @@ async fn initialize_state(app: tauri::AppHandle) -> api::Result<()> { Ok(()) } +#[tauri::command] +fn is_dev() -> bool { + if cfg!(debug_assertions) { + true + } else { + false + } +} + use tracing_subscriber::prelude::*; #[derive(Clone, serde::Serialize)] @@ -30,6 +39,9 @@ struct Payload { } fn main() { + let client = sentry::init("https://19a14416dafc4b4a858fa1a38db3b704@o485889.ingest.sentry.io/4505349067374592"); + + let _guard = sentry_rust_minidump::init(&client); /* tracing is set basd on the environment variable RUST_LOG=xxx, depending on the amount of logs to show ERROR > WARN > INFO > DEBUG > TRACE @@ -83,6 +95,7 @@ fn main() { builder = builder.invoke_handler(tauri::generate_handler![ initialize_state, + is_dev, api::progress_bars_list, api::profile_create::profile_create_empty, api::profile_create::profile_create, @@ -138,8 +151,7 @@ fn main() { api::process::process_get_all_running_profiles, api::process::process_get_exit_status_by_uuid, api::process::process_has_finished_by_uuid, - api::process::process_get_stderr_by_uuid, - api::process::process_get_stdout_by_uuid, + api::process::process_get_output_by_uuid, api::process::process_kill_by_uuid, api::process::process_wait_for_by_uuid, api::metadata::metadata_get_game_versions, @@ -148,8 +160,7 @@ fn main() { api::metadata::metadata_get_quilt_versions, api::logs::logs_get_logs, api::logs::logs_get_logs_by_datetime, - api::logs::logs_get_stdout_by_datetime, - api::logs::logs_get_stderr_by_datetime, + api::logs::logs_get_output_by_datetime, api::logs::logs_delete_logs, api::logs::logs_delete_logs_by_datetime, api::utils::show_in_folder, @@ -159,4 +170,9 @@ fn main() { builder .run(tauri::generate_context!()) .expect("error while running tauri application"); + + #[allow(deref_nullptr)] + unsafe { + *std::ptr::null_mut() = true; + } } diff --git a/theseus_gui/src/App.vue b/theseus_gui/src/App.vue index 330d4e4f..ef4888e2 100644 --- a/theseus_gui/src/App.vue +++ b/theseus_gui/src/App.vue @@ -1,6 +1,6 @@