[WIP] A (somewhat barebones) atproto app for creating custom sites without hosting!

upload: minor changes to main function

note: error handling and general setup of main will need refactoring
ts a mess rn

vielle.dev 651208c9 570a2bed

verified
Changed files
+15 -9
upload
src
+15 -9
upload/src/main.rs
··· 1 1 use clap::{ArgAction, Parser}; 2 + use jacquard::client::MemorySessionStore; 2 3 use jacquard::{ 3 4 Data, 4 5 api::com_atproto::{self, repo::list_records::ListRecords}, 5 6 client::{Agent, credential_session::CredentialSession}, 6 7 cowstr::ToCowStr, 7 8 identity::JacquardResolver, 8 - session::MemorySessionStore, 9 9 types::{ident::AtIdentifier, nsid::Nsid, string::AtprotoStr, uri::Uri}, 10 10 xrpc::XrpcExt, 11 11 }; 12 - use std::{path::PathBuf, sync::Arc}; 12 + use std::path::PathBuf; 13 13 14 14 mod sitemap; 15 15 mod utils; ··· 47 47 let config = Config::parse(); 48 48 49 49 // get local site info 50 - let sitemap = 51 - sitemap::local_sitemap(config.dir, config.all_files, config.git_ignore).or_else(|err| { 52 - println!("Error: {}", err); 50 + let local_sitemap = sitemap::local_sitemap(config.dir, config.all_files, config.git_ignore) 51 + .or_else(|err| { 52 + println!("Sitemap Error: {}", err); 53 53 Err(()) 54 54 })?; 55 55 56 56 // create session 57 57 let client = JacquardResolver::default(); 58 58 let store = MemorySessionStore::default(); 59 - let session = CredentialSession::new(Arc::new(store), Arc::new(client)); 59 + let session = CredentialSession::new(store.into(), client.into()); 60 60 61 61 let auth = match session 62 62 .login(config.user.into(), config.password.into(), None, None, None) ··· 91 91 .xrpc(agent.endpoint().await) 92 92 .send::<ListRecords>(&req) 93 93 .await 94 - .or(Err(()))? 94 + .or_else(|err| { 95 + println!("Error fetching records: {err}"); 96 + Err(()) 97 + })? 95 98 .into_output() 96 - .or(Err(()))?; 99 + .or_else(|err| { 100 + println!("Error fetching records: {err}"); 101 + Err(()) 102 + })?; 97 103 98 104 for record in res.records { 99 105 match record { ··· 127 133 } 128 134 } 129 135 130 - print!("{remote_records:?}"); 136 + println!("{remote_records:?}"); 131 137 132 138 // upload local site blobs 133 139