diff --git a/tui/Cargo.lock b/tui/Cargo.lock index 4c90588..9e35b89 100644 --- a/tui/Cargo.lock +++ b/tui/Cargo.lock @@ -1,23 +1,5 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "ahash" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" -dependencies = [ - "const-random", -] - -[[package]] -name = "ahash" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e" -dependencies = [ - "const-random", -] - [[package]] name = "ansi_term" version = "0.11.0" @@ -27,12 +9,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "array-macro" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06e97b4e522f9e55523001238ac59d13a8603af57f69980de5d8de4bbbe8ada6" - [[package]] name = "atty" version = "0.2.14" @@ -64,9 +40,9 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "bumpalo" -version = "3.4.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" +checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" [[package]] name = "bytes" @@ -75,16 +51,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" [[package]] -name = "cc" -version = "1.0.66" +name = "cassowary" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48" +checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" [[package]] -name = "cfg-if" -version = "0.1.10" +name = "cc" +version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" [[package]] name = "cfg-if" @@ -92,19 +68,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "chrono" -version = "0.4.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" -dependencies = [ - "libc", - "num-integer", - "num-traits", - "time", - "winapi", -] - [[package]] name = "clap" version = "2.33.3" @@ -114,34 +77,12 @@ dependencies = [ "ansi_term", "atty", "bitflags", - "strsim 0.8.0", + "strsim", "textwrap", "unicode-width", "vec_map", ] -[[package]] -name = "const-random" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f590d95d011aa80b063ffe3253422ed5aa462af4e9867d43ce8337562bac77c4" -dependencies = [ - "const-random-macro", - "proc-macro-hack", -] - -[[package]] -name = "const-random-macro" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "615f6e27d000a2bffbc7f2f6a8669179378fa27ee4d0a509e985dfc0a7defb40" -dependencies = [ - "getrandom", - "lazy_static", - "proc-macro-hack", - "tiny-keccak", -] - [[package]] name = "core-foundation" version = "0.9.1" @@ -158,162 +99,13 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" -[[package]] -name = "crossbeam-channel" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87" -dependencies = [ - "crossbeam-utils", - "maybe-uninit", -] - -[[package]] -name = "crossbeam-utils" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" -dependencies = [ - "autocfg", - "cfg-if 0.1.10", - "lazy_static", -] - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "cursive" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a9f12332ab2bca26979ef00cfef9a1c2e287db03b787a83d892ad9961f81374" -dependencies = [ - "ahash 0.3.8", - "cfg-if 0.1.10", - "crossbeam-channel", - "cursive_core", - "enumset", - "lazy_static", - "libc", - "log", - "maplit", - "ncurses", - "signal-hook", - "term_size", - "unicode-segmentation", - "unicode-width", -] - -[[package]] -name = "cursive_core" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85fc5b6a8ba2f1bc743892068bde466438f78d6247197e2dc094bfd53fdea4b7" -dependencies = [ - "ahash 0.4.7", - "chrono", - "crossbeam-channel", - "enum-map", - "enumset", - "lazy_static", - "libc", - "log", - "num", - "owning_ref", - "signal-hook", - "toml", - "unicode-segmentation", - "unicode-width", - "xi-unicode", -] - -[[package]] -name = "darling" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.9.3", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" -dependencies = [ - "darling_core", - "quote", - "syn", -] - [[package]] name = "encoding_rs" -version = "0.8.26" +version = "0.8.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "801bbab217d7f79c0062f4f7205b5d4427c6d1a7bd7aafdd1475f7c59d62b283" +checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "enum-map" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4187999839f4ae8be35cf185d1381aa8dc32d2f5951349cc37ae49ebc4781855" -dependencies = [ - "array-macro", - "enum-map-derive", -] - -[[package]] -name = "enum-map-derive" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5c450cf304c9e18d45db562025a14fb1ca0f5c769b6f609309f81d4c31de455" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "enumset" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "959a80a2062fedd66ed41d99736212de987b3a8c83a4c2cef243968075256bd1" -dependencies = [ - "enumset_derive", - "num-traits", -] - -[[package]] -name = "enumset_derive" -version = "0.5.0" -source = "git+https://github.com/ocboogie/enumset?branch=span-fix#4c01c583c27a725948fededbfb3461c572a669a4" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn", + "cfg-if", ] [[package]] @@ -339,9 +131,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ece68d15c92e84fa4f19d3780f1294e5ca82a78a6d515f1efaabcc144688be00" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" dependencies = [ "matches", "percent-encoding", @@ -349,59 +141,68 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2d31b7ec7efab6eefc7c57233bb10b847986139d88cc2f5a02a1ae6871a1846" +checksum = "8c2dd2df839b57db9ab69c2c9d8f3e8c81984781937fe2807dc6dcf3b2ad2939" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e5145dde8da7d1b3892dad07a9c98fc04bc39892b1ecc9692cf53e2b780a65" +checksum = "15496a72fabf0e62bdc3df11a59a3787429221dd0710ba8ef163d6f7a9112c94" + +[[package]] +name = "futures-io" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71c2c65c57704c32f5241c1223167c2c3294fd34ac020c807ddbe6db287ba59" [[package]] name = "futures-sink" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caf5c69029bda2e743fddd0582d1083951d65cc9539aebf8812f36c3491342d6" +checksum = "85754d98985841b7d4f5e8e6fbfa4a4ac847916893ec511a2917ccd8525b8bb3" [[package]] name = "futures-task" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13de07eb8ea81ae445aca7b69f5f7bf15d7bf4912d8ca37d6645c77ae8a58d86" +checksum = "fa189ef211c15ee602667a6fcfe1c1fd9e07d42250d2156382820fba33c9df80" [[package]] name = "futures-util" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632a8cd0f2a4b3fdea1657f08bde063848c3bd00f9bbf6e256b8be78802e624b" +checksum = "1812c7ab8aedf8d6f2701a43e1243acdbcc2b36ab26e2ad421eb99ac963d96d1" dependencies = [ "futures-core", + "futures-io", "futures-task", + "memchr", "pin-project-lite", "pin-utils", + "slab", ] [[package]] name = "getrandom" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4060f4657be78b8e766215b02b18a2e862d83745545de804638e2b545e81aee6" +checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi", ] [[package]] name = "h2" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b67e66362108efccd8ac053abafc8b7a8d86a37e6e48fc4f6f7485eb5e9e6a5" +checksum = "d832b01df74254fe364568d6ddc294443f61cbec82816b60904303af87efae78" dependencies = [ "bytes", "fnv", @@ -414,7 +215,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "tracing-futures", ] [[package]] @@ -455,9 +255,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.3.4" +version = "1.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" +checksum = "615caabe2c3160b313d52ccc905335f4ed5f10881dd63dc5699d47e90be85691" [[package]] name = "httpdate" @@ -467,9 +267,9 @@ checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" [[package]] name = "hyper" -version = "0.14.2" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12219dc884514cb4a6a03737f4413c0e01c23a1b059b0156004b23f1e19dccbe" +checksum = "e8e946c2b1349055e0b72ae281b238baf1a3ea7307c7e9f9d64673bdd9c26ac7" dependencies = [ "bytes", "futures-channel", @@ -481,7 +281,7 @@ dependencies = [ "httparse", "httpdate", "itoa", - "pin-project 1.0.4", + "pin-project", "socket2", "tokio", "tower-service", @@ -502,17 +302,11 @@ dependencies = [ "tokio-native-tls", ] -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - [[package]] name = "idna" -version = "0.2.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" +checksum = "89829a5d69c23d348314a7ac337fe39173b61149a9864deabd260983aed48c21" dependencies = [ "matches", "unicode-bidi", @@ -521,23 +315,14 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.6.1" +version = "1.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb1fa934250de4de8aef298d81c729a7d33d8c239daa3a7575e6b92bfc7313b" +checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" dependencies = [ "autocfg", "hashbrown", ] -[[package]] -name = "instant" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" -dependencies = [ - "cfg-if 1.0.0", -] - [[package]] name = "ipnet" version = "2.3.0" @@ -552,9 +337,9 @@ checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "js-sys" -version = "0.3.46" +version = "0.3.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3d7383929f7c9c7c2d0fa596f325832df98c3704f2c60553080f7127a58175" +checksum = "dc9f84f9b115ce7843d60706df1422a916680bfdfcbdb0447c5614ff9d7e4d78" dependencies = [ "wasm-bindgen", ] @@ -567,46 +352,25 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.82" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89203f3fba0a3795506acaad8ebce3c80c0af93f994d5a1d7a0b1eeb23271929" - -[[package]] -name = "lock_api" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312" -dependencies = [ - "scopeguard", -] +checksum = "538c092e5586f4cdd7dd8078c4a79220e3e168880218124dcbce860f0ea938c6" [[package]] name = "log" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcf3805d4480bb5b86070dcfeb9e2cb2ebc148adb753c5cca5f884d1d65a42b2" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 0.1.10", + "cfg-if", ] -[[package]] -name = "maplit" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" - [[package]] name = "matches" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - [[package]] name = "memchr" version = "2.3.4" @@ -621,9 +385,9 @@ checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" [[package]] name = "mio" -version = "0.7.7" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e50ae3f04d169fcc9bde0b547d1c205219b7157e07ded9c5aff03e0637cb3ed7" +checksum = "2182a122f3b7f3f5329cb1972cee089ba2459a0a80a56935e6e674f096f8d839" dependencies = [ "libc", "log", @@ -660,17 +424,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "ncurses" -version = "5.100.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7db07ca287f6f4fb267e8b2ab0f9eb68f5a311a97315aaee845afa98f8a416b" -dependencies = [ - "cc", - "libc", - "pkg-config", -] - [[package]] name = "ntapi" version = "0.3.6" @@ -680,69 +433,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "num" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b7a8e9be5e039e2ff869df49155f1c06bd01ade2117ec783e56ab0932b67a8f" -dependencies = [ - "num-complex", - "num-integer", - "num-iter", - "num-rational", - "num-traits", -] - -[[package]] -name = "num-complex" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747d632c0c558b87dbabbe6a82f3b4ae03720d0646ac5b7b4dae89394be5f2c5" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-integer" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2021c8337a54d21aca0d59a92577a029af9431cb59b909b03252b9c164fad59" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" -dependencies = [ - "autocfg", -] - [[package]] name = "num_cpus" version = "1.13.0" @@ -754,22 +444,28 @@ dependencies = [ ] [[package]] -name = "once_cell" -version = "1.5.2" +name = "numtoa" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0" +checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" + +[[package]] +name = "once_cell" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3" [[package]] name = "openssl" -version = "0.10.32" +version = "0.10.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038d43985d1ddca7a9900630d8cd031b56e4794eecc2e9ea39dd17aa04399a70" +checksum = "a61075b62a23fef5a29815de7536d940aa35ce96d18ce0cc5076272db678a577" dependencies = [ "bitflags", - "cfg-if 1.0.0", + "cfg-if", "foreign-types", - "lazy_static", "libc", + "once_cell", "openssl-sys", ] @@ -781,9 +477,9 @@ checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" [[package]] name = "openssl-sys" -version = "0.9.60" +version = "0.9.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "921fc71883267538946025deffb622905ecad223c28efbfdef9bb59a0175f3e6" +checksum = "313752393519e876837e09e1fa183ddef0be7735868dced3196f4472d536277f" dependencies = [ "autocfg", "cc", @@ -792,40 +488,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "owning_ref" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff55baddef9e4ad00f88b6c743a2a8062d4c6ade126c2a528644b8e444d52ce" -dependencies = [ - "stable_deref_trait", -] - -[[package]] -name = "parking_lot" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ccb628cad4f84851442432c60ad8e1f607e29752d0bf072cbd0baf28aa34272" -dependencies = [ - "cfg-if 1.0.0", - "instant", - "libc", - "redox_syscall 0.1.57", - "smallvec", - "winapi", -] - [[package]] name = "percent-encoding" version = "2.1.0" @@ -834,38 +496,18 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "pin-project" -version = "0.4.27" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffbc8e94b38ea3d2d8ba92aea2983b503cd75d0888d75b86bb37970b5698e15" +checksum = "96fa8ebb90271c4477f144354485b8068bd8f6b78b428b01ba892ca26caf0b63" dependencies = [ - "pin-project-internal 0.4.27", -] - -[[package]] -name = "pin-project" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b70b68509f17aa2857863b6fa00bf21fc93674c7a8893de2f469f6aa7ca2f2" -dependencies = [ - "pin-project-internal 1.0.4", + "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "0.4.27" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65ad2ae56b6abe3a1ee25f15ee605bacadb9a764edaba9c2bf4103800d4a1895" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pin-project-internal" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caa25a6393f22ce819b0f50e0be89287292fda8d425be38ee0ca14c4931d9e71" +checksum = "758669ae3558c6f74bd2a18b41f7ac0b5a195aea6639d6a9b5e5d1ad5ba24c0b" dependencies = [ "proc-macro2", "quote", @@ -874,9 +516,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.4" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439697af366c49a6d0a010c56a0d97685bc140ce0d377b13a2ea2aa42d64a827" +checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905" [[package]] name = "pin-utils" @@ -896,12 +538,6 @@ version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" -[[package]] -name = "proc-macro-hack" -version = "0.5.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" - [[package]] name = "proc-macro2" version = "1.0.24" @@ -913,18 +549,18 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ "proc-macro2", ] [[package]] name = "rand" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18519b42a40024d661e1714153e9ad0c3de27cd495760ceb09710920f1098b1e" +checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" dependencies = [ "libc", "rand_chacha", @@ -944,9 +580,9 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c026d7df8b298d90ccbbc5190bd04d85e159eaf5576caeacf8741da93ccbd2e5" +checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" dependencies = [ "getrandom", ] @@ -962,19 +598,22 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.1.57" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - -[[package]] -name = "redox_syscall" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ec8ca9416c5ea37062b502703cd7fcb207736bc294f6e0cf367ac6fc234570" +checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" dependencies = [ "bitflags", ] +[[package]] +name = "redox_termios" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" +dependencies = [ + "redox_syscall", +] + [[package]] name = "remove_dir_all" version = "0.5.3" @@ -986,9 +625,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd281b1030aa675fb90aa994d07187645bb3c8fc756ca766e7c3070b439de9de" +checksum = "bf12057f289428dbf5c591c74bf10392e4a8003f993405a902f20117019022d4" dependencies = [ "base64", "bytes", @@ -1008,6 +647,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "serde", + "serde_json", "serde_urlencoded", "tokio", "tokio-native-tls", @@ -1034,17 +674,11 @@ dependencies = [ "winapi", ] -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - [[package]] name = "security-framework" -version = "2.0.0" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1759c2e3c8580017a484a7ac56d3abc5a6c1feadf88db2f3633f12ae4268c69" +checksum = "d493c5f39e02dfb062cd8f33301f90f9b13b650e8c1b1d0fd75c19dd64bff69d" dependencies = [ "bitflags", "core-foundation", @@ -1055,9 +689,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f99b9d5e26d2a71633cc4f2ebae7cc9f874044e0c351a27e17892d76dce5678b" +checksum = "dee48cdde5ed250b0d3252818f646e174ab414036edb884dde62d80a3ac6082d" dependencies = [ "core-foundation-sys", "libc", @@ -1065,18 +699,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.119" +version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bdd36f49e35b61d49efd8aa7fc068fd295961fd2286d0b2ee9a4c7a14e99cc3" +checksum = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.119" +version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552954ce79a059ddd5fd68c271592374bd15cab2274970380c000118aeffe1cd" +checksum = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b" dependencies = [ "proc-macro2", "quote", @@ -1085,9 +719,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.61" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fceb2595057b6891a4ee808f70054bd2d12f0e97f1cbb78689b59f676df325a" +checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" dependencies = [ "itoa", "ryu", @@ -1106,71 +740,34 @@ dependencies = [ "serde", ] -[[package]] -name = "signal-hook" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e31d442c16f047a671b5a71e2161d6e68814012b7f5379d269ebd915fac2729" -dependencies = [ - "libc", - "signal-hook-registry", -] - -[[package]] -name = "signal-hook-registry" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1d0fef1604ba8f7a073c7e701f213e056707210e9020af4528e0101ce11a6" -dependencies = [ - "libc", -] - [[package]] name = "slab" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" -[[package]] -name = "smallvec" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" - [[package]] name = "socket2" version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "winapi", ] -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - [[package]] name = "strsim" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -[[package]] -name = "strsim" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" - [[package]] name = "syn" -version = "1.0.58" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc60a3d73ea6594cd712d830cc1f0390fd71542d8c8cd24e70cc54cdfd5e05d5" +checksum = "3fd9d1e9976102a03c542daa2eff1b43f9d72306342f3f8b3ed5fb8908195d6f" dependencies = [ "proc-macro2", "quote", @@ -1183,22 +780,24 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "rand", - "redox_syscall 0.2.4", + "redox_syscall", "remove_dir_all", "winapi", ] [[package]] -name = "term_size" -version = "0.3.2" +name = "termion" +version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" +checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" dependencies = [ "libc", - "winapi", + "numtoa", + "redox_syscall", + "redox_termios", ] [[package]] @@ -1210,30 +809,11 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "time" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - [[package]] name = "tinyvec" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf8dbc19eb42fba10e8feaaec282fb50e2c14b2726d6301dbfeed0f73306a6f" +checksum = "317cca572a0e89c3ce0ca1f1bdc9369547fe318a683418e42ac8f59d14701023" dependencies = [ "tinyvec_macros", ] @@ -1246,9 +826,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.0.2" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca04cec6ff2474c638057b65798f60ac183e5e79d3448bb7163d36a39cff6ec" +checksum = "8d56477f6ed99e10225f38f9f75f872f29b8b8bd8c0b946f63345bb144e9eeda" dependencies = [ "autocfg", "bytes", @@ -1256,19 +836,15 @@ dependencies = [ "memchr", "mio", "num_cpus", - "once_cell", - "parking_lot", "pin-project-lite", - "signal-hook-registry", "tokio-macros", - "winapi", ] [[package]] name = "tokio-macros" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42517d2975ca3114b22a16192634e8241dc5cc1f130be194645970cc1c371494" +checksum = "caf7b11a536f46a809a8a9f0bb4237020f70ecbf115b842360afb127ea2fda57" dependencies = [ "proc-macro2", "quote", @@ -1285,22 +861,11 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-stream" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76066865172052eb8796c686f0b441a93df8b08d40a950b062ffb9a426f00edd" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" -version = "0.6.1" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ae4751faa60b9f96dd8344d74592e5a17c0c9a220413dbc6942d14139bbfcc" +checksum = "ec31e5cc6b46e653cf57762f36f71d5e6386391d88a72fd6db4508f8f676fb29" dependencies = [ "bytes", "futures-core", @@ -1308,31 +873,21 @@ dependencies = [ "log", "pin-project-lite", "tokio", - "tokio-stream", -] - -[[package]] -name = "toml" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" -dependencies = [ - "serde", ] [[package]] name = "tower-service" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" +checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.22" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f47026cdc4080c07e49b37087de021820269d996f581aac150ef9e5583eefe3" +checksum = "01ebdc2bb4498ab1ab5f5b73c5803825e60199229ccba0698170e3be0e7f959f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "pin-project-lite", "tracing-core", ] @@ -1346,16 +901,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "tracing-futures" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab7bb6f14721aa00656086e9335d363c5c8747bae02ebe32ea2c7dece5689b4c" -dependencies = [ - "pin-project 0.4.27", - "tracing", -] - [[package]] name = "try-lock" version = "0.2.3" @@ -1367,11 +912,26 @@ name = "tui" version = "0.1.0" dependencies = [ "clap", - "cursive", "reqwest", "serde", "serde_json", + "termion", "tokio", + "tui 0.14.0", + "unicode-width", +] + +[[package]] +name = "tui" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ced152a8e9295a5b168adc254074525c17ac4a83c90b2716274cc38118bddc9" +dependencies = [ + "bitflags", + "cassowary", + "termion", + "unicode-segmentation", + "unicode-width", ] [[package]] @@ -1385,9 +945,9 @@ dependencies = [ [[package]] name = "unicode-normalization" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a13e63ab62dbe32aeee58d1c5408d35c36c392bba5d9d3142287219721afe606" +checksum = "07fbfce1c8a97d547e8b5334978438d9d6ec8c20e38f56d4a4374d181493eaef" dependencies = [ "tinyvec", ] @@ -1412,9 +972,9 @@ checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "url" -version = "2.2.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5909f2b0817350449ed73e8bcd81c8c3c8d9a7a5d8acba4b27db277f1868976e" +checksum = "9ccd964113622c8e9322cfac19eb1004a07e636c545f325da085d5cdde6f1f8b" dependencies = [ "form_urlencoded", "idna", @@ -1446,17 +1006,17 @@ dependencies = [ [[package]] name = "wasi" -version = "0.10.1+wasi-snapshot-preview1" +version = "0.10.2+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93c6c3420963c5c64bca373b25e77acb562081b9bb4dd5bb864187742186cea9" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "wasm-bindgen" -version = "0.2.69" +version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cd364751395ca0f68cafb17666eee36b63077fb5ecd972bbcd74c90c4bf736e" +checksum = "7ee1280240b7c461d6a0071313e08f34a60b0365f14260362e5a2b17d1d31aa7" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "serde", "serde_json", "wasm-bindgen-macro", @@ -1464,9 +1024,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.69" +version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1114f89ab1f4106e5b55e688b828c0ab0ea593a1ea7c094b141b14cbaaec2d62" +checksum = "5b7d8b6942b8bb3a9b0e73fc79b98095a27de6fa247615e59d096754a3bc2aa8" dependencies = [ "bumpalo", "lazy_static", @@ -1479,11 +1039,11 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.19" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fe9756085a84584ee9457a002b7cdfe0bfff169f45d2591d8be1345a6780e35" +checksum = "8e67a5806118af01f0d9045915676b22aaebecf4178ae7021bc171dab0b897ab" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -1491,9 +1051,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.69" +version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6ac8995ead1f084a8dea1e65f194d0973800c7f571f6edd70adf06ecf77084" +checksum = "e5ac38da8ef716661f0f36c0d8320b89028efe10c7c0afde65baffb496ce0d3b" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1501,9 +1061,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.69" +version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a48c72f299d80557c7c62e37e7225369ecc0c963964059509fbafe917c7549" +checksum = "cc053ec74d454df287b9374ee8abb36ffd5acb95ba87da3ba5b7d3fe20eb401e" dependencies = [ "proc-macro2", "quote", @@ -1514,15 +1074,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.69" +version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e7811dd7f9398f14cc76efd356f98f03aa30419dea46aa810d71e819fc97158" +checksum = "7d6f8ec44822dd71f5f221a5847fb34acd9060535c1211b70a05844c0f6383b1" [[package]] name = "web-sys" -version = "0.3.46" +version = "0.3.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222b1ef9334f92a21d3fb53dc3fd80f30836959a90f9274a626d7e06315ba3c3" +checksum = "ec600b26223b2948cedfde2a0aa6756dcf1fef616f43d7b3097aaf53a6c4d92b" dependencies = [ "js-sys", "wasm-bindgen", @@ -1558,9 +1118,3 @@ checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" dependencies = [ "winapi", ] - -[[package]] -name = "xi-unicode" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e71b85d8b1b8bfaf4b5c834187554d201a8cd621c2bbfa33efd41a3ecabd48b2" diff --git a/tui/Cargo.toml b/tui/Cargo.toml index 41b15f5..175e6db 100644 --- a/tui/Cargo.toml +++ b/tui/Cargo.toml @@ -8,16 +8,18 @@ edition = "2018" [dependencies] -clap = "2.33.3" -cursive = { version = "0.15", features=["toml"] } +# UI Backend +tui = "0.14" +termion = "1.5" +unicode-width = "0.1.5" +# Better options support +clap = "2.33.3" + +# For json serde_json = "1.0" serde = { version = "1.0.114", features = ["derive"] } -reqwest = "0.11.0" -tokio = { version = "1", features = ["full"] } - - -[patch.crates-io.enumset_derive] -git = "https://github.com/ocboogie/enumset" -branch = "span-fix" +# Networking related dependancies +tokio = { version = "1", features = ["rt", "net", "macros", "rt-multi-thread"] } +reqwest = { version = "0.11.2", features = [ "json", "blocking"] } diff --git a/tui/src/api_types.rs b/tui/src/api_types.rs new file mode 100644 index 0000000..dce1024 --- /dev/null +++ b/tui/src/api_types.rs @@ -0,0 +1,32 @@ +use serde::{Serialize, Deserialize}; + +#[allow(dead_code)] +const VOICE_CHANNEL: i32 = 1; +#[allow(dead_code)] +const TEXT_CHANNEL: i32 = 2; + +// Network Types +#[allow(dead_code)] +pub struct Message { + pub id: u64, + pub time: i64, + pub content: String, + pub content_type: String, + pub channel_id: u64, + pub userid: u64, + pub username: String, +} + + +#[allow(dead_code)] +pub struct Channel { + pub name: String, + pub id: u64, + pub type_: i32, + pub description: Option, +} + +#[derive(Deserialize)] +pub struct Jwt { + pub jwt: String +} diff --git a/tui/src/auth.rs b/tui/src/auth.rs deleted file mode 100644 index da067a7..0000000 --- a/tui/src/auth.rs +++ /dev/null @@ -1,6 +0,0 @@ -// Deals with logging in and requesting new jwt's when required - - -async fn login() {} - -async fn refresh_jwt() {} \ No newline at end of file diff --git a/tui/src/cache.rs b/tui/src/cache.rs new file mode 100644 index 0000000..0781dec --- /dev/null +++ b/tui/src/cache.rs @@ -0,0 +1,58 @@ +/** + * welcum to the cache zone + * Notes about data model here + * Basically none of the ever gets written to disk so its mutability is + * + * Memory Model things + * The cache should always own its own data and nothing else + * On calls where the cache system needs to take data it should actually + * make its own copy to not disturb the render side of things as it too requires + * ownership of its own data. For this reason all parts of this are basically + * going to be really selfish about its own data + * + */ + +use crate::config::{ ServerMeta, UserConfig }; +use crate::api_types::{Channel, Message}; +use crate::command::Command; + +use std::collections::HashMap; + +struct ChannelCache { + meta: Channel, + messages: Vec +} + +struct ServerCache { + meta: ServerMeta, + user: UserConfig, + channels: Vec +} + +pub struct Cache { + // Hostname -> Cache + servers: HashMap, + active_server: Option +} + +impl Default for Cache { + fn default() -> Cache { + Cache { + servers: HashMap::new(), + active_server: None + } + } +} + +impl Cache { + pub async fn switch_channel(&mut self, id: u64) -> Command { + todo!() + } + pub async fn switch_server(&mut self, host: &str) -> Command { + todo!() + } + + pub async fn send_message(&mut self, id: &str) -> Command { + todo!() + } +} diff --git a/tui/src/command.rs b/tui/src/command.rs new file mode 100644 index 0000000..9b673fe --- /dev/null +++ b/tui/src/command.rs @@ -0,0 +1,94 @@ +use tui::text::{Span, Spans}; +use tui::style::{Style, Modifier}; + +pub enum Command { + Help, + // Picking based on id + Channel(u64), + // Choose server based on hostname + Server(String), + // Send regular message + Message(String), + // Command that failed with some message + Failure(&'static str), +} + +impl Command { + // Pulls out channel id from a line + // Examples: /chan 123 + // /channel 789 + // /channelswag 1 + fn parse_chan_id(s: &str) -> Option { + let parts: Vec<&str> = s.split(" ").collect(); + return if parts.len() < 2 { + None + } else { + let id_s = parts.get(1).unwrap(); + match id_s.parse::() { + Ok(id) => Some(id), + _ => None + } + } + } + + fn parse_hostname(s: &str) -> Option { + let parts: Vec<&str> = s.split(" ").collect(); + return if parts.len() < 2{ + None + } else{ + let hostname: String = (*parts.get(1).unwrap()).into(); + Some(hostname) + } + } + + pub fn from(s: String) -> Command { + let s = s.trim(); + if s.starts_with("/chan") { + match Command::parse_chan_id(s.as_ref()) { + Some(id) => Command::Channel(id), + None => Command::Failure("no valid id(u64) provided") + } + } else if s.starts_with("/serv") { + match Command::parse_hostname(s.as_ref()) { + Some(hostname) => Command::Server(hostname), + None => Command::Failure("no hostname provided") + } + } else if s.starts_with("/help") { + Command::Help + } + else { + if s.starts_with("/") { + Command::Failure("command not found") + } else { + Command::Message(s.into()) + } + } + } + + pub fn styled(&self) -> Spans { + use Command::*; + return match self { + Help => Spans::from(vec![ + Span::styled("! /help\n", Style::default().add_modifier(Modifier::BOLD)), + Span::styled("! /channel ", Style::default().add_modifier(Modifier::BOLD)), + Span::styled("! /server ", Style::default().add_modifier(Modifier::BOLD)), + ]), + Channel(id) => Spans::from(vec![ + Span::styled(format!("! /channel "), Style::default().add_modifier(Modifier::BOLD)), + Span::raw(format!("{}", id)), + ]), + Server(hostname) => Spans::from(vec![ + Span::styled("! /server ", Style::default().add_modifier(Modifier::BOLD)), + Span::raw(hostname) + ]), + Message(msg) => Spans::from(vec![ + Span::styled("(You) ", Style::default().add_modifier(Modifier::BOLD)), + Span::raw(msg) + ]), + Failure(msg) => Spans::from(vec![ + Span::styled("! error ", Style::default().add_modifier(Modifier::BOLD)), + Span::raw(*msg) + ]) + } + } +} diff --git a/tui/src/config.rs b/tui/src/config.rs new file mode 100644 index 0000000..f87b864 --- /dev/null +++ b/tui/src/config.rs @@ -0,0 +1,72 @@ +use serde::{Serialize, Deserialize}; + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct ServerMeta { + pub protocol: String, + pub hostname: String, + pub port: Option, + pub description: String, + pub name: String, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct ServerConfig { + pub user: UserConfig, + pub server: ServerMeta +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct UserConfig { + pub id: u64, + pub secret: String, + pub jwt: Option, + + pub permissions: u64, + pub joindate: i64, + pub status: i32, +} + + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct Config { + pub username: Option, + pub servers: Vec +} + + +impl Config { + pub fn update_jwt(&mut self, hostname: String, jwt: String) { + for servermeta in self.servers.iter_mut() { + if servermeta.server.hostname == hostname { + servermeta.user.jwt = Some(jwt); + break + } + } + } + + pub fn server_url(&self, hostname: &str) -> Option { + // Finds the base-url for the given hostname, assuming it exists + let mut url: Option = None; + for meta in self.servers.iter() { + if meta.server.hostname == hostname { + url = match meta.server.port { + Some(p) => Some(format!("{}://{}:{}", meta.server.protocol, hostname, p)), + None => Some(format!("{}://{}", meta.server.protocol, hostname)) + }; + break + } + } + return url; + } + + pub fn save(&self, path: String) -> std::io::Result<()>{ + use std::io::prelude::Write; + use std::fs::File; + + let content = serde_json::to_string_pretty(self)?; + let mut file = File::create(path)?; + file.write(content.as_bytes())?; + + Ok(()) + } +} diff --git a/tui/src/http.rs b/tui/src/http.rs deleted file mode 100644 index f99925f..0000000 --- a/tui/src/http.rs +++ /dev/null @@ -1,27 +0,0 @@ -use cursive::Cursive; -use reqwest; -use crate::types::Channel; - -pub async fn fetch_channels(domain: &str, port: u16) -> Option>{ - let url = format!("http://{}:{}/channels/list", domain, port); - - if let Ok(resp) = reqwest::get(&url).await { - let bytes = resp.bytes().await.unwrap(); - let res: Result, serde_json::Error> = serde_json::from_slice(&bytes); - return match res { - Ok(res) => Some(res), - _ => None - }; - } - return None; -} - - -pub mod sync { - use cursive::Cursive; - use std::net::Ipv4Addr; - - pub fn open_channel(ip: Ipv4Addr, name: &str, s: &mut Cursive) { - } - -} \ No newline at end of file diff --git a/tui/src/main.rs b/tui/src/main.rs index 5367bbd..b6cda5c 100644 --- a/tui/src/main.rs +++ b/tui/src/main.rs @@ -1,99 +1,224 @@ -extern crate serde; -extern crate clap; -extern crate cursive; +mod util; +mod command; +mod config; +mod api_types; +mod cache; -extern crate tokio; -extern crate reqwest; +use crate::util::event::{Event, Events}; +use crate::command::Command; +use crate::cache::Cache; +use std::{env, fs, error::Error, io}; +use clap::{App as Clap, Arg, ArgMatches}; +use termion::{event::Key, input::MouseTerminal, raw::IntoRawMode, screen::AlternateScreen}; +use tui::{ + backend::TermionBackend, + layout::{Constraint, Direction, Layout}, + style::{Color, Modifier, Style}, + text::{Span, Spans, Text}, + widgets::{Wrap, Block, Borders, Paragraph}, + Terminal, +}; +use unicode_width::UnicodeWidthStr; -use std::{fs, env}; -use std::path::PathBuf; +enum InputMode { + Normal, + Editing, +} -use clap::{Arg, App}; -use cursive::Cursive; -use cursive::menu::MenuTree; -use cursive::event::Key; +/// App holds the state of the application +struct App { + /// Current value of the input box + input: String, + /// Current input mode + input_mode: InputMode, + /// History of recorded messages + messages: Vec, + cache: Cache +} -use serde_json; +impl Default for App { + fn default() -> App { + App { + input: String::new(), + input_mode: InputMode::Normal, + messages: Vec::new(), + cache: Cache::default() // empty cache lad + } + } +} -mod types; -mod http; - -#[tokio::main] -async fn main() { - let args = App::new("Freechat TUI") - .version("69.420") - .author("godrah") - .about("oh you know") +fn get_args() -> ArgMatches<'static> { + Clap::new("Freechat TUI") + .version("v69.420") + .author("Author: shockrah") + .about("Description: A terminal based program for interacting with freechat servers") .arg(Arg::with_name("config") .short("c") .long("config") .value_name("CONFIG") .help("Specify path of config to use") .takes_value(true)) - .arg(Arg::with_name("theme") - .short("t") - .long("theme") - .value_name("THEME_FILE") - .help("Specify theme file on startup") - .takes_value(true)).get_matches(); - - let config: types::Config = if args.args.len() == 0 { + .arg(Arg::with_name("no_login") + .short("l") + .long("no-login") + .help("Don't automatically login on startup")).get_matches() +} + +#[tokio::main] +async fn main() -> Result<(), Box> { + // parameter things first + let args = get_args(); + + let (config_path, mut config): (String, config::Config) = if args.args.len() == 0 { let home = env::var("HOME").unwrap(); - match fs::read_to_string(format!("{}/.config/freechat/config.json", home)) { - Ok(data) => serde_json::from_str(&data).unwrap(), - Err(e) => panic!("Bro: {}", e) + let path = format!("{}/.config/freechat/config.json", home); + match fs::read_to_string(&path) { + Ok(data) => (path, serde_json::from_str(&data).unwrap()), + Err(e) => panic!("Unable to parse config file @{} : {}", path, e) } } else{ let path = args.value_of("config").unwrap(); match fs::read_to_string(path) { - Ok(data) => serde_json::from_str(&data).unwrap(), - Err(e) => panic!("Bro: {}", e) + Ok(data) => (path.into(), serde_json::from_str(&data).unwrap()), + Err(e) => panic!("Unable to parse config @ {} : {}", path, e) } }; + // Terminal initialization + let stdout = io::stdout().into_raw_mode()?; + let stdout = MouseTerminal::from(stdout); + let stdout = AlternateScreen::from(stdout); + let backend = TermionBackend::new(stdout); + let mut terminal = Terminal::new(backend)?; - // only load a theme if requested - let theme = if let Some(theme) = args.value_of("theme") { - Some(PathBuf::from(theme)) - } else { - None - }; + // Setup event handlers + let mut events = Events::new(); - let mut app = cursive::default(); + // Create default app state + let mut app = App::default(); - // optionally load optional theme - if let Some(theme) = theme { let _ = app.load_theme_file(theme); } + loop { + // Draw UI + terminal.draw(|f| { + let chunks = Layout::default() + .direction(Direction::Vertical) + .margin(2) + .constraints( + [ + Constraint::Length(1), + Constraint::Length(3), + Constraint::Min(1), + ] + .as_ref(), + ) + .split(f.size()); - app.add_global_callback('q', Cursive::quit); - app.add_global_callback(Key::Esc, |s| s.select_menubar()); - app.set_autohide_menu(false); // don't hide the menubar all the time + let (msg, style) = match app.input_mode { + InputMode::Normal => ( + vec![ + Span::styled("I", Style::default().add_modifier(Modifier::BOLD)), + Span::raw(" for insert mode"), + ], + Style::default() + ), + InputMode::Editing => ( + vec![ + Span::raw("Keys: "), + Span::styled("Esc", Style::default().add_modifier(Modifier::BOLD)), + Span::styled(" Enter ", Style::default().add_modifier(Modifier::BOLD)), + Span::styled("/help", Style::default().add_modifier(Modifier::BOLD)) + ], + Style::default(), + ), + }; + let mut text = Text::from(Spans::from(msg)); + text.patch_style(style); + let help_message = Paragraph::new(text); + f.render_widget(help_message, chunks[0]); + let input = Paragraph::new(app.input.as_ref()) + .style(match app.input_mode { + InputMode::Normal => Style::default(), + InputMode::Editing => Style::default().fg(Color::Yellow), + }) + .block(Block::default().borders(Borders::ALL)); + f.render_widget(input, chunks[1]); + let mut lines: Vec = Vec::new(); + for cmd in app.messages.iter() { + &lines.push(cmd.styled()); + } - // menu bar at the top lets us pick between different servers in the config - for server in config.servers.iter() { - let name = match &server.name { - Some(name) => name.to_string(), - //None => String::from(&format!("{}", server.ip)) - None => String::from("None") - }; + let list = Paragraph::new(lines) + .wrap(Wrap { trim: false }) + .block(Block::default() + .borders(Borders::ALL) + .title("Messages")); - app.menubar().add_subtree(&name, MenuTree::new()); // add server name - // on action: - // open up search able list of channels - // choose from that list of channels which one you want to see + f.render_widget(list, chunks[2]); - // NOTE: not passing the domain as the IP is resolved on server join - if let Some(channels) = http::fetch_channels(&server.ip, server.port).await { - // add a bunch of actionable leafs to our sub tree - for channel in channels { - app.menubar().find_subtree(name.as_ref()).unwrap().add_leaf(channel.name.clone(), move |s| { - let (ip, name) = channel.parts(); - http::sync::open_channel(ip, name, s); - }); + match app.input_mode { + InputMode::Normal => + // Hide the cursor. `Frame` does this by default, so we don't need to do anything here + {} + + InputMode::Editing => { + // Make the cursor visible and ask tui-rs to put it at the specified coordinates after rendering + f.set_cursor( + // Put cursor past the end of the input text + chunks[1].x + app.input.width() as u16 + 1, + // Move one line down, from the border to the input line + chunks[1].y + 1, + ) + } + } + })?; + + // Handle input + if let Event::Input(input) = events.next()? { + match app.input_mode { + InputMode::Normal => match input { + Key::Char('i') => { + app.input_mode = InputMode::Editing; + events.disable_exit_key(); + } + Key::Char('q') => { + // save the config as is then quit out + match config.save(config_path) { + Ok(_) => println!(":^)"), + Err(e) => eprintln!("Couldn't save config state: {}", e) + }; + break; + } + _ => {} + }, + InputMode::Editing => match input { + Key::Char('\n') => { + let cmd = Command::from(app.input.drain(..).collect()); + app.messages.push(match cmd { + // only for networked commands do we need to touch cache + Command::Channel(id) => app.cache.switch_channel(id).await, + Command::Server(host) => app.cache.switch_server(&host).await, + Command::Message(msg) => app.cache.send_message(&msg).await, + _ => cmd + }); + } + Key::Char(c) => { + app.input.push(c); + } + Key::Backspace => { + app.input.pop(); + } + Key::Ctrl('c') | Key::Esc => { + app.input_mode = InputMode::Normal; + events.enable_exit_key(); + } + _ => {} + }, } } } - - app.run(); + Ok(()) } + + diff --git a/tui/src/types.rs b/tui/src/types.rs deleted file mode 100644 index 5bcc7a5..0000000 --- a/tui/src/types.rs +++ /dev/null @@ -1,36 +0,0 @@ -use serde::{Serialize,Deserialize}; -use std::net::Ipv4Addr; -use std::str::FromStr; - -#[derive(Debug, Deserialize, Serialize)] -pub struct Server { - pub name: Option, - pub domain: Option, - pub ip: String, - pub port: u16, - pub description: Option, - pub key: String, // the secret hush hush uwu - pub id: u64, - pub nickname: Option -} - -#[derive(Deserialize, Serialize)] -pub struct Config { - pub username: String, // global username that is only overriden in server context's if nickname is used - pub servers: Vec -} - -#[derive(Debug, Deserialize)] -pub struct Channel { - pub ip: String, - pub name: String, -} - -impl Channel { - pub fn parts(&self) -> (Ipv4Addr, &str) { - // return the ip/name of the channel - let addr = Ipv4Addr::from_str(&self.ip).unwrap(); - - (addr, self.name.as_ref()) - } -} diff --git a/tui/src/util/event.rs b/tui/src/util/event.rs new file mode 100644 index 0000000..333096a --- /dev/null +++ b/tui/src/util/event.rs @@ -0,0 +1,95 @@ +use std::io; +use std::sync::mpsc; +use std::sync::{ + atomic::{AtomicBool, Ordering}, + Arc, +}; +use std::thread; +use std::time::Duration; + +use termion::event::Key; +use termion::input::TermRead; + +pub enum Event { + Input(I), + Tick, +} + +/// A small event handler that wrap termion input and tick events. Each event +/// type is handled in its own thread and returned to a common `Receiver` +pub struct Events { + rx: mpsc::Receiver>, + input_handle: thread::JoinHandle<()>, + ignore_exit_key: Arc, + tick_handle: thread::JoinHandle<()>, +} + +#[derive(Debug, Clone, Copy)] +pub struct Config { + pub exit_key: Key, + pub tick_rate: Duration, +} + +impl Default for Config { + fn default() -> Config { + Config { + exit_key: Key::Char('q'), + tick_rate: Duration::from_millis(250), + } + } +} + +impl Events { + pub fn new() -> Events { + Events::with_config(Config::default()) + } + + pub fn with_config(config: Config) -> Events { + let (tx, rx) = mpsc::channel(); + let ignore_exit_key = Arc::new(AtomicBool::new(false)); + let input_handle = { + let tx = tx.clone(); + let ignore_exit_key = ignore_exit_key.clone(); + thread::spawn(move || { + let stdin = io::stdin(); + for evt in stdin.keys() { + if let Ok(key) = evt { + if let Err(err) = tx.send(Event::Input(key)) { + eprintln!("{}", err); + return; + } + if !ignore_exit_key.load(Ordering::Relaxed) && key == config.exit_key { + return; + } + } + } + }) + }; + let tick_handle = { + thread::spawn(move || loop { + if tx.send(Event::Tick).is_err() { + break; + } + thread::sleep(config.tick_rate); + }) + }; + Events { + rx, + ignore_exit_key, + input_handle, + tick_handle, + } + } + + pub fn next(&self) -> Result, mpsc::RecvError> { + self.rx.recv() + } + + pub fn disable_exit_key(&mut self) { + self.ignore_exit_key.store(true, Ordering::Relaxed); + } + + pub fn enable_exit_key(&mut self) { + self.ignore_exit_key.store(false, Ordering::Relaxed); + } +} diff --git a/tui/src/util/mod.rs b/tui/src/util/mod.rs new file mode 100644 index 0000000..1d24b84 --- /dev/null +++ b/tui/src/util/mod.rs @@ -0,0 +1,21 @@ +//#[cfg(feature = "termion")] +pub mod event; + +#[derive(Clone)] +pub struct SinSignal { + x: f64, + interval: f64, + period: f64, + scale: f64, +} + + +impl Iterator for SinSignal { + type Item = (f64, f64); + fn next(&mut self) -> Option { + let point = (self.x, (self.x * 1.0 / self.period).sin() * self.scale); + self.x += self.interval; + Some(point) + } +} + diff --git a/tui/themes/dark.toml b/tui/themes/dark.toml deleted file mode 100644 index 66a3064..0000000 --- a/tui/themes/dark.toml +++ /dev/null @@ -1,14 +0,0 @@ -shadow = true -borders = "outset" - -[colors] -shadow = "#1a1a1a" -background = "black" -primary = ["black"] -secondary = "black" -tertiary = "black" -title_primary = "#3560e0" -title_secondary = "#ffff55" -highlight = "#3560e0" -highlight_inactive = "#7a93c9" - diff --git a/tui/themes/high-contrast.toml b/tui/themes/high-contrast.toml deleted file mode 100644 index 28ea860..0000000 --- a/tui/themes/high-contrast.toml +++ /dev/null @@ -1,13 +0,0 @@ -shadow = false -borders = "outset" - -[colors] -background = "black" -primary = ["#000000"] -secondary = "black" -tertiary = "#000000" -title_primary = "black" -title_secondary = "#000000" -highlight = "#000000" -highlight_inactive = "#7a7a7a" - diff --git a/tui/themes/light.toml b/tui/themes/light.toml deleted file mode 100644 index cf9102e..0000000 --- a/tui/themes/light.toml +++ /dev/null @@ -1,11 +0,0 @@ -[colors] -background = "white" -primary = "white" -secondary = "white" -tertiary = "white" -title_primary = "white" -title_secondary = "white" -highlight = "white" -highlight_inactive = "#e0e0e0" -view = "black" -