refact: set global form and json payload limit
This commit is contained in:
parent
3f93ff98d2
commit
1a5b28b20d
49
Cargo.lock
generated
49
Cargo.lock
generated
@ -1,5 +1,31 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "actix"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"actix-http 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"actix-rt 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"actix_derive 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"derive_more 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hashbrown 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"trust-dns-resolver 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "actix-codec"
|
||||
version = "0.1.2"
|
||||
@ -234,6 +260,16 @@ dependencies = [
|
||||
"syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "actix_derive"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "adler32"
|
||||
version = "1.0.3"
|
||||
@ -453,6 +489,15 @@ dependencies = [
|
||||
"cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-channel"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.6.5"
|
||||
@ -1571,6 +1616,7 @@ dependencies = [
|
||||
name = "rubble"
|
||||
version = "0.3.1"
|
||||
dependencies = [
|
||||
"actix 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"actix-files 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"actix-web 1.0.0-rc (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -2285,6 +2331,7 @@ dependencies = [
|
||||
]
|
||||
|
||||
[metadata]
|
||||
"checksum actix 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "671ce3d27313f236827a5dd153a1073ad03ef31fc77f562020263e7830cf1ef7"
|
||||
"checksum actix-codec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9f2c11af4b06dc935d8e1b1491dad56bfb32febc49096a91e773f8535c176453"
|
||||
"checksum actix-connect 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d7fbab0d79b2f3415a79570e3db12eaa75c26239541e613b832655145a5e9488"
|
||||
"checksum actix-files 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "63ed25d86e7916d156be3a9724bcf0129b01d19af7c0fb2145e5193061a92e57"
|
||||
@ -2298,6 +2345,7 @@ dependencies = [
|
||||
"checksum actix-utils 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7ab47adc5e67fc83a0c58570b40531f09814a5daa969e0d913ebeab908a43508"
|
||||
"checksum actix-web 1.0.0-rc (registry+https://github.com/rust-lang/crates.io-index)" = "c364d8f025fa5b0849c093acc0a2de5eb7b00941cdfdfac11278f6b39ae3a279"
|
||||
"checksum actix-web-codegen 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f12fe2bc39a899594da6d67cfd6a1b6670b62e8af66b73f2fd4d1df6cb881699"
|
||||
"checksum actix_derive 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0bf5f6d7bf2d220ae8b4a7ae02a572bb35b7c4806b24049af905ab8110de156c"
|
||||
"checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c"
|
||||
"checksum aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5"
|
||||
"checksum aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e6f484ae0c99fec2e858eb6134949117399f222608d84cadb3f58c1f97c2364c"
|
||||
@ -2326,6 +2374,7 @@ dependencies = [
|
||||
"checksum copyless 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "59de7722d3b5c7b35dd519d617fe5116c9b879a0f145dc5431d78ab1f61d7c23"
|
||||
"checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb"
|
||||
"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
|
||||
"checksum crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "0f0ed1a4de2235cabda8558ff5840bffb97fcb64c97827f354a451307df5f72b"
|
||||
"checksum crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f8306fcef4a7b563b76b7dd949ca48f52bc1141aa067d2ea09565f3e2652aa5c"
|
||||
"checksum darling 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9158d690bc62a3a57c3e45b85e4d50de2008b39345592c64efd79345c7e24be0"
|
||||
"checksum darling_core 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)" = "d2a368589465391e127e10c9e3a08efc8df66fd49b87dc8524c764bbe7f2ef82"
|
||||
|
@ -38,3 +38,4 @@ pretty_env_logger = "0.3.0"
|
||||
time = "0.1.42"
|
||||
rand = "0.6.5"
|
||||
rss = "1.7.0"
|
||||
actix = "0.8.3"
|
||||
|
13
src/main.rs
13
src/main.rs
@ -21,7 +21,7 @@ use dotenv::dotenv;
|
||||
|
||||
use crate::data::RubbleData;
|
||||
use crate::pg_pool::database_pool_establish;
|
||||
use actix_web::web::JsonConfig;
|
||||
use actix_web::web::{FormConfig, JsonConfig};
|
||||
use std::sync::Arc;
|
||||
use tera::compile_templates;
|
||||
use time::Duration;
|
||||
@ -53,7 +53,8 @@ fn main() {
|
||||
HttpServer::new(move || {
|
||||
App::new()
|
||||
.data(data.clone())
|
||||
.data(JsonConfig::default().limit(266000))
|
||||
.data(JsonConfig::default().limit(256_000))
|
||||
.data(FormConfig::default().limit(256_000))
|
||||
.wrap(Logger::default())
|
||||
.wrap(Cors::default())
|
||||
.wrap(IdentityService::new(
|
||||
@ -75,13 +76,7 @@ fn main() {
|
||||
.service(routers::admin::admin_login)
|
||||
.service(routers::admin::admin_authentication)
|
||||
.service(routers::admin::article_creation)
|
||||
.service(
|
||||
web::resource("/article").route(
|
||||
web::post()
|
||||
.data(web::FormConfig::default().limit(256_000))
|
||||
.to(routers::admin::article_save),
|
||||
),
|
||||
)
|
||||
.service(routers::admin::article_save)
|
||||
.service(routers::admin::article_edit)
|
||||
.service(routers::admin::article_deletion)
|
||||
.service(routers::admin::change_password)
|
||||
|
@ -131,6 +131,7 @@ pub fn article_edit(
|
||||
}
|
||||
}
|
||||
|
||||
#[post("/article")]
|
||||
pub fn article_save(
|
||||
id: Identity,
|
||||
article: Form<crate::models::article::form::NewArticleForm>,
|
||||
|
Loading…
Reference in New Issue
Block a user