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

upload: convert the file path to an rkey properly

note: i still havent tested anything since upload blobs. and since upload blobs is most of the buisness logic lmao

once jacquard is patched 🙏🙏

vielle.dev af7b6f20 8ecd3532

verified
Changed files
+6 -4
upload
src
+6 -4
upload/src/main.rs
··· 2 2 use jacquard::api::com_atproto::repo::apply_writes::{ 3 3 self, ApplyWrites, ApplyWritesOutput, ApplyWritesWritesItem, 4 4 }; 5 + use jacquard::client::AgentSessionExt; 5 6 use jacquard::client::MemorySessionStore; 6 - use jacquard::client::{AgentSessionExt}; 7 7 use jacquard::oauth::loopback::LoopbackConfig; 8 8 use jacquard::oauth::types::AuthorizeOptions; 9 9 use jacquard::types::string::{AtStrError, RecordKey, Rkey}; 10 - use jacquard::{atproto, oauth}; 11 10 use jacquard::{ 12 11 Data, 13 12 api::com_atproto::{self, repo::list_records::ListRecords}, ··· 17 16 types::{ident::AtIdentifier, nsid::Nsid, string::AtprotoStr, uri::Uri}, 18 17 xrpc::XrpcExt, 19 18 }; 20 - use miette::{IntoDiagnostic, Result}; 19 + use jacquard::{atproto, oauth}; 20 + use miette::{Context, IntoDiagnostic, Result}; 21 21 use std::{collections::HashMap, fs, path::PathBuf}; 22 22 23 23 use crate::sitemap::{BlobRef, Sitemap, SitemapNode}; ··· 173 173 let mut create_records = new_sitemap 174 174 .into_iter() 175 175 .map(|(k, v)| { 176 - let rkey = RecordKey(Rkey::new_owned(k).into_diagnostic()?); 176 + let rkey = 177 + utils::url_to_rkey(k).wrap_err("Invalid file path. Could not be converted to rkey")?; 178 + let rkey = RecordKey(Rkey::new_owned(rkey).into_diagnostic()?); 177 179 let blob = match v.blob { 178 180 BlobRef::Local(_) => panic!("Illegal local blob"), 179 181 BlobRef::Remote(cid) => cid,