Compare commits

...

27 Commits

Author SHA1 Message Date
Bel LaPointe 31bdb6d92e status every 2s 2023-04-02 11:34:25 -06:00
Bel LaPointe 83f4ee0e51 trim for multiline text i guess 2023-04-02 11:30:22 -06:00
Bel LaPointe ed1d2b5835 condense configs 2023-04-02 11:03:24 -06:00
bel 324a7b07b0 add start button 2023-04-02 09:45:30 -06:00
bel 37566c4413 IT WORKS ON WINDOWS WITH SIGN 2023-03-28 20:17:58 -06:00
Bel LaPointe 787201c3a8 drop some dependencies 2023-03-28 06:35:26 -06:00
bel 6f8a76cb13 dedicated url for say vs send 2023-03-27 20:17:53 -06:00
bel 0f4c567405 maybe 2023-03-27 20:13:05 -06:00
bel d9300d80ff learning that enums are cool and basically the interfaces i wanted 2023-03-27 19:49:11 -06:00
Bel LaPointe 72ae3121d4 TODO send for voting 2023-03-27 17:54:11 -06:00
Bel LaPointe 75149668ef GUI can now send to say as concat string 2023-03-27 17:53:56 -06:00
Bel LaPointe 7e4b7b2080 say and vote wip 2023-03-27 17:31:25 -06:00
Bel LaPointe 28d2a7cca9 drop unused press prefix+suffix and release suffix 2023-03-27 16:00:40 -06:00
Bel LaPointe 9a477c48cc set default window size and position to get outta da way 2023-03-27 15:57:01 -06:00
Bel LaPointe 5598f39315 GOT IT only subscribe to ignored events to capture textinput free keypresses 2023-03-27 15:45:24 -06:00
Bel LaPointe ff2c41cf69 columnify, rowify a lil 2023-03-27 15:13:08 -06:00
Bel LaPointe 21d8cfb185 move comment 2023-03-27 14:57:40 -06:00
Bel LaPointe 173bf045d9 can type into a box while still receiving buttons 2023-03-27 14:56:59 -06:00
bel 25e99fbf93 more debug with http.go 2023-03-25 22:18:24 -06:00
bel 6bbb9861ef log when feedback.read fails 2023-03-25 14:40:22 -06:00
bel 645285019e gui flushes all messages received from server at once, both dedupes and doesnt fill q 2023-03-25 11:27:02 -06:00
bel 49133b5f7a manual test w mayhem-party v0.1.2 ok 2023-03-25 11:02:03 -06:00
bel 26b415667a exchange on every key press and rare tick to save CPU churn 2023-03-25 10:08:11 -06:00
bel b1cb419f3d gui prints output from an http get to a configured URL 2023-03-25 09:59:39 -06:00
bel 8182f90783 background thread sends ts as mvp 2023-03-25 09:38:05 -06:00
bel 14df9125ef drop unimplemented streams and dependencies for build time 2023-03-24 23:55:30 -06:00
bel 451a1c43a3 user in gui template 2023-03-24 23:55:15 -06:00
6 changed files with 579 additions and 383 deletions

512
Cargo.lock generated
View File

@ -18,15 +18,6 @@ version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046"
[[package]]
name = "addr2line"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97"
dependencies = [
"gimli",
]
[[package]]
name = "adler"
version = "1.0.2"
@ -222,19 +213,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "backtrace"
version = "0.3.67"
name = "base64"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca"
dependencies = [
"addr2line",
"cc",
"cfg-if",
"libc",
"miniz_oxide",
"object",
"rustc-demangle",
]
checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a"
[[package]]
name = "bit-set"
@ -318,6 +300,12 @@ version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "bytes"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be"
[[package]]
name = "calloop"
version = "0.10.5"
@ -747,6 +735,15 @@ dependencies = [
"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]]
name = "errno"
version = "0.3.0"
@ -803,28 +800,6 @@ dependencies = [
"pkg-config",
]
[[package]]
name = "failure"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86"
dependencies = [
"backtrace",
"failure_derive",
]
[[package]]
name = "failure_derive"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
"synstructure",
]
[[package]]
name = "fastrand"
version = "1.9.0"
@ -901,6 +876,15 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
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]]
name = "freetype-rs"
version = "0.26.0"
@ -1068,45 +1052,6 @@ dependencies = [
"wasi",
]
[[package]]
name = "gilrs"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d0342acdc7b591d171212e17c9350ca02383b86d5f9af33c6e3598e03a6c57e"
dependencies = [
"fnv",
"gilrs-core",
"log",
"uuid",
"vec_map",
]
[[package]]
name = "gilrs-core"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6789d356476c3280a4e15365d23f62b4b4f1bcdac81fdd552f65807bce4666dd"
dependencies = [
"core-foundation",
"io-kit-sys",
"js-sys",
"libc",
"libudev-sys",
"log",
"nix 0.25.1",
"uuid",
"vec_map",
"wasm-bindgen",
"web-sys",
"windows",
]
[[package]]
name = "gimli"
version = "0.27.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4"
[[package]]
name = "glam"
version = "0.21.3"
@ -1224,6 +1169,25 @@ dependencies = [
"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]]
name = "handlebars"
version = "4.3.6"
@ -1269,16 +1233,61 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
[[package]]
name = "hidapi"
version = "0.5.2"
name = "http"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25440089a47b7c63b7a3515d1cdfcd0ac3d649fdc360540944e05c4e7899b4fe"
checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482"
dependencies = [
"cc",
"failure",
"failure_derive",
"libc",
"pkg-config",
"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]]
@ -1405,6 +1414,16 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
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]]
name = "indexmap"
version = "1.9.2"
@ -1427,16 +1446,6 @@ dependencies = [
"web-sys",
]
[[package]]
name = "io-kit-sys"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7789f7f3c9686f96164f5109d69152de759e76e284f736bd57661c6df5091919"
dependencies = [
"core-foundation-sys",
"mach",
]
[[package]]
name = "io-lifetimes"
version = "1.0.9"
@ -1448,6 +1457,12 @@ dependencies = [
"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]]
name = "itoa"
version = "1.0.6"
@ -1511,40 +1526,6 @@ dependencies = [
"winapi",
]
[[package]]
name = "libudev-sys"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c8469b4a23b962c1396b9b451dda50ef5b283e8dd309d69033475fa9b334324"
dependencies = [
"libc",
"pkg-config",
]
[[package]]
name = "libusb1-sys"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9d0e2afce4245f2c9a418511e5af8718bcaf2fa408aefb259504d1a9cb25f27"
dependencies = [
"cc",
"libc",
"pkg-config",
"vcpkg",
]
[[package]]
name = "libz-sys"
version = "1.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf"
dependencies = [
"cc",
"libc",
"pkg-config",
"vcpkg",
]
[[package]]
name = "linked-hash-map"
version = "0.5.6"
@ -1577,15 +1558,6 @@ dependencies = [
"value-bag",
]
[[package]]
name = "mach"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa"
dependencies = [
"libc",
]
[[package]]
name = "malloc_buf"
version = "0.0.6"
@ -1642,6 +1614,12 @@ dependencies = [
"objc",
]
[[package]]
name = "mime"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
[[package]]
name = "minimal-lexical"
version = "0.2.1"
@ -1874,15 +1852,6 @@ dependencies = [
"objc",
]
[[package]]
name = "object"
version = "0.30.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439"
dependencies = [
"memchr",
]
[[package]]
name = "once_cell"
version = "1.17.1"
@ -2246,36 +2215,6 @@ dependencies = [
"num_cpus",
]
[[package]]
name = "rdkafka"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd7c5d6d17442bcb9f943aae96d67d98c6d36af60442dd5da62aaa7fcbb25c48"
dependencies = [
"futures-channel",
"futures-util",
"libc",
"log",
"rdkafka-sys",
"serde",
"serde_derive",
"serde_json",
"slab",
"tokio",
]
[[package]]
name = "rdkafka-sys"
version = "4.3.0+1.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d222a401698c7f2010e3967353eae566d9934dcda49c29910da922414ab4e3f4"
dependencies = [
"libc",
"libz-sys",
"num_enum",
"pkg-config",
]
[[package]]
name = "redox_syscall"
version = "0.2.16"
@ -2292,21 +2231,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1382d1f0a252c4bf97dc20d979a2fdd05b024acd7c2ed0f7595d7817666a157"
[[package]]
name = "rusb"
version = "0.9.1"
name = "reqwest"
version = "0.11.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "703aa035c21c589b34fb5136b12e68fc8dcf7ea46486861381361dd8ebf5cee0"
checksum = "0ba30cc2c0cd02af1222ed216ba659cdb2f879dfe3181852fe7c50b1d0005949"
dependencies = [
"libc",
"libusb1-sys",
"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]]
name = "rustc-demangle"
version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
[[package]]
name = "rustc-hash"
version = "1.1.0"
@ -2331,14 +2288,10 @@ dependencies = [
name = "rusty-pipe"
version = "0.1.0"
dependencies = [
"gilrs",
"handlebars",
"hidapi",
"iced",
"iced_futures",
"iced_native",
"rdkafka",
"rusb",
"reqwest",
"serde",
"serde_json",
"serde_yaml",
@ -2414,6 +2367,18 @@ dependencies = [
"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]]
name = "serde_yaml"
version = "0.9.19"
@ -2603,18 +2568,6 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "synstructure"
version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
"unicode-xid",
]
[[package]]
name = "termcolor"
version = "1.2.0"
@ -2669,6 +2622,21 @@ dependencies = [
"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"
@ -2676,10 +2644,30 @@ 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]]
name = "toml"
version = "0.5.11"
@ -2706,6 +2694,38 @@ dependencies = [
"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]]
name = "ttf-parser"
version = "0.18.1"
@ -2735,12 +2755,27 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81"
[[package]]
name = "unicode-bidi"
version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
[[package]]
name = "unicode-ident"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
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]]
name = "unicode-segmentation"
version = "1.10.1"
@ -2766,10 +2801,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad2024452afd3874bf539695e04af6732ba06517424dbf958fdb16a01f3bef6c"
[[package]]
name = "uuid"
version = "1.3.0"
name = "url"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1674845326ee10d37ca60470760d4288a6f80f304007d92e5c53bab78c9cfd79"
checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643"
dependencies = [
"form_urlencoded",
"idna",
"percent-encoding",
]
[[package]]
name = "value-bag"
@ -2781,12 +2821,6 @@ dependencies = [
"version_check",
]
[[package]]
name = "vcpkg"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "vec_map"
version = "0.8.2"
@ -2805,6 +2839,16 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
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]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
@ -2985,7 +3029,7 @@ dependencies = [
"js-sys",
"log",
"naga",
"parking_lot 0.12.1",
"parking_lot 0.11.2",
"raw-window-handle 0.5.1",
"smallvec",
"static_assertions",
@ -3011,7 +3055,7 @@ dependencies = [
"fxhash",
"log",
"naga",
"parking_lot 0.12.1",
"parking_lot 0.11.2",
"profiling",
"raw-window-handle 0.5.1",
"smallvec",
@ -3047,7 +3091,7 @@ dependencies = [
"metal",
"naga",
"objc",
"parking_lot 0.12.1",
"parking_lot 0.11.2",
"profiling",
"range-alloc",
"raw-window-handle 0.5.1",
@ -3135,21 +3179,6 @@ dependencies = [
"thiserror",
]
[[package]]
name = "windows"
version = "0.43.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04662ed0e3e5630dfa9b26e4cb823b817f1a9addda855d973a9458c236556244"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc 0.42.2",
"windows_i686_gnu 0.42.2",
"windows_i686_msvc 0.42.2",
"windows_x86_64_gnu 0.42.2",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc 0.42.2",
]
[[package]]
name = "windows-sys"
version = "0.36.1"
@ -3316,6 +3345,15 @@ dependencies = [
"memchr",
]
[[package]]
name = "winreg"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
dependencies = [
"winapi",
]
[[package]]
name = "wio"
version = "0.2.2"

View File

@ -8,12 +8,8 @@ edition = "2021"
[dependencies]
serde = { version = "1.0.156", features = ["derive"] }
serde_yaml = "0.9.19"
serde_json = "1"
rdkafka = "0.29.0"
rusb = "0.9.1"
hidapi = "0.5.0"
gilrs = "0.10.1"
iced = "0.8.0"
iced_native = "0.9.1"
serde_json = { version = "1", default-features=false, features=["alloc"] }
iced = { version = "0.8.0" }
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"] }

View File

@ -37,15 +37,17 @@ pub struct Device {
#[derive(Serialize, Deserialize, Debug)]
pub struct GUI {
pub buttons: Buttons,
pub press: PreSufFix,
pub release: PreSufFix,
pub format: Option<String>,
pub release_prefix: String,
pub format_keys: Option<String>,
pub user: String,
pub feedback: GUIFeedback,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct PreSufFix {
pub prefix: String,
pub suffix: String,
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct GUIFeedback {
pub url_read: Option<String>,
pub url_say: Option<String>,
pub url_send: Option<String>,
}
#[derive(Serialize, Deserialize, Debug)]
@ -58,6 +60,7 @@ pub struct Buttons {
pub b: String,
pub x: String,
pub y: String,
pub start: String,
pub l: String,
pub r: String,
}
@ -118,24 +121,33 @@ fn build_config_std() -> Config {
b: env::var("INPUT_GUI_BUTTON_B").unwrap_or(String::from("2")),
x: env::var("INPUT_GUI_BUTTON_X").unwrap_or(String::from("3")),
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")),
r: env::var("INPUT_GUI_BUTTON_R").unwrap_or(String::from("e")),
},
press: PreSufFix{
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("")),
},
format: match env::var("INPUT_GUI_FORMAT") {
release_prefix: env::var("INPUT_GUI_RELEASE_PREFIX").unwrap_or(String::from("")),
user: env::var("INPUT_GUI_USER").unwrap_or(String::from("me")),
format_keys: match env::var("INPUT_GUI_FORMAT") {
Ok(x) => Some(x),
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}}\"}")),
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,
udp: Some(UDP{

View File

@ -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::keyboard;
use iced::subscription;
use iced::{Alignment, Element, Application, Settings, Subscription, Theme, Command};
use iced_futures::backend::native::async_std::time::every;
use handlebars::Handlebars;
use serde_json::json;
use serde_json::{json, Value};
use std::time::{SystemTime, UNIX_EPOCH};
use std::thread;
use reqwest;
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 {
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,
text_multithreading: def.text_multithreading,
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)
}
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>,
inputs: Inputs,
keys_newly_down: Vec<iced::keyboard::KeyCode>,
keys_already_down: Vec<iced::keyboard::KeyCode>,
keys_up: Vec<iced::keyboard::KeyCode>,
flags: Flags,
input_text_entry_instruction: String,
input_text_entry_value: String,
}
struct Flags {
@ -51,6 +63,7 @@ struct Inputs {
b: iced::keyboard::KeyCode,
x: iced::keyboard::KeyCode,
y: iced::keyboard::KeyCode,
start: iced::keyboard::KeyCode,
l: iced::keyboard::KeyCode,
r: iced::keyboard::KeyCode,
}
@ -64,8 +77,11 @@ struct Stick {
#[derive(Debug, Clone)]
enum Message {
EventOccurred(iced_native::Event),
EventOccurred(iced::Event),
Tick,
InputTextEntryUpdate(String),
InputTextEntrySubmitSay,
InputTextEntrySubmitSend,
Up,
Down,
Left,
@ -74,10 +90,18 @@ enum Message {
B,
X,
Y,
Start,
L,
R,
}
#[derive(Debug, Clone)]
enum Feedback {
Heard(String),
Say(String),
Send(String),
}
fn controller_button_to_string(btn: Message, cur: iced::keyboard::KeyCode) -> String {
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.x => Some(&self.flags.cfg.buttons.x),
_ 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.r => Some(&self.flags.cfg.buttons.r),
_ => 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) {
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![];
for key_code in self.keys_newly_down.iter() {
match self.key_code_to_string(key_code) {
Some(x) => {
for c in self.flags.cfg.press.prefix.chars() {
s.push(c);
}
for c in x.chars() {
s.push(c);
}
for c in self.flags.cfg.press.suffix.chars() {
s.push(c);
}
self.keys_already_down.push(*key_code);
},
None => {},
@ -124,34 +175,34 @@ impl Main {
match self.key_code_to_string(key_code) {
Some(x) => {
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);
for c in self.flags.cfg.release.suffix.chars() {
t.push(c);
}
}
},
None => {},
};
}
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();
}
fn sprintf(&self, pressed: Vec<char>, released: Vec<char>) -> Vec<char> {
match self.flags.cfg.format.clone() {
fn sprintf(&self, format: &String, content: &Value) -> Vec<char> {
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) => {
let reg = Handlebars::new();
return reg.render_template(&x, &json!({
return self.sprintf(&x, &json!({
"pressed": pressed.iter().collect::<String>(),
"released": released.iter().collect::<String>(),
"ms": SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(),
"user": String::from(""),
})).unwrap().chars().collect();
"user": self.flags.cfg.user,
}));
},
None => {
let mut combo = vec![];
@ -170,8 +221,21 @@ impl Application for Main {
type Executor = executor::Default;
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 {
ntfy: String::from(":wave:"),
feedback_send_c: sender2,
feedback_recv_c: receiver1,
ntfy_from_client: String::from(" "),
ntfy_from_server: String::from(" "),
configuring: None,
inputs: Inputs{
stick: Stick {
@ -184,6 +248,7 @@ impl Application for Main {
b: iced::keyboard::KeyCode::Key2,
x: iced::keyboard::KeyCode::Key3,
y: iced::keyboard::KeyCode::Key4,
start: iced::keyboard::KeyCode::Key5,
l: iced::keyboard::KeyCode::Q,
r: iced::keyboard::KeyCode::E,
},
@ -191,6 +256,8 @@ impl Application for Main {
keys_newly_down: vec![],
keys_already_down: vec![],
keys_up: vec![],
input_text_entry_instruction: String::from(""),
input_text_entry_value: String::from(""),
}, Command::none())
}
@ -203,6 +270,17 @@ impl Application for Main {
Message::Tick => {
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() => {
match event {
iced::event::Event::Keyboard(keyboard::Event::KeyPressed{
@ -219,15 +297,16 @@ impl Application for Main {
Message::B => { self.inputs.b = key_code },
Message::X => { self.inputs.x = key_code },
Message::Y => { self.inputs.y = key_code },
Message::Start => { self.inputs.start = key_code },
Message::L => { self.inputs.l = 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;
},
_ => {},
}
};
},
Message::EventOccurred(event) => {
match event {
@ -243,6 +322,7 @@ impl Application for Main {
self.keys_newly_down.dedup();
},
};
self.exchange();
},
iced::event::Event::Keyboard(keyboard::Event::KeyReleased{
key_code,
@ -262,13 +342,14 @@ impl Application for Main {
},
None => {},
};
self.exchange();
},
_ => {},
}
};
},
_ => {
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();
@ -276,30 +357,149 @@ impl Application for Main {
fn subscription(&self) -> Subscription<Message> {
return subscription::Subscription::batch(vec![
subscription::events_with(|event, _| match event {
iced::Event::Keyboard(_) => Some(Message::EventOccurred(event)),
subscription::events_with(|event, status| match status {
iced::event::Status::Ignored => match event {
iced::Event::Keyboard(_) => Some(Message::EventOccurred(event)),
_ => 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> {
let new_cfg_button = |msg: Message, s| button(text(controller_button_to_string(msg.clone(), s))).on_press(msg.clone());
return column![
button(text(controller_button_to_string(Message::Up, self.inputs.stick.up))).on_press(Message::Up),
button(text(controller_button_to_string(Message::Down, self.inputs.stick.down))).on_press(Message::Down),
button(text(controller_button_to_string(Message::Left, self.inputs.stick.left))).on_press(Message::Left),
button(text(controller_button_to_string(Message::Right, self.inputs.stick.right))).on_press(Message::Right),
button(text(controller_button_to_string(Message::A, self.inputs.a))).on_press(Message::A),
button(text(controller_button_to_string(Message::B, self.inputs.b))).on_press(Message::B),
button(text(controller_button_to_string(Message::X, self.inputs.x))).on_press(Message::X),
button(text(controller_button_to_string(Message::Y, self.inputs.y))).on_press(Message::Y),
button(text(controller_button_to_string(Message::L, self.inputs.l))).on_press(Message::L),
button(text(controller_button_to_string(Message::R, self.inputs.r))).on_press(Message::R),
text(self.ntfy.clone()).size(50),
]
.padding(20)
.align_items(Alignment::Center)
.into();
text(String::from("= MAYHEM PARTY =")).size(32),
column![
column![
text(String::from("Button Mapping")).size(24),
text(String::from("--------------")).size(24),
row![
column![
new_cfg_button(Message::Up, self.inputs.stick.up),
new_cfg_button(Message::Down, self.inputs.stick.down),
new_cfg_button(Message::Left, self.inputs.stick.left),
new_cfg_button(Message::Right, self.inputs.stick.right),
new_cfg_button(Message::Start, self.inputs.start),
].padding(5).align_items(Alignment::Center),
column![
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);
},
_ => {},
};
},
_ => {},
},
_ => {},
};
}
}

View File

@ -1,8 +1,5 @@
use crate::config::Stream;
use hidapi::HidApi;
use rusb::UsbContext;
use gilrs::{Gilrs, Button, Event};
use serde_json::json;
use handlebars::Handlebars;
use std::time::{SystemTime, UNIX_EPOCH};
@ -20,7 +17,6 @@ pub fn build_input_stream(cfg: &Stream) -> Box<dyn InputStream> {
return Box::new(build_input_stream_kafka(&cfg).unwrap());
},
"udp" => return Box::new(build_input_stream_udp(&cfg).unwrap()),
"device" => return Box::new(build_input_stream_device(&cfg).unwrap()),
_ => {},
};
assert!(false);
@ -30,78 +26,9 @@ pub fn build_input_stream(cfg: &Stream) -> Box<dyn InputStream> {
pub struct InputStreamDevice {
}
pub fn build_input_stream_device(cfg: &Stream) -> Result<InputStreamDevice, String> {
return build_input_stream_device_gilrs(cfg)
}
pub fn build_input_stream_device_gilrs(cfg: &Stream) -> Result<InputStreamDevice, String> {
let _device_cfg = cfg.engine.device.as_ref().unwrap();
let mut gilrs = Gilrs::new().unwrap();
eprintln!("printing gamepads");
for (_id, gamepad) in gilrs.gamepads() {
eprintln!("{} is {:?}", gamepad.name(), gamepad.power_info());
}
eprintln!("printing gamepads events");
loop {
// eprintln!("reading gamepads events");
// Examine new events
while let Some(Event { id, event, time }) = gilrs.next_event() {
eprintln!("{:?} New event from {}: {:?}", time, id, event);
let active_gamepad = Some(id);
eprintln!("inspecting event");
// You can also use cached gamepad state
if let Some(gamepad) = active_gamepad.map(|id| gilrs.gamepad(id)) {
if gamepad.is_pressed(Button::South) {
eprintln!("Button South is pressed (XBox - A, PS - X)");
}
}
break;
}
std::thread::sleep(std::time::Duration::from_millis(15));
break;
}
return Err("do what".to_string());
}
pub fn build_input_stream_device_hidapi(cfg: &Stream) -> Result<InputStreamDevice, String> {
let _device_cfg = cfg.engine.device.as_ref().unwrap();
match HidApi::new() {
Ok(api) => {
for device in api.devices() {
eprintln!("{:#?}", device);
}
},
Err(e) => {
eprintln!("Error: {}", e);
},
};
return Err("do what".to_string());
}
pub fn build_input_stream_device_rusb(cfg: &Stream) -> Result<InputStreamDevice, String> {
let _device_cfg = cfg.engine.device.as_ref().unwrap();
assert!(rusb::has_capability());
let ctx = rusb::Context::new().unwrap();
assert!(ctx.devices().unwrap().len() > 0);
for device in ctx.devices().unwrap().iter() {
let device_desc = device.device_descriptor().unwrap();
eprintln!("Bus {:03} Device {:03} ID {:04x}:{:04x}",
device.bus_number(),
device.address(),
device_desc.vendor_id(),
device_desc.product_id());
}
return Err("do what".to_string());
}
//pub fn build_input_stream_device_gilrs(cfg: &Stream) -> Result<InputStreamDevice, String> {
//pub fn build_input_stream_device_hidapi(cfg: &Stream) -> Result<InputStreamDevice, String> {
//pub fn build_input_stream_device_rusb(cfg: &Stream) -> Result<InputStreamDevice, String> {
impl InputStream for InputStreamDevice {
fn get(&mut self) -> Vec<char> {

23
src/testdata/http.go vendored Normal file
View 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)
}
}