Use base64 crate for base64 instead of deprecated rustc-serialize, for https://github.com/iceiix/steven/issues/4
This commit is contained in:
parent
fe99910550
commit
e988c64376
|
@ -11,6 +11,15 @@ dependencies = [
|
|||
"nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "0.7.0"
|
||||
|
@ -679,6 +688,11 @@ name = "rustc-serialize"
|
|||
version = "0.3.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "safemem"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
version = "0.1.3"
|
||||
|
@ -752,6 +766,7 @@ dependencies = [
|
|||
name = "steven"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cgmath 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"collision 0.5.1 (git+https://github.com/TheUnnamedDude/collision-rs?rev=f80825e)",
|
||||
|
@ -991,6 +1006,7 @@ dependencies = [
|
|||
[metadata]
|
||||
"checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c"
|
||||
"checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef"
|
||||
"checksum base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643"
|
||||
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
|
||||
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
|
||||
"checksum build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39"
|
||||
|
@ -1073,6 +1089,7 @@ dependencies = [
|
|||
"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1"
|
||||
"checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5"
|
||||
"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
|
||||
"checksum safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dca453248a96cb0749e36ccdfe2b0b4e54a61bfef89fb97ec621eb8e0a93dd9"
|
||||
"checksum same-file 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d931a44fdaa43b8637009e7632a02adc4f2b2e0733c08caa4cf00e8da4a117a7"
|
||||
"checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8"
|
||||
"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
|
||||
|
|
|
@ -21,6 +21,7 @@ zip = "0.4.2"
|
|||
image = "0.20.0"
|
||||
rand = "0.3.14"
|
||||
rustc-serialize = "0.3.24"
|
||||
base64 = "0.9.3"
|
||||
log = "0.4.5"
|
||||
cgmath = "0.7.0"
|
||||
lazy_static = "1.1.0"
|
||||
|
|
|
@ -27,6 +27,7 @@ extern crate hyper;
|
|||
extern crate flate2;
|
||||
extern crate rand;
|
||||
extern crate rustc_serialize;
|
||||
extern crate base64;
|
||||
extern crate cgmath;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
|
|
@ -27,7 +27,7 @@ use protocol;
|
|||
use serde_json;
|
||||
use std::time::{Duration};
|
||||
use image;
|
||||
use rustc_serialize::base64::FromBase64;
|
||||
use base64;
|
||||
use rand;
|
||||
use rand::Rng;
|
||||
|
||||
|
@ -264,9 +264,8 @@ impl ServerList {
|
|||
let mut desc = res.0.description;
|
||||
format::convert_legacy(&mut desc);
|
||||
let favicon = if let Some(icon) = res.0.favicon {
|
||||
let data = icon["data:image/png;base64,".len()..]
|
||||
.from_base64()
|
||||
.unwrap();
|
||||
let data_base64 = &icon["data:image/png;base64,".len()..];
|
||||
let data = base64::decode_config(data_base64, base64::MIME).unwrap();
|
||||
Some(image::load_from_memory(&data).unwrap())
|
||||
} else {
|
||||
None
|
||||
|
|
|
@ -736,7 +736,7 @@ impl Server {
|
|||
|
||||
fn on_player_info(&mut self, player_info: packet::play::clientbound::PlayerInfo) {
|
||||
use protocol::packet::PlayerDetail::*;
|
||||
use rustc_serialize::base64::FromBase64;
|
||||
use base64;
|
||||
use serde_json;
|
||||
for detail in player_info.inner.players {
|
||||
match detail {
|
||||
|
@ -765,7 +765,8 @@ impl Server {
|
|||
// authlib. We could download authlib on startup and extract
|
||||
// the key but this seems like overkill compared to just
|
||||
// whitelisting Mojang's texture servers instead.
|
||||
let skin_blob = match prop.value.from_base64() {
|
||||
let skin_blob_result = &base64::decode_config(&prop.value, base64::MIME);
|
||||
let skin_blob = match skin_blob_result {
|
||||
Ok(val) => val,
|
||||
Err(err) => {
|
||||
error!("Failed to decode skin blob, {:?}", err);
|
||||
|
|
Loading…
Reference in New Issue