fix(cli): fetch cmd

i have a ton of stuff pending locally so language server throws a ton of
errors, hopefully this compiles?
This commit is contained in:
əlemi 2024-09-18 22:23:31 +02:00
parent 047ac5a9e5
commit 75808bc926
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 7 additions and 3 deletions

View file

@ -23,7 +23,7 @@ pub async fn fetch(ctx: upub::Context, uri: String, save: bool, actor: Option<St
}
let mut node = apb::Node::link(uri.to_string());
if let apb::Node::Link(uri) = node {
if let apb::Node::Link(ref uri) = node {
if let Ok(href) = uri.href() {
node = upub::Context::request(reqwest::Method::GET, href, None, &from, &pkey, ctx.domain())
.await?

View file

@ -41,6 +41,10 @@ pub enum CliCommand {
#[arg(long, default_value_t = false)]
/// store fetched object in local db
save: bool,
#[arg(long)]
/// use this actor's private key to fetch
fetch_as: Option<String>,
},
/// act on remote relay actors at instance level
@ -139,8 +143,8 @@ pub async fn run(ctx: upub::Context, command: CliCommand) -> Result<(), Box<dyn
match command {
CliCommand::Faker { count } =>
Ok(faker(ctx, count as i64).await?),
CliCommand::Fetch { uri, save } =>
Ok(fetch(ctx, uri, save).await?),
CliCommand::Fetch { uri, save, fetch_as } =>
Ok(fetch(ctx, uri, save, fetch_as).await?),
CliCommand::Relay { action } =>
Ok(relay(ctx, action).await?),
CliCommand::Fix { likes, shares, replies } =>