Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31bdb6d92e | ||
|
|
83f4ee0e51 | ||
|
|
ed1d2b5835 | ||
|
|
324a7b07b0 | ||
|
|
37566c4413 | ||
|
|
787201c3a8 | ||
|
|
6f8a76cb13 | ||
|
|
0f4c567405 | ||
|
|
d9300d80ff | ||
|
|
72ae3121d4 | ||
|
|
75149668ef | ||
|
|
7e4b7b2080 | ||
|
|
28d2a7cca9 | ||
|
|
9a477c48cc | ||
|
|
5598f39315 | ||
|
|
ff2c41cf69 | ||
|
|
21d8cfb185 | ||
|
|
173bf045d9 | ||
|
|
25e99fbf93 | ||
|
|
6bbb9861ef | ||
|
|
645285019e | ||
|
|
49133b5f7a | ||
|
|
26b415667a | ||
|
|
b1cb419f3d | ||
|
|
8182f90783 |
306
Cargo.lock
generated
306
Cargo.lock
generated
@@ -212,6 +212,12 @@ version = "1.1.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "base64"
|
||||||
|
version = "0.21.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bit-set"
|
name = "bit-set"
|
||||||
version = "0.5.3"
|
version = "0.5.3"
|
||||||
@@ -294,6 +300,12 @@ version = "1.4.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bytes"
|
||||||
|
version = "1.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "calloop"
|
name = "calloop"
|
||||||
version = "0.10.5"
|
version = "0.10.5"
|
||||||
@@ -723,6 +735,15 @@ dependencies = [
|
|||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "encoding_rs"
|
||||||
|
version = "0.8.32"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "errno"
|
name = "errno"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
@@ -855,6 +876,15 @@ version = "0.3.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
|
checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "form_urlencoded"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8"
|
||||||
|
dependencies = [
|
||||||
|
"percent-encoding",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "freetype-rs"
|
name = "freetype-rs"
|
||||||
version = "0.26.0"
|
version = "0.26.0"
|
||||||
@@ -1139,6 +1169,25 @@ dependencies = [
|
|||||||
"svg_fmt",
|
"svg_fmt",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "h2"
|
||||||
|
version = "0.3.16"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5be7b54589b581f624f566bf5d8eb2bab1db736c51528720b6bd36b96b55924d"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"fnv",
|
||||||
|
"futures-core",
|
||||||
|
"futures-sink",
|
||||||
|
"futures-util",
|
||||||
|
"http",
|
||||||
|
"indexmap",
|
||||||
|
"slab",
|
||||||
|
"tokio",
|
||||||
|
"tokio-util",
|
||||||
|
"tracing",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "handlebars"
|
name = "handlebars"
|
||||||
version = "4.3.6"
|
version = "4.3.6"
|
||||||
@@ -1183,6 +1232,64 @@ version = "0.2.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
|
checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "http"
|
||||||
|
version = "0.2.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"fnv",
|
||||||
|
"itoa",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "http-body"
|
||||||
|
version = "0.4.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"http",
|
||||||
|
"pin-project-lite",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "httparse"
|
||||||
|
version = "1.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "httpdate"
|
||||||
|
version = "1.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hyper"
|
||||||
|
version = "0.14.25"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cc5e554ff619822309ffd57d8734d77cd5ce6238bc956f037ea06c58238c9899"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"futures-channel",
|
||||||
|
"futures-core",
|
||||||
|
"futures-util",
|
||||||
|
"h2",
|
||||||
|
"http",
|
||||||
|
"http-body",
|
||||||
|
"httparse",
|
||||||
|
"httpdate",
|
||||||
|
"itoa",
|
||||||
|
"pin-project-lite",
|
||||||
|
"socket2",
|
||||||
|
"tokio",
|
||||||
|
"tower-service",
|
||||||
|
"tracing",
|
||||||
|
"want",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iced"
|
name = "iced"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
@@ -1307,6 +1414,16 @@ version = "1.0.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "idna"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-bidi",
|
||||||
|
"unicode-normalization",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "1.9.2"
|
version = "1.9.2"
|
||||||
@@ -1340,6 +1457,12 @@ dependencies = [
|
|||||||
"windows-sys 0.45.0",
|
"windows-sys 0.45.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ipnet"
|
||||||
|
version = "2.7.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "itoa"
|
||||||
version = "1.0.6"
|
version = "1.0.6"
|
||||||
@@ -1491,6 +1614,12 @@ dependencies = [
|
|||||||
"objc",
|
"objc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "mime"
|
||||||
|
version = "0.3.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "minimal-lexical"
|
name = "minimal-lexical"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
@@ -2101,6 +2230,40 @@ version = "0.7.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f1382d1f0a252c4bf97dc20d979a2fdd05b024acd7c2ed0f7595d7817666a157"
|
checksum = "f1382d1f0a252c4bf97dc20d979a2fdd05b024acd7c2ed0f7595d7817666a157"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "reqwest"
|
||||||
|
version = "0.11.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0ba30cc2c0cd02af1222ed216ba659cdb2f879dfe3181852fe7c50b1d0005949"
|
||||||
|
dependencies = [
|
||||||
|
"base64",
|
||||||
|
"bytes",
|
||||||
|
"encoding_rs",
|
||||||
|
"futures-core",
|
||||||
|
"futures-util",
|
||||||
|
"h2",
|
||||||
|
"http",
|
||||||
|
"http-body",
|
||||||
|
"hyper",
|
||||||
|
"ipnet",
|
||||||
|
"js-sys",
|
||||||
|
"log",
|
||||||
|
"mime",
|
||||||
|
"once_cell",
|
||||||
|
"percent-encoding",
|
||||||
|
"pin-project-lite",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"serde_urlencoded",
|
||||||
|
"tokio",
|
||||||
|
"tower-service",
|
||||||
|
"url",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"wasm-bindgen-futures",
|
||||||
|
"web-sys",
|
||||||
|
"winreg",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc-hash"
|
name = "rustc-hash"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
@@ -2128,7 +2291,7 @@ dependencies = [
|
|||||||
"handlebars",
|
"handlebars",
|
||||||
"iced",
|
"iced",
|
||||||
"iced_futures",
|
"iced_futures",
|
||||||
"iced_native",
|
"reqwest",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_yaml",
|
"serde_yaml",
|
||||||
@@ -2204,6 +2367,18 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_urlencoded"
|
||||||
|
version = "0.7.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
|
||||||
|
dependencies = [
|
||||||
|
"form_urlencoded",
|
||||||
|
"itoa",
|
||||||
|
"ryu",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_yaml"
|
name = "serde_yaml"
|
||||||
version = "0.9.19"
|
version = "0.9.19"
|
||||||
@@ -2447,6 +2622,52 @@ dependencies = [
|
|||||||
"bytemuck",
|
"bytemuck",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tinyvec"
|
||||||
|
version = "1.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
|
||||||
|
dependencies = [
|
||||||
|
"tinyvec_macros",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tinyvec_macros"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tokio"
|
||||||
|
version = "1.26.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"bytes",
|
||||||
|
"libc",
|
||||||
|
"memchr",
|
||||||
|
"mio",
|
||||||
|
"num_cpus",
|
||||||
|
"pin-project-lite",
|
||||||
|
"socket2",
|
||||||
|
"windows-sys 0.45.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tokio-util"
|
||||||
|
version = "0.7.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"futures-core",
|
||||||
|
"futures-sink",
|
||||||
|
"pin-project-lite",
|
||||||
|
"tokio",
|
||||||
|
"tracing",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml"
|
name = "toml"
|
||||||
version = "0.5.11"
|
version = "0.5.11"
|
||||||
@@ -2473,6 +2694,38 @@ dependencies = [
|
|||||||
"winnow",
|
"winnow",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tower-service"
|
||||||
|
version = "0.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tracing"
|
||||||
|
version = "0.1.37"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"pin-project-lite",
|
||||||
|
"tracing-core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tracing-core"
|
||||||
|
version = "0.1.30"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a"
|
||||||
|
dependencies = [
|
||||||
|
"once_cell",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "try-lock"
|
||||||
|
version = "0.2.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ttf-parser"
|
name = "ttf-parser"
|
||||||
version = "0.18.1"
|
version = "0.18.1"
|
||||||
@@ -2502,12 +2755,27 @@ version = "0.1.5"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81"
|
checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-bidi"
|
||||||
|
version = "0.3.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.8"
|
version = "1.0.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
|
checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-normalization"
|
||||||
|
version = "0.1.22"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921"
|
||||||
|
dependencies = [
|
||||||
|
"tinyvec",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-segmentation"
|
name = "unicode-segmentation"
|
||||||
version = "1.10.1"
|
version = "1.10.1"
|
||||||
@@ -2532,6 +2800,17 @@ version = "0.2.7"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ad2024452afd3874bf539695e04af6732ba06517424dbf958fdb16a01f3bef6c"
|
checksum = "ad2024452afd3874bf539695e04af6732ba06517424dbf958fdb16a01f3bef6c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "url"
|
||||||
|
version = "2.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643"
|
||||||
|
dependencies = [
|
||||||
|
"form_urlencoded",
|
||||||
|
"idna",
|
||||||
|
"percent-encoding",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "value-bag"
|
name = "value-bag"
|
||||||
version = "1.0.0-alpha.9"
|
version = "1.0.0-alpha.9"
|
||||||
@@ -2560,6 +2839,16 @@ version = "1.1.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca"
|
checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "want"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0"
|
||||||
|
dependencies = [
|
||||||
|
"log",
|
||||||
|
"try-lock",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
version = "0.11.0+wasi-snapshot-preview1"
|
version = "0.11.0+wasi-snapshot-preview1"
|
||||||
@@ -2740,7 +3029,7 @@ dependencies = [
|
|||||||
"js-sys",
|
"js-sys",
|
||||||
"log",
|
"log",
|
||||||
"naga",
|
"naga",
|
||||||
"parking_lot 0.12.1",
|
"parking_lot 0.11.2",
|
||||||
"raw-window-handle 0.5.1",
|
"raw-window-handle 0.5.1",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"static_assertions",
|
"static_assertions",
|
||||||
@@ -2766,7 +3055,7 @@ dependencies = [
|
|||||||
"fxhash",
|
"fxhash",
|
||||||
"log",
|
"log",
|
||||||
"naga",
|
"naga",
|
||||||
"parking_lot 0.12.1",
|
"parking_lot 0.11.2",
|
||||||
"profiling",
|
"profiling",
|
||||||
"raw-window-handle 0.5.1",
|
"raw-window-handle 0.5.1",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
@@ -2802,7 +3091,7 @@ dependencies = [
|
|||||||
"metal",
|
"metal",
|
||||||
"naga",
|
"naga",
|
||||||
"objc",
|
"objc",
|
||||||
"parking_lot 0.12.1",
|
"parking_lot 0.11.2",
|
||||||
"profiling",
|
"profiling",
|
||||||
"range-alloc",
|
"range-alloc",
|
||||||
"raw-window-handle 0.5.1",
|
"raw-window-handle 0.5.1",
|
||||||
@@ -3056,6 +3345,15 @@ dependencies = [
|
|||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winreg"
|
||||||
|
version = "0.10.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
|
||||||
|
dependencies = [
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wio"
|
name = "wio"
|
||||||
version = "0.2.2"
|
version = "0.2.2"
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ edition = "2021"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
serde = { version = "1.0.156", features = ["derive"] }
|
serde = { version = "1.0.156", features = ["derive"] }
|
||||||
serde_yaml = "0.9.19"
|
serde_yaml = "0.9.19"
|
||||||
serde_json = "1"
|
serde_json = { version = "1", default-features=false, features=["alloc"] }
|
||||||
iced = "0.8.0"
|
iced = { version = "0.8.0" }
|
||||||
iced_native = "0.9.1"
|
|
||||||
handlebars = "4"
|
handlebars = "4"
|
||||||
iced_futures = { version = "0.6.0", features = ["async-std"] }
|
iced_futures = { version = "0.6.0", default-features=false, features = ["async-std"] }
|
||||||
|
reqwest = { version = "0.11", default-features=false, features = ["blocking"] }
|
||||||
|
|||||||
@@ -37,16 +37,17 @@ pub struct Device {
|
|||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
pub struct GUI {
|
pub struct GUI {
|
||||||
pub buttons: Buttons,
|
pub buttons: Buttons,
|
||||||
pub press: PreSufFix,
|
pub release_prefix: String,
|
||||||
pub release: PreSufFix,
|
pub format_keys: Option<String>,
|
||||||
pub format: Option<String>,
|
|
||||||
pub user: String,
|
pub user: String,
|
||||||
|
pub feedback: GUIFeedback,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||||
pub struct PreSufFix {
|
pub struct GUIFeedback {
|
||||||
pub prefix: String,
|
pub url_read: Option<String>,
|
||||||
pub suffix: String,
|
pub url_say: Option<String>,
|
||||||
|
pub url_send: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
@@ -59,6 +60,7 @@ pub struct Buttons {
|
|||||||
pub b: String,
|
pub b: String,
|
||||||
pub x: String,
|
pub x: String,
|
||||||
pub y: String,
|
pub y: String,
|
||||||
|
pub start: String,
|
||||||
pub l: String,
|
pub l: String,
|
||||||
pub r: String,
|
pub r: String,
|
||||||
}
|
}
|
||||||
@@ -119,25 +121,33 @@ fn build_config_std() -> Config {
|
|||||||
b: env::var("INPUT_GUI_BUTTON_B").unwrap_or(String::from("2")),
|
b: env::var("INPUT_GUI_BUTTON_B").unwrap_or(String::from("2")),
|
||||||
x: env::var("INPUT_GUI_BUTTON_X").unwrap_or(String::from("3")),
|
x: env::var("INPUT_GUI_BUTTON_X").unwrap_or(String::from("3")),
|
||||||
y: env::var("INPUT_GUI_BUTTON_Y").unwrap_or(String::from("4")),
|
y: env::var("INPUT_GUI_BUTTON_Y").unwrap_or(String::from("4")),
|
||||||
|
start: env::var("INPUT_GUI_BUTTON_START").unwrap_or(String::from("5")),
|
||||||
l: env::var("INPUT_GUI_BUTTON_L").unwrap_or(String::from("q")),
|
l: env::var("INPUT_GUI_BUTTON_L").unwrap_or(String::from("q")),
|
||||||
r: env::var("INPUT_GUI_BUTTON_R").unwrap_or(String::from("e")),
|
r: env::var("INPUT_GUI_BUTTON_R").unwrap_or(String::from("e")),
|
||||||
},
|
},
|
||||||
press: PreSufFix{
|
release_prefix: env::var("INPUT_GUI_RELEASE_PREFIX").unwrap_or(String::from("")),
|
||||||
prefix: env::var("INPUT_GUI_PRESS_PREFIX").unwrap_or(String::from("")),
|
|
||||||
suffix: env::var("INPUT_GUI_PRESS_SUFFIX").unwrap_or(String::from("")),
|
|
||||||
},
|
|
||||||
release: PreSufFix{
|
|
||||||
prefix: env::var("INPUT_GUI_RELEASE_PREFIX").unwrap_or(String::from("")),
|
|
||||||
suffix: env::var("INPUT_GUI_RELEASE_SUFFIX").unwrap_or(String::from("")),
|
|
||||||
},
|
|
||||||
user: env::var("INPUT_GUI_USER").unwrap_or(String::from("me")),
|
user: env::var("INPUT_GUI_USER").unwrap_or(String::from("me")),
|
||||||
format: match env::var("INPUT_GUI_FORMAT") {
|
format_keys: match env::var("INPUT_GUI_FORMAT") {
|
||||||
Ok(x) => Some(x),
|
Ok(x) => Some(x),
|
||||||
Err(_) => match env::var("INPUT_GUI_FORMAT_V01").unwrap_or(String::from("false")) == String::from("true") {
|
Err(_) => match env::var("INPUT_GUI_FORMAT_V01").unwrap_or(String::from("false")) == String::from("true") {
|
||||||
true => Some(String::from("{\"T\":{{ms}},\"U\":\"{{user}}\",\"Y\":\"{{pressed}}\",\"N\":\"{{released}}\"}")),
|
true => Some(String::from("{\"T\":{{ms}},\"U\":\"{{user}}\",\"Y\":\"{{pressed}}\",\"N\":\"{{released}}\"}")),
|
||||||
false => None,
|
false => None,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
feedback: GUIFeedback{
|
||||||
|
url_read: match env::var("INPUT_GUI_FEEDBACK_URL_READ") {
|
||||||
|
Ok(url) => Some(url),
|
||||||
|
Err(_) => None,
|
||||||
|
},
|
||||||
|
url_say: match env::var("INPUT_GUI_FEEDBACK_URL_SAY") {
|
||||||
|
Ok(url) => Some(url),
|
||||||
|
Err(_) => None,
|
||||||
|
},
|
||||||
|
url_send: match env::var("INPUT_GUI_FEEDBACK_URL_SEND") {
|
||||||
|
Ok(url) => Some(url),
|
||||||
|
Err(_) => None,
|
||||||
|
},
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
device: None,
|
device: None,
|
||||||
udp: Some(UDP{
|
udp: Some(UDP{
|
||||||
|
|||||||
290
src/gui.rs
290
src/gui.rs
@@ -1,15 +1,18 @@
|
|||||||
use iced::widget::{button, column, text};
|
use iced::widget::{button, column, row, text};
|
||||||
|
use iced::widget::text_input;
|
||||||
use iced::executor;
|
use iced::executor;
|
||||||
use iced::keyboard;
|
use iced::keyboard;
|
||||||
use iced::subscription;
|
use iced::subscription;
|
||||||
use iced::{Alignment, Element, Application, Settings, Subscription, Theme, Command};
|
use iced::{Alignment, Element, Application, Settings, Subscription, Theme, Command};
|
||||||
use iced_futures::backend::native::async_std::time::every;
|
use iced_futures::backend::native::async_std::time::every;
|
||||||
use handlebars::Handlebars;
|
use handlebars::Handlebars;
|
||||||
use serde_json::json;
|
use serde_json::{json, Value};
|
||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
|
use std::thread;
|
||||||
|
use reqwest;
|
||||||
|
|
||||||
use crate::stream::OutputStream;
|
use crate::stream::OutputStream;
|
||||||
use crate::config::GUI;
|
use crate::config::{GUI,GUIFeedback};
|
||||||
|
|
||||||
pub fn main(cfg: GUI, output_stream: Box<dyn OutputStream>) -> iced::Result {
|
pub fn main(cfg: GUI, output_stream: Box<dyn OutputStream>) -> iced::Result {
|
||||||
let def: iced::Settings<()> = Settings::default();
|
let def: iced::Settings<()> = Settings::default();
|
||||||
@@ -25,19 +28,28 @@ pub fn main(cfg: GUI, output_stream: Box<dyn OutputStream>) -> iced::Result {
|
|||||||
id: def.id,
|
id: def.id,
|
||||||
text_multithreading: def.text_multithreading,
|
text_multithreading: def.text_multithreading,
|
||||||
try_opengles_first: def.try_opengles_first,
|
try_opengles_first: def.try_opengles_first,
|
||||||
window: def.window,
|
window: iced::window::Settings{
|
||||||
|
size: (300, 900),
|
||||||
|
position: iced::window::Position::Specific(0, 0),
|
||||||
|
..iced::window::Settings::default()
|
||||||
|
},
|
||||||
};
|
};
|
||||||
Main::run(settings)
|
Main::run(settings)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Main {
|
struct Main {
|
||||||
ntfy: String,
|
feedback_recv_c: std::sync::mpsc::Receiver<Feedback>,
|
||||||
|
feedback_send_c: std::sync::mpsc::Sender<Feedback>,
|
||||||
|
ntfy_from_client: String,
|
||||||
|
ntfy_from_server: String,
|
||||||
configuring: Option<Message>,
|
configuring: Option<Message>,
|
||||||
inputs: Inputs,
|
inputs: Inputs,
|
||||||
keys_newly_down: Vec<iced::keyboard::KeyCode>,
|
keys_newly_down: Vec<iced::keyboard::KeyCode>,
|
||||||
keys_already_down: Vec<iced::keyboard::KeyCode>,
|
keys_already_down: Vec<iced::keyboard::KeyCode>,
|
||||||
keys_up: Vec<iced::keyboard::KeyCode>,
|
keys_up: Vec<iced::keyboard::KeyCode>,
|
||||||
flags: Flags,
|
flags: Flags,
|
||||||
|
input_text_entry_instruction: String,
|
||||||
|
input_text_entry_value: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Flags {
|
struct Flags {
|
||||||
@@ -51,6 +63,7 @@ struct Inputs {
|
|||||||
b: iced::keyboard::KeyCode,
|
b: iced::keyboard::KeyCode,
|
||||||
x: iced::keyboard::KeyCode,
|
x: iced::keyboard::KeyCode,
|
||||||
y: iced::keyboard::KeyCode,
|
y: iced::keyboard::KeyCode,
|
||||||
|
start: iced::keyboard::KeyCode,
|
||||||
l: iced::keyboard::KeyCode,
|
l: iced::keyboard::KeyCode,
|
||||||
r: iced::keyboard::KeyCode,
|
r: iced::keyboard::KeyCode,
|
||||||
}
|
}
|
||||||
@@ -64,8 +77,11 @@ struct Stick {
|
|||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
enum Message {
|
enum Message {
|
||||||
EventOccurred(iced_native::Event),
|
EventOccurred(iced::Event),
|
||||||
Tick,
|
Tick,
|
||||||
|
InputTextEntryUpdate(String),
|
||||||
|
InputTextEntrySubmitSay,
|
||||||
|
InputTextEntrySubmitSend,
|
||||||
Up,
|
Up,
|
||||||
Down,
|
Down,
|
||||||
Left,
|
Left,
|
||||||
@@ -74,10 +90,18 @@ enum Message {
|
|||||||
B,
|
B,
|
||||||
X,
|
X,
|
||||||
Y,
|
Y,
|
||||||
|
Start,
|
||||||
L,
|
L,
|
||||||
R,
|
R,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
enum Feedback {
|
||||||
|
Heard(String),
|
||||||
|
Say(String),
|
||||||
|
Send(String),
|
||||||
|
}
|
||||||
|
|
||||||
fn controller_button_to_string(btn: Message, cur: iced::keyboard::KeyCode) -> String {
|
fn controller_button_to_string(btn: Message, cur: iced::keyboard::KeyCode) -> String {
|
||||||
return format!("{:?} => {:?}", cur, btn);
|
return format!("{:?} => {:?}", cur, btn);
|
||||||
}
|
}
|
||||||
@@ -93,26 +117,53 @@ impl Main {
|
|||||||
_ if key_code == &self.inputs.b => Some(&self.flags.cfg.buttons.b),
|
_ if key_code == &self.inputs.b => Some(&self.flags.cfg.buttons.b),
|
||||||
_ if key_code == &self.inputs.x => Some(&self.flags.cfg.buttons.x),
|
_ if key_code == &self.inputs.x => Some(&self.flags.cfg.buttons.x),
|
||||||
_ if key_code == &self.inputs.y => Some(&self.flags.cfg.buttons.y),
|
_ if key_code == &self.inputs.y => Some(&self.flags.cfg.buttons.y),
|
||||||
|
_ if key_code == &self.inputs.start => Some(&self.flags.cfg.buttons.start),
|
||||||
_ if key_code == &self.inputs.l => Some(&self.flags.cfg.buttons.l),
|
_ if key_code == &self.inputs.l => Some(&self.flags.cfg.buttons.l),
|
||||||
_ if key_code == &self.inputs.r => Some(&self.flags.cfg.buttons.r),
|
_ if key_code == &self.inputs.r => Some(&self.flags.cfg.buttons.r),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn send_from_client(&mut self, text: Feedback) {
|
||||||
|
match text.clone() {
|
||||||
|
Feedback::Say(s) | Feedback::Send(s) if s.len() > 0 && s.len() < 1000 => {},
|
||||||
|
_ => return,
|
||||||
|
};
|
||||||
|
match self.feedback_send_c.send(text) {
|
||||||
|
Ok(_) => {},
|
||||||
|
Err(err) => eprintln!("main.send_say() failed to enqueue: {}", err),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
fn exchange(&mut self) {
|
fn exchange(&mut self) {
|
||||||
|
self.exchange_send();
|
||||||
|
self.exchange_recv();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn exchange_recv(&mut self) {
|
||||||
|
loop {
|
||||||
|
match self.feedback_recv_c.try_recv() {
|
||||||
|
Ok(msg) => {
|
||||||
|
match msg {
|
||||||
|
Feedback::Heard(msg) => {
|
||||||
|
self.ntfy_from_server = msg;
|
||||||
|
},
|
||||||
|
_ => break,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
_ => break,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn exchange_send(&mut self) {
|
||||||
let mut s = vec![];
|
let mut s = vec![];
|
||||||
for key_code in self.keys_newly_down.iter() {
|
for key_code in self.keys_newly_down.iter() {
|
||||||
match self.key_code_to_string(key_code) {
|
match self.key_code_to_string(key_code) {
|
||||||
Some(x) => {
|
Some(x) => {
|
||||||
for c in self.flags.cfg.press.prefix.chars() {
|
|
||||||
s.push(c);
|
|
||||||
}
|
|
||||||
for c in x.chars() {
|
for c in x.chars() {
|
||||||
s.push(c);
|
s.push(c);
|
||||||
}
|
}
|
||||||
for c in self.flags.cfg.press.suffix.chars() {
|
|
||||||
s.push(c);
|
|
||||||
}
|
|
||||||
self.keys_already_down.push(*key_code);
|
self.keys_already_down.push(*key_code);
|
||||||
},
|
},
|
||||||
None => {},
|
None => {},
|
||||||
@@ -124,34 +175,34 @@ impl Main {
|
|||||||
match self.key_code_to_string(key_code) {
|
match self.key_code_to_string(key_code) {
|
||||||
Some(x) => {
|
Some(x) => {
|
||||||
for c in x.chars() {
|
for c in x.chars() {
|
||||||
for c in self.flags.cfg.release.prefix.chars() {
|
for c in self.flags.cfg.release_prefix.chars() {
|
||||||
t.push(c);
|
t.push(c);
|
||||||
}
|
}
|
||||||
t.push(c);
|
t.push(c);
|
||||||
for c in self.flags.cfg.release.suffix.chars() {
|
|
||||||
t.push(c);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
None => {},
|
None => {},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if t.len() + s.len() > 0 {
|
if t.len() + s.len() > 0 {
|
||||||
self.flags.output_stream.put(self.sprintf(s, t));
|
self.flags.output_stream.put(self.sprintf_pressed_released(s, t));
|
||||||
}
|
}
|
||||||
self.keys_up.clear();
|
self.keys_up.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sprintf(&self, pressed: Vec<char>, released: Vec<char>) -> Vec<char> {
|
fn sprintf(&self, format: &String, content: &Value) -> Vec<char> {
|
||||||
match self.flags.cfg.format.clone() {
|
return Handlebars::new().render_template(format, content).unwrap().chars().collect();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn sprintf_pressed_released(&self, pressed: Vec<char>, released: Vec<char>) -> Vec<char> {
|
||||||
|
match self.flags.cfg.format_keys.clone() {
|
||||||
Some(x) => {
|
Some(x) => {
|
||||||
let reg = Handlebars::new();
|
return self.sprintf(&x, &json!({
|
||||||
return reg.render_template(&x, &json!({
|
|
||||||
"pressed": pressed.iter().collect::<String>(),
|
"pressed": pressed.iter().collect::<String>(),
|
||||||
"released": released.iter().collect::<String>(),
|
"released": released.iter().collect::<String>(),
|
||||||
"ms": SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(),
|
"ms": SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(),
|
||||||
"user": self.flags.cfg.user,
|
"user": self.flags.cfg.user,
|
||||||
})).unwrap().chars().collect();
|
}));
|
||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
let mut combo = vec![];
|
let mut combo = vec![];
|
||||||
@@ -170,8 +221,21 @@ impl Application for Main {
|
|||||||
type Executor = executor::Default;
|
type Executor = executor::Default;
|
||||||
|
|
||||||
fn new(flags: Self::Flags) -> (Self, Command<Message>) {
|
fn new(flags: Self::Flags) -> (Self, Command<Message>) {
|
||||||
|
let (sender1, receiver1) = std::sync::mpsc::channel();
|
||||||
|
let (sender2, receiver2) = std::sync::mpsc::channel();
|
||||||
|
let feedback_cfg = flags.cfg.feedback.clone();
|
||||||
|
thread::spawn(move || {
|
||||||
|
Feedbacker{
|
||||||
|
send_c: sender1,
|
||||||
|
recv_c: receiver2,
|
||||||
|
cfg: feedback_cfg,
|
||||||
|
}.listen()
|
||||||
|
});
|
||||||
return (Self {
|
return (Self {
|
||||||
ntfy: String::from(":wave:"),
|
feedback_send_c: sender2,
|
||||||
|
feedback_recv_c: receiver1,
|
||||||
|
ntfy_from_client: String::from(" "),
|
||||||
|
ntfy_from_server: String::from(" "),
|
||||||
configuring: None,
|
configuring: None,
|
||||||
inputs: Inputs{
|
inputs: Inputs{
|
||||||
stick: Stick {
|
stick: Stick {
|
||||||
@@ -184,6 +248,7 @@ impl Application for Main {
|
|||||||
b: iced::keyboard::KeyCode::Key2,
|
b: iced::keyboard::KeyCode::Key2,
|
||||||
x: iced::keyboard::KeyCode::Key3,
|
x: iced::keyboard::KeyCode::Key3,
|
||||||
y: iced::keyboard::KeyCode::Key4,
|
y: iced::keyboard::KeyCode::Key4,
|
||||||
|
start: iced::keyboard::KeyCode::Key5,
|
||||||
l: iced::keyboard::KeyCode::Q,
|
l: iced::keyboard::KeyCode::Q,
|
||||||
r: iced::keyboard::KeyCode::E,
|
r: iced::keyboard::KeyCode::E,
|
||||||
},
|
},
|
||||||
@@ -191,6 +256,8 @@ impl Application for Main {
|
|||||||
keys_newly_down: vec![],
|
keys_newly_down: vec![],
|
||||||
keys_already_down: vec![],
|
keys_already_down: vec![],
|
||||||
keys_up: vec![],
|
keys_up: vec![],
|
||||||
|
input_text_entry_instruction: String::from(""),
|
||||||
|
input_text_entry_value: String::from(""),
|
||||||
}, Command::none())
|
}, Command::none())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,6 +270,17 @@ impl Application for Main {
|
|||||||
Message::Tick => {
|
Message::Tick => {
|
||||||
self.exchange();
|
self.exchange();
|
||||||
},
|
},
|
||||||
|
Message::InputTextEntryUpdate(payload) => {
|
||||||
|
self.input_text_entry_value = payload;
|
||||||
|
},
|
||||||
|
Message::InputTextEntrySubmitSend => {
|
||||||
|
self.send_from_client(Feedback::Send(self.input_text_entry_value.clone()));
|
||||||
|
self.input_text_entry_value = String::from("");
|
||||||
|
},
|
||||||
|
Message::InputTextEntrySubmitSay => {
|
||||||
|
self.send_from_client(Feedback::Say(self.input_text_entry_value.clone()));
|
||||||
|
self.input_text_entry_value = String::from("");
|
||||||
|
},
|
||||||
Message::EventOccurred(event) if self.configuring.is_some() => {
|
Message::EventOccurred(event) if self.configuring.is_some() => {
|
||||||
match event {
|
match event {
|
||||||
iced::event::Event::Keyboard(keyboard::Event::KeyPressed{
|
iced::event::Event::Keyboard(keyboard::Event::KeyPressed{
|
||||||
@@ -219,15 +297,16 @@ impl Application for Main {
|
|||||||
Message::B => { self.inputs.b = key_code },
|
Message::B => { self.inputs.b = key_code },
|
||||||
Message::X => { self.inputs.x = key_code },
|
Message::X => { self.inputs.x = key_code },
|
||||||
Message::Y => { self.inputs.y = key_code },
|
Message::Y => { self.inputs.y = key_code },
|
||||||
|
Message::Start => { self.inputs.start = key_code },
|
||||||
Message::L => { self.inputs.l = key_code },
|
Message::L => { self.inputs.l = key_code },
|
||||||
Message::R => { self.inputs.r = key_code },
|
Message::R => { self.inputs.r = key_code },
|
||||||
_ => {},
|
_ => {},
|
||||||
};
|
};
|
||||||
self.ntfy = format!("{:?} => {:?}", key_code.clone(), self.configuring.as_ref().unwrap());
|
self.ntfy_from_client = format!("{:?} => {:?}", key_code.clone(), self.configuring.as_ref().unwrap());
|
||||||
self.configuring = None;
|
self.configuring = None;
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
Message::EventOccurred(event) => {
|
Message::EventOccurred(event) => {
|
||||||
match event {
|
match event {
|
||||||
@@ -243,6 +322,7 @@ impl Application for Main {
|
|||||||
self.keys_newly_down.dedup();
|
self.keys_newly_down.dedup();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
self.exchange();
|
||||||
},
|
},
|
||||||
iced::event::Event::Keyboard(keyboard::Event::KeyReleased{
|
iced::event::Event::Keyboard(keyboard::Event::KeyReleased{
|
||||||
key_code,
|
key_code,
|
||||||
@@ -262,13 +342,14 @@ impl Application for Main {
|
|||||||
},
|
},
|
||||||
None => {},
|
None => {},
|
||||||
};
|
};
|
||||||
|
self.exchange();
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
self.configuring = Some(msg.clone());
|
self.configuring = Some(msg.clone());
|
||||||
self.ntfy = format!("push a key to bind to {:?}", msg.clone());
|
self.ntfy_from_client = format!("push a key to bind to {:?}", msg.clone());
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return Command::none();
|
return Command::none();
|
||||||
@@ -276,30 +357,149 @@ impl Application for Main {
|
|||||||
|
|
||||||
fn subscription(&self) -> Subscription<Message> {
|
fn subscription(&self) -> Subscription<Message> {
|
||||||
return subscription::Subscription::batch(vec![
|
return subscription::Subscription::batch(vec![
|
||||||
subscription::events_with(|event, _| match event {
|
subscription::events_with(|event, status| match status {
|
||||||
iced::Event::Keyboard(_) => Some(Message::EventOccurred(event)),
|
iced::event::Status::Ignored => match event {
|
||||||
|
iced::Event::Keyboard(_) => Some(Message::EventOccurred(event)),
|
||||||
|
_ => None,
|
||||||
|
},
|
||||||
_ => None,
|
_ => None,
|
||||||
}),
|
}),
|
||||||
every(std::time::Duration::from_millis(5)).map(|_| Message::Tick),
|
every(std::time::Duration::from_millis(2000)).map(|_| Message::Tick),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self) -> Element<Message> {
|
fn view(&self) -> Element<Message> {
|
||||||
|
let new_cfg_button = |msg: Message, s| button(text(controller_button_to_string(msg.clone(), s))).on_press(msg.clone());
|
||||||
return column![
|
return column![
|
||||||
button(text(controller_button_to_string(Message::Up, self.inputs.stick.up))).on_press(Message::Up),
|
text(String::from("= MAYHEM PARTY =")).size(32),
|
||||||
button(text(controller_button_to_string(Message::Down, self.inputs.stick.down))).on_press(Message::Down),
|
column![
|
||||||
button(text(controller_button_to_string(Message::Left, self.inputs.stick.left))).on_press(Message::Left),
|
column![
|
||||||
button(text(controller_button_to_string(Message::Right, self.inputs.stick.right))).on_press(Message::Right),
|
text(String::from("Button Mapping")).size(24),
|
||||||
button(text(controller_button_to_string(Message::A, self.inputs.a))).on_press(Message::A),
|
text(String::from("--------------")).size(24),
|
||||||
button(text(controller_button_to_string(Message::B, self.inputs.b))).on_press(Message::B),
|
row![
|
||||||
button(text(controller_button_to_string(Message::X, self.inputs.x))).on_press(Message::X),
|
column![
|
||||||
button(text(controller_button_to_string(Message::Y, self.inputs.y))).on_press(Message::Y),
|
new_cfg_button(Message::Up, self.inputs.stick.up),
|
||||||
button(text(controller_button_to_string(Message::L, self.inputs.l))).on_press(Message::L),
|
new_cfg_button(Message::Down, self.inputs.stick.down),
|
||||||
button(text(controller_button_to_string(Message::R, self.inputs.r))).on_press(Message::R),
|
new_cfg_button(Message::Left, self.inputs.stick.left),
|
||||||
text(self.ntfy.clone()).size(50),
|
new_cfg_button(Message::Right, self.inputs.stick.right),
|
||||||
]
|
new_cfg_button(Message::Start, self.inputs.start),
|
||||||
.padding(20)
|
].padding(5).align_items(Alignment::Center),
|
||||||
.align_items(Alignment::Center)
|
column![
|
||||||
.into();
|
new_cfg_button(Message::A, self.inputs.a),
|
||||||
|
new_cfg_button(Message::B, self.inputs.b),
|
||||||
|
new_cfg_button(Message::X, self.inputs.x),
|
||||||
|
new_cfg_button(Message::Y, self.inputs.y),
|
||||||
|
new_cfg_button(Message::L, self.inputs.l),
|
||||||
|
new_cfg_button(Message::R, self.inputs.r),
|
||||||
|
].padding(5).align_items(Alignment::Center),
|
||||||
|
].padding(5).align_items(Alignment::Center),
|
||||||
|
text(String::from("--------------")).size(24),
|
||||||
|
text(self.ntfy_from_client.clone()).size(18),
|
||||||
|
].padding(20).align_items(Alignment::Center),
|
||||||
|
column![
|
||||||
|
text_input(
|
||||||
|
&self.input_text_entry_instruction,
|
||||||
|
&self.input_text_entry_value,
|
||||||
|
Message::InputTextEntryUpdate
|
||||||
|
),
|
||||||
|
row![
|
||||||
|
button(text("Say")).on_press(Message::InputTextEntrySubmitSay).padding(20),
|
||||||
|
button(text("Send")).on_press(Message::InputTextEntrySubmitSend).padding(20),
|
||||||
|
].padding(20).align_items(Alignment::Center),
|
||||||
|
text(self.ntfy_from_server.clone().trim()).size(18),
|
||||||
|
].padding(20).align_items(Alignment::Center),
|
||||||
|
].padding(0).align_items(Alignment::Center),
|
||||||
|
].padding(0).align_items(Alignment::Center).into();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct Feedbacker {
|
||||||
|
send_c: std::sync::mpsc::Sender<Feedback>,
|
||||||
|
recv_c: std::sync::mpsc::Receiver<Feedback>,
|
||||||
|
cfg: GUIFeedback,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Feedbacker {
|
||||||
|
fn listen(&mut self) {
|
||||||
|
loop {
|
||||||
|
std::thread::sleep(std::time::Duration::from_secs(2));
|
||||||
|
match self.read_from_server() {
|
||||||
|
Some(msg) if msg.len() > 0 => {
|
||||||
|
self.write_from_server(msg.clone());
|
||||||
|
},
|
||||||
|
_ => {},
|
||||||
|
};
|
||||||
|
match self.read_from_client() {
|
||||||
|
Some(msg) => self.write_from_client(msg.clone()),
|
||||||
|
_ => {},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn read_from_server(&mut self) -> Option<String> {
|
||||||
|
return match &self.cfg.url_read {
|
||||||
|
Some(url) => {
|
||||||
|
match reqwest::blocking::get(url) {
|
||||||
|
Ok(resp) => match resp.text() {
|
||||||
|
Ok(text) => Some(text),
|
||||||
|
_ => None,
|
||||||
|
},
|
||||||
|
Err(err) => {
|
||||||
|
eprintln!("feedback.read: cannot fetch: {}", err);
|
||||||
|
None
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_ => None,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write_from_server(&mut self, msg: String) {
|
||||||
|
match self.send_c.send(Feedback::Heard(msg.clone())) {
|
||||||
|
Ok(_) => {},
|
||||||
|
Err(err) => eprintln!("feedback.listen() failed to display {}: {}", msg, err),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
fn read_from_client(&mut self) -> Option<Feedback> {
|
||||||
|
let mut last: Option<Feedback> = None;
|
||||||
|
loop {
|
||||||
|
match self.recv_c.try_recv() {
|
||||||
|
Ok(msg) => {
|
||||||
|
last = Some(msg);
|
||||||
|
},
|
||||||
|
_ => break,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return last;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write_from_client(&mut self, msg: Feedback) {
|
||||||
|
match msg {
|
||||||
|
Feedback::Send(send) if send.len() > 0 => match &self.cfg.url_send {
|
||||||
|
Some(url) => {
|
||||||
|
match reqwest::blocking::get(format!("{}{}", url, send)) {
|
||||||
|
Err(err) => {
|
||||||
|
eprintln!("feedback.write_from_client: cannot send: {}", err);
|
||||||
|
},
|
||||||
|
_ => {},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
_ => {},
|
||||||
|
},
|
||||||
|
Feedback::Say(say) if say.len() > 0 => match &self.cfg.url_say {
|
||||||
|
Some(url) => {
|
||||||
|
match reqwest::blocking::get(format!("{}{}", url, say)) {
|
||||||
|
Err(err) => {
|
||||||
|
eprintln!("feedback.write_from_client: cannot say: {}", err);
|
||||||
|
},
|
||||||
|
_ => {},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
_ => {},
|
||||||
|
},
|
||||||
|
_ => {},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
23
src/testdata/http.go
vendored
Normal file
23
src/testdata/http.go
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
p := os.Getenv("PORT")
|
||||||
|
if err := http.ListenAndServe(":"+p, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
b, _ := io.ReadAll(r.Body)
|
||||||
|
log.Printf("> %s (%+v) %s", r.URL, r.Header, b)
|
||||||
|
body := os.Getenv("BODY")
|
||||||
|
if body == "-" {
|
||||||
|
body = string(b)
|
||||||
|
}
|
||||||
|
w.Write([]byte(body))
|
||||||
|
})); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user