Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f3279ab3da | |||
| 8f5e6992c1 | |||
| 76a53c8ac9 |
Generated
+23
-188
@@ -73,15 +73,6 @@ dependencies = [
|
|||||||
"alloc-no-stdlib",
|
"alloc-no-stdlib",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "android_system_properties"
|
|
||||||
version = "0.1.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anyhow"
|
name = "anyhow"
|
||||||
version = "1.0.69"
|
version = "1.0.69"
|
||||||
@@ -512,21 +503,6 @@ dependencies = [
|
|||||||
"keystream",
|
"keystream",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "chrono"
|
|
||||||
version = "0.4.23"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f"
|
|
||||||
dependencies = [
|
|
||||||
"iana-time-zone",
|
|
||||||
"js-sys",
|
|
||||||
"num-integer",
|
|
||||||
"num-traits",
|
|
||||||
"time 0.1.45",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cipher"
|
name = "cipher"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
@@ -628,7 +604,7 @@ dependencies = [
|
|||||||
"sqlx 0.6.2",
|
"sqlx 0.6.2",
|
||||||
"tap",
|
"tap",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"time 0.3.19",
|
"time",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-stream",
|
"tokio-stream",
|
||||||
"tokio-tungstenite",
|
"tokio-tungstenite",
|
||||||
@@ -672,16 +648,6 @@ dependencies = [
|
|||||||
"objc",
|
"objc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "codespan-reporting"
|
|
||||||
version = "0.11.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
|
|
||||||
dependencies = [
|
|
||||||
"termcolor",
|
|
||||||
"unicode-width",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "color_quant"
|
name = "color_quant"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
@@ -1133,50 +1099,6 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cxx"
|
|
||||||
version = "1.0.91"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "86d3488e7665a7a483b57e25bdd90d0aeb2bc7608c8d0346acf2ad3f1caf1d62"
|
|
||||||
dependencies = [
|
|
||||||
"cc",
|
|
||||||
"cxxbridge-flags",
|
|
||||||
"cxxbridge-macro",
|
|
||||||
"link-cplusplus",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cxx-build"
|
|
||||||
version = "1.0.91"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "48fcaf066a053a41a81dfb14d57d99738b767febb8b735c3016e469fac5da690"
|
|
||||||
dependencies = [
|
|
||||||
"cc",
|
|
||||||
"codespan-reporting",
|
|
||||||
"once_cell",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"scratch",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cxxbridge-flags"
|
|
||||||
version = "1.0.91"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a2ef98b8b717a829ca5603af80e1f9e2e48013ab227b68ef37872ef84ee479bf"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cxxbridge-macro"
|
|
||||||
version = "1.0.91"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "darling"
|
name = "darling"
|
||||||
version = "0.13.4"
|
version = "0.13.4"
|
||||||
@@ -2542,30 +2464,6 @@ dependencies = [
|
|||||||
"tokio-native-tls",
|
"tokio-native-tls",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "iana-time-zone"
|
|
||||||
version = "0.1.53"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765"
|
|
||||||
dependencies = [
|
|
||||||
"android_system_properties",
|
|
||||||
"core-foundation-sys",
|
|
||||||
"iana-time-zone-haiku",
|
|
||||||
"js-sys",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "iana-time-zone-haiku"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca"
|
|
||||||
dependencies = [
|
|
||||||
"cxx",
|
|
||||||
"cxx-build",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ico"
|
name = "ico"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
@@ -2848,30 +2746,6 @@ version = "1.4.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libappindicator"
|
|
||||||
version = "0.8.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "89e1edfdc9b0853358306c6dfb4b77c79c779174256fe93d80c0b5ebca451a2f"
|
|
||||||
dependencies = [
|
|
||||||
"glib",
|
|
||||||
"gtk",
|
|
||||||
"gtk-sys",
|
|
||||||
"libappindicator-sys",
|
|
||||||
"log",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libappindicator-sys"
|
|
||||||
version = "0.8.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "08fcb2bea89cee9613982501ec83eaa2d09256b24540ae463c52a28906163918"
|
|
||||||
dependencies = [
|
|
||||||
"gtk-sys",
|
|
||||||
"libloading",
|
|
||||||
"once_cell",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.139"
|
version = "0.2.139"
|
||||||
@@ -2899,16 +2773,6 @@ dependencies = [
|
|||||||
"pkg-config",
|
"pkg-config",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libloading"
|
|
||||||
version = "0.7.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libm"
|
name = "libm"
|
||||||
version = "0.2.6"
|
version = "0.2.6"
|
||||||
@@ -2947,15 +2811,6 @@ dependencies = [
|
|||||||
"safemem",
|
"safemem",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "link-cplusplus"
|
|
||||||
version = "1.0.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5"
|
|
||||||
dependencies = [
|
|
||||||
"cc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linked-hash-map"
|
name = "linked-hash-map"
|
||||||
version = "0.5.6"
|
version = "0.5.6"
|
||||||
@@ -3031,7 +2886,7 @@ dependencies = [
|
|||||||
"dirs-next",
|
"dirs-next",
|
||||||
"objc-foundation",
|
"objc-foundation",
|
||||||
"objc_id",
|
"objc_id",
|
||||||
"time 0.3.19",
|
"time",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3300,6 +3155,15 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num_threads"
|
||||||
|
version = "0.1.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nym-api-requests"
|
name = "nym-api-requests"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@@ -3376,11 +3240,10 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nym-connect"
|
name = "nym-connect"
|
||||||
version = "1.1.9"
|
version = "1.1.12"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bip39",
|
"bip39",
|
||||||
"chrono",
|
|
||||||
"client-core",
|
"client-core",
|
||||||
"dirs",
|
"dirs",
|
||||||
"eyre",
|
"eyre",
|
||||||
@@ -3409,6 +3272,7 @@ dependencies = [
|
|||||||
"tempfile",
|
"tempfile",
|
||||||
"tendermint-rpc",
|
"tendermint-rpc",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
|
"time",
|
||||||
"tokio",
|
"tokio",
|
||||||
"ts-rs",
|
"ts-rs",
|
||||||
"url",
|
"url",
|
||||||
@@ -3521,10 +3385,10 @@ dependencies = [
|
|||||||
"nym-contracts-common",
|
"nym-contracts-common",
|
||||||
"schemars",
|
"schemars",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde-json-wasm",
|
||||||
"serde_repr",
|
"serde_repr",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"time 0.3.19",
|
"time",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4352,7 +4216,7 @@ dependencies = [
|
|||||||
"line-wrap",
|
"line-wrap",
|
||||||
"quick-xml 0.26.0",
|
"quick-xml 0.26.0",
|
||||||
"serde",
|
"serde",
|
||||||
"time 0.3.19",
|
"time",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4955,12 +4819,6 @@ 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 = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "scratch"
|
|
||||||
version = "1.0.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sct"
|
name = "sct"
|
||||||
version = "0.6.1"
|
version = "0.6.1"
|
||||||
@@ -5753,7 +5611,6 @@ dependencies = [
|
|||||||
"core-foundation",
|
"core-foundation",
|
||||||
"core-graphics",
|
"core-graphics",
|
||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
"dirs-next",
|
|
||||||
"dispatch",
|
"dispatch",
|
||||||
"gdk",
|
"gdk",
|
||||||
"gdk-pixbuf",
|
"gdk-pixbuf",
|
||||||
@@ -5767,7 +5624,6 @@ dependencies = [
|
|||||||
"instant",
|
"instant",
|
||||||
"jni",
|
"jni",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"libappindicator",
|
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
"ndk",
|
"ndk",
|
||||||
@@ -5906,7 +5762,7 @@ dependencies = [
|
|||||||
"sha2 0.10.6",
|
"sha2 0.10.6",
|
||||||
"tauri-utils",
|
"tauri-utils",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"time 0.3.19",
|
"time",
|
||||||
"url",
|
"url",
|
||||||
"uuid 1.3.0",
|
"uuid 1.3.0",
|
||||||
"walkdir",
|
"walkdir",
|
||||||
@@ -6046,7 +5902,7 @@ dependencies = [
|
|||||||
"subtle 2.4.1",
|
"subtle 2.4.1",
|
||||||
"subtle-encoding",
|
"subtle-encoding",
|
||||||
"tendermint-proto",
|
"tendermint-proto",
|
||||||
"time 0.3.19",
|
"time",
|
||||||
"zeroize",
|
"zeroize",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -6079,7 +5935,7 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"serde_bytes",
|
"serde_bytes",
|
||||||
"subtle-encoding",
|
"subtle-encoding",
|
||||||
"time 0.3.19",
|
"time",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -6107,7 +5963,7 @@ dependencies = [
|
|||||||
"tendermint-config",
|
"tendermint-config",
|
||||||
"tendermint-proto",
|
"tendermint-proto",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"time 0.3.19",
|
"time",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
"url",
|
"url",
|
||||||
@@ -6171,17 +6027,6 @@ dependencies = [
|
|||||||
"once_cell",
|
"once_cell",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "time"
|
|
||||||
version = "0.1.45"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
"wasi 0.10.0+wasi-snapshot-preview1",
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "time"
|
name = "time"
|
||||||
version = "0.3.19"
|
version = "0.3.19"
|
||||||
@@ -6190,6 +6035,8 @@ checksum = "53250a3b3fed8ff8fd988587d8925d26a83ac3845d9e03b220b37f34c2b8d6c2"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa 1.0.5",
|
"itoa 1.0.5",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
|
"libc",
|
||||||
|
"num_threads",
|
||||||
"serde",
|
"serde",
|
||||||
"time-core",
|
"time-core",
|
||||||
"time-macros",
|
"time-macros",
|
||||||
@@ -6542,12 +6389,6 @@ version = "1.10.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
|
checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicode-width"
|
|
||||||
version = "0.1.10"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-xid"
|
name = "unicode-xid"
|
||||||
version = "0.2.4"
|
version = "0.2.4"
|
||||||
@@ -6671,7 +6512,7 @@ dependencies = [
|
|||||||
"rustc_version 0.4.0",
|
"rustc_version 0.4.0",
|
||||||
"rustversion",
|
"rustversion",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"time 0.3.19",
|
"time",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -6734,12 +6575,6 @@ version = "0.9.0+wasi-snapshot-preview1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
|
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasi"
|
|
||||||
version = "0.10.0+wasi-snapshot-preview1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
version = "0.11.0+wasi-snapshot-preview1"
|
version = "0.11.0+wasi-snapshot-preview1"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "nym-connect"
|
name = "nym-connect"
|
||||||
version = "1.1.9"
|
version = "1.1.12"
|
||||||
description = "nym-connect for Mobile"
|
description = "nym-connect mobile"
|
||||||
authors = ["Nym Technologies SA"]
|
authors = ["Nym Technologies SA"]
|
||||||
license = ""
|
license = ""
|
||||||
repository = ""
|
repository = ""
|
||||||
@@ -26,7 +26,6 @@ tauri-mobile = { git = "https://github.com/tauri-apps/tauri-mobile", branch = "
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
bip39 = { version = "2.0.0", features = ["zeroize"] }
|
bip39 = { version = "2.0.0", features = ["zeroize"] }
|
||||||
chrono = "0.4"
|
|
||||||
dirs = "4.0"
|
dirs = "4.0"
|
||||||
eyre = "0.6.5"
|
eyre = "0.6.5"
|
||||||
fix-path-env = { git = "https://github.com/tauri-apps/fix-path-env-rs", branch = "release"}
|
fix-path-env = { git = "https://github.com/tauri-apps/fix-path-env-rs", branch = "release"}
|
||||||
@@ -42,10 +41,11 @@ serde = { version = "1.0", features = ["derive"] }
|
|||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
serde_repr = "0.1"
|
serde_repr = "0.1"
|
||||||
tap = "1.0.1"
|
tap = "1.0.1"
|
||||||
# tauri = { git = "https://github.com/tauri-apps/tauri", branch = "next", features = ["clipboard-write-text", "native-tls-vendored", "notification-all", "shell-open", "system-tray", "window-close", "window-minimize", "window-start-dragging"] }
|
# tauri = { git = "https://github.com/tauri-apps/tauri", branch = "next", features = ["clipboard-write-text", "native-tls-vendored", "notification-all", "shell-open"] }
|
||||||
tauri = { version = "2.0.0-alpha.3", features = ["clipboard-write-text", "native-tls-vendored", "notification-all", "shell-open", "system-tray", "window-close", "window-minimize", "window-start-dragging"] }
|
tauri = { version = "2.0.0-alpha.3", features = ["clipboard-write-text", "native-tls-vendored", "notification-all", "shell-open"] }
|
||||||
tendermint-rpc = "0.23.0"
|
tendermint-rpc = "0.23.0"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
|
time = { version = "0.3.17", features = ["local-offset"] }
|
||||||
tokio = { version = "1.24.1", features = ["sync", "time"] }
|
tokio = { version = "1.24.1", features = ["sync", "time"] }
|
||||||
url = "2.2"
|
url = "2.2"
|
||||||
yaml-rust = "0.4"
|
yaml-rust = "0.4"
|
||||||
|
|||||||
@@ -16,11 +16,6 @@ pub mod operations;
|
|||||||
mod state;
|
mod state;
|
||||||
mod tasks;
|
mod tasks;
|
||||||
|
|
||||||
#[cfg(desktop)]
|
|
||||||
mod menu;
|
|
||||||
#[cfg(desktop)]
|
|
||||||
mod window;
|
|
||||||
|
|
||||||
pub use state::State;
|
pub use state::State;
|
||||||
|
|
||||||
#[cfg(mobile)]
|
#[cfg(mobile)]
|
||||||
|
|||||||
@@ -1,9 +1,26 @@
|
|||||||
use std::str::FromStr;
|
|
||||||
|
|
||||||
use fern::colors::{Color, ColoredLevelConfig};
|
use fern::colors::{Color, ColoredLevelConfig};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use serde_repr::{Deserialize_repr, Serialize_repr};
|
use serde_repr::{Deserialize_repr, Serialize_repr};
|
||||||
|
use std::str::FromStr;
|
||||||
use tauri::Manager;
|
use tauri::Manager;
|
||||||
|
use time::{format_description, OffsetDateTime};
|
||||||
|
|
||||||
|
fn formatted_time() -> String {
|
||||||
|
// if we fail to obtain local time according to local offset, fallback to utc
|
||||||
|
let _now = OffsetDateTime::now_local().unwrap_or_else(|_| OffsetDateTime::now_utc());
|
||||||
|
|
||||||
|
// if we're running it in the unit test, use the hardcoded value
|
||||||
|
#[cfg(test)]
|
||||||
|
let _now = OffsetDateTime::from_unix_timestamp(1666666666).unwrap();
|
||||||
|
|
||||||
|
// the unwraps are fine as we know this description is correct
|
||||||
|
// note: the reason for this very particular format is a very simple one
|
||||||
|
// it's what we've always been using since we copied it from the example,
|
||||||
|
// so feel free to update it to whatever
|
||||||
|
let format =
|
||||||
|
format_description::parse("[[[year]-[month]-[day]][[[hour]:[minute]:[second]]").unwrap();
|
||||||
|
_now.format(&format).unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn setup_logging(app_handle: tauri::AppHandle) -> Result<(), log::SetLoggerError> {
|
pub fn setup_logging(app_handle: tauri::AppHandle) -> Result<(), log::SetLoggerError> {
|
||||||
let colors = ColoredLevelConfig::new()
|
let colors = ColoredLevelConfig::new()
|
||||||
@@ -21,7 +38,7 @@ pub fn setup_logging(app_handle: tauri::AppHandle) -> Result<(), log::SetLoggerE
|
|||||||
.format(move |out, message, record| {
|
.format(move |out, message, record| {
|
||||||
out.finish(format_args!(
|
out.finish(format_args!(
|
||||||
"{}[{}][{}] {}",
|
"{}[{}][{}] {}",
|
||||||
chrono::Local::now().format("[%Y-%m-%d][%H:%M:%S]"),
|
formatted_time(),
|
||||||
record.target(),
|
record.target(),
|
||||||
colors.color(record.level()),
|
colors.color(record.level()),
|
||||||
message,
|
message,
|
||||||
@@ -33,7 +50,7 @@ pub fn setup_logging(app_handle: tauri::AppHandle) -> Result<(), log::SetLoggerE
|
|||||||
.format(move |out, message, record| {
|
.format(move |out, message, record| {
|
||||||
out.finish(format_args!(
|
out.finish(format_args!(
|
||||||
"{}[{}] {}",
|
"{}[{}] {}",
|
||||||
chrono::Local::now().format("[%Y-%m-%d][%H:%M:%S]"),
|
formatted_time(),
|
||||||
record.target(),
|
record.target(),
|
||||||
message,
|
message,
|
||||||
))
|
))
|
||||||
@@ -116,3 +133,15 @@ impl From<log::Level> for LogLevel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn log_formatting() {
|
||||||
|
let expected_chrono_formated = "[2022-10-25][02:57:46]".to_string();
|
||||||
|
let new_time_based = formatted_time();
|
||||||
|
assert_eq!(new_time_based, expected_chrono_formated)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,11 +6,5 @@
|
|||||||
use nym_connect::AppBuilder;
|
use nym_connect::AppBuilder;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// As per breaking change description here
|
|
||||||
// https://github.com/tauri-apps/tauri/blob/feac1d193c6d618e49916ad0707201f43d5cdd36/tooling/bundler/CHANGELOG.md
|
|
||||||
//if let Err(error) = fix_path_env::fix() {
|
|
||||||
// log::warn!("Failed to fix PATH: {error}");
|
|
||||||
//}
|
|
||||||
|
|
||||||
AppBuilder::new().run();
|
AppBuilder::new().run();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,62 +0,0 @@
|
|||||||
use tauri::{
|
|
||||||
AppHandle, CustomMenuItem, Menu, Submenu, SystemTray, SystemTrayEvent, SystemTrayMenu,
|
|
||||||
SystemTrayMenuItem, Wry,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::window::window_toggle;
|
|
||||||
|
|
||||||
pub const SHOW_LOG_WINDOW: &str = "show_log_window";
|
|
||||||
pub const CLEAR_STORAGE: &str = "clear_storage";
|
|
||||||
|
|
||||||
pub trait AddDefaultSubmenus {
|
|
||||||
fn add_default_app_submenus(self) -> Self;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl AddDefaultSubmenus for Menu {
|
|
||||||
fn add_default_app_submenus(self) -> Self {
|
|
||||||
let submenu = Submenu::new(
|
|
||||||
"Help",
|
|
||||||
Menu::new().add_item(CustomMenuItem::new(SHOW_LOG_WINDOW, "Show logs")),
|
|
||||||
);
|
|
||||||
self.add_submenu(submenu)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub const TRAY_MENU_QUIT: &str = "quit";
|
|
||||||
pub const TRAY_MENU_SHOW_HIDE: &str = "show-hide";
|
|
||||||
pub const TRAY_MENU_CONNECTION: &str = "connection";
|
|
||||||
|
|
||||||
pub(crate) fn create_tray_menu() -> SystemTray {
|
|
||||||
let quit = CustomMenuItem::new(TRAY_MENU_QUIT, "Quit");
|
|
||||||
let hide = CustomMenuItem::new(TRAY_MENU_SHOW_HIDE, "Hide");
|
|
||||||
let connection = CustomMenuItem::new(TRAY_MENU_CONNECTION, "Connect");
|
|
||||||
let tray_menu = SystemTrayMenu::new()
|
|
||||||
.add_item(hide)
|
|
||||||
.add_item(connection)
|
|
||||||
.add_native_item(SystemTrayMenuItem::Separator)
|
|
||||||
.add_item(quit);
|
|
||||||
|
|
||||||
SystemTray::new().with_menu(tray_menu)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn tray_menu_event_handler(app: &AppHandle<Wry>, event: SystemTrayEvent) {
|
|
||||||
match event {
|
|
||||||
SystemTrayEvent::LeftClick { position, size, .. } => {
|
|
||||||
println!("Event {position:?} {size:?}");
|
|
||||||
}
|
|
||||||
SystemTrayEvent::MenuItemClick { id, .. } => {
|
|
||||||
println!("Event {id}");
|
|
||||||
match id.as_str() {
|
|
||||||
TRAY_MENU_SHOW_HIDE => {
|
|
||||||
window_toggle(app);
|
|
||||||
}
|
|
||||||
TRAY_MENU_QUIT => {
|
|
||||||
// TODO: add disconnecting first
|
|
||||||
app.exit(0);
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,5 +3,3 @@ pub mod directory;
|
|||||||
pub mod export;
|
pub mod export;
|
||||||
pub mod help;
|
pub mod help;
|
||||||
pub mod http;
|
pub mod http;
|
||||||
#[cfg(desktop)]
|
|
||||||
pub mod window;
|
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
use crate::window::window_hide;
|
|
||||||
use tauri::{AppHandle, Wry};
|
|
||||||
|
|
||||||
#[tauri::command]
|
|
||||||
pub fn hide_window(app: AppHandle<Wry>) {
|
|
||||||
window_hide(&app);
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
use crate::menu::TRAY_MENU_SHOW_HIDE;
|
|
||||||
use tauri::{AppHandle, Manager};
|
|
||||||
|
|
||||||
pub(crate) fn window_hide(app: &AppHandle<tauri::Wry>) {
|
|
||||||
let window = app.get_window("main").unwrap();
|
|
||||||
let item_handle = app.tray_handle().get_item(TRAY_MENU_SHOW_HIDE);
|
|
||||||
if window.is_visible().unwrap() {
|
|
||||||
window.hide().unwrap();
|
|
||||||
item_handle.set_title("Show").unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn window_show(app: &AppHandle<tauri::Wry>) {
|
|
||||||
let window = app.get_window("main").unwrap();
|
|
||||||
let item_handle = app.tray_handle().get_item(TRAY_MENU_SHOW_HIDE);
|
|
||||||
if !window.is_visible().unwrap() {
|
|
||||||
window.show().unwrap();
|
|
||||||
item_handle.set_title("Hide").unwrap();
|
|
||||||
window.set_focus().unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn window_toggle(app: &AppHandle<tauri::Wry>) {
|
|
||||||
let window = app.get_window("main").unwrap();
|
|
||||||
if window.is_visible().unwrap() {
|
|
||||||
window_hide(app);
|
|
||||||
} else {
|
|
||||||
window_show(app);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"package": {
|
"package": {
|
||||||
"productName": "nym-connect",
|
"productName": "nym-connect",
|
||||||
"version": "1.1.9"
|
"version": "1.1.12"
|
||||||
},
|
},
|
||||||
"build": {
|
"build": {
|
||||||
"distDir": "../dist",
|
"distDir": "../dist",
|
||||||
@@ -14,7 +14,13 @@
|
|||||||
"active": true,
|
"active": true,
|
||||||
"targets": "all",
|
"targets": "all",
|
||||||
"identifier": "net.nymtech.connect",
|
"identifier": "net.nymtech.connect",
|
||||||
"icon": ["icons/32x32.png", "icons/128x128.png", "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico"],
|
"icon": [
|
||||||
|
"icons/32x32.png",
|
||||||
|
"icons/128x128.png",
|
||||||
|
"icons/128x128@2x.png",
|
||||||
|
"icons/icon.icns",
|
||||||
|
"icons/icon.ico"
|
||||||
|
],
|
||||||
"resources": [],
|
"resources": [],
|
||||||
"externalBin": [],
|
"externalBin": [],
|
||||||
"copyright": "Copyright © 2021-2022 Nym Technologies SA",
|
"copyright": "Copyright © 2021-2022 Nym Technologies SA",
|
||||||
@@ -37,10 +43,6 @@
|
|||||||
"timestampUrl": ""
|
"timestampUrl": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systemTray": {
|
|
||||||
"iconPath": "icons/tray_icon.png",
|
|
||||||
"iconAsTemplate": true
|
|
||||||
},
|
|
||||||
"updater": {
|
"updater": {
|
||||||
"active": false
|
"active": false
|
||||||
},
|
},
|
||||||
@@ -51,11 +53,6 @@
|
|||||||
"clipboard": {
|
"clipboard": {
|
||||||
"writeText": true
|
"writeText": true
|
||||||
},
|
},
|
||||||
"window": {
|
|
||||||
"startDragging": true,
|
|
||||||
"close": true,
|
|
||||||
"minimize": true
|
|
||||||
},
|
|
||||||
"notification": {
|
"notification": {
|
||||||
"all": true
|
"all": true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,12 +6,13 @@ import { CustomTitleBar } from './CustomTitleBar';
|
|||||||
|
|
||||||
export const AppWindowFrame: FCWithChildren = ({ children }) => {
|
export const AppWindowFrame: FCWithChildren = ({ children }) => {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const { userDefinedGateway, setUserDefinedGateway } = useClientContext();
|
const { userDefinedGateway, setUserDefinedGateway, userDefinedSPAddress, setUserDefinedSPAddress } =
|
||||||
|
useClientContext();
|
||||||
|
|
||||||
// defined functions to be used when moving away from pages
|
// defined functions to be used when moving away from pages
|
||||||
const onBack = () => {
|
const onBack = () => {
|
||||||
switch (location.pathname) {
|
switch (location.pathname) {
|
||||||
case '/menu/settings':
|
case '/menu/settings/gateway':
|
||||||
return () => {
|
return () => {
|
||||||
// when the user moves away from the settings page and the gateway is not valid
|
// when the user moves away from the settings page and the gateway is not valid
|
||||||
// set isActive to false
|
// set isActive to false
|
||||||
@@ -19,6 +20,14 @@ export const AppWindowFrame: FCWithChildren = ({ children }) => {
|
|||||||
setUserDefinedGateway((current) => ({ ...current, isActive: false }));
|
setUserDefinedGateway((current) => ({ ...current, isActive: false }));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
case '/menu/settings/service-provider':
|
||||||
|
return () => {
|
||||||
|
// when the user moves away from the settings page and the sp is not valid
|
||||||
|
// set isActive to false
|
||||||
|
if (!userDefinedSPAddress?.address) {
|
||||||
|
setUserDefinedSPAddress((current) => ({ ...current, isActive: false }));
|
||||||
|
}
|
||||||
|
};
|
||||||
default:
|
default:
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
@@ -33,7 +42,7 @@ export const AppWindowFrame: FCWithChildren = ({ children }) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<CustomTitleBar path={location.pathname} onBack={onBack()} />
|
<CustomTitleBar path={location.pathname} onBack={onBack()} />
|
||||||
<Box style={{ padding: '16px', paddingTop: '24px' }}>{children}</Box>
|
<Box style={{ padding: '16px' }}>{children}</Box>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ const ArrowBackIcon = ({ onBack }: { onBack?: () => void }) => {
|
|||||||
return <CustomButton Icon={ArrowBack} onClick={handleBack} />;
|
return <CustomButton Icon={ArrowBack} onClick={handleBack} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getTitleIcon = (path: string) => {
|
const getTitle = (path: string) => {
|
||||||
|
if (path.includes('settings')) return 'Settings';
|
||||||
if (path !== '/') {
|
if (path !== '/') {
|
||||||
const title = path.split('/').slice(-1);
|
const title = path.split('/').slice(-1);
|
||||||
return (
|
return (
|
||||||
@@ -60,7 +61,7 @@ export const CustomTitleBar = ({ path = '/', onBack }: { path?: string; onBack?:
|
|||||||
<Box style={customTitleBarStyles.titlebar}>
|
<Box style={customTitleBarStyles.titlebar}>
|
||||||
{/* set width to keep logo centered */}
|
{/* set width to keep logo centered */}
|
||||||
<Box sx={{ width: '40px' }}>{path === '/' ? <MenuIcon /> : <ArrowBackIcon onBack={onBack} />}</Box>
|
<Box sx={{ width: '40px' }}>{path === '/' ? <MenuIcon /> : <ArrowBackIcon onBack={onBack} />}</Box>
|
||||||
{getTitleIcon(path)}
|
{getTitle(path)}
|
||||||
{path !== '/' && <Box sx={{ width: '40px' }} />}
|
<Box sx={{ width: '40px' }} />
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ import { ServiceProvider } from 'src/types/directory';
|
|||||||
|
|
||||||
export const ServiceProviderInfo = ({ serviceProvider }: { serviceProvider: ServiceProvider }) => (
|
export const ServiceProviderInfo = ({ serviceProvider }: { serviceProvider: ServiceProvider }) => (
|
||||||
<Stack gap={1} sx={{ wordWrap: 'break-word', maxWidth: 200, p: 1 }}>
|
<Stack gap={1} sx={{ wordWrap: 'break-word', maxWidth: 200, p: 1 }}>
|
||||||
|
<Typography variant="body2" fontWeight="bold">
|
||||||
|
Connection info
|
||||||
|
</Typography>
|
||||||
|
<Divider />
|
||||||
<Typography variant="caption" fontWeight="bold">
|
<Typography variant="caption" fontWeight="bold">
|
||||||
Gateway <Typography variant="caption">{serviceProvider.gateway}</Typography>
|
Gateway <Typography variant="caption">{serviceProvider.gateway}</Typography>
|
||||||
</Typography>
|
</Typography>
|
||||||
@@ -16,6 +20,10 @@ export const ServiceProviderInfo = ({ serviceProvider }: { serviceProvider: Serv
|
|||||||
|
|
||||||
export const GatwayWarningInfo = () => (
|
export const GatwayWarningInfo = () => (
|
||||||
<Stack gap={1} sx={{ wordWrap: 'break-word', maxWidth: 200, p: 1 }}>
|
<Stack gap={1} sx={{ wordWrap: 'break-word', maxWidth: 200, p: 1 }}>
|
||||||
|
<Typography variant="body2" fontWeight="bold" color="warning.main">
|
||||||
|
Connection issue
|
||||||
|
</Typography>
|
||||||
|
<Divider />
|
||||||
<Typography variant="caption">Try disconnecting and connecting again</Typography>
|
<Typography variant="caption">Try disconnecting and connecting again</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,13 +4,14 @@ import { invoke } from '@tauri-apps/api';
|
|||||||
import { Error } from 'src/types/error';
|
import { Error } from 'src/types/error';
|
||||||
import { getVersion } from '@tauri-apps/api/app';
|
import { getVersion } from '@tauri-apps/api/app';
|
||||||
import { useEvents } from 'src/hooks/events';
|
import { useEvents } from 'src/hooks/events';
|
||||||
import { UserDefinedGateway } from 'src/types/gateway';
|
import { UserDefinedGateway, UserDefinedSPAddress } from 'src/types/service-provider';
|
||||||
import { forage } from '@tauri-apps/tauri-forage';
|
import { getItemFromStorage, setItemInStorage } from 'src/utils';
|
||||||
import { ConnectionStatusKind, GatewayPerformance } from '../types';
|
import { ConnectionStatusKind, GatewayPerformance } from '../types';
|
||||||
import { ConnectionStatsItem } from '../components/ConnectionStats';
|
import { ConnectionStatsItem } from '../components/ConnectionStats';
|
||||||
import { ServiceProvider } from '../types/directory';
|
import { ServiceProvider } from '../types/directory';
|
||||||
|
|
||||||
const FORAGE_KEY = 'nym-connect-user-gateway';
|
const FORAGE_GATEWAY_KEY = 'nym-connect-user-gateway';
|
||||||
|
const FORAGE_SP_KEY = 'nym-connect-user-sp';
|
||||||
|
|
||||||
type ModeType = 'light' | 'dark';
|
type ModeType = 'light' | 'dark';
|
||||||
|
|
||||||
@@ -25,16 +26,19 @@ export type TClientContext = {
|
|||||||
selectedProvider?: ServiceProvider;
|
selectedProvider?: ServiceProvider;
|
||||||
showInfoModal: boolean;
|
showInfoModal: boolean;
|
||||||
userDefinedGateway?: UserDefinedGateway;
|
userDefinedGateway?: UserDefinedGateway;
|
||||||
|
userDefinedSPAddress: UserDefinedSPAddress;
|
||||||
|
serviceProviders?: ServiceProvider[];
|
||||||
setMode: (mode: ModeType) => void;
|
setMode: (mode: ModeType) => void;
|
||||||
clearError: () => void;
|
clearError: () => void;
|
||||||
setConnectionStatus: (connectionStatus: ConnectionStatusKind) => void;
|
setConnectionStatus: (connectionStatus: ConnectionStatusKind) => void;
|
||||||
setConnectionStats: (connectionStats: ConnectionStatsItem[] | undefined) => void;
|
setConnectionStats: (connectionStats: ConnectionStatsItem[] | undefined) => void;
|
||||||
setConnectedSince: (connectedSince: DateTime | undefined) => void;
|
setConnectedSince: (connectedSince: DateTime | undefined) => void;
|
||||||
setShowInfoModal: (show: boolean) => void;
|
setShowInfoModal: (show: boolean) => void;
|
||||||
setRandomSerivceProvider: () => void;
|
setSerivceProvider: () => void;
|
||||||
startConnecting: () => Promise<void>;
|
startConnecting: () => Promise<void>;
|
||||||
startDisconnecting: () => Promise<void>;
|
startDisconnecting: () => Promise<void>;
|
||||||
setUserDefinedGateway: React.Dispatch<React.SetStateAction<UserDefinedGateway>>;
|
setUserDefinedGateway: React.Dispatch<React.SetStateAction<UserDefinedGateway>>;
|
||||||
|
setUserDefinedSPAddress: React.Dispatch<React.SetStateAction<UserDefinedSPAddress>>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ClientContext = createContext({} as TClientContext);
|
export const ClientContext = createContext({} as TClientContext);
|
||||||
@@ -50,43 +54,39 @@ export const ClientContextProvider: FCWithChildren = ({ children }) => {
|
|||||||
const [appVersion, setAppVersion] = useState<string>();
|
const [appVersion, setAppVersion] = useState<string>();
|
||||||
const [gatewayPerformance, setGatewayPerformance] = useState<GatewayPerformance>('Good');
|
const [gatewayPerformance, setGatewayPerformance] = useState<GatewayPerformance>('Good');
|
||||||
const [showInfoModal, setShowInfoModal] = useState(false);
|
const [showInfoModal, setShowInfoModal] = useState(false);
|
||||||
const [userDefinedGateway, setUserDefinedGateway] = useState<UserDefinedGateway>({ isActive: false, gateway: '' });
|
const [userDefinedGateway, setUserDefinedGateway] = useState<UserDefinedGateway>({
|
||||||
|
isActive: false,
|
||||||
|
gateway: undefined,
|
||||||
|
});
|
||||||
|
const [userDefinedSPAddress, setUserDefinedSPAddress] = useState<UserDefinedSPAddress>({
|
||||||
|
isActive: false,
|
||||||
|
address: undefined,
|
||||||
|
});
|
||||||
|
|
||||||
const getAppVersion = async () => {
|
const getAppVersion = async () => {
|
||||||
const version = await getVersion();
|
const version = await getVersion();
|
||||||
return version;
|
return version;
|
||||||
};
|
};
|
||||||
|
|
||||||
const setUserGatewayInStorage = async (gateway: UserDefinedGateway) => {
|
useEffect(() => {
|
||||||
try {
|
setItemInStorage({ key: FORAGE_GATEWAY_KEY, value: userDefinedGateway });
|
||||||
await forage.setItem({
|
}, [userDefinedGateway]);
|
||||||
key: FORAGE_KEY,
|
|
||||||
value: gateway,
|
|
||||||
} as any)();
|
|
||||||
} catch (e) {
|
|
||||||
console.warn(e);
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
const getUserGatewayFromStorage = async (): Promise<UserDefinedGateway | undefined> => {
|
useEffect(() => {
|
||||||
try {
|
setItemInStorage({ key: FORAGE_SP_KEY, value: userDefinedSPAddress });
|
||||||
const gatewayFromStorage = await forage.getItem({ key: FORAGE_KEY })();
|
}, [userDefinedSPAddress]);
|
||||||
return gatewayFromStorage;
|
|
||||||
} catch (e) {
|
|
||||||
console.warn(e);
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
const initialiseApp = async () => {
|
const initialiseApp = async () => {
|
||||||
const services = await invoke('get_services');
|
const services = await invoke('get_services');
|
||||||
const AppVersion = await getAppVersion();
|
const AppVersion = await getAppVersion();
|
||||||
const storedUserDefinedGateway = await getUserGatewayFromStorage();
|
const storedUserDefinedGateway = await getItemFromStorage({ key: FORAGE_GATEWAY_KEY });
|
||||||
|
const storedUserDefinedSP = await getItemFromStorage({ key: FORAGE_SP_KEY });
|
||||||
|
|
||||||
setAppVersion(AppVersion);
|
setAppVersion(AppVersion);
|
||||||
setServiceProviders(services as ServiceProvider[]);
|
setServiceProviders(services as ServiceProvider[]);
|
||||||
|
|
||||||
if (storedUserDefinedGateway) setUserDefinedGateway(storedUserDefinedGateway);
|
if (storedUserDefinedGateway) setUserDefinedGateway(storedUserDefinedGateway);
|
||||||
|
if (storedUserDefinedSP) setUserDefinedSPAddress(storedUserDefinedSP);
|
||||||
};
|
};
|
||||||
|
|
||||||
useEvents({
|
useEvents({
|
||||||
@@ -125,27 +125,37 @@ export const ClientContextProvider: FCWithChildren = ({ children }) => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const shouldUseUserGateway = !!userDefinedGateway.gateway && userDefinedGateway.isActive;
|
const shouldUseUserGateway = !!userDefinedGateway.gateway && userDefinedGateway.isActive;
|
||||||
|
const shouldUseUserSP = !!userDefinedSPAddress.address && userDefinedSPAddress.isActive;
|
||||||
|
|
||||||
const setServiceProvider = async (newServiceProvider: ServiceProvider) => {
|
const setServiceProvider = async (newServiceProvider: ServiceProvider) => {
|
||||||
await invoke('set_gateway', {
|
await invoke('set_gateway', {
|
||||||
gateway: newServiceProvider.gateway,
|
gateway: shouldUseUserGateway ? userDefinedGateway.gateway : newServiceProvider.gateway,
|
||||||
|
});
|
||||||
|
await invoke('set_service_provider', {
|
||||||
|
serviceProvider: shouldUseUserSP ? userDefinedSPAddress.address : newServiceProvider.address,
|
||||||
});
|
});
|
||||||
await invoke('set_service_provider', { serviceProvider: newServiceProvider.address });
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getRandomSPFromList = (services: ServiceProvider[]) => {
|
const getRandomSPFromList = (services: ServiceProvider[]) => {
|
||||||
const randomSelection = services[Math.floor(Math.random() * services.length)];
|
const randomSelection = services[Math.floor(Math.random() * services.length)];
|
||||||
|
|
||||||
if (shouldUseUserGateway) return { ...randomSelection, gateway: userDefinedGateway.gateway } as ServiceProvider;
|
|
||||||
return randomSelection;
|
return randomSelection;
|
||||||
};
|
};
|
||||||
|
|
||||||
const setRandomSerivceProvider = async () => {
|
const buildServiceProvider = async (serviceProvider: ServiceProvider) => {
|
||||||
|
const sp = { ...serviceProvider };
|
||||||
|
|
||||||
|
if (shouldUseUserGateway) sp.gateway = userDefinedGateway.gateway as string;
|
||||||
|
if (shouldUseUserSP) sp.address = userDefinedSPAddress.address as string;
|
||||||
|
|
||||||
|
return sp;
|
||||||
|
};
|
||||||
|
|
||||||
|
const setSerivceProvider = async () => {
|
||||||
if (serviceProviders) {
|
if (serviceProviders) {
|
||||||
const randomServiceProvider = getRandomSPFromList(serviceProviders);
|
const randomServiceProvider = getRandomSPFromList(serviceProviders);
|
||||||
await setServiceProvider(randomServiceProvider);
|
const withUserDefinitions = await buildServiceProvider(randomServiceProvider);
|
||||||
await setUserGatewayInStorage(userDefinedGateway);
|
await setServiceProvider(withUserDefinitions);
|
||||||
setSelectedProvider(randomServiceProvider);
|
setSelectedProvider(withUserDefinitions);
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
};
|
};
|
||||||
@@ -165,21 +175,25 @@ export const ClientContextProvider: FCWithChildren = ({ children }) => {
|
|||||||
showInfoModal,
|
showInfoModal,
|
||||||
setConnectionStats,
|
setConnectionStats,
|
||||||
selectedProvider,
|
selectedProvider,
|
||||||
|
serviceProviders,
|
||||||
connectedSince,
|
connectedSince,
|
||||||
setConnectedSince,
|
setConnectedSince,
|
||||||
setRandomSerivceProvider,
|
setSerivceProvider,
|
||||||
startConnecting,
|
startConnecting,
|
||||||
startDisconnecting,
|
startDisconnecting,
|
||||||
gatewayPerformance,
|
gatewayPerformance,
|
||||||
setShowInfoModal,
|
setShowInfoModal,
|
||||||
|
userDefinedSPAddress,
|
||||||
userDefinedGateway,
|
userDefinedGateway,
|
||||||
setUserDefinedGateway,
|
setUserDefinedGateway,
|
||||||
|
setUserDefinedSPAddress,
|
||||||
}),
|
}),
|
||||||
[
|
[
|
||||||
mode,
|
mode,
|
||||||
appVersion,
|
appVersion,
|
||||||
error,
|
error,
|
||||||
showInfoModal,
|
showInfoModal,
|
||||||
|
serviceProviders,
|
||||||
connectedSince,
|
connectedSince,
|
||||||
connectionStatus,
|
connectionStatus,
|
||||||
connectionStats,
|
connectionStats,
|
||||||
@@ -187,6 +201,7 @@ export const ClientContextProvider: FCWithChildren = ({ children }) => {
|
|||||||
gatewayPerformance,
|
gatewayPerformance,
|
||||||
selectedProvider,
|
selectedProvider,
|
||||||
userDefinedGateway,
|
userDefinedGateway,
|
||||||
|
userDefinedSPAddress,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ const mockValues: TClientContext = {
|
|||||||
gatewayPerformance: 'Good',
|
gatewayPerformance: 'Good',
|
||||||
showInfoModal: false,
|
showInfoModal: false,
|
||||||
userDefinedGateway: { isActive: false, gateway: '' },
|
userDefinedGateway: { isActive: false, gateway: '' },
|
||||||
|
userDefinedSPAddress: { isActive: false, address: '' },
|
||||||
setShowInfoModal: () => {},
|
setShowInfoModal: () => {},
|
||||||
setMode: () => {},
|
setMode: () => {},
|
||||||
clearError: () => {},
|
clearError: () => {},
|
||||||
@@ -18,8 +19,9 @@ const mockValues: TClientContext = {
|
|||||||
setConnectionStatus: () => {},
|
setConnectionStatus: () => {},
|
||||||
startConnecting: async () => {},
|
startConnecting: async () => {},
|
||||||
startDisconnecting: async () => {},
|
startDisconnecting: async () => {},
|
||||||
setRandomSerivceProvider: () => {},
|
setSerivceProvider: () => {},
|
||||||
setUserDefinedGateway: () => {},
|
setUserDefinedGateway: () => {},
|
||||||
|
setUserDefinedSPAddress: () => {},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const MockProvider: FCWithChildren<{
|
export const MockProvider: FCWithChildren<{
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export const ConnectionPage = () => {
|
|||||||
// eslint-disable-next-line default-case
|
// eslint-disable-next-line default-case
|
||||||
switch (currentStatus) {
|
switch (currentStatus) {
|
||||||
case 'disconnected':
|
case 'disconnected':
|
||||||
await context.setRandomSerivceProvider();
|
await context.setSerivceProvider();
|
||||||
await context.startConnecting();
|
await context.startConnecting();
|
||||||
context.setConnectedSince(DateTime.now());
|
context.setConnectedSince(DateTime.now());
|
||||||
context.setShowInfoModal(true);
|
context.setShowInfoModal(true);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const appsSchema = {
|
|||||||
|
|
||||||
export const CompatibleApps = () => (
|
export const CompatibleApps = () => (
|
||||||
<Box>
|
<Box>
|
||||||
<Typography fontWeight={600} sx={{ mb: 3 }}>
|
<Typography fontWeight={600} color="grey.600" sx={{ mb: 3 }}>
|
||||||
Supported apps
|
Supported apps
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography color="nym.highlight" fontWeight={400} sx={{ mb: 2 }}>
|
<Typography color="nym.highlight" fontWeight={400} sx={{ mb: 2 }}>
|
||||||
|
|||||||
+5
-7
@@ -5,8 +5,8 @@ import { useClientContext } from 'src/context/main';
|
|||||||
import { ConnectionStatusKind } from 'src/types';
|
import { ConnectionStatusKind } from 'src/types';
|
||||||
import { AppVersion } from 'src/components/AppVersion';
|
import { AppVersion } from 'src/components/AppVersion';
|
||||||
|
|
||||||
export const Settings = () => {
|
export const GatewaySettings = () => {
|
||||||
const { userDefinedGateway, setUserDefinedGateway } = useClientContext();
|
const { userDefinedGateway, setUserDefinedGateway, connectionStatus } = useClientContext();
|
||||||
const [gatewayKey, setGatewayKey] = useState<string | undefined>(userDefinedGateway?.gateway);
|
const [gatewayKey, setGatewayKey] = useState<string | undefined>(userDefinedGateway?.gateway);
|
||||||
|
|
||||||
const handleIsValidGatewayKey = (isValid: boolean) => {
|
const handleIsValidGatewayKey = (isValid: boolean) => {
|
||||||
@@ -20,17 +20,14 @@ export const Settings = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
|
const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
|
||||||
console.warn('HANERE***');
|
|
||||||
setUserDefinedGateway((current) => ({ ...current, isActive: e.target.checked }));
|
setUserDefinedGateway((current) => ({ ...current, isActive: e.target.checked }));
|
||||||
};
|
};
|
||||||
|
|
||||||
const { connectionStatus } = useClientContext();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box height="100%">
|
<Box height="100%">
|
||||||
<Stack justifyContent="space-between" height="100%">
|
<Stack justifyContent="space-between" height="100%">
|
||||||
<Box>
|
<Box mt={3}>
|
||||||
<Typography fontWeight="bold" variant="body2" mb={1} fontSize="14px">
|
<Typography fontWeight="bold" variant="body2" mb={1}>
|
||||||
Select your Gateway
|
Select your Gateway
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography color="grey.300" variant="body2" mb={3}>
|
<Typography color="grey.300" variant="body2" mb={3}>
|
||||||
@@ -61,6 +58,7 @@ export const Settings = () => {
|
|||||||
onValidate={handleIsValidGatewayKey}
|
onValidate={handleIsValidGatewayKey}
|
||||||
sx={{ mt: 3 }}
|
sx={{ mt: 3 }}
|
||||||
disabled={connectionStatus === 'connected' || !userDefinedGateway?.isActive}
|
disabled={connectionStatus === 'connected' || !userDefinedGateway?.isActive}
|
||||||
|
autoFocus
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
import React, { ChangeEvent } from 'react';
|
||||||
|
import {
|
||||||
|
Autocomplete,
|
||||||
|
Box,
|
||||||
|
FormControl,
|
||||||
|
FormControlLabel,
|
||||||
|
FormHelperText,
|
||||||
|
Stack,
|
||||||
|
Switch,
|
||||||
|
TextField,
|
||||||
|
Typography,
|
||||||
|
} from '@mui/material';
|
||||||
|
import { AppVersion } from 'src/components/AppVersion';
|
||||||
|
import { ConnectionStatusKind } from 'src/types';
|
||||||
|
import { useClientContext } from 'src/context/main';
|
||||||
|
|
||||||
|
export const ServiceProviderSettings = () => {
|
||||||
|
const { connectionStatus, serviceProviders, userDefinedSPAddress, setUserDefinedSPAddress } = useClientContext();
|
||||||
|
|
||||||
|
const toggleOnOff = (e: ChangeEvent<HTMLInputElement>) => {
|
||||||
|
setUserDefinedSPAddress((current) => ({ ...current, isActive: e.target.checked }));
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSelectFromList = (value: string | null) => {
|
||||||
|
setUserDefinedSPAddress((current) => ({ ...current, address: value ?? undefined }));
|
||||||
|
};
|
||||||
|
|
||||||
|
const getSPDescription = (spAddress: string) => {
|
||||||
|
const match = serviceProviders?.find((sp) => sp.address === spAddress);
|
||||||
|
|
||||||
|
if (match) return match.description;
|
||||||
|
|
||||||
|
return 'N/A';
|
||||||
|
};
|
||||||
|
|
||||||
|
const validateInput = (value: string) => {
|
||||||
|
setUserDefinedSPAddress((current) => ({ ...current, address: !value.length ? undefined : value }));
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Box height="100%">
|
||||||
|
<Stack justifyContent="space-between" height="100%">
|
||||||
|
<Box mt={3}>
|
||||||
|
<Typography fontWeight="bold" variant="body2" mb={1}>
|
||||||
|
Select your Service Provider
|
||||||
|
</Typography>
|
||||||
|
<Typography color="grey.300" variant="body2" mb={3}>
|
||||||
|
Pick a service provider from the list or enter your own
|
||||||
|
</Typography>
|
||||||
|
<FormControl fullWidth>
|
||||||
|
<FormControlLabel
|
||||||
|
control={
|
||||||
|
<Switch
|
||||||
|
checked={userDefinedSPAddress.isActive}
|
||||||
|
onChange={toggleOnOff}
|
||||||
|
disabled={connectionStatus === ConnectionStatusKind.connected}
|
||||||
|
size="small"
|
||||||
|
sx={{ ml: 1 }}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
label={userDefinedSPAddress.isActive ? 'On' : 'Off'}
|
||||||
|
/>
|
||||||
|
{connectionStatus === ConnectionStatusKind.connected && (
|
||||||
|
<FormHelperText sx={{ m: 0, my: 1 }}>This setting is disabled during an active connection</FormHelperText>
|
||||||
|
)}
|
||||||
|
{userDefinedSPAddress.isActive && serviceProviders && (
|
||||||
|
<Autocomplete
|
||||||
|
clearOnEscape
|
||||||
|
disabled={connectionStatus === 'connected'}
|
||||||
|
sx={{ mt: 3 }}
|
||||||
|
options={serviceProviders.map((sp) => sp.address)}
|
||||||
|
freeSolo
|
||||||
|
value={userDefinedSPAddress.address || ''}
|
||||||
|
onChange={(e, value) => handleSelectFromList(value)}
|
||||||
|
size="small"
|
||||||
|
renderInput={(params) => (
|
||||||
|
<TextField
|
||||||
|
autoFocus
|
||||||
|
{...params}
|
||||||
|
placeholder="Service provider"
|
||||||
|
onChange={(e) => validateInput(e.target.value)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
ListboxProps={{ style: { background: 'unset', fontSize: '14px' } }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</FormControl>
|
||||||
|
{userDefinedSPAddress.address && userDefinedSPAddress.isActive && (
|
||||||
|
<Box sx={{ mt: 3 }}>
|
||||||
|
<Typography variant="body2">Name of Service Provider</Typography>
|
||||||
|
<Typography variant="body2" sx={{ mt: 1 }} color="grey.400">
|
||||||
|
{getSPDescription(userDefinedSPAddress.address)}
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
|
<AppVersion />
|
||||||
|
</Stack>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Link as RouterLink } from 'react-router-dom';
|
||||||
|
import { Link, List, ListItem, ListItemButton, ListItemText, Stack } from '@mui/material';
|
||||||
|
import { AppVersion } from 'src/components/AppVersion';
|
||||||
|
|
||||||
|
const menuSchema = [
|
||||||
|
{ title: 'Select your gateway', path: 'gateway' },
|
||||||
|
{ title: 'Select a service provider', path: 'service-provider' },
|
||||||
|
];
|
||||||
|
|
||||||
|
export const SettingsMenu = () => (
|
||||||
|
<Stack justifyContent="space-between" height="100%">
|
||||||
|
<List sx={{ mt: 3 }} dense disablePadding>
|
||||||
|
{menuSchema.map((item) => (
|
||||||
|
<Link component={RouterLink} to={item.path} underline="none" color="white" key={item.title}>
|
||||||
|
<ListItem disablePadding>
|
||||||
|
<ListItemButton>
|
||||||
|
<ListItemText>{item.title}</ListItemText>
|
||||||
|
</ListItemButton>
|
||||||
|
</ListItem>
|
||||||
|
</Link>
|
||||||
|
))}
|
||||||
|
</List>
|
||||||
|
<AppVersion />
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
@@ -4,7 +4,9 @@ import { ConnectionPage } from 'src/pages/connection';
|
|||||||
import { Menu } from 'src/pages/menu';
|
import { Menu } from 'src/pages/menu';
|
||||||
import { CompatibleApps } from 'src/pages/menu/Apps';
|
import { CompatibleApps } from 'src/pages/menu/Apps';
|
||||||
import { HelpGuide } from 'src/pages/menu/Guide';
|
import { HelpGuide } from 'src/pages/menu/Guide';
|
||||||
import { Settings } from 'src/pages/menu/Settings';
|
import { SettingsMenu } from 'src/pages/menu/settings';
|
||||||
|
import { GatewaySettings } from 'src/pages/menu/settings/GatewaySettings';
|
||||||
|
import { ServiceProviderSettings } from 'src/pages/menu/settings/ServiceProviderSettings';
|
||||||
|
|
||||||
export const AppRoutes = () => (
|
export const AppRoutes = () => (
|
||||||
<Routes>
|
<Routes>
|
||||||
@@ -13,7 +15,11 @@ export const AppRoutes = () => (
|
|||||||
<Route index element={<Menu />} />
|
<Route index element={<Menu />} />
|
||||||
<Route path="apps" element={<CompatibleApps />} />
|
<Route path="apps" element={<CompatibleApps />} />
|
||||||
<Route path="guide" element={<HelpGuide />} />
|
<Route path="guide" element={<HelpGuide />} />
|
||||||
<Route path="settings" element={<Settings />} />
|
<Route path="settings">
|
||||||
|
<Route index element={<SettingsMenu />} />
|
||||||
|
<Route path="gateway" element={<GatewaySettings />} />
|
||||||
|
<Route path="service-provider" element={<ServiceProviderSettings />} />
|
||||||
|
</Route>
|
||||||
</Route>
|
</Route>
|
||||||
</Routes>
|
</Routes>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
export interface UserDefinedGateway {
|
||||||
|
isActive: boolean;
|
||||||
|
gateway?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UserDefinedSPAddress {
|
||||||
|
isActive: boolean;
|
||||||
|
address?: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
export interface StorageKeyValue<T> {
|
||||||
|
key: string;
|
||||||
|
value: T;
|
||||||
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
import { useEffect, useRef } from 'react';
|
import { useEffect, useRef } from 'react';
|
||||||
import { EventName, listen, UnlistenFn, EventCallback } from '@tauri-apps/api/event';
|
import { EventName, listen, UnlistenFn, EventCallback } from '@tauri-apps/api/event';
|
||||||
|
import { invoke } from '@tauri-apps/api';
|
||||||
|
import { forage } from '@tauri-apps/tauri-forage';
|
||||||
|
import { StorageKeyValue } from 'src/types/storage';
|
||||||
|
|
||||||
export const useTauriEvents = <T>(event: EventName, handler: EventCallback<T>) => {
|
export const useTauriEvents = <T>(event: EventName, handler: EventCallback<T>) => {
|
||||||
const unlisten = useRef<UnlistenFn>();
|
const unlisten = useRef<UnlistenFn>();
|
||||||
@@ -17,3 +20,29 @@ export const useTauriEvents = <T>(event: EventName, handler: EventCallback<T>) =
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const toggleLogViewer = async () => {
|
||||||
|
await invoke('help_log_toggle_window');
|
||||||
|
};
|
||||||
|
|
||||||
|
export async function setItemInStorage<T>({ key, value }: StorageKeyValue<T>) {
|
||||||
|
try {
|
||||||
|
await forage.setItem({
|
||||||
|
key,
|
||||||
|
value,
|
||||||
|
} as any)();
|
||||||
|
} catch (e) {
|
||||||
|
console.warn(e);
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getItemFromStorage = async ({ key }: Pick<StorageKeyValue<undefined>, 'key'>) => {
|
||||||
|
try {
|
||||||
|
const gatewayFromStorage = await forage.getItem({ key })();
|
||||||
|
return gatewayFromStorage;
|
||||||
|
} catch (e) {
|
||||||
|
console.warn(e);
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user