tangled.org trending bluesky account
12
fork

Configure Feed

Select the types of activity you want to include in your feed.

Yeah that's working perfectly

+695 -113
+2 -1
.gitignore
··· 2 2 /days/*.json 3 3 .env 4 4 .idea 5 - /wasm/dist 5 + /wasm/dist 6 + ./stitch_counter.sqlite
+611 -4
Cargo.lock
··· 151 151 ] 152 152 153 153 [[package]] 154 + name = "atoi" 155 + version = "2.0.0" 156 + source = "registry+https://github.com/rust-lang/crates.io-index" 157 + checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" 158 + dependencies = [ 159 + "num-traits", 160 + ] 161 + 162 + [[package]] 154 163 name = "atproto_api" 155 164 version = "0.1.0" 156 165 dependencies = [ ··· 319 328 version = "2.9.1" 320 329 source = "registry+https://github.com/rust-lang/crates.io-index" 321 330 checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" 331 + dependencies = [ 332 + "serde", 333 + ] 322 334 323 335 [[package]] 324 336 name = "block-buffer" ··· 359 371 version = "0.1.0" 360 372 dependencies = [ 361 373 "anyhow", 362 - "clap", 374 + "async-trait", 375 + "atproto_api", 376 + "atrium-api", 363 377 "dotenv", 364 378 "env_logger", 365 379 "log", 366 - "logic", 380 + "rocketman", 381 + "serde", 382 + "serde_json", 383 + "sqlx", 367 384 "tokio", 368 385 ] 369 386 ··· 527 544 ] 528 545 529 546 [[package]] 547 + name = "crc" 548 + version = "3.3.0" 549 + source = "registry+https://github.com/rust-lang/crates.io-index" 550 + checksum = "9710d3b3739c2e349eb44fe848ad0b7c8cb1e42bd87ee49371df2f7acaf3e675" 551 + dependencies = [ 552 + "crc-catalog", 553 + ] 554 + 555 + [[package]] 556 + name = "crc-catalog" 557 + version = "2.4.0" 558 + source = "registry+https://github.com/rust-lang/crates.io-index" 559 + checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" 560 + 561 + [[package]] 530 562 name = "crc32fast" 531 563 version = "1.4.2" 532 564 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 554 586 ] 555 587 556 588 [[package]] 589 + name = "crossbeam-queue" 590 + version = "0.3.12" 591 + source = "registry+https://github.com/rust-lang/crates.io-index" 592 + checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" 593 + dependencies = [ 594 + "crossbeam-utils", 595 + ] 596 + 597 + [[package]] 557 598 name = "crossbeam-utils" 558 599 version = "0.8.21" 559 600 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 663 704 checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" 664 705 dependencies = [ 665 706 "const-oid", 707 + "pem-rfc7468", 666 708 "zeroize", 667 709 ] 668 710 ··· 727 769 checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" 728 770 729 771 [[package]] 772 + name = "dotenvy" 773 + version = "0.15.7" 774 + source = "registry+https://github.com/rust-lang/crates.io-index" 775 + checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" 776 + 777 + [[package]] 730 778 name = "ecdsa" 731 779 version = "0.16.9" 732 780 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 740 788 ] 741 789 742 790 [[package]] 791 + name = "either" 792 + version = "1.15.0" 793 + source = "registry+https://github.com/rust-lang/crates.io-index" 794 + checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" 795 + dependencies = [ 796 + "serde", 797 + ] 798 + 799 + [[package]] 743 800 name = "elliptic-curve" 744 801 version = "0.13.8" 745 802 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 794 851 dependencies = [ 795 852 "libc", 796 853 "windows-sys 0.59.0", 854 + ] 855 + 856 + [[package]] 857 + name = "etcetera" 858 + version = "0.8.0" 859 + source = "registry+https://github.com/rust-lang/crates.io-index" 860 + checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" 861 + dependencies = [ 862 + "cfg-if", 863 + "home", 864 + "windows-sys 0.48.0", 797 865 ] 798 866 799 867 [[package]] ··· 898 966 checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" 899 967 dependencies = [ 900 968 "futures-core", 969 + "futures-sink", 901 970 ] 902 971 903 972 [[package]] ··· 907 976 checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" 908 977 909 978 [[package]] 979 + name = "futures-executor" 980 + version = "0.3.31" 981 + source = "registry+https://github.com/rust-lang/crates.io-index" 982 + checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" 983 + dependencies = [ 984 + "futures-core", 985 + "futures-task", 986 + "futures-util", 987 + ] 988 + 989 + [[package]] 990 + name = "futures-intrusive" 991 + version = "0.5.0" 992 + source = "registry+https://github.com/rust-lang/crates.io-index" 993 + checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" 994 + dependencies = [ 995 + "futures-core", 996 + "lock_api", 997 + "parking_lot", 998 + ] 999 + 1000 + [[package]] 1001 + name = "futures-io" 1002 + version = "0.3.31" 1003 + source = "registry+https://github.com/rust-lang/crates.io-index" 1004 + checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" 1005 + 1006 + [[package]] 910 1007 name = "futures-macro" 911 1008 version = "0.3.31" 912 1009 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 936 1033 checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" 937 1034 dependencies = [ 938 1035 "futures-core", 1036 + "futures-io", 939 1037 "futures-macro", 940 1038 "futures-sink", 941 1039 "futures-task", 1040 + "memchr", 942 1041 "pin-project-lite", 943 1042 "pin-utils", 944 1043 "slab", ··· 1042 1141 ] 1043 1142 1044 1143 [[package]] 1144 + name = "hashlink" 1145 + version = "0.10.0" 1146 + source = "registry+https://github.com/rust-lang/crates.io-index" 1147 + checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" 1148 + dependencies = [ 1149 + "hashbrown 0.15.3", 1150 + ] 1151 + 1152 + [[package]] 1045 1153 name = "heck" 1046 1154 version = "0.5.0" 1047 1155 source = "registry+https://github.com/rust-lang/crates.io-index" 1048 1156 checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" 1049 1157 1050 1158 [[package]] 1159 + name = "hex" 1160 + version = "0.4.3" 1161 + source = "registry+https://github.com/rust-lang/crates.io-index" 1162 + checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" 1163 + 1164 + [[package]] 1165 + name = "hkdf" 1166 + version = "0.12.4" 1167 + source = "registry+https://github.com/rust-lang/crates.io-index" 1168 + checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" 1169 + dependencies = [ 1170 + "hmac", 1171 + ] 1172 + 1173 + [[package]] 1051 1174 name = "hmac" 1052 1175 version = "0.12.1" 1053 1176 source = "registry+https://github.com/rust-lang/crates.io-index" 1054 1177 checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" 1055 1178 dependencies = [ 1056 1179 "digest", 1180 + ] 1181 + 1182 + [[package]] 1183 + name = "home" 1184 + version = "0.5.11" 1185 + source = "registry+https://github.com/rust-lang/crates.io-index" 1186 + checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" 1187 + dependencies = [ 1188 + "windows-sys 0.59.0", 1057 1189 ] 1058 1190 1059 1191 [[package]] ··· 1430 1562 version = "1.5.0" 1431 1563 source = "registry+https://github.com/rust-lang/crates.io-index" 1432 1564 checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" 1565 + dependencies = [ 1566 + "spin", 1567 + ] 1433 1568 1434 1569 [[package]] 1435 1570 name = "libc" ··· 1438 1573 checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" 1439 1574 1440 1575 [[package]] 1576 + name = "libm" 1577 + version = "0.2.15" 1578 + source = "registry+https://github.com/rust-lang/crates.io-index" 1579 + checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" 1580 + 1581 + [[package]] 1582 + name = "libredox" 1583 + version = "0.1.10" 1584 + source = "registry+https://github.com/rust-lang/crates.io-index" 1585 + checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb" 1586 + dependencies = [ 1587 + "bitflags", 1588 + "libc", 1589 + "redox_syscall", 1590 + ] 1591 + 1592 + [[package]] 1593 + name = "libsqlite3-sys" 1594 + version = "0.30.1" 1595 + source = "registry+https://github.com/rust-lang/crates.io-index" 1596 + checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" 1597 + dependencies = [ 1598 + "cc", 1599 + "pkg-config", 1600 + "vcpkg", 1601 + ] 1602 + 1603 + [[package]] 1441 1604 name = "linux-raw-sys" 1442 1605 version = "0.9.4" 1443 1606 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1522 1685 checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" 1523 1686 dependencies = [ 1524 1687 "regex-automata 0.1.10", 1688 + ] 1689 + 1690 + [[package]] 1691 + name = "md-5" 1692 + version = "0.10.6" 1693 + source = "registry+https://github.com/rust-lang/crates.io-index" 1694 + checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" 1695 + dependencies = [ 1696 + "cfg-if", 1697 + "digest", 1525 1698 ] 1526 1699 1527 1700 [[package]] ··· 1647 1820 ] 1648 1821 1649 1822 [[package]] 1823 + name = "num-bigint-dig" 1824 + version = "0.8.4" 1825 + source = "registry+https://github.com/rust-lang/crates.io-index" 1826 + checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" 1827 + dependencies = [ 1828 + "byteorder", 1829 + "lazy_static", 1830 + "libm", 1831 + "num-integer", 1832 + "num-iter", 1833 + "num-traits", 1834 + "rand", 1835 + "smallvec", 1836 + "zeroize", 1837 + ] 1838 + 1839 + [[package]] 1840 + name = "num-integer" 1841 + version = "0.1.46" 1842 + source = "registry+https://github.com/rust-lang/crates.io-index" 1843 + checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" 1844 + dependencies = [ 1845 + "num-traits", 1846 + ] 1847 + 1848 + [[package]] 1849 + name = "num-iter" 1850 + version = "0.1.45" 1851 + source = "registry+https://github.com/rust-lang/crates.io-index" 1852 + checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" 1853 + dependencies = [ 1854 + "autocfg", 1855 + "num-integer", 1856 + "num-traits", 1857 + ] 1858 + 1859 + [[package]] 1650 1860 name = "num-traits" 1651 1861 version = "0.2.19" 1652 1862 source = "registry+https://github.com/rust-lang/crates.io-index" 1653 1863 checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" 1654 1864 dependencies = [ 1655 1865 "autocfg", 1866 + "libm", 1656 1867 ] 1657 1868 1658 1869 [[package]] ··· 1762 1973 ] 1763 1974 1764 1975 [[package]] 1976 + name = "pem-rfc7468" 1977 + version = "0.7.0" 1978 + source = "registry+https://github.com/rust-lang/crates.io-index" 1979 + checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" 1980 + dependencies = [ 1981 + "base64ct", 1982 + ] 1983 + 1984 + [[package]] 1765 1985 name = "percent-encoding" 1766 1986 version = "2.3.1" 1767 1987 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1780 2000 checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 1781 2001 1782 2002 [[package]] 2003 + name = "pkcs1" 2004 + version = "0.7.5" 2005 + source = "registry+https://github.com/rust-lang/crates.io-index" 2006 + checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" 2007 + dependencies = [ 2008 + "der", 2009 + "pkcs8", 2010 + "spki", 2011 + ] 2012 + 2013 + [[package]] 2014 + name = "pkcs8" 2015 + version = "0.10.2" 2016 + source = "registry+https://github.com/rust-lang/crates.io-index" 2017 + checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" 2018 + dependencies = [ 2019 + "der", 2020 + "spki", 2021 + ] 2022 + 2023 + [[package]] 1783 2024 name = "pkg-config" 1784 2025 version = "0.3.32" 1785 2026 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1893 2134 1894 2135 [[package]] 1895 2136 name = "redox_syscall" 1896 - version = "0.5.12" 2137 + version = "0.5.17" 1897 2138 source = "registry+https://github.com/rust-lang/crates.io-index" 1898 - checksum = "928fca9cf2aa042393a8325b9ead81d2f0df4cb12e1e24cef072922ccd99c5af" 2139 + checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77" 1899 2140 dependencies = [ 1900 2141 "bitflags", 1901 2142 ] ··· 2032 2273 "tracing-subscriber", 2033 2274 "url", 2034 2275 "zstd", 2276 + ] 2277 + 2278 + [[package]] 2279 + name = "rsa" 2280 + version = "0.9.8" 2281 + source = "registry+https://github.com/rust-lang/crates.io-index" 2282 + checksum = "78928ac1ed176a5ca1d17e578a1825f3d81ca54cf41053a592584b020cfd691b" 2283 + dependencies = [ 2284 + "const-oid", 2285 + "digest", 2286 + "num-bigint-dig", 2287 + "num-integer", 2288 + "num-traits", 2289 + "pkcs1", 2290 + "pkcs8", 2291 + "rand_core", 2292 + "signature", 2293 + "spki", 2294 + "subtle", 2295 + "zeroize", 2035 2296 ] 2036 2297 2037 2298 [[package]] ··· 2344 2605 version = "1.15.0" 2345 2606 source = "registry+https://github.com/rust-lang/crates.io-index" 2346 2607 checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" 2608 + dependencies = [ 2609 + "serde", 2610 + ] 2347 2611 2348 2612 [[package]] 2349 2613 name = "socket2" ··· 2365 2629 ] 2366 2630 2367 2631 [[package]] 2632 + name = "spki" 2633 + version = "0.7.3" 2634 + source = "registry+https://github.com/rust-lang/crates.io-index" 2635 + checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" 2636 + dependencies = [ 2637 + "base64ct", 2638 + "der", 2639 + ] 2640 + 2641 + [[package]] 2642 + name = "sqlx" 2643 + version = "0.8.6" 2644 + source = "registry+https://github.com/rust-lang/crates.io-index" 2645 + checksum = "1fefb893899429669dcdd979aff487bd78f4064e5e7907e4269081e0ef7d97dc" 2646 + dependencies = [ 2647 + "sqlx-core", 2648 + "sqlx-macros", 2649 + "sqlx-mysql", 2650 + "sqlx-postgres", 2651 + "sqlx-sqlite", 2652 + ] 2653 + 2654 + [[package]] 2655 + name = "sqlx-core" 2656 + version = "0.8.6" 2657 + source = "registry+https://github.com/rust-lang/crates.io-index" 2658 + checksum = "ee6798b1838b6a0f69c007c133b8df5866302197e404e8b6ee8ed3e3a5e68dc6" 2659 + dependencies = [ 2660 + "base64 0.22.1", 2661 + "bytes", 2662 + "chrono", 2663 + "crc", 2664 + "crossbeam-queue", 2665 + "either", 2666 + "event-listener", 2667 + "futures-core", 2668 + "futures-intrusive", 2669 + "futures-io", 2670 + "futures-util", 2671 + "hashbrown 0.15.3", 2672 + "hashlink", 2673 + "indexmap", 2674 + "log", 2675 + "memchr", 2676 + "once_cell", 2677 + "percent-encoding", 2678 + "serde", 2679 + "serde_json", 2680 + "sha2", 2681 + "smallvec", 2682 + "thiserror 2.0.12", 2683 + "tokio", 2684 + "tokio-stream", 2685 + "tracing", 2686 + "url", 2687 + ] 2688 + 2689 + [[package]] 2690 + name = "sqlx-macros" 2691 + version = "0.8.6" 2692 + source = "registry+https://github.com/rust-lang/crates.io-index" 2693 + checksum = "a2d452988ccaacfbf5e0bdbc348fb91d7c8af5bee192173ac3636b5fb6e6715d" 2694 + dependencies = [ 2695 + "proc-macro2", 2696 + "quote", 2697 + "sqlx-core", 2698 + "sqlx-macros-core", 2699 + "syn", 2700 + ] 2701 + 2702 + [[package]] 2703 + name = "sqlx-macros-core" 2704 + version = "0.8.6" 2705 + source = "registry+https://github.com/rust-lang/crates.io-index" 2706 + checksum = "19a9c1841124ac5a61741f96e1d9e2ec77424bf323962dd894bdb93f37d5219b" 2707 + dependencies = [ 2708 + "dotenvy", 2709 + "either", 2710 + "heck", 2711 + "hex", 2712 + "once_cell", 2713 + "proc-macro2", 2714 + "quote", 2715 + "serde", 2716 + "serde_json", 2717 + "sha2", 2718 + "sqlx-core", 2719 + "sqlx-mysql", 2720 + "sqlx-postgres", 2721 + "sqlx-sqlite", 2722 + "syn", 2723 + "tokio", 2724 + "url", 2725 + ] 2726 + 2727 + [[package]] 2728 + name = "sqlx-mysql" 2729 + version = "0.8.6" 2730 + source = "registry+https://github.com/rust-lang/crates.io-index" 2731 + checksum = "aa003f0038df784eb8fecbbac13affe3da23b45194bd57dba231c8f48199c526" 2732 + dependencies = [ 2733 + "atoi", 2734 + "base64 0.22.1", 2735 + "bitflags", 2736 + "byteorder", 2737 + "bytes", 2738 + "chrono", 2739 + "crc", 2740 + "digest", 2741 + "dotenvy", 2742 + "either", 2743 + "futures-channel", 2744 + "futures-core", 2745 + "futures-io", 2746 + "futures-util", 2747 + "generic-array", 2748 + "hex", 2749 + "hkdf", 2750 + "hmac", 2751 + "itoa", 2752 + "log", 2753 + "md-5", 2754 + "memchr", 2755 + "once_cell", 2756 + "percent-encoding", 2757 + "rand", 2758 + "rsa", 2759 + "serde", 2760 + "sha1", 2761 + "sha2", 2762 + "smallvec", 2763 + "sqlx-core", 2764 + "stringprep", 2765 + "thiserror 2.0.12", 2766 + "tracing", 2767 + "whoami", 2768 + ] 2769 + 2770 + [[package]] 2771 + name = "sqlx-postgres" 2772 + version = "0.8.6" 2773 + source = "registry+https://github.com/rust-lang/crates.io-index" 2774 + checksum = "db58fcd5a53cf07c184b154801ff91347e4c30d17a3562a635ff028ad5deda46" 2775 + dependencies = [ 2776 + "atoi", 2777 + "base64 0.22.1", 2778 + "bitflags", 2779 + "byteorder", 2780 + "chrono", 2781 + "crc", 2782 + "dotenvy", 2783 + "etcetera", 2784 + "futures-channel", 2785 + "futures-core", 2786 + "futures-util", 2787 + "hex", 2788 + "hkdf", 2789 + "hmac", 2790 + "home", 2791 + "itoa", 2792 + "log", 2793 + "md-5", 2794 + "memchr", 2795 + "once_cell", 2796 + "rand", 2797 + "serde", 2798 + "serde_json", 2799 + "sha2", 2800 + "smallvec", 2801 + "sqlx-core", 2802 + "stringprep", 2803 + "thiserror 2.0.12", 2804 + "tracing", 2805 + "whoami", 2806 + ] 2807 + 2808 + [[package]] 2809 + name = "sqlx-sqlite" 2810 + version = "0.8.6" 2811 + source = "registry+https://github.com/rust-lang/crates.io-index" 2812 + checksum = "c2d12fe70b2c1b4401038055f90f151b78208de1f9f89a7dbfd41587a10c3eea" 2813 + dependencies = [ 2814 + "atoi", 2815 + "chrono", 2816 + "flume", 2817 + "futures-channel", 2818 + "futures-core", 2819 + "futures-executor", 2820 + "futures-intrusive", 2821 + "futures-util", 2822 + "libsqlite3-sys", 2823 + "log", 2824 + "percent-encoding", 2825 + "serde", 2826 + "serde_urlencoded", 2827 + "sqlx-core", 2828 + "thiserror 2.0.12", 2829 + "tracing", 2830 + "url", 2831 + ] 2832 + 2833 + [[package]] 2368 2834 name = "stable_deref_trait" 2369 2835 version = "1.2.0" 2370 2836 source = "registry+https://github.com/rust-lang/crates.io-index" 2371 2837 checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" 2838 + 2839 + [[package]] 2840 + name = "stringprep" 2841 + version = "0.1.5" 2842 + source = "registry+https://github.com/rust-lang/crates.io-index" 2843 + checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" 2844 + dependencies = [ 2845 + "unicode-bidi", 2846 + "unicode-normalization", 2847 + "unicode-properties", 2848 + ] 2372 2849 2373 2850 [[package]] 2374 2851 name = "strsim" ··· 2493 2970 ] 2494 2971 2495 2972 [[package]] 2973 + name = "tinyvec" 2974 + version = "1.10.0" 2975 + source = "registry+https://github.com/rust-lang/crates.io-index" 2976 + checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" 2977 + dependencies = [ 2978 + "tinyvec_macros", 2979 + ] 2980 + 2981 + [[package]] 2982 + name = "tinyvec_macros" 2983 + version = "0.1.1" 2984 + source = "registry+https://github.com/rust-lang/crates.io-index" 2985 + checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" 2986 + 2987 + [[package]] 2496 2988 name = "tokio" 2497 2989 version = "1.45.0" 2498 2990 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2542 3034 ] 2543 3035 2544 3036 [[package]] 3037 + name = "tokio-stream" 3038 + version = "0.1.17" 3039 + source = "registry+https://github.com/rust-lang/crates.io-index" 3040 + checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" 3041 + dependencies = [ 3042 + "futures-core", 3043 + "pin-project-lite", 3044 + "tokio", 3045 + ] 3046 + 3047 + [[package]] 2545 3048 name = "tokio-tungstenite" 2546 3049 version = "0.20.1" 2547 3050 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2603 3106 source = "registry+https://github.com/rust-lang/crates.io-index" 2604 3107 checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" 2605 3108 dependencies = [ 3109 + "log", 2606 3110 "pin-project-lite", 2607 3111 "tracing-attributes", 2608 3112 "tracing-core", ··· 2702 3206 checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" 2703 3207 2704 3208 [[package]] 3209 + name = "unicode-bidi" 3210 + version = "0.3.18" 3211 + source = "registry+https://github.com/rust-lang/crates.io-index" 3212 + checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" 3213 + 3214 + [[package]] 2705 3215 name = "unicode-ident" 2706 3216 version = "1.0.18" 2707 3217 source = "registry+https://github.com/rust-lang/crates.io-index" 2708 3218 checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" 2709 3219 2710 3220 [[package]] 3221 + name = "unicode-normalization" 3222 + version = "0.1.24" 3223 + source = "registry+https://github.com/rust-lang/crates.io-index" 3224 + checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" 3225 + dependencies = [ 3226 + "tinyvec", 3227 + ] 3228 + 3229 + [[package]] 3230 + name = "unicode-properties" 3231 + version = "0.1.3" 3232 + source = "registry+https://github.com/rust-lang/crates.io-index" 3233 + checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" 3234 + 3235 + [[package]] 2711 3236 name = "unsigned-varint" 2712 3237 version = "0.8.0" 2713 3238 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2798 3323 dependencies = [ 2799 3324 "wit-bindgen-rt", 2800 3325 ] 3326 + 3327 + [[package]] 3328 + name = "wasite" 3329 + version = "0.1.0" 3330 + source = "registry+https://github.com/rust-lang/crates.io-index" 3331 + checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" 2801 3332 2802 3333 [[package]] 2803 3334 name = "wasm-bindgen" ··· 2898 3429 checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" 2899 3430 2900 3431 [[package]] 3432 + name = "whoami" 3433 + version = "1.6.1" 3434 + source = "registry+https://github.com/rust-lang/crates.io-index" 3435 + checksum = "5d4a4db5077702ca3015d3d02d74974948aba2ad9e12ab7df718ee64ccd7e97d" 3436 + dependencies = [ 3437 + "libredox", 3438 + "wasite", 3439 + ] 3440 + 3441 + [[package]] 2901 3442 name = "winapi" 2902 3443 version = "0.3.9" 2903 3444 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3043 3584 3044 3585 [[package]] 3045 3586 name = "windows-sys" 3587 + version = "0.48.0" 3588 + source = "registry+https://github.com/rust-lang/crates.io-index" 3589 + checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 3590 + dependencies = [ 3591 + "windows-targets 0.48.5", 3592 + ] 3593 + 3594 + [[package]] 3595 + name = "windows-sys" 3046 3596 version = "0.52.0" 3047 3597 source = "registry+https://github.com/rust-lang/crates.io-index" 3048 3598 checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" ··· 3057 3607 checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" 3058 3608 dependencies = [ 3059 3609 "windows-targets 0.52.6", 3610 + ] 3611 + 3612 + [[package]] 3613 + name = "windows-targets" 3614 + version = "0.48.5" 3615 + source = "registry+https://github.com/rust-lang/crates.io-index" 3616 + checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 3617 + dependencies = [ 3618 + "windows_aarch64_gnullvm 0.48.5", 3619 + "windows_aarch64_msvc 0.48.5", 3620 + "windows_i686_gnu 0.48.5", 3621 + "windows_i686_msvc 0.48.5", 3622 + "windows_x86_64_gnu 0.48.5", 3623 + "windows_x86_64_gnullvm 0.48.5", 3624 + "windows_x86_64_msvc 0.48.5", 3060 3625 ] 3061 3626 3062 3627 [[package]] ··· 3102 3667 3103 3668 [[package]] 3104 3669 name = "windows_aarch64_gnullvm" 3670 + version = "0.48.5" 3671 + source = "registry+https://github.com/rust-lang/crates.io-index" 3672 + checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 3673 + 3674 + [[package]] 3675 + name = "windows_aarch64_gnullvm" 3105 3676 version = "0.52.6" 3106 3677 source = "registry+https://github.com/rust-lang/crates.io-index" 3107 3678 checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" ··· 3114 3685 3115 3686 [[package]] 3116 3687 name = "windows_aarch64_msvc" 3688 + version = "0.48.5" 3689 + source = "registry+https://github.com/rust-lang/crates.io-index" 3690 + checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 3691 + 3692 + [[package]] 3693 + name = "windows_aarch64_msvc" 3117 3694 version = "0.52.6" 3118 3695 source = "registry+https://github.com/rust-lang/crates.io-index" 3119 3696 checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" ··· 3126 3703 3127 3704 [[package]] 3128 3705 name = "windows_i686_gnu" 3706 + version = "0.48.5" 3707 + source = "registry+https://github.com/rust-lang/crates.io-index" 3708 + checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 3709 + 3710 + [[package]] 3711 + name = "windows_i686_gnu" 3129 3712 version = "0.52.6" 3130 3713 source = "registry+https://github.com/rust-lang/crates.io-index" 3131 3714 checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" ··· 3150 3733 3151 3734 [[package]] 3152 3735 name = "windows_i686_msvc" 3736 + version = "0.48.5" 3737 + source = "registry+https://github.com/rust-lang/crates.io-index" 3738 + checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 3739 + 3740 + [[package]] 3741 + name = "windows_i686_msvc" 3153 3742 version = "0.52.6" 3154 3743 source = "registry+https://github.com/rust-lang/crates.io-index" 3155 3744 checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" ··· 3162 3751 3163 3752 [[package]] 3164 3753 name = "windows_x86_64_gnu" 3754 + version = "0.48.5" 3755 + source = "registry+https://github.com/rust-lang/crates.io-index" 3756 + checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 3757 + 3758 + [[package]] 3759 + name = "windows_x86_64_gnu" 3165 3760 version = "0.52.6" 3166 3761 source = "registry+https://github.com/rust-lang/crates.io-index" 3167 3762 checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" ··· 3174 3769 3175 3770 [[package]] 3176 3771 name = "windows_x86_64_gnullvm" 3772 + version = "0.48.5" 3773 + source = "registry+https://github.com/rust-lang/crates.io-index" 3774 + checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 3775 + 3776 + [[package]] 3777 + name = "windows_x86_64_gnullvm" 3177 3778 version = "0.52.6" 3178 3779 source = "registry+https://github.com/rust-lang/crates.io-index" 3179 3780 checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" ··· 3183 3784 version = "0.53.0" 3184 3785 source = "registry+https://github.com/rust-lang/crates.io-index" 3185 3786 checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" 3787 + 3788 + [[package]] 3789 + name = "windows_x86_64_msvc" 3790 + version = "0.48.5" 3791 + source = "registry+https://github.com/rust-lang/crates.io-index" 3792 + checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 3186 3793 3187 3794 [[package]] 3188 3795 name = "windows_x86_64_msvc"
+7 -2
bot/Cargo.toml
··· 5 5 6 6 [dependencies] 7 7 anyhow = "1.0.98" 8 - clap.workspace = true 9 - logic = { workspace = true, features = ["cli"] } 8 + atproto_api.workspace = true 9 + rocketman.workspace = true 10 + atrium-api.workspace = true 10 11 log.workspace = true 11 12 env_logger = "0.11.8" 12 13 dotenv = "0.15.0" 13 14 tokio.workspace = true 15 + sqlx = { version = "0.8.2", features = ["runtime-tokio", "macros", "sqlite", "chrono"] } 16 + async-trait = "0.1.83" 17 + serde.workspace = true 18 + serde_json = "1.0.132" 14 19
+75 -106
bot/src/main.rs
··· 1 1 extern crate dotenv; 2 2 3 - use anyhow::anyhow; 4 - use clap::{Parser, Subcommand, arg}; 5 3 use dotenv::dotenv; 6 - use logic::emoji::Emoji; 7 - use logic::{ 8 - Error, HydratedStatus, StatusSphereListener, BotApi, StatusphereIngesterTrait, 9 - }; 4 + use atrium_api::types::Collection; 5 + use rocketman::{connection::JetstreamConnection, handler, ingestion::LexiconIngestor, options::JetstreamOptions, types::event::Operation}; 6 + use sqlx::sqlite::{SqliteConnectOptions, SqlitePool}; 7 + use std::collections::HashMap; 8 + use std::sync::{Arc, Mutex}; 9 + use std::time::Duration; 10 10 11 - #[derive(Parser, Debug)] 12 - #[command(version, about, long_about = None)] 13 - #[command(propagate_version = true)] 14 - struct Cli { 15 - #[command(subcommand)] 16 - command: Commands, 17 - } 11 + #[tokio::main] 12 + async fn main() -> anyhow::Result<()> { 13 + env_logger::init_from_env(env_logger::Env::new().default_filter_or("info")); 14 + dotenv().ok(); 18 15 19 - #[derive(Subcommand, Debug)] 20 - enum Commands { 21 - /// Create a new Statusphere emoji status 22 - NewStatus(NewStatusArgs), 23 - ///Shows your current Statusphere status 24 - CurrentStatus(CurrentStatusArgs), 25 - /// Starts a JetStream listener listening for Statusphere updates 26 - Listen, 27 - } 16 + // Initialize DB pool and run migrations 17 + let database_url = std::env::var("DATABASE_URL").unwrap_or_else(|_| "./stitch_counter.sqlite".to_string()); 18 + let options = SqliteConnectOptions::new() 19 + .filename(database_url) 20 + .create_if_missing(true) 21 + .busy_timeout(Duration::from_secs(5)); 22 + let pool = SqlitePool::connect_with(options).await?; 23 + // Run migrations from ./migrations 24 + sqlx::migrate!("./migrations").run(&pool).await?; 28 25 29 - #[derive(Parser, Debug)] 30 - struct NewStatusArgs { 31 - #[arg(short, long)] 32 - emoji: Emoji, 33 - } 26 + // Configure Jetstream to listen to sh.tangled.feed.star 27 + let opts = JetstreamOptions::builder() 28 + .wanted_collections(vec![atproto_api::sh::tangled::feed::Star::NSID.to_string()]) 29 + .build(); 34 30 35 - #[derive(Parser, Debug)] 36 - struct CurrentStatusArgs { 37 - /// If you're not getting your own Statusphere can look up someone else's 38 - #[arg(long, default_value = None)] 39 - handle: Option<String>, 40 - } 31 + let jetstream = JetstreamConnection::new(opts); 41 32 42 - #[tokio::main] 43 - async fn main() -> anyhow::Result<()> { 44 - env_logger::init_from_env(env_logger::Env::new().default_filter_or("info")); 45 - dotenv().ok(); 33 + let cursor: Arc<Mutex<Option<u64>>> = Arc::new(Mutex::new(None)); 46 34 47 - let cli = Cli::parse(); 48 - match &cli.command { 49 - Commands::NewStatus(args) => { 50 - //We check .env variables 51 - let handle = std::env::var("HANDLE") 52 - .expect("The env variable HANDLE is not set. Check the .env"); 35 + let msg_rx = jetstream.get_msg_rx(); 36 + let reconnect_tx = jetstream.get_reconnect_tx(); 53 37 54 - let password = std::env::var("APP_PASSWORD") 55 - .expect("The env variable APP_PASSWORD is not set. Check the .env"); 38 + // Ingestor for the star collection 39 + let mut ingestors: HashMap<String, Box<dyn LexiconIngestor + Send + Sync>> = HashMap::new(); 40 + ingestors.insert( 41 + atproto_api::sh::tangled::feed::Star::NSID.to_string(), 42 + Box::new(StarIngestor { pool: pool.clone() }), 43 + ); 44 + let ingestors = Arc::new(ingestors); 56 45 57 - let status_sphere_client = BotApi::new_logged_in(handle, password).await?; 58 - match status_sphere_client.new_status(args.emoji.to_emoji()).await { 59 - Ok(_) => { 60 - log::info!( 61 - "You just set {:?} as your current status.", 62 - args.emoji.to_emoji() 63 - ); 64 - } 65 - Err(err) => { 66 - log::error!("Error setting status: {}", err); 67 - } 46 + // Spawn message handling loop 47 + let ingestors_clone = ingestors.clone(); 48 + let reconnect_tx_clone = reconnect_tx.clone(); 49 + let cursor_clone = cursor.clone(); 50 + tokio::spawn(async move { 51 + while let Ok(message) = msg_rx.recv_async().await { 52 + if let Err(e) = handler::handle_message(message, &ingestors_clone, reconnect_tx_clone.clone(), cursor_clone.clone()).await { 53 + eprintln!("Error processing message: {}", e); 68 54 } 69 55 } 70 - Commands::CurrentStatus(args) => { 71 - let status_sphere_client = BotApi::new(); 56 + }); 57 + 58 + // Connect to jetstream 59 + jetstream.connect(cursor.clone()).await.map_err(|e| anyhow::anyhow!(e.to_string())) 60 + } 72 61 73 - let handle = match args.handle.as_ref() { 74 - None => { 75 - log::info!("No handle passed, using the one in the env variable HANDLE"); 76 - &match std::env::var("HANDLE") { 77 - Ok(handle) => handle, 78 - Err(_) => { 79 - return Err(anyhow!( 80 - "You did not pass a handle and The env variable HANDLE is not set" 81 - )); 82 - } 83 - } 84 - } 85 - Some(handle) => handle, 86 - }; 62 + struct StarIngestor { 63 + pool: SqlitePool, 64 + } 87 65 88 - match status_sphere_client.get_latest_status(handle.clone()).await { 89 - Ok(result) => match result { 90 - None => { 91 - log::info!("{} has no status", handle); 92 - } 93 - Some(status) => { 94 - log::info!( 95 - "{} has a status of {} that was set on {}", 96 - handle, 97 - status.status, 98 - status.created_at.as_str() 66 + #[async_trait::async_trait] 67 + impl LexiconIngestor for StarIngestor { 68 + async fn ingest(&self, message: rocketman::types::event::Event<serde_json::Value>) -> anyhow::Result<()> { 69 + if let Some(commit) = &message.commit { 70 + match commit.operation { 71 + Operation::Create | Operation::Update => { 72 + if let Some(record) = &commit.record { 73 + let rec = serde_json::from_value::<atproto_api::sh::tangled::feed::star::RecordData>(record.clone())?; 74 + // Insert or ignore duplicate per did+rkey 75 + let _ = sqlx::query( 76 + "INSERT OR IGNORE INTO stars(createdAt, did, rkey, subject) VALUES(?, ?, ?, ?)" 99 77 ) 78 + .bind(rec.created_at.as_str()) 79 + .bind(&message.did) 80 + .bind(commit.rkey.as_str()) 81 + .bind(&rec.subject) 82 + .execute(&self.pool) 83 + .await?; 100 84 } 101 - }, 102 - 103 - Err(err) => { 104 - return Err(anyhow!(err)); 85 + } 86 + Operation::Delete => { 87 + // Delete by did and rkey 88 + let _ = sqlx::query("DELETE FROM stars WHERE did = ? AND rkey = ?") 89 + .bind(&message.did) 90 + .bind(commit.rkey.as_str()) 91 + .execute(&self.pool) 92 + .await?; 105 93 } 106 94 } 107 95 } 108 - &Commands::Listen => { 109 - let status_sphere_listener = StatusSphereListener::new(ExampleIngestor); 110 - status_sphere_listener.listen().await?; 111 - } 112 - } 113 - 114 - Ok(()) 115 - } 116 - 117 - pub struct ExampleIngestor; 118 - 119 - impl StatusphereIngesterTrait for ExampleIngestor { 120 - fn ingest(&self, status: HydratedStatus) -> Result<(), Error> { 121 - log::info!( 122 - "{} just posted the status {}", 123 - status.handle.unwrap_or(status.did), 124 - //Eh. i'm keeping the name but yeah 125 - status.status.status 126 - ); 127 96 Ok(()) 128 97 } 129 98 }