mirror of
https://github.com/nimbold/Firelink.git
synced 2026-07-27 20:40:12 +00:00
refactor(backend): replace legacy manual proxy scraping with native sysproxy crate
This commit is contained in:
Generated
+194
-33
@@ -8,6 +8,15 @@ version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.6.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.4"
|
||||
@@ -950,7 +959,7 @@ dependencies = [
|
||||
"rustc_version",
|
||||
"toml 1.1.2+spec-1.1.0",
|
||||
"vswhom",
|
||||
"winreg",
|
||||
"winreg 0.55.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1064,7 +1073,7 @@ version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f"
|
||||
dependencies = [
|
||||
"memoffset",
|
||||
"memoffset 0.9.1",
|
||||
"rustc_version",
|
||||
]
|
||||
|
||||
@@ -1549,6 +1558,21 @@ dependencies = [
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "handlebars"
|
||||
version = "0.29.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb04af2006ea09d985fef82b81e0eb25337e51b691c76403332378a53d521edc"
|
||||
dependencies = [
|
||||
"lazy_static 0.2.11",
|
||||
"log 0.3.9",
|
||||
"pest",
|
||||
"quick-error",
|
||||
"regex 0.2.11",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.3"
|
||||
@@ -1615,7 +1639,7 @@ version = "0.38.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1054432bae2f14e0061e33d23402fbaa67a921d319d56adc6bcf887ddad1cbc2"
|
||||
dependencies = [
|
||||
"log",
|
||||
"log 0.4.32",
|
||||
"markup5ever",
|
||||
]
|
||||
|
||||
@@ -1752,7 +1776,7 @@ dependencies = [
|
||||
"core-foundation-sys",
|
||||
"iana-time-zone-haiku",
|
||||
"js-sys",
|
||||
"log",
|
||||
"log 0.4.32",
|
||||
"wasm-bindgen",
|
||||
"windows-core 0.62.2",
|
||||
]
|
||||
@@ -1936,6 +1960,22 @@ dependencies = [
|
||||
"cfb",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "interfaces"
|
||||
version = "0.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ec8f50a973916cac3da5057c986db05cd3346f38c78e9bc24f64cc9f6a3978f"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"cc",
|
||||
"handlebars",
|
||||
"lazy_static 1.5.0",
|
||||
"libc",
|
||||
"nix",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ipnet"
|
||||
version = "2.12.0"
|
||||
@@ -2000,7 +2040,7 @@ dependencies = [
|
||||
"cfg-if",
|
||||
"combine",
|
||||
"jni-sys 0.3.1",
|
||||
"log",
|
||||
"log 0.4.32",
|
||||
"thiserror 1.0.69",
|
||||
"walkdir",
|
||||
"windows-sys 0.45.0",
|
||||
@@ -2084,10 +2124,22 @@ version = "3.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eebcc3aff044e5944a8fbaf69eb277d11986064cba30c468730e8b9909fb551c"
|
||||
dependencies = [
|
||||
"log",
|
||||
"log 0.4.32",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||
|
||||
[[package]]
|
||||
name = "leb128fmt"
|
||||
version = "0.1.0"
|
||||
@@ -2104,7 +2156,7 @@ dependencies = [
|
||||
"gtk",
|
||||
"gtk-sys",
|
||||
"libappindicator-sys",
|
||||
"log",
|
||||
"log 0.4.32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2173,6 +2225,15 @@ dependencies = [
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
|
||||
dependencies = [
|
||||
"log 0.4.32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.32"
|
||||
@@ -2197,7 +2258,7 @@ version = "0.38.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8983d30f2915feeaaab2d6babdd6bc7e9ed1a00b66b5e6d74df19aa9c0e91862"
|
||||
dependencies = [
|
||||
"log",
|
||||
"log 0.4.32",
|
||||
"tendril",
|
||||
"web_atoms",
|
||||
]
|
||||
@@ -2214,6 +2275,15 @@ version = "2.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4"
|
||||
|
||||
[[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.9.1"
|
||||
@@ -2288,7 +2358,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"log 0.4.32",
|
||||
"openssl",
|
||||
"openssl-probe",
|
||||
"openssl-sys",
|
||||
@@ -2306,7 +2376,7 @@ checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4"
|
||||
dependencies = [
|
||||
"bitflags 2.13.0",
|
||||
"jni-sys 0.3.1",
|
||||
"log",
|
||||
"log 0.4.32",
|
||||
"ndk-sys",
|
||||
"num_enum",
|
||||
"raw-window-handle",
|
||||
@@ -2328,6 +2398,19 @@ version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.23.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"cc",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"memoffset 0.6.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "notify-rust"
|
||||
version = "4.17.0"
|
||||
@@ -2335,7 +2418,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "50ff2e74231b72c832d82982193b417f230945be6bdb5575b251d941d31adb00"
|
||||
dependencies = [
|
||||
"futures-lite",
|
||||
"log",
|
||||
"log 0.4.32",
|
||||
"mac-notification-sys",
|
||||
"serde",
|
||||
"tauri-winrt-notification",
|
||||
@@ -2758,6 +2841,12 @@ version = "2.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
|
||||
|
||||
[[package]]
|
||||
name = "pest"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0a6dda33d67c26f0aac90d324ab2eb7239c819fc7b2552fe9faa4fe88441edc8"
|
||||
|
||||
[[package]]
|
||||
name = "phf"
|
||||
version = "0.13.1"
|
||||
@@ -2995,6 +3084,12 @@ version = "0.1.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e0c5ccf5294c6ccd63a74f1565028353830a9c2f5eb0c682c355c471726a6e3f"
|
||||
|
||||
[[package]]
|
||||
name = "quick-error"
|
||||
version = "1.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
|
||||
|
||||
[[package]]
|
||||
name = "quick-xml"
|
||||
version = "0.37.5"
|
||||
@@ -3109,16 +3204,29 @@ dependencies = [
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9329abc99e39129fcceabd24cf5d85b4671ef7c29c50e972bc5afe32438ec384"
|
||||
dependencies = [
|
||||
"aho-corasick 0.6.10",
|
||||
"memchr",
|
||||
"regex-syntax 0.5.6",
|
||||
"thread_local",
|
||||
"utf8-ranges",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.12.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"aho-corasick 1.1.4",
|
||||
"memchr",
|
||||
"regex-automata",
|
||||
"regex-syntax",
|
||||
"regex-syntax 0.8.11",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3127,9 +3235,18 @@ version = "0.4.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"aho-corasick 1.1.4",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
"regex-syntax 0.8.11",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7"
|
||||
dependencies = [
|
||||
"ucd-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3157,7 +3274,7 @@ dependencies = [
|
||||
"hyper-tls",
|
||||
"hyper-util",
|
||||
"js-sys",
|
||||
"log",
|
||||
"log 0.4.32",
|
||||
"mime",
|
||||
"native-tls",
|
||||
"percent-encoding",
|
||||
@@ -3194,7 +3311,7 @@ dependencies = [
|
||||
"hyper",
|
||||
"hyper-util",
|
||||
"js-sys",
|
||||
"log",
|
||||
"log 0.4.32",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"serde",
|
||||
@@ -3224,7 +3341,7 @@ dependencies = [
|
||||
"gobject-sys",
|
||||
"gtk-sys",
|
||||
"js-sys",
|
||||
"log",
|
||||
"log 0.4.32",
|
||||
"objc2",
|
||||
"objc2-app-kit",
|
||||
"objc2-core-foundation",
|
||||
@@ -3440,7 +3557,7 @@ dependencies = [
|
||||
"bitflags 2.13.0",
|
||||
"cssparser",
|
||||
"derive_more",
|
||||
"log",
|
||||
"log 0.4.32",
|
||||
"new_debug_unreachable",
|
||||
"phf",
|
||||
"phf_codegen",
|
||||
@@ -3859,6 +3976,18 @@ dependencies = [
|
||||
"windows 0.62.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sysproxy"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9707a79d3b95683aa5a9521e698ffd878b8fb289727c25a69157fb85d529ffff"
|
||||
dependencies = [
|
||||
"interfaces",
|
||||
"thiserror 1.0.69",
|
||||
"winapi",
|
||||
"winreg 0.10.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "system-configuration"
|
||||
version = "0.7.0"
|
||||
@@ -3913,7 +4042,7 @@ dependencies = [
|
||||
"gtk",
|
||||
"jni",
|
||||
"libc",
|
||||
"log",
|
||||
"log 0.4.32",
|
||||
"ndk",
|
||||
"ndk-sys",
|
||||
"objc2",
|
||||
@@ -3970,7 +4099,7 @@ dependencies = [
|
||||
"image",
|
||||
"jni",
|
||||
"libc",
|
||||
"log",
|
||||
"log 0.4.32",
|
||||
"mime",
|
||||
"muda",
|
||||
"objc2",
|
||||
@@ -4009,12 +4138,14 @@ dependencies = [
|
||||
"axum",
|
||||
"hmac",
|
||||
"keyring",
|
||||
"regex",
|
||||
"regex 1.12.4",
|
||||
"reqwest 0.12.28",
|
||||
"semver",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2",
|
||||
"sysinfo",
|
||||
"sysproxy",
|
||||
"tauri",
|
||||
"tauri-build",
|
||||
"tauri-plugin-deep-link",
|
||||
@@ -4133,7 +4264,7 @@ version = "2.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "65981abb771e74e571a38196c3baa11c459379164791eba0e67abc1a5fac9884"
|
||||
dependencies = [
|
||||
"log",
|
||||
"log 0.4.32",
|
||||
"raw-window-handle",
|
||||
"rfd",
|
||||
"serde",
|
||||
@@ -4154,7 +4285,7 @@ dependencies = [
|
||||
"anyhow",
|
||||
"dunce",
|
||||
"glob",
|
||||
"log",
|
||||
"log 0.4.32",
|
||||
"objc2-foundation",
|
||||
"percent-encoding",
|
||||
"schemars 0.8.22",
|
||||
@@ -4175,7 +4306,7 @@ version = "2.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "01fc2c5ff41105bd1f7242d8201fdf3efd70749b82fa013a17f2126357d194cc"
|
||||
dependencies = [
|
||||
"log",
|
||||
"log 0.4.32",
|
||||
"notify-rust",
|
||||
"rand",
|
||||
"serde",
|
||||
@@ -4260,7 +4391,7 @@ dependencies = [
|
||||
"gtk",
|
||||
"http",
|
||||
"jni",
|
||||
"log",
|
||||
"log 0.4.32",
|
||||
"objc2",
|
||||
"objc2-app-kit",
|
||||
"once_cell",
|
||||
@@ -4293,13 +4424,13 @@ dependencies = [
|
||||
"http",
|
||||
"infer",
|
||||
"json-patch",
|
||||
"log",
|
||||
"log 0.4.32",
|
||||
"memchr",
|
||||
"phf",
|
||||
"plist",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
"regex 1.12.4",
|
||||
"schemars 0.8.22",
|
||||
"semver",
|
||||
"serde",
|
||||
@@ -4401,6 +4532,15 @@ dependencies = [
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
|
||||
dependencies = [
|
||||
"lazy_static 1.5.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.47"
|
||||
@@ -4698,7 +4838,7 @@ version = "0.1.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
|
||||
dependencies = [
|
||||
"log",
|
||||
"log 0.4.32",
|
||||
"pin-project-lite",
|
||||
"tracing-attributes",
|
||||
"tracing-core",
|
||||
@@ -4764,13 +4904,19 @@ version = "1.20.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
|
||||
|
||||
[[package]]
|
||||
name = "ucd-util"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "abd2fc5d32b590614af8b0a20d837f32eca055edd0bbead59a9cfe80858be003"
|
||||
|
||||
[[package]]
|
||||
name = "uds_windows"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e"
|
||||
dependencies = [
|
||||
"memoffset",
|
||||
"memoffset 0.9.1",
|
||||
"tempfile",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
@@ -4859,7 +5005,7 @@ version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70acd30e3aa1450bc2eece896ce2ad0d178e9c079493819301573dae3c37ba6d"
|
||||
dependencies = [
|
||||
"regex",
|
||||
"regex 1.12.4",
|
||||
"serde",
|
||||
"unic-ucd-ident",
|
||||
"url",
|
||||
@@ -4871,6 +5017,12 @@ version = "0.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
|
||||
|
||||
[[package]]
|
||||
name = "utf8-ranges"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fcfc827f90e53a02eaef5e535ee14266c1d569214c6aa70133a624d8a3164ba"
|
||||
|
||||
[[package]]
|
||||
name = "utf8_iter"
|
||||
version = "1.0.4"
|
||||
@@ -5705,6 +5857,15 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winreg"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winreg"
|
||||
version = "0.55.0"
|
||||
@@ -5781,7 +5942,7 @@ dependencies = [
|
||||
"anyhow",
|
||||
"bitflags 2.13.0",
|
||||
"indexmap 2.14.0",
|
||||
"log",
|
||||
"log 0.4.32",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
@@ -5800,7 +5961,7 @@ dependencies = [
|
||||
"anyhow",
|
||||
"id-arena",
|
||||
"indexmap 2.14.0",
|
||||
"log",
|
||||
"log 0.4.32",
|
||||
"semver",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
|
||||
@@ -37,3 +37,5 @@ tempfile = "3"
|
||||
thiserror = "2.0.18"
|
||||
axum = "0.8.9"
|
||||
tower-http = { version = "0.6.11", features = ["cors"] }
|
||||
sysproxy = "0.3.0"
|
||||
semver = "1.0.28"
|
||||
|
||||
@@ -2,128 +2,17 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_system_proxy() -> Result<Option<String>, String> {
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
use std::process::Command;
|
||||
let output = Command::new("scutil").arg("--proxy").output().map_err(|e| e.to_string())?;
|
||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||
|
||||
let mut http_enable = false;
|
||||
let mut http_proxy = String::new();
|
||||
let mut http_port = String::new();
|
||||
let mut https_enable = false;
|
||||
let mut https_proxy = String::new();
|
||||
let mut https_port = String::new();
|
||||
|
||||
for line in stdout.lines() {
|
||||
let parts: Vec<&str> = line.splitn(2, ':').collect();
|
||||
if parts.len() == 2 {
|
||||
let key = parts[0].trim();
|
||||
let value = parts[1].trim();
|
||||
match key {
|
||||
"HTTPEnable" => http_enable = value == "1",
|
||||
"HTTPProxy" => http_proxy = value.to_string(),
|
||||
"HTTPPort" => http_port = value.to_string(),
|
||||
"HTTPSEnable" => https_enable = value == "1",
|
||||
"HTTPSProxy" => https_proxy = value.to_string(),
|
||||
"HTTPSPort" => https_port = value.to_string(),
|
||||
_ => {}
|
||||
}
|
||||
match sysproxy::Sysproxy::get_system_proxy() {
|
||||
Ok(proxy) => {
|
||||
if proxy.enable {
|
||||
// Determine protocol, usually sysproxy returns the host and port
|
||||
// We'll default to http:// unless the user has configured something specific
|
||||
Ok(Some(format!("http://{}:{}", proxy.host, proxy.port)))
|
||||
} else {
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
|
||||
if https_enable && !https_proxy.is_empty() {
|
||||
return Ok(Some(format!("http://{}:{}", https_proxy, https_port))); // Often https proxy is HTTP
|
||||
} else if http_enable && !http_proxy.is_empty() {
|
||||
return Ok(Some(format!("http://{}:{}", http_proxy, http_port)));
|
||||
}
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
use std::process::Command;
|
||||
let enable_output = Command::new("reg")
|
||||
.args(&["query", r#"HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"#, "/v", "ProxyEnable"])
|
||||
.output();
|
||||
|
||||
if let Ok(output) = enable_output {
|
||||
let enable_stdout = String::from_utf8_lossy(&output.stdout);
|
||||
if !enable_stdout.contains("0x1") {
|
||||
return Ok(None);
|
||||
}
|
||||
} else {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
let proxy_output = Command::new("reg")
|
||||
.args(&["query", r#"HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"#, "/v", "ProxyServer"])
|
||||
.output();
|
||||
|
||||
if let Ok(output) = proxy_output {
|
||||
let proxy_stdout = String::from_utf8_lossy(&output.stdout);
|
||||
if let Some(line) = proxy_stdout.lines().find(|l| l.contains("ProxyServer")) {
|
||||
let parts: Vec<&str> = line.split_whitespace().collect();
|
||||
if parts.len() >= 3 {
|
||||
let mut proxy = parts.last().unwrap().to_string();
|
||||
if !proxy.starts_with("http") {
|
||||
proxy = format!("http://{}", proxy);
|
||||
}
|
||||
return Ok(Some(proxy));
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
if let Ok(proxy) = std::env::var("https_proxy") {
|
||||
if !proxy.is_empty() { return Ok(Some(proxy)); }
|
||||
}
|
||||
if let Ok(proxy) = std::env::var("HTTPS_PROXY") {
|
||||
if !proxy.is_empty() { return Ok(Some(proxy)); }
|
||||
}
|
||||
if let Ok(proxy) = std::env::var("http_proxy") {
|
||||
if !proxy.is_empty() { return Ok(Some(proxy)); }
|
||||
}
|
||||
if let Ok(proxy) = std::env::var("HTTP_PROXY") {
|
||||
if !proxy.is_empty() { return Ok(Some(proxy)); }
|
||||
}
|
||||
|
||||
use std::process::Command;
|
||||
let mode_output = Command::new("gsettings")
|
||||
.args(&["get", "org.gnome.system.proxy", "mode"])
|
||||
.output();
|
||||
|
||||
if let Ok(output) = mode_output {
|
||||
let mode = String::from_utf8_lossy(&output.stdout);
|
||||
if mode.contains("'manual'") {
|
||||
let https_host = Command::new("gsettings").args(&["get", "org.gnome.system.proxy.https", "host"]).output();
|
||||
let https_port = Command::new("gsettings").args(&["get", "org.gnome.system.proxy.https", "port"]).output();
|
||||
|
||||
if let (Ok(h), Ok(p)) = (https_host, https_port) {
|
||||
let host = String::from_utf8_lossy(&h.stdout).replace("'", "").trim().to_string();
|
||||
let port = String::from_utf8_lossy(&p.stdout).trim().to_string();
|
||||
if !host.is_empty() && port != "0" {
|
||||
return Ok(Some(format!("https://{}:{}", host, port)));
|
||||
}
|
||||
}
|
||||
|
||||
let http_host = Command::new("gsettings").args(&["get", "org.gnome.system.proxy.http", "host"]).output();
|
||||
let http_port = Command::new("gsettings").args(&["get", "org.gnome.system.proxy.http", "port"]).output();
|
||||
|
||||
if let (Ok(h), Ok(p)) = (http_host, http_port) {
|
||||
let host = String::from_utf8_lossy(&h.stdout).replace("'", "").trim().to_string();
|
||||
let port = String::from_utf8_lossy(&p.stdout).trim().to_string();
|
||||
if !host.is_empty() && port != "0" {
|
||||
return Ok(Some(format!("http://{}:{}", host, port)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(None)
|
||||
Err(_) => Ok(None),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,21 +122,15 @@ pub async fn check_for_updates(app_handle: tauri::AppHandle) -> Result<ReleaseCh
|
||||
}
|
||||
|
||||
fn cmp_versions(a: &str, b: &str) -> std::cmp::Ordering {
|
||||
use semver::Version;
|
||||
|
||||
let a_clean = a.trim_start_matches(|c| c == 'v' || c == 'V');
|
||||
let b_clean = b.trim_start_matches(|c| c == 'v' || c == 'V');
|
||||
|
||||
let a_parts: Vec<u32> = a_clean.split('.').filter_map(|s| s.parse().ok()).collect();
|
||||
let b_parts: Vec<u32> = b_clean.split('.').filter_map(|s| s.parse().ok()).collect();
|
||||
let a_ver = Version::parse(a_clean).unwrap_or_else(|_| Version::new(0, 0, 0));
|
||||
let b_ver = Version::parse(b_clean).unwrap_or_else(|_| Version::new(0, 0, 0));
|
||||
|
||||
let len = std::cmp::max(a_parts.len(), b_parts.len());
|
||||
for i in 0..len {
|
||||
let a_val = a_parts.get(i).unwrap_or(&0);
|
||||
let b_val = b_parts.get(i).unwrap_or(&0);
|
||||
if a_val != b_val {
|
||||
return a_val.cmp(b_val);
|
||||
}
|
||||
}
|
||||
std::cmp::Ordering::Equal
|
||||
a_ver.cmp(&b_ver)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
|
||||
Reference in New Issue
Block a user