diff --git a/Cargo.lock b/Cargo.lock index abac5bc..69183cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -254,6 +254,19 @@ dependencies = [ "libc", ] +[[package]] +name = "async-compression" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc2d0cfb2a7388d34f590e76686704c494ed7aaceed62ee1ba35cbf363abc2a5" +dependencies = [ + "flate2", + "futures-core", + "memchr", + "pin-project-lite", + "tokio", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -262,9 +275,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "base64" -version = "0.21.6" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c79fed4cdb43e993fcdadc7e58a09fd0e3e649c4436fa11da71c9f1f3ee7feb9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "bitflags" @@ -1235,6 +1248,7 @@ version = "0.11.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" dependencies = [ + "async-compression", "base64", "bytes", "encoding_rs", @@ -1260,6 +1274,7 @@ dependencies = [ "system-configuration", "tokio", "tokio-rustls", + "tokio-util", "tower-service", "url", "wasm-bindgen", diff --git a/Cargo.toml b/Cargo.toml index aa69b98..f56f75f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ actix-web = { version = "4.4.1", default-features = false, features = ["macros", actix-files = "0.6.5" tera = "1.19.1" serde = { version = "1.0.195", features = ["derive"] } -reqwest = { version = "0.11.23", default-features = false, features = ["rustls-tls"] } +reqwest = { version = "0.11.23", default-features = false, features = ["rustls-tls", "gzip"] } serde_json = "1.0.111" -base64 = "0.21.6" +base64 = "0.21.7" mime = "0.3.17" diff --git a/src/main.rs b/src/main.rs index bf88443..fc8596a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,7 +23,7 @@ struct Paste { } #[derive(Serialize, Deserialize)] -struct GitLabSuccessJSON { +struct GiteaSuccessJSON { name: String, path: String, size: u64, @@ -34,42 +34,53 @@ struct GitLabSuccessJSON { html_url: String, git_url: String, submodule_git_url: Option, - content: String + content: String, } #[derive(Serialize, Deserialize)] -struct GitLabFailedJSON { +struct GiteaFailedJSON { errors: Option>, message: String, - url: String + url: String, } #[get("/")] async fn paste_render(data: Data