tangled.org trending bluesky account

consteltation looks to be working

+302 -22
+262 -21
Cargo.lock
··· 160 160 ] 161 161 162 162 [[package]] 163 + name = "atomic-waker" 164 + version = "1.1.2" 165 + source = "registry+https://github.com/rust-lang/crates.io-index" 166 + checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" 167 + 168 + [[package]] 163 169 name = "atproto_api" 164 170 version = "0.1.0" 165 171 dependencies = [ ··· 237 243 "jose-jwa", 238 244 "jose-jwk", 239 245 "p256", 240 - "rand", 246 + "rand 0.8.5", 241 247 "reqwest", 242 248 "serde", 243 249 "serde_html_form", ··· 378 384 "env_logger", 379 385 "log", 380 386 "logic", 387 + "reqwest", 381 388 "rocketman", 382 389 "serde", 383 390 "serde_json", ··· 440 447 checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 441 448 442 449 [[package]] 450 + name = "cfg_aliases" 451 + version = "0.2.1" 452 + source = "registry+https://github.com/rust-lang/crates.io-index" 453 + checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" 454 + 455 + [[package]] 443 456 name = "chrono" 444 457 version = "0.4.41" 445 458 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 627 640 checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" 628 641 dependencies = [ 629 642 "generic-array", 630 - "rand_core", 643 + "rand_core 0.6.4", 631 644 "subtle", 632 645 "zeroize", 633 646 ] ··· 828 841 "ff", 829 842 "generic-array", 830 843 "group", 831 - "rand_core", 844 + "rand_core 0.6.4", 832 845 "sec1", 833 846 "subtle", 834 847 "zeroize", 848 + ] 849 + 850 + [[package]] 851 + name = "encoding_rs" 852 + version = "0.8.35" 853 + source = "registry+https://github.com/rust-lang/crates.io-index" 854 + checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" 855 + dependencies = [ 856 + "cfg-if", 835 857 ] 836 858 837 859 [[package]] ··· 917 939 source = "registry+https://github.com/rust-lang/crates.io-index" 918 940 checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" 919 941 dependencies = [ 920 - "rand_core", 942 + "rand_core 0.6.4", 921 943 "subtle", 922 944 ] 923 945 ··· 1108 1130 checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" 1109 1131 dependencies = [ 1110 1132 "cfg-if", 1133 + "js-sys", 1111 1134 "libc", 1112 1135 "r-efi", 1113 1136 "wasi 0.14.2+wasi-0.2.4", 1137 + "wasm-bindgen", 1114 1138 ] 1115 1139 1116 1140 [[package]] ··· 1139 1163 checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" 1140 1164 dependencies = [ 1141 1165 "ff", 1142 - "rand_core", 1166 + "rand_core 0.6.4", 1143 1167 "subtle", 1144 1168 ] 1145 1169 1146 1170 [[package]] 1171 + name = "h2" 1172 + version = "0.4.12" 1173 + source = "registry+https://github.com/rust-lang/crates.io-index" 1174 + checksum = "f3c0b69cfcb4e1b9f1bf2f53f95f766e4661169728ec61cd3fe5a0166f2d1386" 1175 + dependencies = [ 1176 + "atomic-waker", 1177 + "bytes", 1178 + "fnv", 1179 + "futures-core", 1180 + "futures-sink", 1181 + "http 1.3.1", 1182 + "indexmap", 1183 + "slab", 1184 + "tokio", 1185 + "tokio-util", 1186 + "tracing", 1187 + ] 1188 + 1189 + [[package]] 1147 1190 name = "hashbrown" 1148 1191 version = "0.14.5" 1149 1192 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1268 1311 "bytes", 1269 1312 "futures-channel", 1270 1313 "futures-util", 1314 + "h2", 1271 1315 "http 1.3.1", 1272 1316 "http-body", 1273 1317 "httparse", ··· 1276 1320 "smallvec", 1277 1321 "tokio", 1278 1322 "want", 1323 + ] 1324 + 1325 + [[package]] 1326 + name = "hyper-rustls" 1327 + version = "0.27.6" 1328 + source = "registry+https://github.com/rust-lang/crates.io-index" 1329 + checksum = "03a01595e11bdcec50946522c32dde3fc6914743000a68b93000965f2f02406d" 1330 + dependencies = [ 1331 + "http 1.3.1", 1332 + "hyper", 1333 + "hyper-util", 1334 + "rustls 0.23.31", 1335 + "rustls-pki-types", 1336 + "tokio", 1337 + "tokio-rustls 0.26.2", 1338 + "tower-service", 1339 + "webpki-roots 1.0.2", 1279 1340 ] 1280 1341 1281 1342 [[package]] ··· 1700 1761 ] 1701 1762 1702 1763 [[package]] 1764 + name = "lru-slab" 1765 + version = "0.1.2" 1766 + source = "registry+https://github.com/rust-lang/crates.io-index" 1767 + checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" 1768 + 1769 + [[package]] 1703 1770 name = "matchers" 1704 1771 version = "0.1.0" 1705 1772 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1852 1919 "num-integer", 1853 1920 "num-iter", 1854 1921 "num-traits", 1855 - "rand", 1922 + "rand 0.8.5", 1856 1923 "smallvec", 1857 1924 "zeroize", 1858 1925 ] ··· 2124 2191 checksum = "33cb294fe86a74cbcf50d4445b37da762029549ebeea341421c7c70370f86cac" 2125 2192 2126 2193 [[package]] 2194 + name = "quinn" 2195 + version = "0.11.8" 2196 + source = "registry+https://github.com/rust-lang/crates.io-index" 2197 + checksum = "626214629cda6781b6dc1d316ba307189c85ba657213ce642d9c77670f8202c8" 2198 + dependencies = [ 2199 + "bytes", 2200 + "cfg_aliases", 2201 + "pin-project-lite", 2202 + "quinn-proto", 2203 + "quinn-udp", 2204 + "rustc-hash", 2205 + "rustls 0.23.31", 2206 + "socket2", 2207 + "thiserror 2.0.12", 2208 + "tokio", 2209 + "tracing", 2210 + "web-time", 2211 + ] 2212 + 2213 + [[package]] 2214 + name = "quinn-proto" 2215 + version = "0.11.12" 2216 + source = "registry+https://github.com/rust-lang/crates.io-index" 2217 + checksum = "49df843a9161c85bb8aae55f101bc0bac8bcafd637a620d9122fd7e0b2f7422e" 2218 + dependencies = [ 2219 + "bytes", 2220 + "getrandom 0.3.3", 2221 + "lru-slab", 2222 + "rand 0.9.2", 2223 + "ring", 2224 + "rustc-hash", 2225 + "rustls 0.23.31", 2226 + "rustls-pki-types", 2227 + "slab", 2228 + "thiserror 2.0.12", 2229 + "tinyvec", 2230 + "tracing", 2231 + "web-time", 2232 + ] 2233 + 2234 + [[package]] 2235 + name = "quinn-udp" 2236 + version = "0.5.12" 2237 + source = "registry+https://github.com/rust-lang/crates.io-index" 2238 + checksum = "ee4e529991f949c5e25755532370b8af5d114acae52326361d68d47af64aa842" 2239 + dependencies = [ 2240 + "cfg_aliases", 2241 + "libc", 2242 + "once_cell", 2243 + "socket2", 2244 + "tracing", 2245 + "windows-sys 0.52.0", 2246 + ] 2247 + 2248 + [[package]] 2127 2249 name = "quote" 2128 2250 version = "1.0.40" 2129 2251 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2145 2267 checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 2146 2268 dependencies = [ 2147 2269 "libc", 2148 - "rand_chacha", 2149 - "rand_core", 2270 + "rand_chacha 0.3.1", 2271 + "rand_core 0.6.4", 2272 + ] 2273 + 2274 + [[package]] 2275 + name = "rand" 2276 + version = "0.9.2" 2277 + source = "registry+https://github.com/rust-lang/crates.io-index" 2278 + checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" 2279 + dependencies = [ 2280 + "rand_chacha 0.9.0", 2281 + "rand_core 0.9.3", 2150 2282 ] 2151 2283 2152 2284 [[package]] ··· 2156 2288 checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 2157 2289 dependencies = [ 2158 2290 "ppv-lite86", 2159 - "rand_core", 2291 + "rand_core 0.6.4", 2292 + ] 2293 + 2294 + [[package]] 2295 + name = "rand_chacha" 2296 + version = "0.9.0" 2297 + source = "registry+https://github.com/rust-lang/crates.io-index" 2298 + checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" 2299 + dependencies = [ 2300 + "ppv-lite86", 2301 + "rand_core 0.9.3", 2160 2302 ] 2161 2303 2162 2304 [[package]] ··· 2169 2311 ] 2170 2312 2171 2313 [[package]] 2314 + name = "rand_core" 2315 + version = "0.9.3" 2316 + source = "registry+https://github.com/rust-lang/crates.io-index" 2317 + checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" 2318 + dependencies = [ 2319 + "getrandom 0.3.3", 2320 + ] 2321 + 2322 + [[package]] 2172 2323 name = "redox_syscall" 2173 2324 version = "0.5.17" 2174 2325 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2230 2381 "async-compression", 2231 2382 "base64 0.22.1", 2232 2383 "bytes", 2384 + "encoding_rs", 2233 2385 "futures-core", 2234 2386 "futures-util", 2387 + "h2", 2235 2388 "http 1.3.1", 2236 2389 "http-body", 2237 2390 "http-body-util", 2238 2391 "hyper", 2392 + "hyper-rustls", 2239 2393 "hyper-tls", 2240 2394 "hyper-util", 2241 2395 "ipnet", ··· 2246 2400 "once_cell", 2247 2401 "percent-encoding", 2248 2402 "pin-project-lite", 2403 + "quinn", 2404 + "rustls 0.23.31", 2249 2405 "rustls-pemfile 2.2.0", 2406 + "rustls-pki-types", 2250 2407 "serde", 2251 2408 "serde_json", 2252 2409 "serde_urlencoded", 2253 2410 "sync_wrapper", 2411 + "system-configuration", 2254 2412 "tokio", 2255 2413 "tokio-native-tls", 2414 + "tokio-rustls 0.26.2", 2256 2415 "tokio-util", 2257 2416 "tower", 2258 2417 "tower-service", ··· 2260 2419 "wasm-bindgen", 2261 2420 "wasm-bindgen-futures", 2262 2421 "web-sys", 2422 + "webpki-roots 0.26.11", 2263 2423 "windows-registry", 2264 2424 ] 2265 2425 ··· 2300 2460 "flume", 2301 2461 "futures-util", 2302 2462 "metrics", 2303 - "rand", 2463 + "rand 0.8.5", 2304 2464 "serde", 2305 2465 "serde_json", 2306 2466 "tokio", ··· 2324 2484 "num-traits", 2325 2485 "pkcs1", 2326 2486 "pkcs8", 2327 - "rand_core", 2487 + "rand_core 0.6.4", 2328 2488 "signature", 2329 2489 "spki", 2330 2490 "subtle", ··· 2338 2498 checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" 2339 2499 2340 2500 [[package]] 2501 + name = "rustc-hash" 2502 + version = "2.1.1" 2503 + source = "registry+https://github.com/rust-lang/crates.io-index" 2504 + checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" 2505 + 2506 + [[package]] 2341 2507 name = "rustc_version" 2342 2508 version = "0.4.1" 2343 2509 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2367 2533 dependencies = [ 2368 2534 "log", 2369 2535 "ring", 2370 - "rustls-webpki", 2536 + "rustls-webpki 0.101.7", 2371 2537 "sct", 2372 2538 ] 2373 2539 2374 2540 [[package]] 2541 + name = "rustls" 2542 + version = "0.23.31" 2543 + source = "registry+https://github.com/rust-lang/crates.io-index" 2544 + checksum = "c0ebcbd2f03de0fc1122ad9bb24b127a5a6cd51d72604a3f3c50ac459762b6cc" 2545 + dependencies = [ 2546 + "once_cell", 2547 + "ring", 2548 + "rustls-pki-types", 2549 + "rustls-webpki 0.103.5", 2550 + "subtle", 2551 + "zeroize", 2552 + ] 2553 + 2554 + [[package]] 2375 2555 name = "rustls-native-certs" 2376 2556 version = "0.6.3" 2377 2557 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2407 2587 source = "registry+https://github.com/rust-lang/crates.io-index" 2408 2588 checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" 2409 2589 dependencies = [ 2590 + "web-time", 2410 2591 "zeroize", 2411 2592 ] 2412 2593 ··· 2421 2602 ] 2422 2603 2423 2604 [[package]] 2605 + name = "rustls-webpki" 2606 + version = "0.103.5" 2607 + source = "registry+https://github.com/rust-lang/crates.io-index" 2608 + checksum = "b5a37813727b78798e53c2bec3f5e8fe12a6d6f8389bf9ca7802add4c9905ad8" 2609 + dependencies = [ 2610 + "ring", 2611 + "rustls-pki-types", 2612 + "untrusted", 2613 + ] 2614 + 2615 + [[package]] 2424 2616 name = "rustversion" 2425 2617 version = "1.0.20" 2426 2618 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2624 2816 checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" 2625 2817 dependencies = [ 2626 2818 "digest", 2627 - "rand_core", 2819 + "rand_core 0.6.4", 2628 2820 ] 2629 2821 2630 2822 [[package]] ··· 2790 2982 "memchr", 2791 2983 "once_cell", 2792 2984 "percent-encoding", 2793 - "rand", 2985 + "rand 0.8.5", 2794 2986 "rsa", 2795 2987 "serde", 2796 2988 "sha1", ··· 2829 3021 "md-5", 2830 3022 "memchr", 2831 3023 "once_cell", 2832 - "rand", 3024 + "rand 0.8.5", 2833 3025 "serde", 2834 3026 "serde_json", 2835 3027 "sha2", ··· 2927 3119 ] 2928 3120 2929 3121 [[package]] 3122 + name = "system-configuration" 3123 + version = "0.6.1" 3124 + source = "registry+https://github.com/rust-lang/crates.io-index" 3125 + checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" 3126 + dependencies = [ 3127 + "bitflags", 3128 + "core-foundation", 3129 + "system-configuration-sys", 3130 + ] 3131 + 3132 + [[package]] 3133 + name = "system-configuration-sys" 3134 + version = "0.6.0" 3135 + source = "registry+https://github.com/rust-lang/crates.io-index" 3136 + checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" 3137 + dependencies = [ 3138 + "core-foundation-sys", 3139 + "libc", 3140 + ] 3141 + 3142 + [[package]] 2930 3143 name = "tagptr" 2931 3144 version = "0.2.0" 2932 3145 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3065 3278 source = "registry+https://github.com/rust-lang/crates.io-index" 3066 3279 checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" 3067 3280 dependencies = [ 3068 - "rustls", 3281 + "rustls 0.21.12", 3282 + "tokio", 3283 + ] 3284 + 3285 + [[package]] 3286 + name = "tokio-rustls" 3287 + version = "0.26.2" 3288 + source = "registry+https://github.com/rust-lang/crates.io-index" 3289 + checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b" 3290 + dependencies = [ 3291 + "rustls 0.23.31", 3069 3292 "tokio", 3070 3293 ] 3071 3294 ··· 3088 3311 dependencies = [ 3089 3312 "futures-util", 3090 3313 "log", 3091 - "rustls", 3314 + "rustls 0.21.12", 3092 3315 "rustls-native-certs", 3093 3316 "tokio", 3094 - "tokio-rustls", 3317 + "tokio-rustls 0.24.1", 3095 3318 "tungstenite", 3096 - "webpki-roots", 3319 + "webpki-roots 0.25.4", 3097 3320 ] 3098 3321 3099 3322 [[package]] ··· 3227 3450 "http 0.2.12", 3228 3451 "httparse", 3229 3452 "log", 3230 - "rand", 3231 - "rustls", 3453 + "rand 0.8.5", 3454 + "rustls 0.21.12", 3232 3455 "sha1", 3233 3456 "thiserror 1.0.69", 3234 3457 "url", ··· 3469 3692 version = "0.25.4" 3470 3693 source = "registry+https://github.com/rust-lang/crates.io-index" 3471 3694 checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" 3695 + 3696 + [[package]] 3697 + name = "webpki-roots" 3698 + version = "0.26.11" 3699 + source = "registry+https://github.com/rust-lang/crates.io-index" 3700 + checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9" 3701 + dependencies = [ 3702 + "webpki-roots 1.0.2", 3703 + ] 3704 + 3705 + [[package]] 3706 + name = "webpki-roots" 3707 + version = "1.0.2" 3708 + source = "registry+https://github.com/rust-lang/crates.io-index" 3709 + checksum = "7e8983c3ab33d6fb807cfcdad2491c4ea8cbc8ed839181c7dfd9c67c83e261b2" 3710 + dependencies = [ 3711 + "rustls-pki-types", 3712 + ] 3472 3713 3473 3714 [[package]] 3474 3715 name = "whoami"
+1
bot/Cargo.toml
··· 17 17 serde.workspace = true 18 18 serde_json = "1.0.132" 19 19 logic.workspace = true 20 + reqwest = { version = "0.12", features = ["json", "rustls-tls"] } 20 21
+39 -1
bot/src/main.rs
··· 8 8 use std::sync::{Arc, Mutex}; 9 9 use std::time::Duration; 10 10 use logic::BotApi; 11 + use reqwest::Url; 12 + use serde::Deserialize; 11 13 12 14 #[tokio::main] 13 15 async fn main() -> anyhow::Result<()> { ··· 92 94 post_window_hours: i64, 93 95 } 94 96 97 + #[derive(Deserialize, Debug)] 98 + struct ConstellationCountResponse { 99 + total: i64, 100 + } 101 + 102 + async fn fetch_constellation_count(target: &str) -> anyhow::Result<i64> { 103 + let base = std::env::var("CONSTELLATION_BASE_URL") 104 + .unwrap_or_else(|_| "https://constellation.microcosm.blue".to_string()); 105 + let endpoint = if base.ends_with('/') { 106 + format!("{}links/count", base) 107 + } else { 108 + format!("{}/links/count", base) 109 + }; 110 + 111 + // Build URL with query params in one go to avoid non-Send lifetimes 112 + let url = Url::parse_with_params( 113 + &endpoint, 114 + &[ 115 + ("target", target.to_string()), 116 + ("collection", atproto_api::sh::tangled::feed::Star::NSID.to_string()), 117 + ("path", ".subject".to_string()), 118 + ], 119 + )?; 120 + 121 + let resp = reqwest::Client::new() 122 + .get(url) 123 + .send() 124 + .await? 125 + .error_for_status()?; 126 + 127 + let parsed: ConstellationCountResponse = resp.json().await?; 128 + Ok(parsed.total) 129 + } 130 + 95 131 #[async_trait::async_trait] 96 132 impl LexiconIngestor for StarIngestor { 97 133 async fn ingest(&self, message: rocketman::types::event::Event<serde_json::Value>) -> anyhow::Result<()> { ··· 146 182 .execute(&self.pool) 147 183 .await?; 148 184 149 - log::info!("Threshold met and allowed to be posted"); 185 + let starts_count = fetch_constellation_count(&rec.subject).await?; 186 + 187 + log::info!("Threshold met and allowed to be posted, stars: {starts_count}"); 150 188 } 151 189 } 152 190 }