Updated Documentation and Mii Renderer URL
This commit is contained in:
parent
3184001ed2
commit
c91aa25565
3 changed files with 19 additions and 7 deletions
2
.env.example
Normal file
2
.env.example
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
ROCKET_ADDRESS=0.0.0.0
|
||||||
|
ROCKET_PORT=8000
|
||||||
|
|
@ -1,5 +1,2 @@
|
||||||
# Cache Mii
|
# Cache Mii
|
||||||
Mii Render Caching Server that saves a .png and .tga render of a user's mii for use across SPFN's services
|
Mii Render Caching Server that saves a .png and .tga render of a user's mii for use across SPFN's services
|
||||||
|
|
||||||
### Credits:
|
|
||||||
- [Mii Renderer](https://mii-unsecure.ariankordi.net/): Arian Kordi
|
|
||||||
|
|
|
||||||
21
src/main.rs
21
src/main.rs
|
|
@ -5,7 +5,7 @@ use rocket::State;
|
||||||
use reqwest::Client;
|
use reqwest::Client;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
|
|
||||||
static MII_RENDERER_URL: &str = "https://mii-render.spfn.net";
|
static MII_RENDERER_URL: &str = "https://mii-renderer.spfn.net";
|
||||||
|
|
||||||
static ALLOWED_FORMATS: [&str; 2] = [
|
static ALLOWED_FORMATS: [&str; 2] = [
|
||||||
"png",
|
"png",
|
||||||
|
|
@ -17,10 +17,23 @@ async fn request_mii_render(client: &State<Client>, mii_data: &str, ext: &str) -
|
||||||
|
|
||||||
let response = client.get(req_str)
|
let response = client.get(req_str)
|
||||||
.send()
|
.send()
|
||||||
.await
|
.await;
|
||||||
.ok()?;
|
|
||||||
|
|
||||||
Some(response.bytes().await.expect("Failed to parse Mii Render to Bytes"))
|
match response {
|
||||||
|
Ok(res) => {
|
||||||
|
Some(res.bytes().await.expect("Failed to parse Mii Render to Bytes"))
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
let status = match err.status() {
|
||||||
|
Some(err_status) => {
|
||||||
|
err_status.to_string()
|
||||||
|
}
|
||||||
|
None => String::from("No Response")
|
||||||
|
};
|
||||||
|
println!("Error Requesting New Render - {}", status);
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[rocket::get("/<pid_str>/<path>")]
|
#[rocket::get("/<pid_str>/<path>")]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue