this repo has no description

revamp config, actions now save

phaz.uk 79d25cc1 51af8407

verified
Changed files
+278 -737
src
src-tauri
+1 -669
src-tauri/Cargo.lock
··· 8 8 dependencies = [ 9 9 "anyhow", 10 10 "dirs", 11 + "flate2", 11 12 "serde", 12 13 "serde_json", 13 - "sqlx", 14 14 "tauri", 15 15 "tauri-build", 16 16 "tauri-plugin-opener", ··· 55 55 dependencies = [ 56 56 "alloc-no-stdlib", 57 57 ] 58 - 59 - [[package]] 60 - name = "allocator-api2" 61 - version = "0.2.21" 62 - source = "registry+https://github.com/rust-lang/crates.io-index" 63 - checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" 64 58 65 59 [[package]] 66 60 name = "android-tzdata" ··· 238 232 ] 239 233 240 234 [[package]] 241 - name = "atoi" 242 - version = "2.0.0" 243 - source = "registry+https://github.com/rust-lang/crates.io-index" 244 - checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" 245 - dependencies = [ 246 - "num-traits", 247 - ] 248 - 249 - [[package]] 250 235 name = "atomic-waker" 251 236 version = "1.1.2" 252 237 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 286 271 checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" 287 272 288 273 [[package]] 289 - name = "base64ct" 290 - version = "1.8.0" 291 - source = "registry+https://github.com/rust-lang/crates.io-index" 292 - checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" 293 - 294 - [[package]] 295 274 name = "bitflags" 296 275 version = "1.3.2" 297 276 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 542 521 ] 543 522 544 523 [[package]] 545 - name = "const-oid" 546 - version = "0.9.6" 547 - source = "registry+https://github.com/rust-lang/crates.io-index" 548 - checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" 549 - 550 - [[package]] 551 524 name = "convert_case" 552 525 version = "0.4.0" 553 526 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 613 586 ] 614 587 615 588 [[package]] 616 - name = "crc" 617 - version = "3.3.0" 618 - source = "registry+https://github.com/rust-lang/crates.io-index" 619 - checksum = "9710d3b3739c2e349eb44fe848ad0b7c8cb1e42bd87ee49371df2f7acaf3e675" 620 - dependencies = [ 621 - "crc-catalog", 622 - ] 623 - 624 - [[package]] 625 - name = "crc-catalog" 626 - version = "2.4.0" 627 - source = "registry+https://github.com/rust-lang/crates.io-index" 628 - checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" 629 - 630 - [[package]] 631 589 name = "crc32fast" 632 590 version = "1.5.0" 633 591 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 641 599 version = "0.5.15" 642 600 source = "registry+https://github.com/rust-lang/crates.io-index" 643 601 checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" 644 - dependencies = [ 645 - "crossbeam-utils", 646 - ] 647 - 648 - [[package]] 649 - name = "crossbeam-queue" 650 - version = "0.3.12" 651 - source = "registry+https://github.com/rust-lang/crates.io-index" 652 - checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" 653 602 dependencies = [ 654 603 "crossbeam-utils", 655 604 ] ··· 743 692 ] 744 693 745 694 [[package]] 746 - name = "der" 747 - version = "0.7.10" 748 - source = "registry+https://github.com/rust-lang/crates.io-index" 749 - checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" 750 - dependencies = [ 751 - "const-oid", 752 - "pem-rfc7468", 753 - "zeroize", 754 - ] 755 - 756 - [[package]] 757 695 name = "deranged" 758 696 version = "0.4.0" 759 697 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 783 721 checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" 784 722 dependencies = [ 785 723 "block-buffer", 786 - "const-oid", 787 724 "crypto-common", 788 - "subtle", 789 725 ] 790 726 791 727 [[package]] ··· 860 796 ] 861 797 862 798 [[package]] 863 - name = "dotenvy" 864 - version = "0.15.7" 865 - source = "registry+https://github.com/rust-lang/crates.io-index" 866 - checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" 867 - 868 - [[package]] 869 799 name = "dpi" 870 800 version = "0.1.2" 871 801 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 902 832 checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" 903 833 904 834 [[package]] 905 - name = "either" 906 - version = "1.15.0" 907 - source = "registry+https://github.com/rust-lang/crates.io-index" 908 - checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" 909 - dependencies = [ 910 - "serde", 911 - ] 912 - 913 - [[package]] 914 835 name = "embed-resource" 915 836 version = "3.0.5" 916 837 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 984 905 ] 985 906 986 907 [[package]] 987 - name = "etcetera" 988 - version = "0.8.0" 989 - source = "registry+https://github.com/rust-lang/crates.io-index" 990 - checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" 991 - dependencies = [ 992 - "cfg-if", 993 - "home", 994 - "windows-sys 0.48.0", 995 - ] 996 - 997 - [[package]] 998 908 name = "event-listener" 999 909 version = "5.4.0" 1000 910 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1048 958 dependencies = [ 1049 959 "crc32fast", 1050 960 "miniz_oxide", 1051 - ] 1052 - 1053 - [[package]] 1054 - name = "flume" 1055 - version = "0.11.1" 1056 - source = "registry+https://github.com/rust-lang/crates.io-index" 1057 - checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" 1058 - dependencies = [ 1059 - "futures-core", 1060 - "futures-sink", 1061 - "spin", 1062 961 ] 1063 962 1064 963 [[package]] ··· 1068 967 checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 1069 968 1070 969 [[package]] 1071 - name = "foldhash" 1072 - version = "0.1.5" 1073 - source = "registry+https://github.com/rust-lang/crates.io-index" 1074 - checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" 1075 - 1076 - [[package]] 1077 970 name = "foreign-types" 1078 971 version = "0.5.0" 1079 972 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1126 1019 checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" 1127 1020 dependencies = [ 1128 1021 "futures-core", 1129 - "futures-sink", 1130 1022 ] 1131 1023 1132 1024 [[package]] ··· 1144 1036 "futures-core", 1145 1037 "futures-task", 1146 1038 "futures-util", 1147 - ] 1148 - 1149 - [[package]] 1150 - name = "futures-intrusive" 1151 - version = "0.5.0" 1152 - source = "registry+https://github.com/rust-lang/crates.io-index" 1153 - checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" 1154 - dependencies = [ 1155 - "futures-core", 1156 - "lock_api", 1157 - "parking_lot", 1158 1039 ] 1159 1040 1160 1041 [[package]] ··· 1533 1414 version = "0.15.4" 1534 1415 source = "registry+https://github.com/rust-lang/crates.io-index" 1535 1416 checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" 1536 - dependencies = [ 1537 - "allocator-api2", 1538 - "equivalent", 1539 - "foldhash", 1540 - ] 1541 - 1542 - [[package]] 1543 - name = "hashlink" 1544 - version = "0.10.0" 1545 - source = "registry+https://github.com/rust-lang/crates.io-index" 1546 - checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" 1547 - dependencies = [ 1548 - "hashbrown 0.15.4", 1549 - ] 1550 1417 1551 1418 [[package]] 1552 1419 name = "heck" ··· 1571 1438 version = "0.4.3" 1572 1439 source = "registry+https://github.com/rust-lang/crates.io-index" 1573 1440 checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" 1574 - 1575 - [[package]] 1576 - name = "hkdf" 1577 - version = "0.12.4" 1578 - source = "registry+https://github.com/rust-lang/crates.io-index" 1579 - checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" 1580 - dependencies = [ 1581 - "hmac", 1582 - ] 1583 - 1584 - [[package]] 1585 - name = "hmac" 1586 - version = "0.12.1" 1587 - source = "registry+https://github.com/rust-lang/crates.io-index" 1588 - checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" 1589 - dependencies = [ 1590 - "digest", 1591 - ] 1592 - 1593 - [[package]] 1594 - name = "home" 1595 - version = "0.5.11" 1596 - source = "registry+https://github.com/rust-lang/crates.io-index" 1597 - checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" 1598 - dependencies = [ 1599 - "windows-sys 0.59.0", 1600 - ] 1601 1441 1602 1442 [[package]] 1603 1443 name = "html5ever" ··· 2029 1869 version = "1.5.0" 2030 1870 source = "registry+https://github.com/rust-lang/crates.io-index" 2031 1871 checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" 2032 - dependencies = [ 2033 - "spin", 2034 - ] 2035 1872 2036 1873 [[package]] 2037 1874 name = "libappindicator" ··· 2074 1911 ] 2075 1912 2076 1913 [[package]] 2077 - name = "libm" 2078 - version = "0.2.15" 2079 - source = "registry+https://github.com/rust-lang/crates.io-index" 2080 - checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" 2081 - 2082 - [[package]] 2083 1914 name = "libredox" 2084 1915 version = "0.1.8" 2085 1916 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2087 1918 dependencies = [ 2088 1919 "bitflags 2.9.1", 2089 1920 "libc", 2090 - ] 2091 - 2092 - [[package]] 2093 - name = "libsqlite3-sys" 2094 - version = "0.30.1" 2095 - source = "registry+https://github.com/rust-lang/crates.io-index" 2096 - checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" 2097 - dependencies = [ 2098 - "cc", 2099 - "pkg-config", 2100 - "vcpkg", 2101 1921 ] 2102 1922 2103 1923 [[package]] ··· 2166 1986 checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" 2167 1987 2168 1988 [[package]] 2169 - name = "md-5" 2170 - version = "0.10.6" 2171 - source = "registry+https://github.com/rust-lang/crates.io-index" 2172 - checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" 2173 - dependencies = [ 2174 - "cfg-if", 2175 - "digest", 2176 - ] 2177 - 2178 - [[package]] 2179 1989 name = "memchr" 2180 1990 version = "2.7.5" 2181 1991 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2294 2104 checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" 2295 2105 2296 2106 [[package]] 2297 - name = "num-bigint-dig" 2298 - version = "0.8.4" 2299 - source = "registry+https://github.com/rust-lang/crates.io-index" 2300 - checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" 2301 - dependencies = [ 2302 - "byteorder", 2303 - "lazy_static", 2304 - "libm", 2305 - "num-integer", 2306 - "num-iter", 2307 - "num-traits", 2308 - "rand 0.8.5", 2309 - "smallvec", 2310 - "zeroize", 2311 - ] 2312 - 2313 - [[package]] 2314 2107 name = "num-conv" 2315 2108 version = "0.1.0" 2316 2109 source = "registry+https://github.com/rust-lang/crates.io-index" 2317 2110 checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" 2318 2111 2319 2112 [[package]] 2320 - name = "num-integer" 2321 - version = "0.1.46" 2322 - source = "registry+https://github.com/rust-lang/crates.io-index" 2323 - checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" 2324 - dependencies = [ 2325 - "num-traits", 2326 - ] 2327 - 2328 - [[package]] 2329 - name = "num-iter" 2330 - version = "0.1.45" 2331 - source = "registry+https://github.com/rust-lang/crates.io-index" 2332 - checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" 2333 - dependencies = [ 2334 - "autocfg", 2335 - "num-integer", 2336 - "num-traits", 2337 - ] 2338 - 2339 - [[package]] 2340 2113 name = "num-traits" 2341 2114 version = "0.2.19" 2342 2115 source = "registry+https://github.com/rust-lang/crates.io-index" 2343 2116 checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" 2344 2117 dependencies = [ 2345 2118 "autocfg", 2346 - "libm", 2347 2119 ] 2348 2120 2349 2121 [[package]] ··· 2686 2458 checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3" 2687 2459 2688 2460 [[package]] 2689 - name = "pem-rfc7468" 2690 - version = "0.7.0" 2691 - source = "registry+https://github.com/rust-lang/crates.io-index" 2692 - checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" 2693 - dependencies = [ 2694 - "base64ct", 2695 - ] 2696 - 2697 - [[package]] 2698 2461 name = "percent-encoding" 2699 2462 version = "2.3.1" 2700 2463 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2858 2621 ] 2859 2622 2860 2623 [[package]] 2861 - name = "pkcs1" 2862 - version = "0.7.5" 2863 - source = "registry+https://github.com/rust-lang/crates.io-index" 2864 - checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" 2865 - dependencies = [ 2866 - "der", 2867 - "pkcs8", 2868 - "spki", 2869 - ] 2870 - 2871 - [[package]] 2872 - name = "pkcs8" 2873 - version = "0.10.2" 2874 - source = "registry+https://github.com/rust-lang/crates.io-index" 2875 - checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" 2876 - dependencies = [ 2877 - "der", 2878 - "spki", 2879 - ] 2880 - 2881 - [[package]] 2882 2624 name = "pkg-config" 2883 2625 version = "0.3.32" 2884 2626 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3237 2979 ] 3238 2980 3239 2981 [[package]] 3240 - name = "rsa" 3241 - version = "0.9.8" 3242 - source = "registry+https://github.com/rust-lang/crates.io-index" 3243 - checksum = "78928ac1ed176a5ca1d17e578a1825f3d81ca54cf41053a592584b020cfd691b" 3244 - dependencies = [ 3245 - "const-oid", 3246 - "digest", 3247 - "num-bigint-dig", 3248 - "num-integer", 3249 - "num-traits", 3250 - "pkcs1", 3251 - "pkcs8", 3252 - "rand_core 0.6.4", 3253 - "signature", 3254 - "spki", 3255 - "subtle", 3256 - "zeroize", 3257 - ] 3258 - 3259 - [[package]] 3260 2982 name = "rustc-demangle" 3261 2983 version = "0.1.26" 3262 2984 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3549 3271 ] 3550 3272 3551 3273 [[package]] 3552 - name = "sha1" 3553 - version = "0.10.6" 3554 - source = "registry+https://github.com/rust-lang/crates.io-index" 3555 - checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" 3556 - dependencies = [ 3557 - "cfg-if", 3558 - "cpufeatures", 3559 - "digest", 3560 - ] 3561 - 3562 - [[package]] 3563 3274 name = "sha2" 3564 3275 version = "0.10.9" 3565 3276 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3586 3297 ] 3587 3298 3588 3299 [[package]] 3589 - name = "signature" 3590 - version = "2.2.0" 3591 - source = "registry+https://github.com/rust-lang/crates.io-index" 3592 - checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" 3593 - dependencies = [ 3594 - "digest", 3595 - "rand_core 0.6.4", 3596 - ] 3597 - 3598 - [[package]] 3599 3300 name = "simd-adler32" 3600 3301 version = "0.3.7" 3601 3302 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3624 3325 version = "1.15.1" 3625 3326 source = "registry+https://github.com/rust-lang/crates.io-index" 3626 3327 checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" 3627 - dependencies = [ 3628 - "serde", 3629 - ] 3630 3328 3631 3329 [[package]] 3632 3330 name = "socket2" ··· 3687 3385 ] 3688 3386 3689 3387 [[package]] 3690 - name = "spin" 3691 - version = "0.9.8" 3692 - source = "registry+https://github.com/rust-lang/crates.io-index" 3693 - checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" 3694 - dependencies = [ 3695 - "lock_api", 3696 - ] 3697 - 3698 - [[package]] 3699 - name = "spki" 3700 - version = "0.7.3" 3701 - source = "registry+https://github.com/rust-lang/crates.io-index" 3702 - checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" 3703 - dependencies = [ 3704 - "base64ct", 3705 - "der", 3706 - ] 3707 - 3708 - [[package]] 3709 - name = "sqlx" 3710 - version = "0.8.6" 3711 - source = "registry+https://github.com/rust-lang/crates.io-index" 3712 - checksum = "1fefb893899429669dcdd979aff487bd78f4064e5e7907e4269081e0ef7d97dc" 3713 - dependencies = [ 3714 - "sqlx-core", 3715 - "sqlx-macros", 3716 - "sqlx-mysql", 3717 - "sqlx-postgres", 3718 - "sqlx-sqlite", 3719 - ] 3720 - 3721 - [[package]] 3722 - name = "sqlx-core" 3723 - version = "0.8.6" 3724 - source = "registry+https://github.com/rust-lang/crates.io-index" 3725 - checksum = "ee6798b1838b6a0f69c007c133b8df5866302197e404e8b6ee8ed3e3a5e68dc6" 3726 - dependencies = [ 3727 - "base64 0.22.1", 3728 - "bytes", 3729 - "crc", 3730 - "crossbeam-queue", 3731 - "either", 3732 - "event-listener", 3733 - "futures-core", 3734 - "futures-intrusive", 3735 - "futures-io", 3736 - "futures-util", 3737 - "hashbrown 0.15.4", 3738 - "hashlink", 3739 - "indexmap 2.10.0", 3740 - "log", 3741 - "memchr", 3742 - "once_cell", 3743 - "percent-encoding", 3744 - "serde", 3745 - "serde_json", 3746 - "sha2", 3747 - "smallvec", 3748 - "thiserror 2.0.12", 3749 - "tokio", 3750 - "tokio-stream", 3751 - "tracing", 3752 - "url", 3753 - ] 3754 - 3755 - [[package]] 3756 - name = "sqlx-macros" 3757 - version = "0.8.6" 3758 - source = "registry+https://github.com/rust-lang/crates.io-index" 3759 - checksum = "a2d452988ccaacfbf5e0bdbc348fb91d7c8af5bee192173ac3636b5fb6e6715d" 3760 - dependencies = [ 3761 - "proc-macro2", 3762 - "quote", 3763 - "sqlx-core", 3764 - "sqlx-macros-core", 3765 - "syn 2.0.104", 3766 - ] 3767 - 3768 - [[package]] 3769 - name = "sqlx-macros-core" 3770 - version = "0.8.6" 3771 - source = "registry+https://github.com/rust-lang/crates.io-index" 3772 - checksum = "19a9c1841124ac5a61741f96e1d9e2ec77424bf323962dd894bdb93f37d5219b" 3773 - dependencies = [ 3774 - "dotenvy", 3775 - "either", 3776 - "heck 0.5.0", 3777 - "hex", 3778 - "once_cell", 3779 - "proc-macro2", 3780 - "quote", 3781 - "serde", 3782 - "serde_json", 3783 - "sha2", 3784 - "sqlx-core", 3785 - "sqlx-mysql", 3786 - "sqlx-postgres", 3787 - "sqlx-sqlite", 3788 - "syn 2.0.104", 3789 - "tokio", 3790 - "url", 3791 - ] 3792 - 3793 - [[package]] 3794 - name = "sqlx-mysql" 3795 - version = "0.8.6" 3796 - source = "registry+https://github.com/rust-lang/crates.io-index" 3797 - checksum = "aa003f0038df784eb8fecbbac13affe3da23b45194bd57dba231c8f48199c526" 3798 - dependencies = [ 3799 - "atoi", 3800 - "base64 0.22.1", 3801 - "bitflags 2.9.1", 3802 - "byteorder", 3803 - "bytes", 3804 - "crc", 3805 - "digest", 3806 - "dotenvy", 3807 - "either", 3808 - "futures-channel", 3809 - "futures-core", 3810 - "futures-io", 3811 - "futures-util", 3812 - "generic-array", 3813 - "hex", 3814 - "hkdf", 3815 - "hmac", 3816 - "itoa", 3817 - "log", 3818 - "md-5", 3819 - "memchr", 3820 - "once_cell", 3821 - "percent-encoding", 3822 - "rand 0.8.5", 3823 - "rsa", 3824 - "serde", 3825 - "sha1", 3826 - "sha2", 3827 - "smallvec", 3828 - "sqlx-core", 3829 - "stringprep", 3830 - "thiserror 2.0.12", 3831 - "tracing", 3832 - "whoami", 3833 - ] 3834 - 3835 - [[package]] 3836 - name = "sqlx-postgres" 3837 - version = "0.8.6" 3838 - source = "registry+https://github.com/rust-lang/crates.io-index" 3839 - checksum = "db58fcd5a53cf07c184b154801ff91347e4c30d17a3562a635ff028ad5deda46" 3840 - dependencies = [ 3841 - "atoi", 3842 - "base64 0.22.1", 3843 - "bitflags 2.9.1", 3844 - "byteorder", 3845 - "crc", 3846 - "dotenvy", 3847 - "etcetera", 3848 - "futures-channel", 3849 - "futures-core", 3850 - "futures-util", 3851 - "hex", 3852 - "hkdf", 3853 - "hmac", 3854 - "home", 3855 - "itoa", 3856 - "log", 3857 - "md-5", 3858 - "memchr", 3859 - "once_cell", 3860 - "rand 0.8.5", 3861 - "serde", 3862 - "serde_json", 3863 - "sha2", 3864 - "smallvec", 3865 - "sqlx-core", 3866 - "stringprep", 3867 - "thiserror 2.0.12", 3868 - "tracing", 3869 - "whoami", 3870 - ] 3871 - 3872 - [[package]] 3873 - name = "sqlx-sqlite" 3874 - version = "0.8.6" 3875 - source = "registry+https://github.com/rust-lang/crates.io-index" 3876 - checksum = "c2d12fe70b2c1b4401038055f90f151b78208de1f9f89a7dbfd41587a10c3eea" 3877 - dependencies = [ 3878 - "atoi", 3879 - "flume", 3880 - "futures-channel", 3881 - "futures-core", 3882 - "futures-executor", 3883 - "futures-intrusive", 3884 - "futures-util", 3885 - "libsqlite3-sys", 3886 - "log", 3887 - "percent-encoding", 3888 - "serde", 3889 - "serde_urlencoded", 3890 - "sqlx-core", 3891 - "thiserror 2.0.12", 3892 - "tracing", 3893 - "url", 3894 - ] 3895 - 3896 - [[package]] 3897 3388 name = "stable_deref_trait" 3898 3389 version = "1.2.0" 3899 3390 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3931 3422 ] 3932 3423 3933 3424 [[package]] 3934 - name = "stringprep" 3935 - version = "0.1.5" 3936 - source = "registry+https://github.com/rust-lang/crates.io-index" 3937 - checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" 3938 - dependencies = [ 3939 - "unicode-bidi", 3940 - "unicode-normalization", 3941 - "unicode-properties", 3942 - ] 3943 - 3944 - [[package]] 3945 3425 name = "strsim" 3946 3426 version = "0.11.1" 3947 3427 source = "registry+https://github.com/rust-lang/crates.io-index" 3948 3428 checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" 3949 - 3950 - [[package]] 3951 - name = "subtle" 3952 - version = "2.6.1" 3953 - source = "registry+https://github.com/rust-lang/crates.io-index" 3954 - checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" 3955 3429 3956 3430 [[package]] 3957 3431 name = "swift-rs" ··· 4431 3905 ] 4432 3906 4433 3907 [[package]] 4434 - name = "tinyvec" 4435 - version = "1.9.0" 4436 - source = "registry+https://github.com/rust-lang/crates.io-index" 4437 - checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71" 4438 - dependencies = [ 4439 - "tinyvec_macros", 4440 - ] 4441 - 4442 - [[package]] 4443 - name = "tinyvec_macros" 4444 - version = "0.1.1" 4445 - source = "registry+https://github.com/rust-lang/crates.io-index" 4446 - checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" 4447 - 4448 - [[package]] 4449 3908 name = "tokio" 4450 3909 version = "1.47.0" 4451 3910 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4475 3934 ] 4476 3935 4477 3936 [[package]] 4478 - name = "tokio-stream" 4479 - version = "0.1.17" 4480 - source = "registry+https://github.com/rust-lang/crates.io-index" 4481 - checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" 4482 - dependencies = [ 4483 - "futures-core", 4484 - "pin-project-lite", 4485 - "tokio", 4486 - ] 4487 - 4488 - [[package]] 4489 3937 name = "tokio-util" 4490 3938 version = "0.7.15" 4491 3939 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4651 4099 source = "registry+https://github.com/rust-lang/crates.io-index" 4652 4100 checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" 4653 4101 dependencies = [ 4654 - "log", 4655 4102 "pin-project-lite", 4656 4103 "tracing-attributes", 4657 4104 "tracing-core", ··· 4770 4217 ] 4771 4218 4772 4219 [[package]] 4773 - name = "unicode-bidi" 4774 - version = "0.3.18" 4775 - source = "registry+https://github.com/rust-lang/crates.io-index" 4776 - checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" 4777 - 4778 - [[package]] 4779 4220 name = "unicode-ident" 4780 4221 version = "1.0.18" 4781 4222 source = "registry+https://github.com/rust-lang/crates.io-index" 4782 4223 checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" 4783 4224 4784 4225 [[package]] 4785 - name = "unicode-normalization" 4786 - version = "0.1.24" 4787 - source = "registry+https://github.com/rust-lang/crates.io-index" 4788 - checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" 4789 - dependencies = [ 4790 - "tinyvec", 4791 - ] 4792 - 4793 - [[package]] 4794 - name = "unicode-properties" 4795 - version = "0.1.3" 4796 - source = "registry+https://github.com/rust-lang/crates.io-index" 4797 - checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" 4798 - 4799 - [[package]] 4800 4226 name = "unicode-segmentation" 4801 4227 version = "1.12.0" 4802 4228 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4849 4275 "serde", 4850 4276 "wasm-bindgen", 4851 4277 ] 4852 - 4853 - [[package]] 4854 - name = "vcpkg" 4855 - version = "0.2.15" 4856 - source = "registry+https://github.com/rust-lang/crates.io-index" 4857 - checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" 4858 4278 4859 4279 [[package]] 4860 4280 name = "version-compare" ··· 4929 4349 ] 4930 4350 4931 4351 [[package]] 4932 - name = "wasite" 4933 - version = "0.1.0" 4934 - source = "registry+https://github.com/rust-lang/crates.io-index" 4935 - checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" 4936 - 4937 - [[package]] 4938 4352 name = "wasm-bindgen" 4939 4353 version = "0.2.100" 4940 4354 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 5106 4520 "thiserror 2.0.12", 5107 4521 "windows", 5108 4522 "windows-core", 5109 - ] 5110 - 5111 - [[package]] 5112 - name = "whoami" 5113 - version = "1.6.0" 5114 - source = "registry+https://github.com/rust-lang/crates.io-index" 5115 - checksum = "6994d13118ab492c3c80c1f81928718159254c53c472bf9ce36f8dae4add02a7" 5116 - dependencies = [ 5117 - "redox_syscall", 5118 - "wasite", 5119 4523 ] 5120 4524 5121 4525 [[package]] ··· 5277 4681 5278 4682 [[package]] 5279 4683 name = "windows-sys" 5280 - version = "0.48.0" 5281 - source = "registry+https://github.com/rust-lang/crates.io-index" 5282 - checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 5283 - dependencies = [ 5284 - "windows-targets 0.48.5", 5285 - ] 5286 - 5287 - [[package]] 5288 - name = "windows-sys" 5289 4684 version = "0.59.0" 5290 4685 source = "registry+https://github.com/rust-lang/crates.io-index" 5291 4686 checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" ··· 5319 4714 5320 4715 [[package]] 5321 4716 name = "windows-targets" 5322 - version = "0.48.5" 5323 - source = "registry+https://github.com/rust-lang/crates.io-index" 5324 - checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 5325 - dependencies = [ 5326 - "windows_aarch64_gnullvm 0.48.5", 5327 - "windows_aarch64_msvc 0.48.5", 5328 - "windows_i686_gnu 0.48.5", 5329 - "windows_i686_msvc 0.48.5", 5330 - "windows_x86_64_gnu 0.48.5", 5331 - "windows_x86_64_gnullvm 0.48.5", 5332 - "windows_x86_64_msvc 0.48.5", 5333 - ] 5334 - 5335 - [[package]] 5336 - name = "windows-targets" 5337 4717 version = "0.52.6" 5338 4718 source = "registry+https://github.com/rust-lang/crates.io-index" 5339 4719 checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" ··· 5391 4771 5392 4772 [[package]] 5393 4773 name = "windows_aarch64_gnullvm" 5394 - version = "0.48.5" 5395 - source = "registry+https://github.com/rust-lang/crates.io-index" 5396 - checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 5397 - 5398 - [[package]] 5399 - name = "windows_aarch64_gnullvm" 5400 4774 version = "0.52.6" 5401 4775 source = "registry+https://github.com/rust-lang/crates.io-index" 5402 4776 checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" ··· 5415 4789 5416 4790 [[package]] 5417 4791 name = "windows_aarch64_msvc" 5418 - version = "0.48.5" 5419 - source = "registry+https://github.com/rust-lang/crates.io-index" 5420 - checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 5421 - 5422 - [[package]] 5423 - name = "windows_aarch64_msvc" 5424 4792 version = "0.52.6" 5425 4793 source = "registry+https://github.com/rust-lang/crates.io-index" 5426 4794 checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" ··· 5439 4807 5440 4808 [[package]] 5441 4809 name = "windows_i686_gnu" 5442 - version = "0.48.5" 5443 - source = "registry+https://github.com/rust-lang/crates.io-index" 5444 - checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 5445 - 5446 - [[package]] 5447 - name = "windows_i686_gnu" 5448 4810 version = "0.52.6" 5449 4811 source = "registry+https://github.com/rust-lang/crates.io-index" 5450 4812 checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" ··· 5475 4837 5476 4838 [[package]] 5477 4839 name = "windows_i686_msvc" 5478 - version = "0.48.5" 5479 - source = "registry+https://github.com/rust-lang/crates.io-index" 5480 - checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 5481 - 5482 - [[package]] 5483 - name = "windows_i686_msvc" 5484 4840 version = "0.52.6" 5485 4841 source = "registry+https://github.com/rust-lang/crates.io-index" 5486 4842 checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" ··· 5499 4855 5500 4856 [[package]] 5501 4857 name = "windows_x86_64_gnu" 5502 - version = "0.48.5" 5503 - source = "registry+https://github.com/rust-lang/crates.io-index" 5504 - checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 5505 - 5506 - [[package]] 5507 - name = "windows_x86_64_gnu" 5508 4858 version = "0.52.6" 5509 4859 source = "registry+https://github.com/rust-lang/crates.io-index" 5510 4860 checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" ··· 5523 4873 5524 4874 [[package]] 5525 4875 name = "windows_x86_64_gnullvm" 5526 - version = "0.48.5" 5527 - source = "registry+https://github.com/rust-lang/crates.io-index" 5528 - checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 5529 - 5530 - [[package]] 5531 - name = "windows_x86_64_gnullvm" 5532 4876 version = "0.52.6" 5533 4877 source = "registry+https://github.com/rust-lang/crates.io-index" 5534 4878 checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" ··· 5544 4888 version = "0.42.2" 5545 4889 source = "registry+https://github.com/rust-lang/crates.io-index" 5546 4890 checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" 5547 - 5548 - [[package]] 5549 - name = "windows_x86_64_msvc" 5550 - version = "0.48.5" 5551 - source = "registry+https://github.com/rust-lang/crates.io-index" 5552 - checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 5553 4891 5554 4892 [[package]] 5555 4893 name = "windows_x86_64_msvc" ··· 5795 5133 "syn 2.0.104", 5796 5134 "synstructure", 5797 5135 ] 5798 - 5799 - [[package]] 5800 - name = "zeroize" 5801 - version = "1.8.1" 5802 - source = "registry+https://github.com/rust-lang/crates.io-index" 5803 - checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" 5804 5136 5805 5137 [[package]] 5806 5138 name = "zerotrie"
+1 -1
src-tauri/Cargo.toml
··· 22 22 tauri-plugin-opener = "2" 23 23 serde = { version = "1", features = ["derive"] } 24 24 serde_json = "1" 25 - sqlx = { version = "0.8.6", features = [ "sqlite", "runtime-tokio" ] } 26 25 tokio = { version = "1.47.0", features = [ "macros" ] } 27 26 dirs = "6.0.0" 28 27 anyhow = "1.0.99" 28 + flate2 = "1.1.2" 29 29
+29
src-tauri/src/frontend_calls/get_actions.rs
··· 1 + use crate::structs::action::{ Action, ActionParameters }; 2 + 3 + #[tauri::command] 4 + pub fn get_actions() -> Vec<Action> { 5 + vec![ 6 + Action { 7 + name: "If Equals".into(), 8 + parameters: vec![ ActionParameters::AnyType, ActionParameters::Label(" = "), ActionParameters::AnyType ] 9 + } 10 + ] 11 + } 12 + 13 + #[tauri::command] 14 + pub fn get_action( name: String ) -> Option<Action> { 15 + let actions = vec![ 16 + Action { 17 + name: "If Equals".into(), 18 + parameters: vec![ ActionParameters::AnyType, ActionParameters::Label(" = "), ActionParameters::AnyType ] 19 + } 20 + ]; 21 + 22 + let action = actions.iter().find(| x | x.name == name); 23 + 24 + if action.is_some(){ 25 + Some(action.unwrap().clone()) 26 + } else{ 27 + None 28 + } 29 + }
+4 -1
src-tauri/src/frontend_calls/mod.rs
··· 1 - pub mod get_addresses; 1 + pub mod get_addresses; 2 + pub mod get_actions; 3 + 4 + pub mod triggers;
+88
src-tauri/src/frontend_calls/triggers.rs
··· 1 + use serde_json::{json, Value}; 2 + use tauri::State; 3 + 4 + use crate::utils::config::Config; 5 + 6 + #[tauri::command] 7 + pub fn new_trigger( id: String, conf: State<Config> ){ 8 + if let Some(triggers) = conf.get("triggers").unwrap_or(Value::Array(Vec::new())).as_array(){ 9 + let mut triggers = triggers.clone(); 10 + triggers.push(json!({ 11 + "id": id, 12 + "address": "", 13 + "actions": [] 14 + })); 15 + 16 + conf.set("triggers", Value::Array(triggers)); 17 + conf.save(); 18 + } 19 + } 20 + 21 + #[tauri::command] 22 + pub fn rm_trigger( indx: usize, conf: State<Config> ){ 23 + if let Some(triggers) = conf.get("triggers").unwrap_or(Value::Array(Vec::new())).as_array(){ 24 + let mut triggers = triggers.clone(); 25 + triggers.remove(indx); 26 + 27 + conf.set("triggers", Value::Array(triggers)); 28 + conf.save(); 29 + } 30 + } 31 + 32 + #[tauri::command] 33 + pub fn add_trigger_action( indx: usize, action: Value, conf: State<Config> ){ 34 + if let Some(triggers) = conf.get("triggers").unwrap_or(Value::Array(Vec::new())).as_array(){ 35 + let mut triggers = triggers.clone(); 36 + 37 + let actions = triggers[indx]["actions"].as_array_mut().unwrap(); 38 + actions.push(action); 39 + 40 + conf.set("triggers", Value::Array(triggers)); 41 + conf.save(); 42 + } 43 + } 44 + 45 + #[tauri::command] 46 + pub fn rm_trigger_action( indx: usize, action_indx: usize, conf: State<Config> ){ 47 + if let Some(triggers) = conf.get("triggers").unwrap_or(Value::Array(Vec::new())).as_array(){ 48 + let mut triggers = triggers.clone(); 49 + 50 + let actions = triggers[indx]["actions"].as_array_mut().unwrap(); 51 + actions.remove(action_indx); 52 + 53 + conf.set("triggers", Value::Array(triggers)); 54 + conf.save(); 55 + } 56 + } 57 + 58 + #[tauri::command] 59 + pub fn set_trigger_action_type( indx: usize, action_indx: usize, action_type: Option<String>, conf: State<Config> ){ 60 + if let Some(triggers) = conf.get("triggers").unwrap_or(Value::Array(Vec::new())).as_array(){ 61 + let mut triggers = triggers.clone(); 62 + 63 + triggers[indx]["actions"][action_indx]["actionType"] = if action_type.is_none(){ 64 + Value::Null 65 + } else { 66 + Value::String(action_type.unwrap()) 67 + }; 68 + 69 + conf.set("triggers", Value::Array(triggers)); 70 + conf.save(); 71 + } 72 + } 73 + 74 + #[tauri::command] 75 + pub fn set_trigger_address( indx: usize, address: String, conf: State<Config> ){ 76 + if let Some(triggers) = conf.get("triggers").unwrap_or(Value::Array(Vec::new())).as_array(){ 77 + let mut triggers = triggers.clone(); 78 + triggers[indx]["address"] = Value::String(address); 79 + 80 + conf.set("triggers", Value::Array(triggers)); 81 + conf.save(); 82 + } 83 + } 84 + 85 + #[tauri::command] 86 + pub fn list_triggers( conf: State<Config> ) -> Value{ 87 + conf.get("triggers").unwrap_or(Value::Array(Vec::new())) 88 + }
+14 -12
src-tauri/src/lib.rs
··· 1 - use std::{fs, sync::Mutex}; 1 + use std::{ fs, sync::Mutex }; 2 2 3 - use sqlx::{ migrate::MigrateDatabase, Sqlite, SqlitePool }; 4 3 use frontend_calls::*; 5 4 6 5 use crate::{ setup::setup, utils::config::Config }; 7 6 8 7 mod frontend_calls; 8 + mod structs; 9 9 mod setup; 10 10 mod utils; 11 11 mod osc; ··· 26 26 } 27 27 } 28 28 29 - let db_file = container_folder.join("VRCMacros.db"); 30 - if !db_file.exists(){ Sqlite::create_database(db_file.to_str().unwrap()).await.unwrap(); } 31 - 32 - let conf_file = container_folder.join("VRCMacros.json"); 33 - if !conf_file.exists(){ fs::write(&conf_file, "{}").unwrap() } 34 - 35 - let pool = SqlitePool::connect(db_file.to_str().unwrap()).await.unwrap(); 29 + let conf_file = container_folder.join("conf"); 36 30 let conf = Config::new(conf_file); 37 31 38 32 static ADDRESSES: Mutex<Vec<String>> = Mutex::new(Vec::new()); ··· 40 34 tauri::Builder::default() 41 35 .plugin(tauri_plugin_opener::init()) 42 36 .invoke_handler(tauri::generate_handler![ 43 - get_addresses::get_addresses 37 + get_addresses::get_addresses, 38 + get_actions::get_actions, 39 + get_actions::get_action, 40 + 41 + triggers::new_trigger, 42 + triggers::rm_trigger, 43 + triggers::add_trigger_action, 44 + triggers::rm_trigger_action, 45 + triggers::set_trigger_action_type, 46 + triggers::set_trigger_address, 47 + triggers::list_triggers, 44 48 ]) 45 - .manage(pool) 46 49 .manage(conf) 47 50 .manage(&ADDRESSES) 48 51 .setup(| app | { 49 52 setup(app, &ADDRESSES); 50 - 51 53 Ok(()) 52 54 }) 53 55 .run(tauri::generate_context!())
-2
src-tauri/src/setup.rs
··· 20 20 window.emit("osc-message", &message).unwrap(); 21 21 22 22 let addr = message.address.clone(); 23 - dbg!(&addr); 24 - 25 23 let mut addresses = addresses.lock().unwrap(); 26 24 if !addresses.contains(&addr){ addresses.push(addr); } 27 25 }
+19
src-tauri/src/structs/action.rs
··· 1 + use serde::Serialize; 2 + 3 + #[derive(Serialize, Clone)] 4 + #[serde(tag = "key", content = "value")] 5 + pub enum ActionParameters{ 6 + AnyType, 7 + Int, 8 + String, 9 + Float, 10 + Boolean, 11 + Actions, 12 + Label(&'static str) 13 + } 14 + 15 + #[derive(Serialize, Clone)] 16 + pub struct Action{ 17 + pub name: String, 18 + pub parameters: Vec<ActionParameters> 19 + }
+1
src-tauri/src/structs/mod.rs
··· 1 + pub mod action;
+25 -16
src-tauri/src/utils/config.rs
··· 1 - use std::{ collections::HashMap, fs, path::PathBuf, sync::Mutex }; 1 + use std::{ collections::HashMap, fs::File, io::{ Read, Write }, path::PathBuf, sync::Mutex }; 2 2 3 - use serde::{ Deserialize, Serialize }; 3 + use flate2::{ read::GzDecoder, write::GzEncoder, Compression }; 4 4 use serde_json::Value; 5 5 6 - #[derive(Clone, Deserialize, Serialize)] 7 - pub enum ConfigValue{ 8 - Bool(bool), 9 - String(String), 10 - Number(f64), 11 - Null 12 - } 13 - 14 6 pub struct Config{ 15 - store: Mutex<HashMap<String, ConfigValue>>, 7 + store: Mutex<HashMap<String, Value>>, 8 + path: PathBuf 16 9 } 17 10 18 11 impl Config{ 19 12 pub fn new( path: PathBuf ) -> Self{ 20 - let json_string = fs::read_to_string(path).unwrap(); 13 + let json_string = if path.exists(){ 14 + let mut decoder = GzDecoder::new(File::open(&path).unwrap()); 15 + let mut string = String::new(); 16 + 17 + decoder.read_to_string(&mut string).unwrap(); 18 + string 19 + } else{ 20 + "{}".into() 21 + }; 22 + 21 23 let json: Value = serde_json::from_str(&json_string).unwrap(); 22 24 23 25 let mut hashmap = HashMap::new(); 24 26 25 27 let obj = json.as_object().unwrap(); 26 28 for ( key, val ) in obj{ 27 - hashmap.insert(key.clone(), if val.is_boolean(){ ConfigValue::Bool(val.as_bool().unwrap()) } else if val.is_number(){ ConfigValue::Number(val.as_f64().unwrap()) } else if val.is_string(){ ConfigValue::String(val.as_str().unwrap().to_owned()) } else { ConfigValue::Null }); 29 + hashmap.insert(key.clone(), val.clone()); 28 30 } 29 31 30 32 Config { 31 33 store: Mutex::new(hashmap), 34 + path: path 32 35 } 33 36 } 34 37 35 - pub fn set( &self, key: &str, value: ConfigValue ){ 38 + pub fn set( &self, key: &str, value: Value ){ 36 39 self.store.lock().unwrap().insert(key.to_owned(), value); 37 40 } 38 41 39 - pub fn get( &self, key: &str ) -> Option<ConfigValue>{ 42 + pub fn get( &self, key: &str ) -> Option<Value>{ 40 43 let store = self.store.lock().unwrap(); 41 44 let val = store.get(&key.to_owned()); 42 45 ··· 49 52 50 53 pub fn save( &self ){ 51 54 let dat = serde_json::to_string(&self.store.lock().unwrap().clone()).unwrap(); 52 - fs::write(dirs::config_dir().unwrap().join("VRCMacros").join("VRCMacros.json"), dat).unwrap(); 55 + dbg!(&dat); 56 + 57 + let file = File::create(&self.path).unwrap(); 58 + let mut encoder = GzEncoder::new(file, Compression::default()); 59 + 60 + encoder.write_all(dat.as_bytes()).unwrap(); 61 + encoder.finish().unwrap(); 53 62 } 54 63 }
+33 -14
src/Components/Actions.tsx
··· 1 - import { Accessor, createSignal, For, Setter } from 'solid-js'; 1 + import { For } from 'solid-js'; 2 2 import './Actions.css'; 3 3 import { TriggerEl } from './TriggerEl'; 4 + import { createStore } from 'solid-js/store'; 5 + import { invoke } from '@tauri-apps/api/core'; 4 6 5 7 export interface Trigger{ 8 + id: string, 6 9 address: string, 7 - actions: Accessor<any>, 8 - setActions: Setter<any> 10 + actions: any[] 9 11 } 10 12 11 13 export let Actions = () => { 12 - let [ triggers, setTriggers ] = createSignal<Trigger[]>([], { equals: false }); 14 + let [ triggers, setTriggers ] = createStore<Trigger[]>([]); 15 + 16 + invoke<Trigger[]>('list_triggers').then(triggers => { setTriggers(triggers) }) 13 17 14 18 return ( 15 19 <div app-page> 16 20 <div app-col> 17 21 <div style={{ width: '100%' }}><h1>Actions</h1></div> 18 22 <div app-button style={{ width: 'fit-content', "margin-left": '50%' }} onClick={() => { 19 - let trig = triggers(); 20 - let [ actions, setActions ] = createSignal([], { equals: false }); 23 + let id = Math.random().toString().replace('0.', ''); 21 24 22 - trig.push({ address: '', actions, setActions }); 23 - setTriggers(trig); 25 + invoke('new_trigger', { id }); 26 + setTriggers(( trig ) => [ 27 + ...trig, 28 + { address: '', actions: [], id } 29 + ]); 24 30 }}>+</div> 25 31 </div> 26 32 27 - <For each={triggers()}> 28 - { ( item ) => <TriggerEl 33 + <For each={triggers}> 34 + { ( item, index ) => <TriggerEl 29 35 trigger={item} 30 36 onDelete={() => { 31 - let trig = triggers(); 32 - trig = trig.filter(x => x !== item); 33 - 34 - setTriggers(trig); 37 + invoke('rm_trigger', { indx: index() }); 38 + setTriggers(( trig ) => trig.filter(x => x.id !== item.id)); 39 + }} 40 + onAddAction={( action ) => { 41 + invoke('add_trigger_action', { indx: index(), action }); 42 + setTriggers(index(), "actions", ( actions ) => [ ...actions, action ]); 43 + }} 44 + onDeleteAction={( id, indx ) => { 45 + invoke('rm_trigger_action', { indx: index(), actionIndx: indx }); 46 + setTriggers(index(), "actions", ( actions ) => actions.filter(x => x.id !== id)) 47 + }} 48 + onSetActionType={( i, type ) => { 49 + invoke('set_trigger_action_type', { indx: index(), actionIndx: i, actionType: type }); 50 + setTriggers(index(), "actions", i, "actionType", type) 51 + }} 52 + onSetOSCAddress={( address ) => { 53 + invoke('set_trigger_address', { indx: index(), address }); 35 54 }} /> } 36 55 </For> 37 56 </div>
+3
src/Components/TextInput.css
··· 18 18 float: left; 19 19 border-radius: 5px; 20 20 21 + max-height: 300px; 22 + overflow-y: auto; 23 + 21 24 background: #525252; 22 25 z-index: 50; 23 26 }
+14 -5
src/Components/TextInput.tsx
··· 5 5 export interface TextInputProps{ 6 6 placeholder: string, 7 7 value?: string, 8 - requestSuggestions?: ( text: string ) => Promise<string[]> 8 + requestSuggestions?: ( text: string ) => Promise<string[]>, 9 + change?: ( text: string ) => void 9 10 } 10 11 11 12 export let TextInput = ( props: TextInputProps ) => { ··· 26 27 if(s != suggestions()){ 27 28 setSuggestions(s); 28 29 29 - setSuggestionsOpen(s !== null && s.length > 0 && input.value.length > 0); 30 - changeSelection(() => { suggestionsIndex = 0; }); 30 + let open = s !== null && s.length > 0 && input.value.length > 0; 31 + 32 + setSuggestionsOpen(open); 33 + if(open)changeSelection(() => { suggestionsIndex = 0; }); 31 34 } 32 35 } 33 36 } 34 37 35 - let onKeyUp = ( ev: KeyboardEvent ) => { 38 + let onKeyDown = ( ev: KeyboardEvent ) => { 36 39 switch(ev.key){ 37 40 case 'ArrowDown': 38 41 changeSelection(() => { ··· 50 53 let currentDiv = suggestionsContainer.children[suggestionsIndex]; 51 54 if(currentDiv)input.value = currentDiv.innerHTML; 52 55 56 + props.change ? props.change(input.value) : null 53 57 setSuggestionsOpen(false); 54 58 break; 55 59 } ··· 60 64 child.classList.remove('suggestion-selected'); 61 65 62 66 cb(); 67 + 68 + let height = suggestionsIndex * 19; 69 + suggestionsContainer.scrollTo(0, height - 150); 63 70 64 71 let currentDiv = suggestionsContainer.children[suggestionsIndex]; 65 72 if(currentDiv)currentDiv.classList.add('suggestion-selected'); ··· 73 80 type="text" 74 81 placeholder={ props.placeholder } 75 82 value={ props.value || "" } 83 + onChange={() => props.change ? props.change(input.value) : null} 76 84 onInput={onInput} 77 - onKeyUp={onKeyUp} 85 + onKeyDown={onKeyDown} 86 + onFocusOut={() => setSuggestionsOpen(false)} 78 87 ref={input} /> 79 88 80 89 <Show when={suggestionsOpen()}>
+42 -17
src/Components/TriggerEl.tsx
··· 2 2 import { Trigger } from "./Actions" 3 3 import { TextInput } from "./TextInput" 4 4 import { invoke } from "@tauri-apps/api/core" 5 + import { ActionType } from "../Structs/ActionType" 5 6 6 7 export interface TriggerElProps{ 7 8 trigger: Trigger, 8 9 9 - onDelete: () => void 10 + onDelete: () => void, 11 + 12 + onAddAction: ( value: any ) => void, 13 + onDeleteAction: ( id: string, index: number ) => void, 14 + 15 + onSetActionType: ( index: number, type: string | null ) => void, 16 + 17 + onSetOSCAddress: ( address: string ) => void, 10 18 } 11 19 12 - export let TriggerEl = ( { trigger, onDelete }: TriggerElProps ) => { 20 + export let TriggerEl = ( { trigger, onDelete, onAddAction, onDeleteAction, onSetActionType, onSetOSCAddress }: TriggerElProps ) => { 13 21 let suggestOSCAddresses = async ( text: string ): Promise<string[]> => { 14 22 let addresses = await invoke<string[]>('get_addresses'); 15 23 return addresses.filter(x => x.toLowerCase().includes(text.toLowerCase())); 16 24 } 17 25 26 + let suggestActionNames = async ( text: string ): Promise<string[]> => { 27 + let actions = await invoke<ActionType[]>('get_actions'); 28 + return actions.filter(x => x.name.toLowerCase().includes(text.toLowerCase())).map(x => x.name); 29 + } 30 + 18 31 return ( 19 32 <div app-trigger-el> 20 33 <div app-col> 21 34 OSC Address: 22 35 <div style={{ width: '400px', display: 'inline-block', "margin-left": '10px' }}> 23 - <TextInput placeholder="/avatar/parameters/MyValue" value={ trigger.address } requestSuggestions={suggestOSCAddresses} /> 36 + <TextInput 37 + placeholder="/avatar/parameters/MyValue" 38 + value={ trigger.address } 39 + requestSuggestions={suggestOSCAddresses} 40 + change={onSetOSCAddress} /> 24 41 </div> 25 42 <div app-icon style={{ 'margin-left': 'calc(100% - 545px)' }} onClick={onDelete}> 26 43 <img src="/assets/icons/trash-can-solid-full.svg" width="18" /> ··· 28 45 </div> 29 46 30 47 <br /> 31 - <For each={trigger.actions()}> 32 - { item => <div app-trigger-action app-col> 33 - <div style={{ width: 'calc(100% - 40px)', height: '30px', display: 'flex', "justify-content": 'center', 'align-items': 'center' }}> 34 - <TextInput placeholder="Search Actions..." /> 48 + <For each={trigger.actions}> 49 + { ( item, index ) => <div app-trigger-action> 50 + <div app-col> 51 + <div style={{ width: 'calc(100% - 40px)', height: '30px', display: 'flex', "justify-content": 'center', 'align-items': 'center' }}> 52 + <TextInput 53 + placeholder="Search Actions..." 54 + requestSuggestions={suggestActionNames} 55 + value={item.actionType} 56 + change={async ( text: string ) => { 57 + let action = await invoke<ActionType>('get_action', { name: text }); 58 + if(action)onSetActionType(index(), action.name); 59 + else onSetActionType(index(), null); 60 + }} /> 61 + </div> 62 + <div app-icon style={{ width: '40px' }} onClick={() => { 63 + onDeleteAction(item.id, index()); 64 + }}> 65 + <img src="/assets/icons/trash-can-solid-full.svg" width="18" /> 66 + </div> 35 67 </div> 36 - <div app-icon style={{ width: '40px' }} onClick={() => { 37 - let actions = trigger.actions(); 38 - actions = actions.filter(( x: any ) => x !== item); 39 68 40 - trigger.setActions(actions); 41 - }}> 42 - <img src="/assets/icons/trash-can-solid-full.svg" width="18" /> 69 + <div> 70 + 43 71 </div> 44 72 </div> } 45 73 </For> 46 74 47 75 <br /> 48 76 <div app-button onClick={() => { 49 - let actions = trigger.actions(); 50 - actions.push({}); 51 - 52 - trigger.setActions(actions); 77 + onAddAction({ id: Math.random().toString().replace('0.', '') }) 53 78 }}>Add Action +</div> 54 79 </div> 55 80 )
+4
src/Structs/ActionType.ts
··· 1 + export interface ActionType{ 2 + name: string, 3 + parameters: any[] 4 + }