rename trade subcommand to confirm and deprecate trade subcommand (#368)

This commit is contained in:
Carson McManus 2024-03-04 06:56:48 -05:00 committed by GitHub
parent ad146c97c9
commit 46a1c2ed04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 14 additions and 13 deletions

View file

@ -3,7 +3,7 @@
[![Lint, Build, Test](https://github.com/dyc3/steamguard-cli/actions/workflows/rust.yml/badge.svg)](https://github.com/dyc3/steamguard-cli/actions/workflows/rust.yml) [![Lint, Build, Test](https://github.com/dyc3/steamguard-cli/actions/workflows/rust.yml/badge.svg)](https://github.com/dyc3/steamguard-cli/actions/workflows/rust.yml)
[![AUR Tester](https://github.com/dyc3/steamguard-cli/actions/workflows/aur-checker.yml/badge.svg)](https://github.com/dyc3/steamguard-cli/actions/workflows/aur-checker.yml) [![AUR Tester](https://github.com/dyc3/steamguard-cli/actions/workflows/aur-checker.yml/badge.svg)](https://github.com/dyc3/steamguard-cli/actions/workflows/aur-checker.yml)
A command line utility for setting up and using Steam Mobile Authenticator (AKA Steam 2FA). It can also be used to respond to trade and market confirmations. A command line utility for setting up and using Steam Mobile Authenticator (AKA Steam 2FA). It can also be used to respond to trade, market, and any other steam mobile confirmations that you would normally get in the app.
**The only legitimate place to download steamguard-cli binaries is through this repo's releases, or by any package manager that is linked in this document.** **The only legitimate place to download steamguard-cli binaries is through this repo's releases, or by any package manager that is linked in this document.**

View file

@ -10,6 +10,7 @@ use crate::AccountManager;
pub mod code; pub mod code;
pub mod completions; pub mod completions;
pub mod confirm;
pub mod debug; pub mod debug;
pub mod decrypt; pub mod decrypt;
pub mod encrypt; pub mod encrypt;
@ -19,10 +20,10 @@ pub mod qr;
pub mod qr_login; pub mod qr_login;
pub mod remove; pub mod remove;
pub mod setup; pub mod setup;
pub mod trade;
pub use code::CodeCommand; pub use code::CodeCommand;
pub use completions::CompletionsCommand; pub use completions::CompletionsCommand;
pub use confirm::ConfirmCommand;
pub use debug::DebugCommand; pub use debug::DebugCommand;
pub use decrypt::DecryptCommand; pub use decrypt::DecryptCommand;
pub use encrypt::EncryptCommand; pub use encrypt::EncryptCommand;
@ -32,7 +33,6 @@ pub use qr::QrCommand;
pub use qr_login::QrLoginCommand; pub use qr_login::QrLoginCommand;
pub use remove::RemoveCommand; pub use remove::RemoveCommand;
pub use setup::SetupCommand; pub use setup::SetupCommand;
pub use trade::TradeCommand;
/// A command that does not operate on the manifest or individual accounts. /// A command that does not operate on the manifest or individual accounts.
pub(crate) trait ConstCommand { pub(crate) trait ConstCommand {
@ -166,7 +166,8 @@ pub(crate) enum Subcommands {
Completion(CompletionsCommand), Completion(CompletionsCommand),
Setup(SetupCommand), Setup(SetupCommand),
Import(ImportCommand), Import(ImportCommand),
Trade(TradeCommand), #[clap(alias = "trade")]
Confirm(ConfirmCommand),
Remove(RemoveCommand), Remove(RemoveCommand),
Encrypt(EncryptCommand), Encrypt(EncryptCommand),
Decrypt(DecryptCommand), Decrypt(DecryptCommand),

View file

@ -9,12 +9,12 @@ use crate::{tui, AccountManager};
use super::*; use super::*;
#[derive(Debug, Clone, Parser)] #[derive(Debug, Clone, Parser)]
#[clap(about = "Interactive interface for trade confirmations")] #[clap(about = "Interactive interface for steam mobile confirmations")]
pub struct TradeCommand { pub struct ConfirmCommand {
#[clap( #[clap(
short, short,
long, long,
help = "Accept all open trade confirmations. Does not open interactive interface." help = "Accept all open mobile confirmations. Does not open interactive interface."
)] )]
pub accept_all: bool, pub accept_all: bool,
#[clap( #[clap(
@ -25,7 +25,7 @@ pub struct TradeCommand {
pub fail_fast: bool, pub fail_fast: bool,
} }
impl<T> AccountCommand<T> for TradeCommand impl<T> AccountCommand<T> for ConfirmCommand
where where
T: Transport + Clone, T: Transport + Clone,
{ {
@ -44,12 +44,12 @@ where
crate::do_login(transport.clone(), &mut account, args.password.clone())?; crate::do_login(transport.clone(), &mut account, args.password.clone())?;
} }
info!("{}: Checking for trade confirmations", account.account_name); info!("{}: Checking for confirmations", account.account_name);
let confirmations: Vec<Confirmation>; let confirmations: Vec<Confirmation>;
loop { loop {
let confirmer = Confirmer::new(transport.clone(), &account); let confirmer = Confirmer::new(transport.clone(), &account);
match confirmer.get_trade_confirmations() { match confirmer.get_confirmations() {
Ok(confs) => { Ok(confs) => {
confirmations = confs; confirmations = confs;
break; break;
@ -59,7 +59,7 @@ where
crate::do_login(transport.clone(), &mut account, args.password.clone())?; crate::do_login(transport.clone(), &mut account, args.password.clone())?;
} }
Err(err) => { Err(err) => {
error!("Failed to get trade confirmations: {}", err); error!("Failed to get confirmations: {}", err);
return Err(err.into()); return Err(err.into());
} }
} }

View file

@ -86,7 +86,7 @@ fn run(args: commands::Args) -> anyhow::Result<()> {
Subcommands::Import(args) => CommandType::Manifest(Box::new(args)), Subcommands::Import(args) => CommandType::Manifest(Box::new(args)),
Subcommands::Encrypt(args) => CommandType::Manifest(Box::new(args)), Subcommands::Encrypt(args) => CommandType::Manifest(Box::new(args)),
Subcommands::Decrypt(args) => CommandType::Manifest(Box::new(args)), Subcommands::Decrypt(args) => CommandType::Manifest(Box::new(args)),
Subcommands::Trade(args) => CommandType::Account(Box::new(args)), Subcommands::Confirm(args) => CommandType::Account(Box::new(args)),
Subcommands::Remove(args) => CommandType::Account(Box::new(args)), Subcommands::Remove(args) => CommandType::Account(Box::new(args)),
Subcommands::Code(args) => CommandType::Account(Box::new(args)), Subcommands::Code(args) => CommandType::Account(Box::new(args)),
#[cfg(feature = "qr")] #[cfg(feature = "qr")]

View file

@ -82,7 +82,7 @@ where
cookies cookies
} }
pub fn get_trade_confirmations(&self) -> Result<Vec<Confirmation>, ConfirmerError> { pub fn get_confirmations(&self) -> Result<Vec<Confirmation>, ConfirmerError> {
let cookies = self.build_cookie_jar(); let cookies = self.build_cookie_jar();
let client = self.transport.innner_http_client()?; let client = self.transport.innner_http_client()?;