this repo has no description
1
fork

Configure Feed

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

Added logger

+120
+103
Cargo.lock
··· 3 3 version = 4 4 4 5 5 [[package]] 6 + name = "aho-corasick" 7 + version = "1.1.4" 8 + source = "registry+https://github.com/rust-lang/crates.io-index" 9 + checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" 10 + dependencies = [ 11 + "memchr", 12 + ] 13 + 14 + [[package]] 6 15 name = "anstream" 7 16 version = "0.6.21" 8 17 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 165 174 "proc-macro2", 166 175 "quote", 167 176 "syn", 177 + ] 178 + 179 + [[package]] 180 + name = "env_filter" 181 + version = "1.0.0" 182 + source = "registry+https://github.com/rust-lang/crates.io-index" 183 + checksum = "7a1c3cc8e57274ec99de65301228b537f1e4eedc1b8e0f9411c6caac8ae7308f" 184 + dependencies = [ 185 + "log", 186 + "regex", 187 + ] 188 + 189 + [[package]] 190 + name = "env_logger" 191 + version = "0.11.9" 192 + source = "registry+https://github.com/rust-lang/crates.io-index" 193 + checksum = "b2daee4ea451f429a58296525ddf28b45a3b64f1acf6587e2067437bb11e218d" 194 + dependencies = [ 195 + "anstream", 196 + "anstyle", 197 + "env_filter", 198 + "jiff", 199 + "log", 168 200 ] 169 201 170 202 [[package]] ··· 489 521 checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" 490 522 491 523 [[package]] 524 + name = "jiff" 525 + version = "0.2.21" 526 + source = "registry+https://github.com/rust-lang/crates.io-index" 527 + checksum = "b3e3d65f018c6ae946ab16e80944b97096ed73c35b221d1c478a6c81d8f57940" 528 + dependencies = [ 529 + "jiff-static", 530 + "log", 531 + "portable-atomic", 532 + "portable-atomic-util", 533 + "serde_core", 534 + ] 535 + 536 + [[package]] 537 + name = "jiff-static" 538 + version = "0.2.21" 539 + source = "registry+https://github.com/rust-lang/crates.io-index" 540 + checksum = "a17c2b211d863c7fde02cbea8a3c1a439b98e109286554f2860bdded7ff83818" 541 + dependencies = [ 542 + "proc-macro2", 543 + "quote", 544 + "syn", 545 + ] 546 + 547 + [[package]] 492 548 name = "js-sys" 493 549 version = "0.3.91" 494 550 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 566 622 dependencies = [ 567 623 "anyhow", 568 624 "clap", 625 + "env_logger", 626 + "log", 569 627 "opake-core", 570 628 "reqwest", 571 629 "serde", ··· 577 635 name = "opake-core" 578 636 version = "0.1.0" 579 637 dependencies = [ 638 + "log", 580 639 "serde", 581 640 "serde_json", 582 641 "thiserror", ··· 624 683 checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 625 684 626 685 [[package]] 686 + name = "portable-atomic" 687 + version = "1.13.1" 688 + source = "registry+https://github.com/rust-lang/crates.io-index" 689 + checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" 690 + 691 + [[package]] 692 + name = "portable-atomic-util" 693 + version = "0.2.5" 694 + source = "registry+https://github.com/rust-lang/crates.io-index" 695 + checksum = "7a9db96d7fa8782dd8c15ce32ffe8680bbd1e978a43bf51a34d39483540495f5" 696 + dependencies = [ 697 + "portable-atomic", 698 + ] 699 + 700 + [[package]] 627 701 name = "potential_utf" 628 702 version = "0.1.4" 629 703 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 757 831 dependencies = [ 758 832 "bitflags", 759 833 ] 834 + 835 + [[package]] 836 + name = "regex" 837 + version = "1.12.3" 838 + source = "registry+https://github.com/rust-lang/crates.io-index" 839 + checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" 840 + dependencies = [ 841 + "aho-corasick", 842 + "memchr", 843 + "regex-automata", 844 + "regex-syntax", 845 + ] 846 + 847 + [[package]] 848 + name = "regex-automata" 849 + version = "0.4.14" 850 + source = "registry+https://github.com/rust-lang/crates.io-index" 851 + checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" 852 + dependencies = [ 853 + "aho-corasick", 854 + "memchr", 855 + "regex-syntax", 856 + ] 857 + 858 + [[package]] 859 + name = "regex-syntax" 860 + version = "0.8.10" 861 + source = "registry+https://github.com/rust-lang/crates.io-index" 862 + checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" 760 863 761 864 [[package]] 762 865 name = "reqwest"
+1
Cargo.toml
··· 7 7 version = "0.1.0" 8 8 9 9 [workspace.dependencies] 10 + log = "0.4" 10 11 serde = { version = "1", features = ["derive"] } 11 12 serde_json = "1" 12 13 thiserror = "2"
+2
crates/opake-cli/Cargo.toml
··· 13 13 clap = { version = "4", features = ["derive"] } 14 14 tokio = { version = "1", features = ["full"] } 15 15 anyhow = "1" 16 + env_logger = "0.11" 17 + log.workspace = true 16 18 reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] } 17 19 serde.workspace = true 18 20 serde_json.workspace = true
+1
crates/opake-cli/src/main.rs
··· 70 70 71 71 #[tokio::main] 72 72 async fn main() -> anyhow::Result<()> { 73 + env_logger::init(); 73 74 let cli = Cli::parse(); 74 75 75 76 match cli.command {
+1
crates/opake-core/Cargo.toml
··· 5 5 version.workspace = true 6 6 7 7 [dependencies] 8 + log.workspace = true 8 9 serde.workspace = true 9 10 serde_json.workspace = true 10 11 thiserror.workspace = true
+12
crates/opake-core/src/client.rs
··· 5 5 // Core owns the XRPC protocol logic (endpoints, auth, response parsing) 6 6 // but never touches the network directly. 7 7 8 + use log::{debug, info, warn}; 9 + 8 10 use crate::error::Error; 9 11 use crate::records::BlobRef; 10 12 use serde::{Deserialize, Serialize}; ··· 112 114 113 115 /// Authenticate via `com.atproto.server.createSession`. 114 116 pub async fn login(&mut self, identifier: &str, password: &str) -> Result<&Session, Error> { 117 + info!("authenticating as {} against {}", identifier, self.base_url); 118 + 115 119 let body = serde_json::json!({ 116 120 "identifier": identifier, 117 121 "password": password, ··· 128 132 .await?; 129 133 130 134 if response.status != 200 { 135 + warn!("login failed with HTTP {}", response.status); 131 136 return Err(Error::Auth(format!( 132 137 "login failed (HTTP {})", 133 138 response.status ··· 135 140 } 136 141 137 142 let session: Session = serde_json::from_slice(&response.body)?; 143 + info!("authenticated as {} ({})", session.handle, session.did); 138 144 self.session = Some(session); 139 145 Ok(self.session.as_ref().unwrap()) 140 146 } ··· 159 165 160 166 /// Upload raw bytes as a blob via `com.atproto.repo.uploadBlob`. 161 167 pub async fn upload_blob(&self, data: Vec<u8>, mime_type: &str) -> Result<BlobRef, Error> { 168 + debug!("uploading blob ({} bytes, {})", data.len(), mime_type); 162 169 let auth = self.auth_header()?; 163 170 164 171 let response = self ··· 184 191 185 192 /// Fetch a blob by DID + CID via `com.atproto.sync.getBlob`. 186 193 pub async fn get_blob(&self, did: &str, cid: &str) -> Result<Vec<u8>, Error> { 194 + debug!("fetching blob did={} cid={}", did, cid); 187 195 let auth = self.auth_header()?; 188 196 let url = format!( 189 197 "{}/xrpc/com.atproto.sync.getBlob?did={}&cid={}", ··· 209 217 collection: &str, 210 218 record: &R, 211 219 ) -> Result<RecordRef, Error> { 220 + debug!("creating record in {}", collection); 212 221 let auth = self.auth_header()?; 213 222 let did = self.did()?; 214 223 ··· 238 247 collection: &str, 239 248 rkey: &str, 240 249 ) -> Result<RecordEntry, Error> { 250 + debug!("getting record {}/{}/{}", did, collection, rkey); 241 251 let auth = self.auth_header()?; 242 252 let url = format!( 243 253 "{}/xrpc/com.atproto.repo.getRecord?repo={}&collection={}&rkey={}", ··· 264 274 limit: Option<u32>, 265 275 cursor: Option<&str>, 266 276 ) -> Result<RecordPage, Error> { 277 + debug!("listing records in {}", collection); 267 278 let auth = self.auth_header()?; 268 279 let did = self.did()?; 269 280 ··· 293 304 294 305 /// Delete a record via `com.atproto.repo.deleteRecord`. 295 306 pub async fn delete_record(&self, collection: &str, rkey: &str) -> Result<(), Error> { 307 + debug!("deleting record {}/{}", collection, rkey); 296 308 let auth = self.auth_header()?; 297 309 let did = self.did()?; 298 310