Implement launching the game on Linux

This commit is contained in:
fnrir
2023-08-18 13:31:18 +02:00
parent ef576e36b8
commit 3ecc4f4231
8 changed files with 557 additions and 100 deletions

499
src-tauri/Cargo.lock generated
View File

@@ -2,6 +2,15 @@
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 version = 3
[[package]]
name = "addr2line"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97"
dependencies = [
"gimli",
]
[[package]] [[package]]
name = "adler" name = "adler"
version = "1.0.2" version = "1.0.2"
@@ -61,6 +70,49 @@ dependencies = [
"alloc-no-stdlib", "alloc-no-stdlib",
] ]
[[package]]
name = "anime-game-core"
version = "1.15.1"
source = "git+https://github.com/an-anime-team/anime-game-core?tag=1.15.1#347a4ce274a2842a59ed049749503976affb2e74"
dependencies = [
"anyhow",
"bzip2",
"cached",
"dns-lookup",
"flate2",
"fs_extra",
"kinda-virtual-fs",
"lazy_static",
"md-5",
"minreq",
"serde",
"serde_json",
"sysinfo 0.29.2",
"tar",
"thiserror",
"tracing",
"xz",
"zip 0.6.2",
]
[[package]]
name = "anime-launcher-sdk"
version = "1.11.1"
source = "git+https://github.com/an-anime-team/anime-launcher-sdk.git?tag=1.11.1#4193fb94c81c6fea052397744c936a8f4c1a8232"
dependencies = [
"anime-game-core",
"anyhow",
"cached",
"discord-rich-presence",
"enum-ordinalize",
"lazy_static",
"md-5",
"serde",
"serde_json",
"tracing",
"wincompatlib",
]
[[package]] [[package]]
name = "ansi_term" name = "ansi_term"
version = "0.12.1" version = "0.12.1"
@@ -75,6 +127,9 @@ name = "anyhow"
version = "1.0.58" version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704"
dependencies = [
"backtrace",
]
[[package]] [[package]]
name = "args" name = "args"
@@ -126,7 +181,7 @@ checksum = "db8b7511298d5b7784b40b092d9e9dcd3a627a5707e4b5e507931ab0d44eeebf"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
"synstructure", "synstructure",
] ]
@@ -138,7 +193,7 @@ checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
"synstructure", "synstructure",
] ]
@@ -150,7 +205,7 @@ checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
] ]
[[package]] [[package]]
@@ -183,7 +238,7 @@ dependencies = [
"parking", "parking",
"polling", "polling",
"slab", "slab",
"socket2", "socket2 0.4.4",
"waker-fn", "waker-fn",
"winapi", "winapi",
] ]
@@ -199,13 +254,13 @@ dependencies = [
[[package]] [[package]]
name = "async-trait" name = "async-trait"
version = "0.1.56" version = "0.1.68"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96cf8829f67d2eab0b2dfa42c5d0ef737e0724e4a82b01b3e292456202b19716" checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 2.0.18",
] ]
[[package]] [[package]]
@@ -256,6 +311,27 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "backtrace"
version = "0.3.67"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca"
dependencies = [
"addr2line",
"cc",
"cfg-if",
"libc",
"miniz_oxide 0.6.2",
"object",
"rustc-demangle",
]
[[package]]
name = "base64"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff"
[[package]] [[package]]
name = "base64" name = "base64"
version = "0.13.0" version = "0.13.0"
@@ -412,6 +488,42 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c"
[[package]]
name = "cached"
version = "0.44.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b195e4fbc4b6862bbd065b991a34750399c119797efff72492f28a5864de8700"
dependencies = [
"async-trait",
"cached_proc_macro",
"cached_proc_macro_types",
"futures",
"hashbrown 0.13.2",
"instant",
"once_cell",
"thiserror",
"tokio",
]
[[package]]
name = "cached_proc_macro"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b48814962d2fd604c50d2b9433c2a41a0ab567779ee2c02f7fba6eca1221f082"
dependencies = [
"cached_proc_macro_types",
"darling 0.14.4",
"proc-macro2",
"quote",
"syn 1.0.98",
]
[[package]]
name = "cached_proc_macro_types"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a4f925191b4367301851c6d99b09890311d74b0d43f274c0b34c86d308a3663"
[[package]] [[package]]
name = "cairo-rs" name = "cairo-rs"
version = "0.15.12" version = "0.15.12"
@@ -747,7 +859,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"smallvec", "smallvec",
"syn", "syn 1.0.98",
] ]
[[package]] [[package]]
@@ -757,7 +869,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfae75de57f2b2e85e8768c3ea840fd159c8f33e2b6522c7835b7abac81be16e" checksum = "dfae75de57f2b2e85e8768c3ea840fd159c8f33e2b6522c7835b7abac81be16e"
dependencies = [ dependencies = [
"quote", "quote",
"syn", "syn 1.0.98",
] ]
[[package]] [[package]]
@@ -767,7 +879,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f877be4f7c9f246b183111634f75baa039715e3f46ce860677d3b19a69fb229c" checksum = "f877be4f7c9f246b183111634f75baa039715e3f46ce860677d3b19a69fb229c"
dependencies = [ dependencies = [
"quote", "quote",
"syn", "syn 1.0.98",
] ]
[[package]] [[package]]
@@ -790,6 +902,7 @@ checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35"
name = "cultivation" name = "cultivation"
version = "1.1.1" version = "1.1.1"
dependencies = [ dependencies = [
"anime-launcher-sdk",
"args", "args",
"cc", "cc",
"ctrlc", "ctrlc",
@@ -811,7 +924,7 @@ dependencies = [
"serde_json", "serde_json",
"sevenz-rust", "sevenz-rust",
"sudo", "sudo",
"sysinfo", "sysinfo 0.28.4",
"tauri", "tauri",
"tauri-build", "tauri-build",
"tokio", "tokio",
@@ -830,8 +943,18 @@ version = "0.13.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c"
dependencies = [ dependencies = [
"darling_core", "darling_core 0.13.4",
"darling_macro", "darling_macro 0.13.4",
]
[[package]]
name = "darling"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850"
dependencies = [
"darling_core 0.14.4",
"darling_macro 0.14.4",
] ]
[[package]] [[package]]
@@ -845,7 +968,21 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"strsim", "strsim",
"syn", "syn 1.0.98",
]
[[package]]
name = "darling_core"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0"
dependencies = [
"fnv",
"ident_case",
"proc-macro2",
"quote",
"strsim",
"syn 1.0.98",
] ]
[[package]] [[package]]
@@ -854,9 +991,20 @@ version = "0.13.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835"
dependencies = [ dependencies = [
"darling_core", "darling_core 0.13.4",
"quote", "quote",
"syn", "syn 1.0.98",
]
[[package]]
name = "darling_macro"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e"
dependencies = [
"darling_core 0.14.4",
"quote",
"syn 1.0.98",
] ]
[[package]] [[package]]
@@ -933,7 +1081,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"rustc_version 0.4.0", "rustc_version 0.4.0",
"syn", "syn 1.0.98",
] ]
[[package]] [[package]]
@@ -977,6 +1125,18 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "discord-rich-presence"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47fc4beffb85ee1461588499073a4d9c20dcc7728c4b13d6b282ab6c508947e5"
dependencies = [
"serde",
"serde_derive",
"serde_json",
"uuid 0.8.2",
]
[[package]] [[package]]
name = "dispatch" name = "dispatch"
version = "0.2.0" version = "0.2.0"
@@ -991,7 +1151,7 @@ checksum = "3bf95dc3f046b9da4f2d51833c0d3547d8564ef6910f5c1ed130306a75b92886"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
] ]
[[package]] [[package]]
@@ -1000,6 +1160,18 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257" checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257"
[[package]]
name = "dns-lookup"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f332aa79f9e9de741ac013237294ef42ce2e9c6394dc7d766725812f1238812"
dependencies = [
"cfg-if",
"libc",
"socket2 0.5.3",
"windows-sys 0.48.0",
]
[[package]] [[package]]
name = "dtoa" name = "dtoa"
version = "0.4.8" version = "0.4.8"
@@ -1049,6 +1221,19 @@ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]]
name = "enum-ordinalize"
version = "3.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4f76552f53cefc9a7f64987c3701b99d982f7690606fd67de1d09712fbf52f1"
dependencies = [
"num-bigint 0.4.3",
"num-traits 0.2.15",
"proc-macro2",
"quote",
"syn 2.0.18",
]
[[package]] [[package]]
name = "enum_primitive" name = "enum_primitive"
version = "0.1.1" version = "0.1.1"
@@ -1128,7 +1313,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6"
dependencies = [ dependencies = [
"crc32fast", "crc32fast",
"miniz_oxide", "miniz_oxide 0.5.3",
] ]
[[package]] [[package]]
@@ -1162,6 +1347,12 @@ dependencies = [
"percent-encoding", "percent-encoding",
] ]
[[package]]
name = "fs_extra"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"
[[package]] [[package]]
name = "fuchsia-cprng" name = "fuchsia-cprng"
version = "0.1.1" version = "0.1.1"
@@ -1249,7 +1440,7 @@ checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
] ]
[[package]] [[package]]
@@ -1417,6 +1608,12 @@ dependencies = [
"wasi 0.11.0+wasi-snapshot-preview1", "wasi 0.11.0+wasi-snapshot-preview1",
] ]
[[package]]
name = "gimli"
version = "0.27.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e"
[[package]] [[package]]
name = "gio" name = "gio"
version = "0.15.12" version = "0.15.12"
@@ -1479,7 +1676,7 @@ dependencies = [
"proc-macro-error", "proc-macro-error",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
] ]
[[package]] [[package]]
@@ -1574,7 +1771,7 @@ dependencies = [
"proc-macro-error", "proc-macro-error",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
] ]
[[package]] [[package]]
@@ -1605,6 +1802,12 @@ dependencies = [
"ahash", "ahash",
] ]
[[package]]
name = "hashbrown"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
[[package]] [[package]]
name = "heck" name = "heck"
version = "0.3.3" version = "0.3.3"
@@ -1649,7 +1852,7 @@ dependencies = [
"markup5ever", "markup5ever",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
] ]
[[package]] [[package]]
@@ -1694,9 +1897,9 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
[[package]] [[package]]
name = "hudsucker" name = "hudsucker"
version = "0.19.1" version = "0.19.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "655326a6a1f44e52c64ee30a4fdfd86e4de893b2ed6757250391ec6c9a8f93a8" checksum = "d1f3686f2987b902c5fafb0ee2ff369fd7f869822da20deed181d1d846a858bc"
dependencies = [ dependencies = [
"async-compression", "async-compression",
"async-trait", "async-trait",
@@ -1736,7 +1939,7 @@ dependencies = [
"httpdate", "httpdate",
"itoa 1.0.2", "itoa 1.0.2",
"pin-project-lite", "pin-project-lite",
"socket2", "socket2 0.4.4",
"tokio", "tokio",
"tower-service", "tower-service",
"tracing", "tracing",
@@ -1850,7 +2053,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"hashbrown", "hashbrown 0.12.3",
] ]
[[package]] [[package]]
@@ -1993,6 +2196,12 @@ dependencies = [
"treediff", "treediff",
] ]
[[package]]
name = "kinda-virtual-fs"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca9325aac17917b5650f25d477ce2909f2e9539688227fdee3ceb5093f666c9e"
[[package]] [[package]]
name = "kuchiki" name = "kuchiki"
version = "0.8.1" version = "0.8.1"
@@ -2013,9 +2222,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.132" version = "0.2.146"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b"
[[package]] [[package]]
name = "libdbus-sys" name = "libdbus-sys"
@@ -2078,6 +2287,17 @@ dependencies = [
"byteorder", "byteorder",
] ]
[[package]]
name = "lzma-sys"
version = "0.1.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fda04ab3764e6cde78b9974eec4f779acaba7c4e84b36eca3cf77c581b85d27"
dependencies = [
"cc",
"libc",
"pkg-config",
]
[[package]] [[package]]
name = "mac" name = "mac"
version = "0.1.1" version = "0.1.1"
@@ -2144,6 +2364,25 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
[[package]]
name = "md-5"
version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca"
dependencies = [
"digest 0.10.6",
"md5-asm",
]
[[package]]
name = "md5-asm"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73b9a6f25ec11ea27e22d7fc8beafda909da44ece95f63e94f1eeb23d19bb5c7"
dependencies = [
"cc",
]
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.5.0" version = "2.5.0"
@@ -2180,6 +2419,32 @@ dependencies = [
"adler", "adler",
] ]
[[package]]
name = "miniz_oxide"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa"
dependencies = [
"adler",
]
[[package]]
name = "minreq"
version = "2.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3de406eeb24aba36ed3829532fa01649129677186b44a49debec0ec574ca7da7"
dependencies = [
"base64 0.12.3",
"log",
"once_cell",
"rustls",
"rustls-native-certs",
"serde",
"serde_json",
"webpki",
"webpki-roots",
]
[[package]] [[package]]
name = "mio" name = "mio"
version = "0.8.4" version = "0.8.4"
@@ -2455,7 +2720,7 @@ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
] ]
[[package]] [[package]]
@@ -2506,6 +2771,15 @@ dependencies = [
"objc", "objc",
] ]
[[package]]
name = "object"
version = "0.30.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385"
dependencies = [
"memchr",
]
[[package]] [[package]]
name = "oid-registry" name = "oid-registry"
version = "0.4.0" version = "0.4.0"
@@ -2569,7 +2843,7 @@ checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
] ]
[[package]] [[package]]
@@ -2597,7 +2871,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a" checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a"
dependencies = [ dependencies = [
"dlv-list", "dlv-list",
"hashbrown", "hashbrown 0.12.3",
] ]
[[package]] [[package]]
@@ -2741,7 +3015,7 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03c64931a1a212348ec4f3b4362585eca7159d0d09cbdf4a7f74f02173596fd4" checksum = "03c64931a1a212348ec4f3b4362585eca7159d0d09cbdf4a7f74f02173596fd4"
dependencies = [ dependencies = [
"base64", "base64 0.13.0",
] ]
[[package]] [[package]]
@@ -2822,7 +3096,7 @@ dependencies = [
"proc-macro-hack", "proc-macro-hack",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
] ]
[[package]] [[package]]
@@ -2836,7 +3110,7 @@ dependencies = [
"proc-macro-hack", "proc-macro-hack",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
] ]
[[package]] [[package]]
@@ -2874,7 +3148,7 @@ checksum = "710faf75e1b33345361201d36d04e98ac1ed8909151a017ed384700836104c74"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
] ]
[[package]] [[package]]
@@ -2901,7 +3175,7 @@ version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd39bc6cdc9355ad1dc5eeedefee696bb35c34caf21768741e81826c0bbd7225" checksum = "bd39bc6cdc9355ad1dc5eeedefee696bb35c34caf21768741e81826c0bbd7225"
dependencies = [ dependencies = [
"base64", "base64 0.13.0",
"indexmap", "indexmap",
"line-wrap", "line-wrap",
"serde", "serde",
@@ -2930,7 +3204,7 @@ dependencies = [
"bitflags", "bitflags",
"crc32fast", "crc32fast",
"deflate 1.0.0", "deflate 1.0.0",
"miniz_oxide", "miniz_oxide 0.5.3",
] ]
[[package]] [[package]]
@@ -2977,7 +3251,7 @@ dependencies = [
"proc-macro-error-attr", "proc-macro-error-attr",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
"version_check", "version_check",
] ]
@@ -3000,9 +3274,9 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.40" version = "1.0.60"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
@@ -3036,9 +3310,9 @@ dependencies = [
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.20" version = "1.0.28"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
@@ -3303,7 +3577,7 @@ version = "0.11.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b75aa69a3f06bbcc66ede33af2af253c6f7a86b1ca0033f60c580a27074fbf92" checksum = "b75aa69a3f06bbcc66ede33af2af253c6f7a86b1ca0033f60c580a27074fbf92"
dependencies = [ dependencies = [
"base64", "base64 0.13.0",
"bytes", "bytes",
"encoding_rs", "encoding_rs",
"futures-core", "futures-core",
@@ -3385,6 +3659,12 @@ dependencies = [
"ordered-multimap", "ordered-multimap",
] ]
[[package]]
name = "rustc-demangle"
version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
[[package]] [[package]]
name = "rustc-serialize" name = "rustc-serialize"
version = "0.3.24" version = "0.3.24"
@@ -3430,13 +3710,25 @@ dependencies = [
"webpki", "webpki",
] ]
[[package]]
name = "rustls-native-certs"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00"
dependencies = [
"openssl-probe",
"rustls-pemfile",
"schannel",
"security-framework",
]
[[package]] [[package]]
name = "rustls-pemfile" name = "rustls-pemfile"
version = "1.0.0" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7522c9de787ff061458fe9a829dc790a3f5b22dc571694fc5883f448b94d9a9" checksum = "e7522c9de787ff061458fe9a829dc790a3f5b22dc571694fc5883f448b94d9a9"
dependencies = [ dependencies = [
"base64", "base64 0.13.0",
] ]
[[package]] [[package]]
@@ -3594,7 +3886,7 @@ checksum = "dc1d3230c1de7932af58ad8ffbe1d784bd55efd5a9d84ac24f69c72d83543dfb"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
] ]
[[package]] [[package]]
@@ -3616,7 +3908,7 @@ checksum = "a2ad84e47328a31223de7fed7a4f5087f2d6ddfe586cf3ca25b7a165bc0a5aed"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
] ]
[[package]] [[package]]
@@ -3647,10 +3939,10 @@ version = "1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082" checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082"
dependencies = [ dependencies = [
"darling", "darling 0.13.4",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
] ]
[[package]] [[package]]
@@ -3672,7 +3964,7 @@ checksum = "74064874e9f6a15f04c1f3cb627902d0e6b410abbf36668afa873c61889f1763"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
] ]
[[package]] [[package]]
@@ -3818,6 +4110,16 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "socket2"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877"
dependencies = [
"libc",
"windows-sys 0.48.0",
]
[[package]] [[package]]
name = "soup2" name = "soup2"
version = "0.2.1" version = "0.2.1"
@@ -3917,7 +4219,7 @@ dependencies = [
"heck 0.3.3", "heck 0.3.3",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
] ]
[[package]] [[package]]
@@ -3947,6 +4249,17 @@ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]]
name = "syn"
version = "2.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]] [[package]]
name = "synstructure" name = "synstructure"
version = "0.12.6" version = "0.12.6"
@@ -3955,7 +4268,7 @@ checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
"unicode-xid", "unicode-xid",
] ]
@@ -3974,6 +4287,21 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "sysinfo"
version = "0.29.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9557d0845b86eea8182f7b10dff120214fb6cd9fd937b6f4917714e546a38695"
dependencies = [
"cfg-if",
"core-foundation-sys",
"libc",
"ntapi",
"once_cell",
"rayon",
"winapi",
]
[[package]] [[package]]
name = "system-deps" name = "system-deps"
version = "5.0.0" version = "5.0.0"
@@ -4138,7 +4466,7 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16d62a3c8790d6cba686cea6e3f7f569d12c662c3274c2d165a4fd33e3871b72" checksum = "16d62a3c8790d6cba686cea6e3f7f569d12c662c3274c2d165a4fd33e3871b72"
dependencies = [ dependencies = [
"base64", "base64 0.13.0",
"brotli", "brotli",
"ico", "ico",
"json-patch", "json-patch",
@@ -4167,7 +4495,7 @@ dependencies = [
"heck 0.4.0", "heck 0.4.0",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
"tauri-codegen", "tauri-codegen",
"tauri-utils", "tauri-utils",
] ]
@@ -4289,7 +4617,7 @@ checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
] ]
[[package]] [[package]]
@@ -4356,12 +4684,25 @@ dependencies = [
"memchr", "memchr",
"mio", "mio",
"num_cpus", "num_cpus",
"parking_lot 0.12.1",
"pin-project-lite", "pin-project-lite",
"signal-hook-registry", "signal-hook-registry",
"socket2", "socket2 0.4.4",
"tokio-macros",
"windows-sys 0.45.0", "windows-sys 0.45.0",
] ]
[[package]]
name = "tokio-macros"
version = "1.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.98",
]
[[package]] [[package]]
name = "tokio-native-tls" name = "tokio-native-tls"
version = "0.3.0" version = "0.3.0"
@@ -4461,7 +4802,7 @@ checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
] ]
[[package]] [[package]]
@@ -4530,7 +4871,7 @@ version = "0.17.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e27992fd6a8c29ee7eef28fc78349aa244134e10ad447ce3b9f0ac0ed0fa4ce0" checksum = "e27992fd6a8c29ee7eef28fc78349aa244134e10ad447ce3b9f0ac0ed0fa4ce0"
dependencies = [ dependencies = [
"base64", "base64 0.13.0",
"byteorder", "byteorder",
"bytes", "bytes",
"http", "http",
@@ -4549,7 +4890,7 @@ version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30ee6ab729cd4cf0fd55218530c4522ed30b7b6081752839b68fcec8d0960788" checksum = "30ee6ab729cd4cf0fd55218530c4522ed30b7b6081752839b68fcec8d0960788"
dependencies = [ dependencies = [
"base64", "base64 0.13.0",
"byteorder", "byteorder",
"bytes", "bytes",
"http", "http",
@@ -4814,7 +5155,7 @@ dependencies = [
"once_cell", "once_cell",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@@ -4848,7 +5189,7 @@ checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@@ -4955,7 +5296,7 @@ checksum = "eaebe196c01691db62e9e4ca52c5ef1e4fd837dcae27dae3ada599b5a8fd05ac"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 1.0.98",
] ]
[[package]] [[package]]
@@ -5024,6 +5365,16 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "wincompatlib"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89cd8dd63a2925273bdc4efd837ac5b847b06b23f141ce73664e274d54bbfa83"
dependencies = [
"anyhow",
"minreq",
]
[[package]] [[package]]
name = "windows" name = "windows"
version = "0.24.0" version = "0.24.0"
@@ -5079,7 +5430,7 @@ version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67a1062e555f7d9d66fd1130ed4f7c6ec41a47529ee0850cd0e926d95b26bb14" checksum = "67a1062e555f7d9d66fd1130ed4f7c6ec41a47529ee0850cd0e926d95b26bb14"
dependencies = [ dependencies = [
"syn", "syn 1.0.98",
"windows-tokens", "windows-tokens",
] ]
@@ -5454,7 +5805,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fb9bace5b5589ffead1afb76e43e34cff39cd0f3ce7e170ae0c29e53b88eb1c" checksum = "9fb9bace5b5589ffead1afb76e43e34cff39cd0f3ce7e170ae0c29e53b88eb1c"
dependencies = [ dependencies = [
"asn1-rs 0.3.1", "asn1-rs 0.3.1",
"base64", "base64 0.13.0",
"data-encoding", "data-encoding",
"der-parser 7.0.0", "der-parser 7.0.0",
"lazy_static", "lazy_static",
@@ -5473,7 +5824,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8" checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8"
dependencies = [ dependencies = [
"asn1-rs 0.5.1", "asn1-rs 0.5.1",
"base64", "base64 0.13.0",
"data-encoding", "data-encoding",
"der-parser 8.1.0", "der-parser 8.1.0",
"lazy_static", "lazy_static",
@@ -5500,6 +5851,24 @@ version = "0.8.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52839dc911083a8ef63efa4d039d1f58b5e409f923e44c80828f206f66e5541c" checksum = "52839dc911083a8ef63efa4d039d1f58b5e409f923e44c80828f206f66e5541c"
[[package]]
name = "xz"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c887690ff2a2e233e8e49633461521f98ec57fbff9d59a884c9a4f04ec1da34"
dependencies = [
"xz2",
]
[[package]]
name = "xz2"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "388c44dc09d76f1536602ead6d325eb532f5c122f17782bd57fb47baeeb767e2"
dependencies = [
"lzma-sys",
]
[[package]] [[package]]
name = "yasna" name = "yasna"
version = "0.5.0" version = "0.5.0"

View File

@@ -53,7 +53,7 @@ serde_json = "1"
# Dependencies for the HTTP(S) proxy. # Dependencies for the HTTP(S) proxy.
http = "0.2" http = "0.2"
hudsucker = "0.19.1" hudsucker = "0.19.2"
tracing = "0.1.21" tracing = "0.1.21"
tokio-rustls = "0.23.0" tokio-rustls = "0.23.0"
tokio-tungstenite = "0.17.0" tokio-tungstenite = "0.17.0"
@@ -71,6 +71,12 @@ file_diff = "1.0.0"
rust-ini = "0.18.0" rust-ini = "0.18.0"
ctrlc = "3.2.3" ctrlc = "3.2.3"
[target.'cfg(target_os = "linux")'.dependencies.anime-launcher-sdk]
git = "https://github.com/an-anime-team/anime-launcher-sdk.git"
tag = "1.11.1"
default-features = false
features = ["all", "genshin"]
[features] [features]
# by default Tauri runs in production mode # by default Tauri runs in production mode
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL # when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL

View File

@@ -33,7 +33,8 @@
"horny_mode": "Horny Mode", "horny_mode": "Horny Mode",
"auto_mongodb": "Automatically Start MongoDB", "auto_mongodb": "Automatically Start MongoDB",
"un_elevated": "Run the game non-elevated (no admin)", "un_elevated": "Run the game non-elevated (no admin)",
"redirect_more": "Also redirect other MHY games" "redirect_more": "Also redirect other MHY games",
"check_aagl": "For more options, check the other launcher"
}, },
"downloads": { "downloads": {
"grasscutter_fullbuild": "Download Grasscutter All-in-One", "grasscutter_fullbuild": "Download Grasscutter All-in-One",

View File

@@ -33,7 +33,8 @@
"horny_mode": "Tryb 34", "horny_mode": "Tryb 34",
"auto_mongodb": "Automatycznie uruchamiaj MongoDB", "auto_mongodb": "Automatycznie uruchamiaj MongoDB",
"un_elevated": "Uruchamiaj grę bez uprawnień administratora/roota", "un_elevated": "Uruchamiaj grę bez uprawnień administratora/roota",
"redirect_more": "Przekieruj też inne gry MHY" "redirect_more": "Przekieruj też inne gry MHY",
"check_aagl": "Więcej opcji znajdziesz w drugim launcherze"
}, },
"downloads": { "downloads": {
"grasscutter_fullbuild": "Pobierz Grasscutter (wszystko w jednym)", "grasscutter_fullbuild": "Pobierz Grasscutter (wszystko w jednym)",

View File

@@ -22,6 +22,12 @@ use crate::admin::reopen_as_admin;
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
use system_helpers::is_elevated; use system_helpers::is_elevated;
#[cfg(target_os = "linux")]
use std::{
thread::{sleep, JoinHandle},
time::{Duration, Instant},
};
mod admin; mod admin;
mod config; mod config;
mod downloader; mod downloader;
@@ -39,6 +45,9 @@ static WATCH_GAME_PROCESS: Lazy<Mutex<String>> = Lazy::new(|| Mutex::new(String:
static WATCH_GRASSCUTTER_PROCESS: Lazy<Mutex<String>> = Lazy::new(|| Mutex::new(String::new())); static WATCH_GRASSCUTTER_PROCESS: Lazy<Mutex<String>> = Lazy::new(|| Mutex::new(String::new()));
static GC_PID: std::sync::Mutex<usize> = Mutex::new(696969); static GC_PID: std::sync::Mutex<usize> = Mutex::new(696969);
#[cfg(target_os = "linux")]
pub static AAGL_THREAD: Lazy<Mutex<Option<JoinHandle<()>>>> = Lazy::new(|| Mutex::new(None));
fn try_flush() { fn try_flush() {
std::io::stdout().flush().unwrap_or(()) std::io::stdout().flush().unwrap_or(())
} }
@@ -270,6 +279,7 @@ fn is_game_running() -> bool {
!proc.is_empty() !proc.is_empty()
} }
#[cfg(target_os = "windows")]
#[tauri::command] #[tauri::command]
fn enable_process_watcher(window: tauri::Window, process: String) { fn enable_process_watcher(window: tauri::Window, process: String) {
*WATCH_GAME_PROCESS.lock().unwrap() = process; *WATCH_GAME_PROCESS.lock().unwrap() = process;
@@ -315,6 +325,41 @@ fn enable_process_watcher(window: tauri::Window, process: String) {
}); });
} }
// The library takes care of it
#[cfg(target_os = "linux")]
#[tauri::command]
fn enable_process_watcher(window: tauri::Window, process: String) {
drop(process);
thread::spawn(move || {
let end_time = Instant::now() + Duration::from_secs(60);
let game_thread = loop {
let mut lock = AAGL_THREAD.lock().unwrap();
if lock.is_some() {
break lock.take().unwrap();
}
drop(lock);
if end_time < Instant::now() {
// If more than 60 seconds pass something has gone wrong
println!("Waiting for game thread timed out");
return;
}
// Otherwhise wait in order to not use too many CPU cycles
sleep(Duration::from_millis(128));
};
game_thread.join().unwrap();
println!("Game closed");
*WATCH_GAME_PROCESS.lock().unwrap() = "".to_string();
disconnect();
window.emit("game_closed", &()).unwrap();
});
}
#[cfg(target_os = "macos")]
#[tauri::command]
fn enable_process_watcher(window: tauri::Window, process: String) {}
#[tauri::command] #[tauri::command]
fn is_grasscutter_running() -> bool { fn is_grasscutter_running() -> bool {
// Grab the grasscutter process name // Grab the grasscutter process name

View File

@@ -26,6 +26,9 @@ use tauri::{api::path::data_dir, http::Uri};
#[cfg(windows)] #[cfg(windows)]
use registry::{Data, Hive, Security}; use registry::{Data, Hive, Security};
#[cfg(target_os = "linux")]
use anime_launcher_sdk::{config::ConfigExt, genshin::config::Config};
async fn shutdown_signal() { async fn shutdown_signal() {
tokio::signal::ctrl_c() tokio::signal::ctrl_c()
.await .await
@@ -281,24 +284,23 @@ pub fn connect_to_proxy(proxy_port: u16) {
println!("Connected to the proxy."); println!("Connected to the proxy.");
} }
#[cfg(unix)] #[cfg(target_os = "linux")]
pub fn connect_to_proxy(proxy_port: u16) { pub fn connect_to_proxy(proxy_port: u16) {
// Edit /etc/environment to set $http_proxy and $https_proxy let mut config = Config::get().unwrap();
let mut env_file = match fs::read_to_string("/etc/environment") { let proxy_addr = format!("127.0.0.1:{}", proxy_port);
Ok(f) => f, if !config.game.environment.contains_key("http_proxy") {
Err(e) => { config
println!("Error opening /etc/environment: {}", e); .game
return; .environment
} .insert("http_proxy".to_string(), proxy_addr.clone());
}; }
if !config.game.environment.contains_key("https_proxy") {
// Append the proxy configuration. config
// We will not remove the current proxy config if it exists, so we can just remove these last lines when we disconnect .game
env_file += format!("\nhttps_proxy=127.0.0.1:{}", proxy_port).as_str(); .environment
env_file += format!("\nhttp_proxy=127.0.0.1:{}", proxy_port).as_str(); .insert("https_proxy".to_string(), proxy_addr);
}
// Save Config::update(config);
fs::write("/etc/environment", env_file).unwrap();
} }
#[cfg(target_od = "macos")] #[cfg(target_od = "macos")]
@@ -327,21 +329,14 @@ pub fn disconnect_from_proxy() {
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
pub fn disconnect_from_proxy() { pub fn disconnect_from_proxy() {
println!("Re-writing environment variables"); let mut config = Config::get().unwrap();
if config.game.environment.contains_key("http_proxy") {
let regexp = regex::Regex::new( config.game.environment.remove("http_proxy");
// This has to be specific as possible or we risk fuckin up their environment LOL }
r"(https|http)_proxy=.*127.0.0.1:.*", if config.game.environment.contains_key("https_proxy") {
) config.game.environment.remove("https_proxy");
.unwrap(); }
let environment = &fs::read_to_string("/etc/environment").expect("Failed to open environment"); Config::update(config);
let new_environment = regexp.replace_all(environment, "").to_string();
// Write new environment
fs::write("/etc/environment", new_environment.trim_end()).expect(
"Could not write environment, remove proxy declarations manually if they are still set",
);
} }
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]

View File

@@ -10,6 +10,13 @@ use {
windows_service::service_manager::{ServiceManager, ServiceManagerAccess}, windows_service::service_manager::{ServiceManager, ServiceManagerAccess},
}; };
#[cfg(target_os = "linux")]
use crate::AAGL_THREAD;
#[cfg(target_os = "linux")]
use anime_launcher_sdk::genshin::game;
#[cfg(target_os = "linux")]
use std::thread;
#[tauri::command] #[tauri::command]
pub fn run_program(path: String, args: Option<String>) { pub fn run_program(path: String, args: Option<String>) {
// Without unwrap_or, this can crash when UAC prompt is denied // Without unwrap_or, this can crash when UAC prompt is denied
@@ -22,6 +29,7 @@ pub fn run_program(path: String, args: Option<String>) {
}; };
} }
#[cfg(target_os = "windows")]
#[tauri::command] #[tauri::command]
pub fn run_program_relative(path: String, args: Option<String>) { pub fn run_program_relative(path: String, args: Option<String>) {
// Save the current working directory // Save the current working directory
@@ -41,6 +49,13 @@ pub fn run_program_relative(path: String, args: Option<String>) {
std::env::set_current_dir(cwd).unwrap(); std::env::set_current_dir(cwd).unwrap();
} }
#[cfg(target_os = "linux")]
#[tauri::command]
pub fn run_program_relative(path: String, args: Option<String>) {
// This program should not run as root
run_un_elevated(path, args)
}
#[tauri::command] #[tauri::command]
pub fn run_command(program: &str, args: Vec<&str>, relative: Option<bool>) { pub fn run_command(program: &str, args: Vec<&str>, relative: Option<bool>) {
let prog = program.to_string(); let prog = program.to_string();
@@ -90,6 +105,7 @@ pub fn run_jar(path: String, execute_in: String, java_path: String) {
}; };
} }
#[cfg(target_os = "windows")]
#[tauri::command] #[tauri::command]
pub fn run_un_elevated(path: String, args: Option<String>) { pub fn run_un_elevated(path: String, args: Option<String>) {
// Open the program non-elevated. // Open the program non-elevated.
@@ -106,6 +122,20 @@ pub fn run_un_elevated(path: String, args: Option<String>) {
}; };
} }
#[cfg(target_os = "linux")]
#[tauri::command]
pub fn run_un_elevated(path: String, args: Option<String>) {
drop(path);
drop(args);
let t = thread::spawn(|| {
game::run().expect("doo doo");
});
{
let mut l = AAGL_THREAD.lock().unwrap();
l.replace(t);
}
}
#[tauri::command] #[tauri::command]
pub fn open_in_browser(url: String) { pub fn open_in_browser(url: String) {
// Open the URL in the default browser. // Open the URL in the default browser.

View File

@@ -434,6 +434,16 @@ export default class Options extends React.Component<IProps, IState> {
</BigButton> </BigButton>
</div> </div>
</div> </div>
{this.state.platform === 'linux' && (
<>
<Divider />
<div className="OptionSection" id="menuOptionsContainerCheckAAGL">
<div className="OptionLabel" id="menuOptionsLabelCheckAAGL">
<Tr text="options.check_aagl" />
</div>
</div>
</>
)}
{this.state.swag && ( {this.state.swag && (
<> <>
<Divider /> <Divider />