Skip to content

Commit

Permalink
Merge pull request #63 from Chloe-Woahie/dev-main
Browse files Browse the repository at this point in the history
v0.32.2
  • Loading branch information
fekie authored Jun 5, 2023
2 parents 16bc8d6 + aa85ce8 commit c6bb2e9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "MIT"
name = "roboat"
readme = "README.md"
repository = "https://github.com/Chloe-Woahie/roboat"
version = "0.32.1"
version = "0.32.2"

[dependencies]
reqwest = { version = "0.11.14", default-features=false, features = ["rustls-tls", "json"] }
Expand All @@ -17,7 +17,8 @@ serde = {version="1.0.136", features=["derive"]}
serde_json = "1.0.94"
tokio = { version = "1.27.0", features = ["full"] }
uuid = {version="1.3.1", features=["fast-rng", "v4"]}
base64 = "0.13.1"
base64 = "0.21.2"


[dev-dependencies]
clap = { version = "4.1.13", features = ["derive"] }
clap = { version = "4.1.13", features = ["derive"] }
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Alternatively, you can add a specific version of roboat to your project by addin

```toml
[dependencies]
roboat = "0.32.1"
roboat = "0.32.2"
```

# Quick Start Examples
Expand Down
7 changes: 4 additions & 3 deletions src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ use reqwest::Response;
use serde::de::DeserializeOwned;
use serde::{Deserialize, Serialize};

// I really hate the way new updates of this library work but I don't want a dependency to be outdated
use base64::{engine::general_purpose, Engine as _};
/// Roblox's error response used when a status code of 403 is given. Only the first error
/// is used when converting to [`RoboatError`].
#[allow(missing_docs)]
Expand Down Expand Up @@ -74,11 +76,10 @@ impl Client {
};

// We can unwrap here because we're kinda screwed if it's spitting out other stuff and the library would need to be fixed.
let metadata =
String::from_utf8(base64::decode(metadata_encoded).unwrap()).unwrap();
let metadata = general_purpose::STANDARD.decode(metadata_encoded).unwrap();

// We parse the metadata into a struct, and error if we cant.
let metadata_struct: ChallengeMetadata = match serde_json::from_str(&metadata) {
let metadata_struct: ChallengeMetadata = match serde_json::from_slice(&metadata) {
Ok(x) => x,
Err(_) => {
return RoboatError::UnknownStatus403Format;
Expand Down

0 comments on commit c6bb2e9

Please sign in to comment.