doy / rbw

unofficial bitwarden cli
https://git.tozt.net/rbw
Other
573 stars 82 forks source link

Pass `User-Agent` header to prevent login from returning 400 #151

Closed Ty3uK closed 6 months ago

Ty3uK commented 6 months ago

Fixes #145

Ty3uK commented 6 months ago

cargo install --git https://github.com/Ty3uK/rbw --rev 40a33ec

Msouza91 commented 6 months ago

Uninstalled previous version and installed with the parameter listed, but I'm still getting the error, how can I provide useful debug info?

mxkrsv commented 6 months ago

Uninstalled previous version and installed with the parameter listed, but I'm still getting the error, how can I provide useful debug info?

@Msouza91 you must export PATH="$HOME/.cargo/bin:$PATH", otherwise the new rbw will launch the old rbw-agent, which is the reason of the failure.

mxkrsv commented 6 months ago

Worked for me, thank you very much!

Msouza91 commented 6 months ago

export PATH="$HOME/.cargo/bin:$PATH

I already had this on my .zshrc, not to mention that I uninstalled the previous version, did an rbw purge and deleted the config file before installing this rev to be on the safe side.

rjc commented 6 months ago

I can confirm this fixes the issue from #145.

joelsleeba commented 6 months ago

@Msouza91 I faced the same issue. Problem was that even after uninstallation, the old rbw-agent was running in the background. Kill rbw-agent. Try rbw login again.

This fixed it for me.

rpdelaney commented 6 months ago

Linter error:

 error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
  --> src/edit.rs:35:29
   |
35 |               Some(editor) => match editor.to_str() {
   |  _____________________________^
36 | |                 Some("vim" | "nvim") => {
37 | |                     // disable swap files and viminfo for password entry
38 | |                     editor_args.push(std::ffi::OsString::from("-ni"));
...  |
43 | |                 }
44 | |             },
   | |_____________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else
   = note: `-D clippy::single-match-else` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::single_match_else)]`
help: try
   |
35 ~             Some(editor) => if let Some("vim" | "nvim") = editor.to_str() {
36 +                 // disable swap files and viminfo for password entry
37 +                 editor_args.push(std::ffi::OsString::from("-ni"));
38 +                 editor_args.push(std::ffi::OsString::from("NONE"));
39 +             } else {
40 +                 // other editor support welcomed
41 ~             },
   |
Ty3uK commented 6 months ago

Linter error:


 error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`

  --> src/edit.rs:35:29

   |

35 |               Some(editor) => match editor.to_str() {

   |  _____________________________^

36 | |                 Some("vim" | "nvim") => {

37 | |                     // disable swap files and viminfo for password entry

38 | |                     editor_args.push(std::ffi::OsString::from("-ni"));

...  |

43 | |                 }

44 | |             },

   | |_____________^

   |

   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else

   = note: `-D clippy::single-match-else` implied by `-D warnings`

   = help: to override `-D warnings` add `#[allow(clippy::single_match_else)]`

help: try

   |

35 ~             Some(editor) => if let Some("vim" | "nvim") = editor.to_str() {

36 +                 // disable swap files and viminfo for password entry

37 +                 editor_args.push(std::ffi::OsString::from("-ni"));

38 +                 editor_args.push(std::ffi::OsString::from("NONE"));

39 +             } else {

40 +                 // other editor support welcomed

41 ~             },

   |

I know, I fixed this and got another linter error in another files.

I suppose we need to fix main and all PR's need to be rebased.

rpdelaney commented 6 months ago

main looks like it's building okay to me. 🤔 I'll take a stab at it.

rjc commented 6 months ago

Just an FYI - this fix has now been committed the -current and -stable branches of the OpenBSD's ports tree.

Thank you!

Ty3uK commented 6 months ago

main looks like it's building okay to me. 🤔 I'll take a stab at it.

I got this on fresh main:

❯ cargo clippy --all-targets -- -Dwarnings
    Checking rbw v1.8.3 (/Users/ty3uk/projects/rust/rbw)
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
  --> src/edit.rs:35:29
   |
35 |               Some(editor) => match editor.to_str() {
   |  _____________________________^
36 | |                 Some("vim" | "nvim") => {
37 | |                     // disable swap files and viminfo for password entry
38 | |                     editor_args.push(std::ffi::OsString::from("-ni"));
...  |
43 | |                 }
44 | |             },
   | |_____________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else
   = note: `-D clippy::single-match-else` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::single_match_else)]`
help: try
   |
35 ~             Some(editor) => if let Some("vim" | "nvim") = editor.to_str() {
36 +                 // disable swap files and viminfo for password entry
37 +                 editor_args.push(std::ffi::OsString::from("-ni"));
38 +                 editor_args.push(std::ffi::OsString::from("NONE"));
39 +             } else {
40 +                 // other editor support welcomed
41 ~             },
   |

error: could not compile `rbw` (lib) due to previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `rbw` (lib test) due to previous error