mirror of
https://github.com/Astatin3/unshell.git
synced 2026-06-08 22:38:01 -06:00
Start work on server
This commit is contained in:
Generated
+18
-467
@@ -34,17 +34,6 @@ version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
|
||||
|
||||
[[package]]
|
||||
name = "aes"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cipher",
|
||||
"cpufeatures",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.8.12"
|
||||
@@ -59,15 +48,6 @@ dependencies = [
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "android-activity"
|
||||
version = "0.6.0"
|
||||
@@ -95,15 +75,6 @@ version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04"
|
||||
|
||||
[[package]]
|
||||
name = "android_system_properties"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arboard"
|
||||
version = "3.6.1"
|
||||
@@ -154,26 +125,6 @@ version = "0.22.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
||||
|
||||
[[package]]
|
||||
name = "bincode"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36eaf5d7b090263e8150820482d5d93cd964a81e4019913c972f4edcc6edb740"
|
||||
dependencies = [
|
||||
"bincode_derive",
|
||||
"serde",
|
||||
"unty",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bincode_derive"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf95709a440f45e986983918d0e8a1f30a9b1df04918fc828670606804ac3c09"
|
||||
dependencies = [
|
||||
"virtue",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bit-set"
|
||||
version = "0.8.0"
|
||||
@@ -204,33 +155,6 @@ dependencies = [
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
version = "0.10.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block-padding"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block-padding"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "710f1dd022ef4e93f8a438b4ba958de7f64308434fa6a87104481645cc30068b"
|
||||
dependencies = [
|
||||
"hybrid-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block2"
|
||||
version = "0.5.1"
|
||||
@@ -329,15 +253,6 @@ dependencies = [
|
||||
"wayland-client",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cbc"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6"
|
||||
dependencies = [
|
||||
"cipher",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.47"
|
||||
@@ -377,29 +292,6 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.42"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2"
|
||||
dependencies = [
|
||||
"iana-time-zone",
|
||||
"js-sys",
|
||||
"num-traits",
|
||||
"wasm-bindgen",
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cipher"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
|
||||
dependencies = [
|
||||
"crypto-common",
|
||||
"inout",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clipboard-win"
|
||||
version = "5.4.1"
|
||||
@@ -487,15 +379,6 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
version = "1.5.0"
|
||||
@@ -505,15 +388,6 @@ dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-channel"
|
||||
version = "0.5.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2"
|
||||
dependencies = [
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.21"
|
||||
@@ -526,32 +400,12 @@ version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
|
||||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cursor-icon"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f"
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.10.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
||||
dependencies = [
|
||||
"block-buffer",
|
||||
"crypto-common",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dispatch"
|
||||
version = "0.2.0"
|
||||
@@ -811,19 +665,6 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580"
|
||||
dependencies = [
|
||||
"humantime",
|
||||
"is-terminal",
|
||||
"log",
|
||||
"regex",
|
||||
"termcolor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "epaint"
|
||||
version = "0.33.2"
|
||||
@@ -958,16 +799,6 @@ dependencies = [
|
||||
"percent-encoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gethostname"
|
||||
version = "1.1.0"
|
||||
@@ -1106,18 +937,6 @@ version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c"
|
||||
|
||||
[[package]]
|
||||
name = "hex"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||
|
||||
[[package]]
|
||||
name = "hex-literal"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e712f64ec3850b98572bffac52e2c6f282b29fe6c5fa6d42334b30be438d95c1"
|
||||
|
||||
[[package]]
|
||||
name = "hexf-parse"
|
||||
version = "0.2.1"
|
||||
@@ -1133,45 +952,6 @@ dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "humantime"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424"
|
||||
|
||||
[[package]]
|
||||
name = "hybrid-array"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f471e0a81b2f90ffc0cb2f951ae04da57de8baa46fa99112b062a5173a5088d0"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone"
|
||||
version = "0.1.64"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb"
|
||||
dependencies = [
|
||||
"android_system_properties",
|
||||
"core-foundation-sys",
|
||||
"iana-time-zone-haiku",
|
||||
"js-sys",
|
||||
"log",
|
||||
"wasm-bindgen",
|
||||
"windows-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone-haiku"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "icu_collections"
|
||||
version = "2.1.1"
|
||||
@@ -1298,27 +1078,6 @@ dependencies = [
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "inout"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01"
|
||||
dependencies = [
|
||||
"block-padding 0.3.3",
|
||||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is-terminal"
|
||||
version = "0.4.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.14.0"
|
||||
@@ -1368,9 +1127,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.82"
|
||||
version = "0.3.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65"
|
||||
checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"wasm-bindgen",
|
||||
@@ -1950,7 +1709,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d"
|
||||
dependencies = [
|
||||
"phf_shared",
|
||||
"rand 0.8.5",
|
||||
"rand",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2060,25 +1819,6 @@ dependencies = [
|
||||
"zerovec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
|
||||
dependencies = [
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pretty_env_logger"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "865724d4dbe39d9f3dd3b52b88d859d66bcb2d6a0acfd5ea68a65fb66d4bdc1c"
|
||||
dependencies = [
|
||||
"env_logger",
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-crate"
|
||||
version = "3.4.0"
|
||||
@@ -2148,27 +1888,7 @@ version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||
dependencies = [
|
||||
"rand_core 0.6.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.9.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"
|
||||
dependencies = [
|
||||
"rand_chacha",
|
||||
"rand_core 0.9.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core 0.9.3",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2177,15 +1897,6 @@ version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "raw-window-handle"
|
||||
version = "0.6.2"
|
||||
@@ -2210,35 +1921,6 @@ dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.12.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-automata",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
|
||||
|
||||
[[package]]
|
||||
name = "renderdoc-sys"
|
||||
version = "1.1.0"
|
||||
@@ -2372,17 +2054,6 @@ dependencies = [
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha2"
|
||||
version = "0.10.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures",
|
||||
"digest",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shlex"
|
||||
version = "1.3.0"
|
||||
@@ -2528,15 +2199,6 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.69"
|
||||
@@ -2663,12 +2325,6 @@ dependencies = [
|
||||
"rustc-hash 2.1.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb"
|
||||
|
||||
[[package]]
|
||||
name = "unicase"
|
||||
version = "2.8.1"
|
||||
@@ -2693,20 +2349,6 @@ version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
|
||||
|
||||
[[package]]
|
||||
name = "unshell-crypt"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"block-padding 0.4.2",
|
||||
"cbc",
|
||||
"getrandom",
|
||||
"hex",
|
||||
"hex-literal",
|
||||
"regex",
|
||||
"sha2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unshell-gui"
|
||||
version = "0.1.0"
|
||||
@@ -2716,45 +2358,13 @@ dependencies = [
|
||||
"egui_extras",
|
||||
"egui_tiles",
|
||||
"log",
|
||||
"pretty_env_logger",
|
||||
"rand 0.9.2",
|
||||
"serde",
|
||||
"unshell-lib",
|
||||
"serde_json",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unshell-lib"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"chrono",
|
||||
"crossbeam-channel",
|
||||
"libc",
|
||||
"libloading",
|
||||
"rand 0.9.2",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"unshell-obfuscate",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unshell-obfuscate"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"unshell-crypt",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unty"
|
||||
version = "0.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d49784317cd0d1ee7ec5c716dd598ec5b4483ea832a2dced265471cc0f690ae"
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "2.5.7"
|
||||
@@ -2779,12 +2389,6 @@ version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||
|
||||
[[package]]
|
||||
name = "virtue"
|
||||
version = "0.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "051eb1abcf10076295e815102942cc58f9d5e3b4560e46e53c21e8ff6f3af7b1"
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "2.5.0"
|
||||
@@ -2806,9 +2410,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.105"
|
||||
version = "0.2.106"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60"
|
||||
checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
@@ -2819,9 +2423,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.55"
|
||||
version = "0.4.56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "551f88106c6d5e7ccc7cd9a16f312dd3b5d36ea8b4954304657d5dfba115d4a0"
|
||||
checksum = "836d9622d604feee9e5de25ac10e3ea5f2d65b41eac0d9ce72eb5deae707ce7c"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
@@ -2832,9 +2436,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.105"
|
||||
version = "0.2.106"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2"
|
||||
checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
@@ -2842,9 +2446,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.105"
|
||||
version = "0.2.106"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc"
|
||||
checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"proc-macro2",
|
||||
@@ -2855,9 +2459,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.105"
|
||||
version = "0.2.106"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76"
|
||||
checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@@ -2999,9 +2603,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.82"
|
||||
version = "0.3.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a1f95c0d03a47f4ae1f7a64643a6bb97465d9b740f0fa8f90ea33915c99a9a1"
|
||||
checksum = "9b32828d774c412041098d182a8b38b16ea816958e07cf40eec2bc080ae137ac"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
@@ -3144,65 +2748,12 @@ dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-core"
|
||||
version = "0.62.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
|
||||
dependencies = [
|
||||
"windows-implement",
|
||||
"windows-interface",
|
||||
"windows-link",
|
||||
"windows-result",
|
||||
"windows-strings",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-implement"
|
||||
version = "0.60.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-interface"
|
||||
version = "0.59.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||
|
||||
[[package]]
|
||||
name = "windows-result"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-strings"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.45.0"
|
||||
|
||||
@@ -12,7 +12,7 @@ all-features = true
|
||||
targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]
|
||||
|
||||
[dependencies]
|
||||
unshell-lib = {path="../unshell-lib"}
|
||||
# unshell-lib = {path="../unshell-lib"}
|
||||
|
||||
egui = "0.33.0"
|
||||
eframe = { version = "0.33.0", default-features = false, features = [
|
||||
@@ -28,17 +28,18 @@ log = "0.4.27"
|
||||
# You only need serde if you want app persistence:
|
||||
serde = { version = "1.0.219", features = ["derive"] }
|
||||
egui_extras = "0.33.2"
|
||||
rand = "0.9.2"
|
||||
egui_tiles = "0.14.0"
|
||||
|
||||
# native:
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
pretty_env_logger = "0.5.0"
|
||||
# [target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
# pretty_env_logger = "0.5.0"
|
||||
|
||||
# web:
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
# [target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
wasm-bindgen-futures = "0.4.50"
|
||||
wasm-bindgen = "0.2.106"
|
||||
web-sys = "0.3.70" # to access the DOM (to hide the loading text)
|
||||
serde_json = "1.0.145"
|
||||
|
||||
[profile.release]
|
||||
opt-level = 2 # fast and small wasm
|
||||
|
||||
@@ -1,2 +1,24 @@
|
||||
[build]
|
||||
filehash = false
|
||||
|
||||
# # Proxy /api/* to backend
|
||||
# [[proxy]]
|
||||
# backend = "http://localhost:8081"
|
||||
# rewrite = "/api/"
|
||||
|
||||
# # Proxy /auth/* to backend
|
||||
# [[proxy]]
|
||||
# backend = "http://localhost:8081"
|
||||
# rewrite = "/auth/"
|
||||
|
||||
[[proxy]]
|
||||
backend = "http://localhost:3000/api" # Address to proxy requests to
|
||||
# ws = false # Use WebSocket for this proxy
|
||||
# insecure = true # Disable certificate validation
|
||||
# no_system_proxy = false # Disable system proxy
|
||||
# rewrite = "" # Strip the given prefix off paths
|
||||
# no_redirect = false # Disable following redirects of proxy responses
|
||||
|
||||
|
||||
[[proxy]]
|
||||
backend = "http://localhost:3000/auth"
|
||||
|
||||
@@ -23,3 +23,42 @@ self.addEventListener("fetch", function (e) {
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
// export function httpGet(theUrl) {
|
||||
// var xmlHttp = new XMLHttpRequest();
|
||||
// xmlHttp.open("GET", theUrl, false); // false for synchronous request
|
||||
// xmlHttp.send(null);
|
||||
// return xmlHttp.responseText;
|
||||
// }
|
||||
|
||||
export function httpGet(theUrl, callback) {
|
||||
var xmlHttp = new XMLHttpRequest();
|
||||
xmlHttp.onreadystatechange = function () {
|
||||
if (xmlHttp.readyState !== 4) return;
|
||||
|
||||
if (xmlHttp.status == 200) callback(xmlHttp.responseText);
|
||||
else alert("Error " + xmlHttp.status + ", " + xmlHttp.responseText);
|
||||
};
|
||||
xmlHttp.open("GET", theUrl, true); // true for asynchronous
|
||||
xmlHttp.setRequestHeader("Content-Type", "application/json");
|
||||
xmlHttp.send(null);
|
||||
}
|
||||
|
||||
export function httpPost(url, body, callback) {
|
||||
var xmlHttp = new XMLHttpRequest();
|
||||
xmlHttp.onreadystatechange = function () {
|
||||
if (xmlHttp.readyState !== 4) return;
|
||||
|
||||
if (xmlHttp.status === 200) {
|
||||
// var json = JSON.parse(xhr.responseText);
|
||||
callback(xmlHttp.responseText);
|
||||
} else {
|
||||
alert("Error " + xmlHttp.status + ", " + xmlHttp.responseText);
|
||||
}
|
||||
};
|
||||
|
||||
xmlHttp.open("POST", url, true);
|
||||
xmlHttp.setRequestHeader("Content-Type", "application/json");
|
||||
// var data = JSON.stringify({ email: "[email protected]", password: "101010" });
|
||||
xmlHttp.send(body);
|
||||
}
|
||||
|
||||
+42
-49
@@ -1,12 +1,16 @@
|
||||
use egui::Frame;
|
||||
use egui_tiles::Tree;
|
||||
|
||||
use crate::app::{AppState, windows::WindowWrapper};
|
||||
use crate::{
|
||||
app::{AppState, windows::WindowWrapper},
|
||||
auth::Auth,
|
||||
};
|
||||
|
||||
/// We derive Deserialize/Serialize so we can persist app state on shutdown.
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
#[serde(default)] // if we add new fields, give them default values when deserializing old state
|
||||
pub struct TemplateApp {
|
||||
auth: Auth,
|
||||
// tab: Tab,
|
||||
state: AppState,
|
||||
tree: Tree<WindowWrapper>,
|
||||
@@ -14,22 +18,8 @@ pub struct TemplateApp {
|
||||
|
||||
impl Default for TemplateApp {
|
||||
fn default() -> Self {
|
||||
// let mut tiles = egui_tiles::Tiles::default();
|
||||
|
||||
// let invis_1 = tiles.insert_pane(WindowWrapper {
|
||||
// nr: 0,
|
||||
// window: AppWindow::None,
|
||||
// });
|
||||
// let invis_2 = tiles.insert_pane(WindowWrapper {
|
||||
// nr: 0,
|
||||
// window: AppWindow::None,
|
||||
// });
|
||||
|
||||
// tiles.set_visible(invis_1, false);
|
||||
// tiles.set_visible(invis_2, false);
|
||||
// let root = tiles.insert_horizontal_tile(vec![invis_1]);
|
||||
|
||||
Self {
|
||||
auth: Auth::default(),
|
||||
state: AppState::default(),
|
||||
tree: egui_tiles::Tree::new_horizontal("tree_root", Vec::new()),
|
||||
}
|
||||
@@ -38,17 +28,17 @@ impl Default for TemplateApp {
|
||||
|
||||
impl TemplateApp {
|
||||
/// Called once before the first frame.
|
||||
pub fn new(_cc: &eframe::CreationContext<'_>) -> Self {
|
||||
pub fn new(cc: &eframe::CreationContext<'_>) -> Self {
|
||||
// This is also where you can customize the look and feel of egui using
|
||||
// `cc.egui_ctx.set_visuals` and `cc.egui_ctx.set_fonts`.
|
||||
|
||||
// Load previous app state (if any).
|
||||
// Note that you must enable the `persistence` feature for this to work.
|
||||
// if let Some(storage) = cc.storage {
|
||||
// eframe::get_value(storage, eframe::APP_KEY).unwrap_or_default()
|
||||
// } else {
|
||||
Default::default()
|
||||
// }
|
||||
if let Some(storage) = cc.storage {
|
||||
eframe::get_value(storage, eframe::APP_KEY).unwrap_or_default()
|
||||
} else {
|
||||
Default::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,40 +50,43 @@ impl eframe::App for TemplateApp {
|
||||
|
||||
/// Called each time the UI needs repainting, which may be many times per second.
|
||||
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
|
||||
// Put your widgets into a `SidePanel`, `TopBottomPanel`, `CentralPanel`, `Window` or `Area`.
|
||||
// For inspiration and more examples, go to https://emilk.github.io/egui
|
||||
if !self.auth.logged_in() {
|
||||
egui::CentralPanel::default()
|
||||
.frame(Frame::central_panel(&ctx.style()).inner_margin(0))
|
||||
.show(ctx, |ui| self.auth.update(ui));
|
||||
} else {
|
||||
egui::TopBottomPanel::top("tab_panel").show(ctx, |ui| {
|
||||
// The top panel is often a good place for a menu bar:
|
||||
|
||||
egui::TopBottomPanel::top("tab_panel").show(ctx, |ui| {
|
||||
// The top panel is often a good place for a menu bar:
|
||||
egui::MenuBar::new().ui(ui, |ui| {
|
||||
ui.menu_button("File", |ui| {
|
||||
ui.label("File");
|
||||
});
|
||||
|
||||
egui::MenuBar::new().ui(ui, |ui| {
|
||||
ui.menu_button("File", |ui| {
|
||||
ui.label("File");
|
||||
});
|
||||
|
||||
ui.menu_button("View", |ui| {
|
||||
ui.label("View");
|
||||
|
||||
self.state.labels(&mut self.tree, ui);
|
||||
ui.menu_button("View", |ui| {
|
||||
ui.label("View");
|
||||
|
||||
self.state.labels(&mut self.tree, ui);
|
||||
});
|
||||
|
||||
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
|
||||
egui::widgets::global_theme_preference_switch(ui);
|
||||
});
|
||||
|
||||
// ui.style
|
||||
});
|
||||
});
|
||||
|
||||
egui::TopBottomPanel::bottom("tab_panel").show(ctx, |ui| {
|
||||
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
|
||||
egui::widgets::global_theme_preference_switch(ui);
|
||||
ui.label(format!("UnShell UI {}", env!("CARGO_PKG_VERSION")));
|
||||
egui::warn_if_debug_build(ui);
|
||||
});
|
||||
|
||||
// ui.style
|
||||
});
|
||||
});
|
||||
|
||||
egui::TopBottomPanel::bottom("tab_panel").show(ctx, |ui| {
|
||||
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
|
||||
ui.label(format!("UnShell UI {}", env!("CARGO_PKG_VERSION")));
|
||||
egui::warn_if_debug_build(ui);
|
||||
});
|
||||
});
|
||||
|
||||
egui::CentralPanel::default()
|
||||
.frame(Frame::central_panel(&ctx.style()).inner_margin(0))
|
||||
.show(ctx, |ui| self.tree.ui(&mut self.state, ui));
|
||||
egui::CentralPanel::default()
|
||||
.frame(Frame::central_panel(&ctx.style()).inner_margin(0))
|
||||
.show(ctx, |ui| self.tree.ui(&mut self.state, ui));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+28
-74
@@ -3,11 +3,9 @@ mod windows;
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::{app::windows::WindowWrapper, config::Config, flowchart::FlowChart};
|
||||
pub use app::TemplateApp;
|
||||
use egui_tiles::{TileId, Tree};
|
||||
use log::info;
|
||||
|
||||
use crate::{app::windows::WindowWrapper, config::Config, flowchart::FlowChart};
|
||||
|
||||
#[derive(Default, serde::Deserialize, serde::Serialize)]
|
||||
struct AppState {
|
||||
@@ -29,87 +27,44 @@ impl AppState {
|
||||
let enabled = self.open_windows.contains_key(&key);
|
||||
|
||||
if ui.selectable_label(enabled, *name).clicked() {
|
||||
// if enabled {
|
||||
// let tid = *self.open_windows.get(&key).unwrap();
|
||||
// tree.remove_recursively(tid);
|
||||
// tree.tiles.remove(tid);
|
||||
// self.open_windows.remove(&key);
|
||||
if enabled {
|
||||
let tid = *self.open_windows.get(&key).unwrap();
|
||||
tree.remove_recursively(tid);
|
||||
tree.tiles.remove(tid);
|
||||
self.open_windows.remove(&key);
|
||||
|
||||
// // if self.open_windows.is_empty()
|
||||
// } else {
|
||||
let tid = tree.tiles.insert_pane(WindowWrapper {
|
||||
nr: i + 1,
|
||||
window: *key,
|
||||
});
|
||||
// if self.open_windows.is_empty()
|
||||
} else {
|
||||
let tid = tree.tiles.insert_pane(WindowWrapper {
|
||||
nr: i + 1,
|
||||
window: *key,
|
||||
});
|
||||
|
||||
match self.open_windows.len() {
|
||||
0 => {
|
||||
tree.root = Some(tid);
|
||||
}
|
||||
1 => {
|
||||
let old_root = tree.root.unwrap();
|
||||
let tab_id = tree.tiles.insert_tab_tile(vec![old_root, tid]);
|
||||
tree.root = Some(tab_id);
|
||||
}
|
||||
_ => {
|
||||
let pid = tree.tiles.insert_tab_tile(vec![tid]);
|
||||
tree.move_tile_to_container(pid, tree.root.unwrap().clone(), 0, true);
|
||||
match self.open_windows.len() {
|
||||
0 => {
|
||||
tree.root = Some(tid);
|
||||
}
|
||||
1 => {
|
||||
let old_root = tree.root.unwrap();
|
||||
let tab_id = tree.tiles.insert_tab_tile(vec![old_root, tid]);
|
||||
tree.root = Some(tab_id);
|
||||
tree.make_active(|t, _| t == tid);
|
||||
}
|
||||
_ => {
|
||||
let root = tree.root().unwrap();
|
||||
let n = tree.tiles.get_container(root).unwrap().num_children();
|
||||
tree.move_tile_to_container(tid, tree.root.unwrap().clone(), n, true);
|
||||
}
|
||||
}
|
||||
self.open_windows.insert(key.clone(), tid);
|
||||
}
|
||||
|
||||
self.open_windows.insert(key.clone(), tid);
|
||||
}
|
||||
}
|
||||
|
||||
// if ui
|
||||
// .selectable_label(
|
||||
// self.open_windows.contains_key(&AppWindow::Flowchart),
|
||||
// "Network",
|
||||
// )
|
||||
// .clicked()
|
||||
// {
|
||||
// // self.open_windows. = Tab::Flowchart;
|
||||
// }
|
||||
|
||||
// if ui
|
||||
// .selectable_label(self.open_windows.contains_key(&AppWindow::Config), "Config")
|
||||
// .clicked()
|
||||
// {
|
||||
// // self.open_windows. = Tab::Flowchart;
|
||||
// }
|
||||
|
||||
// if ui
|
||||
// .selectable_label(self.tab == Tab::Test, self.config.title())
|
||||
// .clicked()
|
||||
// {
|
||||
// self.tab = Tab::Test;
|
||||
// }
|
||||
}
|
||||
|
||||
// fn contains(&self, key: &AppWindow)
|
||||
|
||||
// fn toggle(&mut self, key: &AppWindow) {
|
||||
// if self.
|
||||
// }
|
||||
}
|
||||
|
||||
// impl Default for AppState {
|
||||
// fn default() -> Self {
|
||||
// Self {
|
||||
// open_windows: HashMap::from([
|
||||
// (AppWindow::Flowchart, false),
|
||||
// (AppWindow::Config, false),
|
||||
// ]),
|
||||
|
||||
// flowchart: Default::default(),
|
||||
// config: Default::default(),
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
#[derive(Clone, Copy, serde::Deserialize, serde::Serialize, PartialEq, Eq, Hash)]
|
||||
enum AppWindow {
|
||||
None,
|
||||
Flowchart,
|
||||
Config,
|
||||
}
|
||||
@@ -117,7 +72,6 @@ enum AppWindow {
|
||||
impl AppWindow {
|
||||
fn update(&self, state: &mut AppState, ui: &mut egui::Ui) {
|
||||
match self {
|
||||
AppWindow::None => {}
|
||||
AppWindow::Flowchart => state.flowchart.paint(ui),
|
||||
AppWindow::Config => state.config.update(ui),
|
||||
}
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
|
||||
use egui::{Align2, Area, Frame, Order, Sense, UiKind, Vec2, mutex::Mutex};
|
||||
use wasm_bindgen::prelude::Closure;
|
||||
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
pub struct Auth {
|
||||
// Auth Stuff
|
||||
token: Option<Token>,
|
||||
#[serde(skip)]
|
||||
auth_state: Arc<Mutex<AuthState>>,
|
||||
|
||||
// UI Stuff
|
||||
username: String,
|
||||
password: String,
|
||||
show_password: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize, PartialEq, Eq)]
|
||||
struct Token {
|
||||
access_token: String,
|
||||
token_type: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
enum AuthState {
|
||||
NotLoggedIn,
|
||||
RequestSent,
|
||||
Authorised(Token),
|
||||
Error(String),
|
||||
}
|
||||
|
||||
impl Default for AuthState {
|
||||
fn default() -> Self {
|
||||
Self::NotLoggedIn
|
||||
}
|
||||
}
|
||||
|
||||
impl Auth {
|
||||
pub fn logged_in(&mut self) -> bool {
|
||||
if self.token.is_some() {
|
||||
true
|
||||
} else {
|
||||
match *self.auth_state.lock() {
|
||||
AuthState::Authorised(ref token) => {
|
||||
self.token = Some(token.clone());
|
||||
true
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
// self.auth_state.lock().eq(&AuthState::Authorised)
|
||||
}
|
||||
|
||||
pub fn update(&mut self, ui: &mut egui::Ui) {
|
||||
Area::new("Auth".into())
|
||||
.kind(UiKind::Modal)
|
||||
.sense(Sense::hover())
|
||||
.anchor(Align2::CENTER_CENTER, Vec2::ZERO)
|
||||
.order(Order::Foreground)
|
||||
.interactable(true)
|
||||
.show(ui.ctx(), |ui| {
|
||||
Frame::popup(ui.style()).show(ui, |ui| {
|
||||
ui.heading("UnShell Login");
|
||||
|
||||
ui.horizontal(|ui| {
|
||||
ui.label("Username");
|
||||
ui.text_edit_singleline(&mut self.username);
|
||||
});
|
||||
|
||||
ui.horizontal(|ui| {
|
||||
ui.label("Password");
|
||||
let _ = ui.add(
|
||||
// [ui.available_width(), 24.],
|
||||
egui::TextEdit::singleline(&mut self.password)
|
||||
.password(!self.show_password),
|
||||
);
|
||||
|
||||
self.show_password = ui.button("Show").is_pointer_button_down_on();
|
||||
|
||||
// ui.toggle_value(&mut self.show_password, "Show");
|
||||
});
|
||||
|
||||
if ui.button("Login").clicked() {
|
||||
let json = serde_json::to_string(&HashMap::from([
|
||||
("client_id", self.username.clone()),
|
||||
("client_secret", self.password.clone()),
|
||||
]))
|
||||
.unwrap();
|
||||
|
||||
let state = self.auth_state.clone();
|
||||
*(state.lock()) = AuthState::RequestSent;
|
||||
|
||||
crate::httpPost(
|
||||
"/auth",
|
||||
&json,
|
||||
Closure::once_into_js(move |response: String| {
|
||||
*(state.lock()) =
|
||||
if let Ok(token) = serde_json::from_str::<Token>(&response) {
|
||||
AuthState::Authorised(token)
|
||||
} else {
|
||||
AuthState::Error("Malformed Response".into())
|
||||
}
|
||||
|
||||
// self.logged_in
|
||||
// .store(true, std::sync::atomic::Ordering::Relaxed);
|
||||
// self.logged_in();
|
||||
}),
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
// });
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Auth {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
token: Default::default(),
|
||||
auth_state: Arc::new(Mutex::new(AuthState::NotLoggedIn)),
|
||||
username: Default::default(),
|
||||
password: Default::default(),
|
||||
show_password: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
use egui::{TextStyle, Ui};
|
||||
use egui_extras::{Column, TableBuilder};
|
||||
use unshell_lib::config::RuntimeConfig;
|
||||
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
pub struct Config {
|
||||
@@ -22,7 +21,7 @@ impl Default for Config {
|
||||
current_payloads: vec![PayloadConfig {
|
||||
name: "Test".to_string(),
|
||||
components: vec!["server".to_string()],
|
||||
runtimes: Vec::new(),
|
||||
// runtimes: Vec::new(),
|
||||
}],
|
||||
}
|
||||
}
|
||||
@@ -217,7 +216,7 @@ impl Config {
|
||||
struct PayloadConfig {
|
||||
name: String,
|
||||
components: Vec<String>,
|
||||
runtimes: Vec<RuntimeConfig>,
|
||||
// runtimes: Vec<RuntimeConfig>,
|
||||
}
|
||||
|
||||
impl PayloadConfig {
|
||||
@@ -225,7 +224,7 @@ impl PayloadConfig {
|
||||
Self {
|
||||
name: "New Payload".to_string(),
|
||||
components: Vec::new(),
|
||||
runtimes: Vec::new(),
|
||||
// runtimes: Vec::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,5 +4,30 @@
|
||||
extern crate log;
|
||||
|
||||
pub mod app;
|
||||
mod auth;
|
||||
mod config;
|
||||
mod flowchart;
|
||||
|
||||
// mod JsFunc {
|
||||
// use wasm_bindgen::JsValue;
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
extern "C" {
|
||||
#[wasm_bindgen(js_namespace = console)]
|
||||
pub fn log(text: &str);
|
||||
|
||||
}
|
||||
|
||||
#[wasm_bindgen(module = "/assets/sw.js")]
|
||||
extern "C" {
|
||||
pub fn httpGet(url: &str, callback: JsValue);
|
||||
pub fn httpPost(url: &str, data: &str, callback: JsValue);
|
||||
}
|
||||
|
||||
// }
|
||||
// #[cfg(not(target_arch = "wasm32"))]
|
||||
// mod JsFunc {
|
||||
|
||||
// pub fn httpGet(url: &str, callback: fn() -> {}) {}
|
||||
// }
|
||||
|
||||
+15
-14
@@ -1,24 +1,23 @@
|
||||
#![warn(clippy::all, rust_2018_idioms)]
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
|
||||
use unshell_gui::app::TemplateApp;
|
||||
|
||||
// When compiling natively:
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
fn main() -> eframe::Result {
|
||||
pretty_env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`).
|
||||
// pretty_env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`).
|
||||
|
||||
let native_options = eframe::NativeOptions {
|
||||
viewport: egui::ViewportBuilder::default()
|
||||
.with_inner_size([400.0, 300.0])
|
||||
.with_min_inner_size([300.0, 220.0]),
|
||||
..Default::default()
|
||||
};
|
||||
eframe::run_native(
|
||||
"eframe template",
|
||||
native_options,
|
||||
Box::new(|cc| Ok(Box::new(TemplateApp::new(cc)))),
|
||||
)
|
||||
// let native_options = eframe::NativeOptions {
|
||||
// viewport: egui::ViewportBuilder::default()
|
||||
// .with_inner_size([400.0, 300.0])
|
||||
// .with_min_inner_size([300.0, 220.0]),
|
||||
// ..Default::default()
|
||||
// };
|
||||
// eframe::run_native(
|
||||
// "eframe template",
|
||||
// native_options,
|
||||
// Box::new(|cc| Ok(Box::new(TemplateApp::new(cc)))),
|
||||
// )
|
||||
todo!()
|
||||
}
|
||||
|
||||
// When compiling to web using trunk:
|
||||
@@ -26,6 +25,8 @@ fn main() -> eframe::Result {
|
||||
fn main() {
|
||||
use eframe::wasm_bindgen::JsCast as _;
|
||||
|
||||
use unshell_gui::app::TemplateApp;
|
||||
|
||||
// Redirect `log` message to `console.log` and friends:
|
||||
eframe::WebLogger::init(log::LevelFilter::Debug).ok();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user