1
0
mirror of https://github.com/4yn/slidershim.git synced 2024-11-24 05:50:12 +01:00

brokenithm urls and logging

This commit is contained in:
4yn 2022-02-05 18:00:06 +08:00
parent 91030cb96b
commit 21afaa661b
13 changed files with 218 additions and 425 deletions

View File

@ -1,4 +1,5 @@
html, body { html,
body {
position: relative; position: relative;
width: 100%; width: 100%;
height: 100%; height: 100%;
@ -9,11 +10,16 @@ html, body {
* { * {
box-sizing: border-box; box-sizing: border-box;
color: #ddd; color: #ddd;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
font-size: 1rem; font-size: 1rem;
user-select: none; user-select: none;
} }
pre {
font-family: monospace;
}
body { body {
margin: 0; margin: 0;
padding: 1rem; padding: 1rem;
@ -31,7 +37,8 @@ body {
font-weight: 500; font-weight: 500;
} }
.row, .row-2 { .row,
.row-2 {
margin: 0 0 0.5rem 0; margin: 0 0 0.5rem 0;
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
@ -47,7 +54,8 @@ body {
flex: 2 2 0; flex: 2 2 0;
} }
input, select { input,
select {
width: 100%; width: 100%;
background-color: #444; background-color: #444;
color: #ddd; color: #ddd;
@ -71,6 +79,10 @@ button:active {
background: #777; background: #777;
} }
button.primary {
background: rgb(35, 67, 211);
}
.preview { .preview {
width: 100%; width: 100%;
display: flex; display: flex;
@ -84,7 +96,8 @@ button:active {
height: 3rem; height: 3rem;
} }
.ground-btn, .ground-led { .ground-btn,
.ground-led {
height: 3rem; height: 3rem;
position: absolute; position: absolute;
top: 0; top: 0;

418
src-tauri/Cargo.lock generated
View File

@ -74,37 +74,12 @@ version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"
[[package]]
name = "arrayvec"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
[[package]] [[package]]
name = "arrayvec" name = "arrayvec"
version = "0.7.2" version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
[[package]]
name = "async-io"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a811e6a479f2439f0c04038796b5cfb3d2ad56c230e0f2d3f7b04d68cfee607b"
dependencies = [
"concurrent-queue",
"futures-lite",
"libc",
"log",
"once_cell",
"parking",
"polling",
"slab",
"socket2",
"waker-fn",
"winapi",
]
[[package]] [[package]]
name = "async-trait" name = "async-trait"
version = "0.1.52" version = "0.1.52"
@ -196,17 +171,6 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "blake2b_simd"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587"
dependencies = [
"arrayref",
"arrayvec 0.5.2",
"constant_time_eq",
]
[[package]] [[package]]
name = "blake3" name = "blake3"
version = "1.3.1" version = "1.3.1"
@ -214,7 +178,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f"
dependencies = [ dependencies = [
"arrayref", "arrayref",
"arrayvec 0.7.2", "arrayvec",
"cc", "cc",
"cfg-if 1.0.0", "cfg-if 1.0.0",
"constant_time_eq", "constant_time_eq",
@ -294,12 +258,6 @@ dependencies = [
"pkg-config", "pkg-config",
] ]
[[package]]
name = "cache-padded"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c"
[[package]] [[package]]
name = "cairo-rs" name = "cairo-rs"
version = "0.14.9" version = "0.14.9"
@ -370,19 +328,6 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
[[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]] [[package]]
name = "cocoa" name = "cocoa"
version = "0.24.0" version = "0.24.0"
@ -445,15 +390,6 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "concurrent-queue"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3"
dependencies = [
"cache-padded",
]
[[package]] [[package]]
name = "constant_time_eq" name = "constant_time_eq"
version = "0.1.5" version = "0.1.5"
@ -707,17 +643,6 @@ dependencies = [
"byteorder", "byteorder",
] ]
[[package]]
name = "derivative"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "derive_more" name = "derive_more"
version = "0.99.17" version = "0.99.17"
@ -761,17 +686,6 @@ dependencies = [
"dirs-sys", "dirs-sys",
] ]
[[package]]
name = "dirs"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901"
dependencies = [
"libc",
"redox_users 0.3.5",
"winapi",
]
[[package]] [[package]]
name = "dirs-next" name = "dirs-next"
version = "2.0.0" version = "2.0.0"
@ -789,7 +703,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780" checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780"
dependencies = [ dependencies = [
"libc", "libc",
"redox_users 0.4.0", "redox_users",
"winapi", "winapi",
] ]
@ -800,7 +714,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
dependencies = [ dependencies = [
"libc", "libc",
"redox_users 0.4.0", "redox_users",
"winapi", "winapi",
] ]
@ -837,27 +751,6 @@ version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7" checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7"
[[package]]
name = "enumflags2"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83c8d82922337cd23a15f88b70d8e4ef5f11da38dd7cdb55e84dd5de99695da0"
dependencies = [
"enumflags2_derive",
"serde",
]
[[package]]
name = "enumflags2_derive"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "946ee94e3dbf58fdd324f9ce245c7b238d46a66f00e86a020b71996349e46cce"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "env_logger" name = "env_logger"
version = "0.9.0" version = "0.9.0"
@ -1577,6 +1470,18 @@ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
] ]
[[package]]
name = "ipconfig"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "723519edce41262b05d4143ceb95050e4c614f483e78e9fd9e39a8275a84ad98"
dependencies = [
"socket2",
"widestring",
"winapi",
"winreg",
]
[[package]] [[package]]
name = "itertools" name = "itertools"
version = "0.10.3" version = "0.10.3"
@ -1736,18 +1641,6 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
[[package]]
name = "mac-notification-sys"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dfb6b71a9a89cd38b395d994214297447e8e63b1ba5708a9a2b0b1048ceda76"
dependencies = [
"cc",
"chrono",
"dirs",
"objc-foundation",
]
[[package]] [[package]]
name = "mach" name = "mach"
version = "0.1.2" version = "0.1.2"
@ -1819,12 +1712,6 @@ dependencies = [
"autocfg", "autocfg",
] ]
[[package]]
name = "minisign-verify"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db0507fe8e3c68cd62961cf9f87f6c2b21d884d3515a7150a4a3fa9d014e5c12"
[[package]] [[package]]
name = "miniz_oxide" name = "miniz_oxide"
version = "0.3.7" version = "0.3.7"
@ -1884,16 +1771,6 @@ dependencies = [
"tempfile", "tempfile",
] ]
[[package]]
name = "nb-connect"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1bb540dc6ef51cfe1916ec038ce7a620daf3a111e2502d745197cd53d6bca15"
dependencies = [
"libc",
"socket2",
]
[[package]] [[package]]
name = "ndk" name = "ndk"
version = "0.4.0" version = "0.4.0"
@ -1959,39 +1836,12 @@ dependencies = [
"void", "void",
] ]
[[package]]
name = "nix"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50e4785f2c3b7589a0d0c1dd60285e1188adac4006e8abd6dd578e1567027363"
dependencies = [
"bitflags",
"cc",
"cfg-if 0.1.10",
"libc",
"void",
]
[[package]] [[package]]
name = "nodrop" name = "nodrop"
version = "0.1.14" version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb"
[[package]]
name = "notify-rust"
version = "4.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca6ebab865e67efdd7182a88d76cadbdd2a8d02d1c7a4e16bb7c234016a12cac"
dependencies = [
"mac-notification-sys",
"serde",
"winrt-notification",
"zbus",
"zvariant",
"zvariant_derive",
]
[[package]] [[package]]
name = "ntapi" name = "ntapi"
version = "0.3.6" version = "0.3.6"
@ -2146,27 +1996,6 @@ dependencies = [
"vcpkg", "vcpkg",
] ]
[[package]]
name = "os_info"
version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "198e392be7e882f0c2836f425e430f81d9a0e99651e4646311347417cddbfd43"
dependencies = [
"log",
"serde",
"winapi",
]
[[package]]
name = "os_pipe"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb233f06c2307e1f5ce2ecad9f8121cffbbee2c95428f44ea85222e460d0d213"
dependencies = [
"libc",
"winapi",
]
[[package]] [[package]]
name = "palette" name = "palette"
version = "0.6.0" version = "0.6.0"
@ -2458,19 +2287,6 @@ dependencies = [
"miniz_oxide 0.3.7", "miniz_oxide 0.3.7",
] ]
[[package]]
name = "polling"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "685404d509889fade3e86fe3a5803bca2ec09b0c0778d5ada6ec8bf7a8de5259"
dependencies = [
"cfg-if 1.0.0",
"libc",
"log",
"wepoll-ffi",
"winapi",
]
[[package]] [[package]]
name = "ppv-lite86" name = "ppv-lite86"
version = "0.2.16" version = "0.2.16"
@ -2700,17 +2516,6 @@ dependencies = [
"bitflags", "bitflags",
] ]
[[package]]
name = "redox_users"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d"
dependencies = [
"getrandom 0.1.16",
"redox_syscall 0.1.57",
"rust-argon2",
]
[[package]] [[package]]
name = "redox_users" name = "redox_users"
version = "0.4.0" version = "0.4.0"
@ -2789,18 +2594,6 @@ dependencies = [
"libusb1-sys", "libusb1-sys",
] ]
[[package]]
name = "rust-argon2"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb"
dependencies = [
"base64",
"blake2b_simd",
"constant_time_eq",
"crossbeam-utils",
]
[[package]] [[package]]
name = "rustc_version" name = "rustc_version"
version = "0.3.3" version = "0.3.3"
@ -2995,7 +2788,7 @@ dependencies = [
"cfg-if 0.1.10", "cfg-if 0.1.10",
"libudev", "libudev",
"mach 0.2.3", "mach 0.2.3",
"nix 0.16.1", "nix",
"regex", "regex",
"winapi", "winapi",
] ]
@ -3033,13 +2826,14 @@ dependencies = [
] ]
[[package]] [[package]]
name = "shared_child" name = "simple-logging"
version = "0.3.5" version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6be9f7d5565b1483af3e72975e2dee33879b3b86bd48c0929fccf6585d79e65a" checksum = "b00d48e85675326bb182a2286ea7c1a0b264333ae10f27a937a72be08628b542"
dependencies = [ dependencies = [
"libc", "lazy_static",
"winapi", "log",
"thread-id",
] ]
[[package]] [[package]]
@ -3064,6 +2858,7 @@ dependencies = [
"futures", "futures",
"futures-util", "futures-util",
"hyper", "hyper",
"ipconfig",
"log", "log",
"palette", "palette",
"path-clean", "path-clean",
@ -3071,6 +2866,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"serialport", "serialport",
"simple-logging",
"tauri", "tauri",
"tauri-build", "tauri-build",
"tokio", "tokio",
@ -3127,12 +2923,6 @@ dependencies = [
"loom", "loom",
] ]
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]] [[package]]
name = "string_cache" name = "string_cache"
version = "0.8.2" version = "0.8.2"
@ -3177,15 +2967,6 @@ version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aaf86bbcfd1fa9670b7a129f64fc0c9fcbbfe4f1bc4210e9e98fe71ffc12cde2" checksum = "aaf86bbcfd1fa9670b7a129f64fc0c9fcbbfe4f1bc4210e9e98fe71ffc12cde2"
[[package]]
name = "strum"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7ac893c7d471c8a21f31cfe213ec4f6d9afeed25537c772e08ef3f005f8729e"
dependencies = [
"strum_macros 0.22.0",
]
[[package]] [[package]]
name = "strum_macros" name = "strum_macros"
version = "0.18.0" version = "0.18.0"
@ -3210,18 +2991,6 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "strum_macros"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "339f799d8b549e3744c7ac7feb216383e4005d94bdb22561b3ab8f3b808ae9fb"
dependencies = [
"heck",
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "subtle" name = "subtle"
version = "2.4.1" version = "2.4.1"
@ -3330,7 +3099,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79a0579dcc6fb883fe90dd3c66d76b8b8f4a1786e1e915e314b2017a500ede09" checksum = "79a0579dcc6fb883fe90dd3c66d76b8b8f4a1786e1e915e314b2017a500ede09"
dependencies = [ dependencies = [
"attohttpc", "attohttpc",
"base64",
"bincode", "bincode",
"cfg_aliases", "cfg_aliases",
"dirs-next", "dirs-next",
@ -3343,12 +3111,8 @@ dependencies = [
"gtk", "gtk",
"http", "http",
"ignore", "ignore",
"minisign-verify",
"notify-rust",
"once_cell", "once_cell",
"open", "open",
"os_info",
"os_pipe",
"percent-encoding", "percent-encoding",
"rand 0.8.4", "rand 0.8.4",
"raw-window-handle 0.3.4", "raw-window-handle 0.3.4",
@ -3357,7 +3121,6 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"serde_repr", "serde_repr",
"shared_child",
"state", "state",
"tar", "tar",
"tauri-macros", "tauri-macros",
@ -3553,6 +3316,17 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "thread-id"
version = "3.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7fbf4c9d56b320106cd64fd024dadfa0be7cb4706725fc44a7d7ce952d820c1"
dependencies = [
"libc",
"redox_syscall 0.1.57",
"winapi",
]
[[package]] [[package]]
name = "thread_local" name = "thread_local"
version = "1.1.4" version = "1.1.4"
@ -4031,15 +3805,6 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "wepoll-ffi"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb"
dependencies = [
"cc",
]
[[package]] [[package]]
name = "widestring" name = "widestring"
version = "0.5.1" version = "0.5.1"
@ -4084,41 +3849,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]] [[package]]
name = "windows" name = "winreg"
version = "0.24.0" version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9f39345ae0c8ab072c0ac7fe8a8b411636aa34f89be19ddd0d9226544f13944" checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69"
dependencies = [ dependencies = [
"windows_i686_gnu", "winapi",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_msvc",
] ]
[[package]]
name = "windows_i686_gnu"
version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0866510a3eca9aed73a077490bbbf03e5eaac4e1fd70849d89539e5830501fd"
[[package]]
name = "windows_i686_msvc"
version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf0ffed56b7e9369a29078d2ab3aaeceea48eb58999d2cff3aa2494a275b95c6"
[[package]]
name = "windows_x86_64_gnu"
version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "384a173630588044205a2993b6864a2f56e5a8c1e7668c07b93ec18cf4888dc4"
[[package]]
name = "windows_x86_64_msvc"
version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bd8f062d8ca5446358159d79a90be12c543b3a965c847c8f3eedf14b321d399"
[[package]] [[package]]
name = "winres" name = "winres"
version = "0.1.12" version = "0.1.12"
@ -4128,17 +3866,6 @@ dependencies = [
"toml", "toml",
] ]
[[package]]
name = "winrt-notification"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "007a0353840b23e0c6dc73e5b962ff58ed7f6bc9ceff3ce7fe6fbad8d496edf4"
dependencies = [
"strum 0.22.0",
"windows",
"xml-rs",
]
[[package]] [[package]]
name = "wry" name = "wry"
version = "0.12.2" version = "0.12.2"
@ -4189,47 +3916,6 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "xml-rs"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3"
[[package]]
name = "zbus"
version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2326acc379a3ac4e34b794089f5bdb17086bf29a5fdf619b7b4cc772dc2e9dad"
dependencies = [
"async-io",
"byteorder",
"derivative",
"enumflags2",
"fastrand",
"futures",
"nb-connect",
"nix 0.17.0",
"once_cell",
"polling",
"scoped-tls",
"serde",
"serde_repr",
"zbus_macros",
"zvariant",
]
[[package]]
name = "zbus_macros"
version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a482c56029e48681b89b92b5db3c446db0915e8dd1052c0328a574eda38d5f93"
dependencies = [
"proc-macro-crate 0.1.5",
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "zip" name = "zip"
version = "0.5.13" version = "0.5.13"
@ -4272,29 +3958,3 @@ dependencies = [
"cc", "cc",
"libc", "libc",
] ]
[[package]]
name = "zvariant"
version = "2.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a68c7b55f2074489b7e8e07d2d0a6ee6b4f233867a653c664d8020ba53692525"
dependencies = [
"byteorder",
"enumflags2",
"libc",
"serde",
"static_assertions",
"zvariant_derive",
]
[[package]]
name = "zvariant_derive"
version = "2.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4ca5e22593eb4212382d60d26350065bf2a02c34b85bc850474a74b589a3de9"
dependencies = [
"proc-macro-crate 1.1.0",
"proc-macro2",
"quote",
"syn",
]

View File

@ -15,12 +15,12 @@ build = "src/build.rs"
tauri-build = { version = "1.0.0-beta.4" } tauri-build = { version = "1.0.0-beta.4" }
[dependencies] [dependencies]
serde_json = "1.0" serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
log = "0.4.14" log = "0.4.14"
env_logger = "0.9.0" env_logger = "0.9.0"
tauri = { version = "1.0.0-beta.8", features = ["api-all", "system-tray"] } simple-logging = "2.0.2"
tauri = { version = "1.0.0-beta.8", features = ["shell-open", "system-tray"] }
futures = "0.3.19" futures = "0.3.19"
futures-util = "0.3.19" futures-util = "0.3.19"
@ -34,6 +34,7 @@ serialport = "4.0.1"
vigem-client = "0.1.1" vigem-client = "0.1.1"
palette = "0.6.0" palette = "0.6.0"
winapi = "0.3.9" winapi = "0.3.9"
ipconfig = "0.3.0"
hyper = { version="0.14.16", features= ["server", "http1", "http2", "tcp", "stream", "runtime"] } hyper = { version="0.14.16", features= ["server", "http1", "http2", "tcp", "stream", "runtime"] }
path-clean = "0.1.0" path-clean = "0.1.0"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -9,21 +9,20 @@ mod slider_io;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use env_logger; // use env_logger;
use log::info; use log::info;
use tauri::{ use tauri::{
async_runtime::Handle as AsyncHandle, AppHandle, CustomMenuItem, Event, Manager, Runtime, AppHandle, CustomMenuItem, Event, Manager, Runtime, SystemTray, SystemTrayEvent, SystemTrayMenu,
SystemTray, SystemTrayEvent, SystemTrayMenu,
}; };
fn show_window<R: Runtime>(handle: &AppHandle<R>) { fn show_window<R: Runtime>(handle: &AppHandle<R>) {
handle.emit_all("ackShow", ""); handle.emit_all("ackShow", "").ok();
handle.get_window("main").unwrap().show().ok(); handle.get_window("main").unwrap().show().ok();
} }
fn hide_window<R: Runtime>(handle: &AppHandle<R>) { fn hide_window<R: Runtime>(handle: &AppHandle<R>) {
handle.emit_all("ackHide", ""); handle.emit_all("ackHide", "").ok();
handle.get_window("main").unwrap().hide().ok(); handle.get_window("main").unwrap().hide().ok();
} }
@ -33,9 +32,14 @@ fn quit_app() {
fn main() { fn main() {
// Setup logger // Setup logger
env_logger::Builder::new() // env_logger::Builder::new()
.filter_level(log::LevelFilter::Debug) // .filter_level(log::LevelFilter::Debug)
.init(); // .init();
simple_logging::log_to_file(
slider_io::Config::get_log_file_path().unwrap().as_path(),
log::LevelFilter::Debug,
)
.unwrap();
let config = Arc::new(Mutex::new(Some(slider_io::Config::default()))); let config = Arc::new(Mutex::new(Some(slider_io::Config::default())));
let manager = Arc::new(Mutex::new(slider_io::Manager::new())); let manager = Arc::new(Mutex::new(slider_io::Manager::new()));
@ -105,12 +109,17 @@ fn main() {
Some(config_handle.as_ref().unwrap().raw.as_str().to_string()), Some(config_handle.as_ref().unwrap().raw.as_str().to_string()),
) )
.unwrap(); .unwrap();
let ips = slider_io::list_ips();
if let Ok(ips) = ips {
app_handle.emit_all("listIps", &ips).unwrap();
}
}); });
// UI update event // UI update event
let app_handle = app.handle(); let app_handle = app.handle();
let manager_clone = Arc::clone(&manager); let manager_clone = Arc::clone(&manager);
app.listen_global("queryState", move |event| { app.listen_global("queryState", move |_| {
// app_handle.emit_all("showState", "@@@"); // app_handle.emit_all("showState", "@@@");
let snapshot = { let snapshot = {
let manager_handle = manager_clone.lock().unwrap(); let manager_handle = manager_clone.lock().unwrap();
@ -118,7 +127,7 @@ fn main() {
}; };
match snapshot { match snapshot {
Some(snapshot) => { Some(snapshot) => {
app_handle.emit_all("showState", snapshot); app_handle.emit_all("showState", snapshot).ok();
} }
_ => {} _ => {}
} }

View File

@ -153,8 +153,18 @@ impl Config {
.unwrap() .unwrap()
} }
pub fn get_log_file_path() -> Option<Box<PathBuf>> {
let project_dir = ProjectDirs::from("me", "ress.imp", "slidershim").unwrap();
let config_dir = project_dir.config_dir();
fs::create_dir_all(config_dir).unwrap();
let log_path = config_dir.join("log.txt");
return Some(Box::new(log_path));
}
fn get_saved_path() -> Option<Box<PathBuf>> { fn get_saved_path() -> Option<Box<PathBuf>> {
let project_dir = ProjectDirs::from("me", "imp.ress", "slidershim").unwrap(); let project_dir = ProjectDirs::from("me", "ress.imp", "slidershim").unwrap();
let config_dir = project_dir.config_dir(); let config_dir = project_dir.config_dir();
fs::create_dir_all(config_dir).unwrap(); fs::create_dir_all(config_dir).unwrap();

View File

@ -2,7 +2,7 @@ use log::info;
use crate::slider_io::{ use crate::slider_io::{
brokenithm::BrokenithmJob, brokenithm::BrokenithmJob,
config::{Config, DeviceMode}, config::{Config, DeviceMode, LedMode, OutputMode},
controller_state::FullState, controller_state::FullState,
device::HidDeviceJob, device::HidDeviceJob,
led::LedJob, led::LedJob,
@ -16,8 +16,8 @@ pub struct Context {
config: Config, config: Config,
device_worker: Option<ThreadWorker>, device_worker: Option<ThreadWorker>,
brokenithm_worker: Option<AsyncWorker>, brokenithm_worker: Option<AsyncWorker>,
output_worker: ThreadWorker, output_worker: Option<ThreadWorker>,
led_worker: ThreadWorker, led_worker: Option<ThreadWorker>,
} }
impl Context { impl Context {
@ -30,6 +30,7 @@ impl Context {
let state = FullState::new(); let state = FullState::new();
let (device_worker, brokenithm_worker) = match &config.device_mode { let (device_worker, brokenithm_worker) = match &config.device_mode {
DeviceMode::None => (None, None),
DeviceMode::Brokenithm { ground_only } => ( DeviceMode::Brokenithm { ground_only } => (
None, None,
Some(AsyncWorker::new( Some(AsyncWorker::new(
@ -37,16 +38,28 @@ impl Context {
BrokenithmJob::new(&state, ground_only), BrokenithmJob::new(&state, ground_only),
)), )),
), ),
other => ( _ => (
Some(ThreadWorker::new( Some(ThreadWorker::new(
"device", "device",
HidDeviceJob::from_config(&state, other), HidDeviceJob::from_config(&state, &config.device_mode),
)), )),
None, None,
), ),
}; };
let output_worker = ThreadWorker::new("output", OutputJob::new(&state, &config.output_mode)); let output_worker = match &config.output_mode {
let led_worker = ThreadWorker::new("led", LedJob::new(&state, &config.led_mode)); OutputMode::None => None,
_ => Some(ThreadWorker::new(
"output",
OutputJob::new(&state, &config.output_mode),
)),
};
let led_worker = match &config.led_mode {
LedMode::None => None,
_ => Some(ThreadWorker::new(
"led",
LedJob::new(&state, &config.led_mode),
)),
};
Self { Self {
state, state,

View File

@ -18,3 +18,4 @@ mod manager;
pub use config::Config; pub use config::Config;
pub use manager::Manager; pub use manager::Manager;
pub use utils::list_ips;

View File

@ -33,3 +33,14 @@ impl Error for ShimError {
"shimError" "shimError"
} }
} }
pub fn list_ips() -> Result<Vec<String>, Box<dyn Error>> {
let mut ips = vec![];
for adapter in ipconfig::get_adapters()? {
for ip_address in adapter.ip_addresses() {
ips.push(format!("{}", ip_address));
}
}
Ok(ips)
}

View File

@ -13,7 +13,7 @@
"bundle": { "bundle": {
"active": true, "active": true,
"targets": "all", "targets": "all",
"identifier": "com.tauri.dev", "identifier": "me.ress.imp.slidershim",
"icon": [ "icon": [
"icons/32x32.png", "icons/32x32.png",
"icons/128x128.png", "icons/128x128.png",
@ -51,13 +51,16 @@
"active": false "active": false
}, },
"allowlist": { "allowlist": {
"all": true "all": false,
"shell": {
"open": true
}
}, },
"windows": [ "windows": [
{ {
"title": "slidershim", "title": "slidershim",
"width": 500, "width": 500,
"height": 400, "height": 500,
"resizable": false, "resizable": false,
"fullscreen": false "fullscreen": false
} }

View File

@ -2,6 +2,7 @@
import { onMount } from "svelte"; import { onMount } from "svelte";
import { emit, listen } from "@tauri-apps/api/event"; import { emit, listen } from "@tauri-apps/api/event";
import Link from "./Link.svelte";
import Preview from "./Preview.svelte"; import Preview from "./Preview.svelte";
let deviceMode = "none"; let deviceMode = "none";
@ -14,8 +15,15 @@
let ledWebsocketUrl = "http://localhost:3001"; let ledWebsocketUrl = "http://localhost:3001";
let ledSerialPort = "COM5"; let ledSerialPort = "COM5";
let debugstr = ""; let dirty = false;
function markDirty() {
dirty = true;
}
// let debugstr = "";
let ips: Array<string> = [];
let polling = null; let polling = null;
let tick = 0; let tick = 0;
let previewData = Array(131).fill(0); let previewData = Array(131).fill(0);
@ -37,7 +45,6 @@
onMount(async () => { onMount(async () => {
// console.log(emit, listen); // console.log(emit, listen);
await listen("showConfig", (event) => { await listen("showConfig", (event) => {
debugstr = event.payload;
const payload: any = JSON.parse(event.payload as any); const payload: any = JSON.parse(event.payload as any);
deviceMode = payload.deviceMode || "none"; deviceMode = payload.deviceMode || "none";
outputMode = payload.outputMode || "none"; outputMode = payload.outputMode || "none";
@ -51,7 +58,13 @@
}); });
await listen("showState", (event) => { await listen("showState", (event) => {
previewData = event.payload; previewData = event.payload as any;
});
await listen("listIps", (event) => {
ips = (event.payload as Array<string>).filter(
(x) => x.split(".").length == 4
);
}); });
await emit("ready", ""); await emit("ready", "");
@ -82,6 +95,7 @@
ledSerialPort, ledSerialPort,
}) })
); );
dirty = false;
console.log("Done"); console.log("Done");
} }
@ -110,31 +124,53 @@
<div class="row"> <div class="row">
<div class="label">Input Device</div> <div class="label">Input Device</div>
<div class="input"> <div class="input">
<select bind:value={deviceMode}> <select bind:value={deviceMode} on:change={markDirty}>
<option value="none">None</option> <option value="none">None</option>
<option value="tasoller-one">GAMO2 Tasoller, 1.0 HID Firmware</option> <option value="tasoller-one">GAMO2 Tasoller, 1.0 HID Firmware</option>
<option value="tasoller-two">GAMO2 Tasoller, 2.0 HID Firmware</option> <option value="tasoller-two">GAMO2 Tasoller, 2.0 HID Firmware</option>
<option value="yuancon">Yuancon Laverita, HID Firmware</option> <option value="yuancon">Yuancon Laverita, HID Firmware</option>
<option value="brokenithm">Brokenithm</option> <option value="brokenithm">Brokenithm</option>
<option value="brokenithm-ground">Brokenithm, Ground only (WIP)</option> <option value="brokenithm-ground">Brokenithm, Ground only</option>
</select> </select>
</div> </div>
</div> </div>
{#if deviceMode.slice(0, 10) === "brokenithm"}
<div class="row">
<div class="label" />
<div class="input">
Brokenithm open at:
<pre>
{ips.map((x) => `http://${x}:1606/`).join("\n")}
</pre>
</div>
</div>
{/if}
<div class="row"> <div class="row">
<div class="label">Output Mode</div> <div class="label">Output Mode</div>
<div class="input"> <div class="input">
<select bind:value={outputMode}> <select bind:value={outputMode} on:change={markDirty}>
<option value="none">None</option> <option value="none">None</option>
<option value="kb-32-tasoller">Keyboard 32-zone, Tasoller Layout</option <option value="kb-32-tasoller">Keyboard 32-zone, Tasoller Layout</option
> >
<option value="kb-32-yuancon">Keyboard 32-zone, Yuancon Layout</option> <option value="kb-32-yuancon">Keyboard 32-zone, Yuancon Layout</option>
<option value="kb-8-deemo">Keyboard 8-zone, Deemo Layout</option> <option value="kb-8-deemo">Keyboard 8-zone, Deemo Layout</option>
<option value="kb-voltex">Keyboard 10-zone, Voltex Layout</option> <option value="kb-voltex">Keyboard 10-zone, Voltex Layout</option>
<option value="websocket">Websocket</option> <option value="gamepad-voltex">XBOX 360 Gamepad, Voltex Layout</option>
<!-- <option value="websocket">Websocket</option> -->
</select> </select>
</div> </div>
</div> </div>
{#if outputMode.slice(0, 2) === "kb"} {#if outputMode === "gamepad-voltex"}
<div class="row">
<div class="label" />
<div class="input">
Gamepad emulation requires <Link
href="https://github.com/ViGEm/ViGEmBus/releases">ViGEMBus</Link
>
</div>
</div>
{/if}
{#if outputMode.slice(0, 2) === "kb" && deviceMode.slice(0, 10) !== "brokenithm"}
<div class="row"> <div class="row">
<div class="label">Sensitivity</div> <div class="label">Sensitivity</div>
<div class="input"> <div class="input">
@ -144,6 +180,7 @@
max="255" max="255"
step="1" step="1"
bind:value={keyboardSensitivity} bind:value={keyboardSensitivity}
on:change={markDirty}
/> />
</div> </div>
</div> </div>
@ -156,6 +193,7 @@
max="255" max="255"
step="1" step="1"
bind:value={keyboardSensitivity} bind:value={keyboardSensitivity}
on:change={markDirty}
/> />
</div> </div>
</div> </div>
@ -164,27 +202,30 @@
<div class="row"> <div class="row">
<div class="label">Output URL</div> <div class="label">Output URL</div>
<div class="input"> <div class="input">
<input placeholder="URL" bind:value={outputWebsocketUrl} /> <input
placeholder="URL"
bind:value={outputWebsocketUrl}
on:change={markDirty}
/>
</div> </div>
</div> </div>
{/if} {/if}
<div class="row"> <div class="row">
<div class="label">LED Mode</div> <div class="label">LED Mode</div>
<div class="input"> <div class="input">
<select bind:value={ledMode}> <select bind:value={ledMode} on:change={markDirty}>
<option value="none">None</option> <option value="none">None</option>
<option value="reactive-4">Reactive, 4-Zone</option> <option value="reactive-4">Reactive, 4-Zone</option>
<option value="reactive-8">Reactive, 8-Zone</option> <option value="reactive-8">Reactive, 8-Zone</option>
<option value="reactive-16">Reactive, 16-Zone</option> <option value="reactive-16">Reactive, 16-Zone</option>
<option value="reactive-voltex">Reactive, Voltex Layout</option> <option value="reactive-voltex">Reactive, Voltex Layout</option>
<option value="attract">Rainbow Attract Mode</option> <option value="attract">Rainbow Attract Mode</option>
<option value="test">LED Test</option> <!-- <option value="websocket">Websocket</option> -->
<option value="websocket">Websocket</option>
<option value="serial">Serial</option> <option value="serial">Serial</option>
</select> </select>
</div> </div>
</div> </div>
{#if ledMode.slice(0, 8) === "reactive"} {#if ledMode.slice(0, 8) === "reactive" && deviceMode.slice(0, 10) !== "brokenithm"}
<div class="row"> <div class="row">
<div class="label">Sensitivity</div> <div class="label">Sensitivity</div>
<div class="input"> <div class="input">
@ -194,6 +235,7 @@
max="255" max="255"
step="1" step="1"
bind:value={ledSensitivity} bind:value={ledSensitivity}
on:change={markDirty}
/> />
</div> </div>
</div> </div>
@ -206,6 +248,7 @@
max="255" max="255"
step="1" step="1"
bind:value={ledSensitivity} bind:value={ledSensitivity}
on:change={markDirty}
/> />
</div> </div>
</div> </div>
@ -214,15 +257,28 @@
<div class="row"> <div class="row">
<div class="label">LED URL</div> <div class="label">LED URL</div>
<div class="input"> <div class="input">
<input placeholder="URL" bind:value={ledWebsocketUrl} /> <input
placeholder="URL"
bind:value={ledWebsocketUrl}
on:change={markDirty}
/>
</div> </div>
</div> </div>
{/if} {/if}
{#if ledMode === "serial"} {#if ledMode === "serial"}
<div class="row">
<div class="label" />
<div class="input">
Serial LED may require <Link
href="https://sourceforge.net/projects/com0com/files/com0com/2.2.2.0/com0com-2.2.2.0-x64-fre-signed.zip/download"
>com0com</Link
>
</div>
</div>
<div class="row"> <div class="row">
<div class="label">LED Serial Port</div> <div class="label">LED Serial Port</div>
<div class="input"> <div class="input">
<select bind:value={ledSerialPort}> <select bind:value={ledSerialPort} on:change={markDirty}>
<option value="COM1">COM1</option> <option value="COM1">COM1</option>
<option value="COM2">COM2</option> <option value="COM2">COM2</option>
<option value="COM3">COM3</option> <option value="COM3">COM3</option>
@ -237,7 +293,10 @@
</div> </div>
{/if} {/if}
<div class="row"> <div class="row">
<button on:click={async () => await setConfig()}>Apply</button> <button
on:click={async () => await setConfig()}
class={`${dirty && "primary"}`}>Apply</button
>
<button on:click={async () => await hide()}>Hide</button> <button on:click={async () => await hide()}>Hide</button>
<button on:click={async () => await quit()}>Quit</button> <button on:click={async () => await quit()}>Quit</button>
</div> </div>

13
src/Link.svelte Normal file
View File

@ -0,0 +1,13 @@
<script lang="ts">
import { open } from "@tauri-apps/api/shell";
export let href: string;
</script>
<a
{href}
on:click={async (e) => {
e.preventDefault();
await open(href);
}}><slot /></a
>