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:
parent
047ac5a9e5
commit
75808bc926
2 changed files with 7 additions and 3 deletions
|
@ -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());
|
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() {
|
if let Ok(href) = uri.href() {
|
||||||
node = upub::Context::request(reqwest::Method::GET, href, None, &from, &pkey, ctx.domain())
|
node = upub::Context::request(reqwest::Method::GET, href, None, &from, &pkey, ctx.domain())
|
||||||
.await?
|
.await?
|
||||||
|
|
|
@ -41,6 +41,10 @@ pub enum CliCommand {
|
||||||
#[arg(long, default_value_t = false)]
|
#[arg(long, default_value_t = false)]
|
||||||
/// store fetched object in local db
|
/// store fetched object in local db
|
||||||
save: bool,
|
save: bool,
|
||||||
|
|
||||||
|
#[arg(long)]
|
||||||
|
/// use this actor's private key to fetch
|
||||||
|
fetch_as: Option<String>,
|
||||||
},
|
},
|
||||||
|
|
||||||
/// act on remote relay actors at instance level
|
/// 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 {
|
match command {
|
||||||
CliCommand::Faker { count } =>
|
CliCommand::Faker { count } =>
|
||||||
Ok(faker(ctx, count as i64).await?),
|
Ok(faker(ctx, count as i64).await?),
|
||||||
CliCommand::Fetch { uri, save } =>
|
CliCommand::Fetch { uri, save, fetch_as } =>
|
||||||
Ok(fetch(ctx, uri, save).await?),
|
Ok(fetch(ctx, uri, save, fetch_as).await?),
|
||||||
CliCommand::Relay { action } =>
|
CliCommand::Relay { action } =>
|
||||||
Ok(relay(ctx, action).await?),
|
Ok(relay(ctx, action).await?),
|
||||||
CliCommand::Fix { likes, shares, replies } =>
|
CliCommand::Fix { likes, shares, replies } =>
|
||||||
|
|
Loading…
Reference in a new issue