mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-10 15:57:53 +00:00
Merge remote-tracking branch 'upstream/main' into rust-command-parser
This commit is contained in:
commit
b353dcbda2
94 changed files with 2575 additions and 738 deletions
|
|
@ -8,10 +8,10 @@ use anyhow::Context;
|
|||
use axum::extract::State;
|
||||
use axum::routing::get;
|
||||
use axum::{
|
||||
Json, Router,
|
||||
http::StatusCode,
|
||||
response::{IntoResponse, Response},
|
||||
routing::post,
|
||||
Json, Router,
|
||||
};
|
||||
use libpk::_config::AvatarsConfig;
|
||||
use libpk::db::repository::avatars as db;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use std::io::Cursor;
|
|||
use std::time::Instant;
|
||||
use tracing::{debug, error, info, instrument};
|
||||
|
||||
use crate::{hash::Hash, ImageKind, PKAvatarError};
|
||||
use crate::{ImageKind, PKAvatarError, hash::Hash};
|
||||
|
||||
const MAX_DIMENSION: u32 = 4000;
|
||||
|
||||
|
|
@ -211,8 +211,8 @@ fn process_gif_inner(
|
|||
}))
|
||||
}
|
||||
|
||||
fn reader_for(data: &[u8]) -> image::io::Reader<Cursor<&[u8]>> {
|
||||
image::io::Reader::new(Cursor::new(data))
|
||||
fn reader_for(data: &[u8]) -> image::ImageReader<Cursor<&[u8]>> {
|
||||
image::ImageReader::new(Cursor::new(data))
|
||||
.with_guessed_format()
|
||||
.expect("cursor i/o is infallible")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ pub async fn pull(
|
|||
let size = match response.content_length() {
|
||||
None => return Err(PKAvatarError::MissingHeader("Content-Length")),
|
||||
Some(size) if size > MAX_SIZE => {
|
||||
return Err(PKAvatarError::ImageFileSizeTooLarge(size, MAX_SIZE))
|
||||
return Err(PKAvatarError::ImageFileSizeTooLarge(size, MAX_SIZE));
|
||||
}
|
||||
Some(size) => size,
|
||||
};
|
||||
|
|
@ -162,7 +162,7 @@ pub fn parse_url(url: &str) -> anyhow::Result<ParsedUrl> {
|
|||
attachment_id: 0,
|
||||
filename: "".to_string(),
|
||||
full_url: url.to_string(),
|
||||
})
|
||||
});
|
||||
}
|
||||
_ => anyhow::bail!("not a discord cdn url"),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue