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