remove props compression

This commit is contained in:
Evan Almloff 2023-07-07 11:08:27 -07:00
parent 7597068af6
commit c49c75cb60
4 changed files with 2 additions and 9 deletions

View file

@ -50,7 +50,6 @@ serde_json = { version = "1.0.95", optional = true }
tokio-stream = { version = "0.1.12", features = ["sync"], optional = true }
futures-util = { workspace = true, optional = true }
postcard = { version = "1.0.4", features = ["use-std"] }
yazi = "0.1.5"
base64 = "0.21.0"
pin-project = "1.1.2"

View file

@ -41,6 +41,7 @@ fn app(cx: Scope<AppProps>) -> Element {
}
#[server(PostServerData)]
#[middleware(Auth(AuthLevel::Admin))]
async fn post_server_data(
#[extract] Axum(axum::extract::Host(host), _): Axum<_, _>,
data: String,

View file

@ -6,7 +6,6 @@ use base64::Engine;
#[allow(unused)]
pub(crate) fn serde_from_string<T: DeserializeOwned>(string: &str) -> Option<T> {
let decompressed = STANDARD.decode(string.as_bytes()).ok()?;
let (decompressed, _) = yazi::decompress(&decompressed, yazi::Format::Zlib).unwrap();
postcard::from_bytes(&decompressed).ok()
}

View file

@ -9,13 +9,7 @@ pub(crate) fn serde_to_writable<T: Serialize>(
write_to: &mut impl std::io::Write,
) -> std::io::Result<()> {
let serialized = postcard::to_allocvec(value).unwrap();
let compressed = yazi::compress(
&serialized,
yazi::Format::Zlib,
yazi::CompressionLevel::BestSize,
)
.unwrap();
write_to.write_all(&STANDARD.encode(compressed).as_bytes())?;
write_to.write_all(&STANDARD.encode(serialized).as_bytes())?;
Ok(())
}