mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-23 09:44:46 +00:00
update actix-web to v3 stable (#1125)
This commit is contained in:
parent
bd0e69b2bb
commit
986dc3f52c
502
server/Cargo.lock
generated
vendored
502
server/Cargo.lock
generated
vendored
File diff suppressed because it is too large
Load diff
8
server/Cargo.toml
vendored
8
server/Cargo.toml
vendored
|
@ -28,10 +28,10 @@ bcrypt = "0.8.0"
|
||||||
chrono = { version = "0.4.7", features = ["serde"] }
|
chrono = { version = "0.4.7", features = ["serde"] }
|
||||||
serde_json = { version = "1.0.52", features = ["preserve_order"]}
|
serde_json = { version = "1.0.52", features = ["preserve_order"]}
|
||||||
serde = { version = "1.0.105", features = ["derive"] }
|
serde = { version = "1.0.105", features = ["derive"] }
|
||||||
actix = "0.10.0-alpha.2"
|
actix = "0.10.0"
|
||||||
actix-web = { version = "3.0.0-alpha.3", features = ["rustls"] }
|
actix-web = { version = "3.0.0", default-features = false, features = ["rustls"] }
|
||||||
actix-files = "0.3.0-alpha.1"
|
actix-files = "0.3.0"
|
||||||
actix-web-actors = "3.0.0-alpha.1"
|
actix-web-actors = "3.0.0"
|
||||||
actix-rt = "1.1.1"
|
actix-rt = "1.1.1"
|
||||||
awc = "2.0.0-alpha.2"
|
awc = "2.0.0-alpha.2"
|
||||||
log = "0.4.0"
|
log = "0.4.0"
|
||||||
|
|
|
@ -39,7 +39,7 @@ lazy_static! {
|
||||||
|
|
||||||
embed_migrations!();
|
embed_migrations!();
|
||||||
|
|
||||||
#[actix_rt::main]
|
#[actix_web::main]
|
||||||
async fn main() -> Result<(), LemmyError> {
|
async fn main() -> Result<(), LemmyError> {
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
let settings = Settings::get();
|
let settings = Settings::get();
|
||||||
|
|
|
@ -80,13 +80,13 @@ fn get_feed_all_data(conn: &PgConnection, sort_type: &SortType) -> Result<String
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_feed(
|
async fn get_feed(
|
||||||
path: web::Path<(String, String)>,
|
web::Path((req_type, param)): web::Path<(String, String)>,
|
||||||
info: web::Query<Params>,
|
info: web::Query<Params>,
|
||||||
context: web::Data<LemmyContext>,
|
context: web::Data<LemmyContext>,
|
||||||
) -> Result<HttpResponse, Error> {
|
) -> Result<HttpResponse, Error> {
|
||||||
let sort_type = get_sort_type(info).map_err(ErrorBadRequest)?;
|
let sort_type = get_sort_type(info).map_err(ErrorBadRequest)?;
|
||||||
|
|
||||||
let request_type = match path.0.as_ref() {
|
let request_type = match req_type.as_str() {
|
||||||
"u" => RequestType::User,
|
"u" => RequestType::User,
|
||||||
"c" => RequestType::Community,
|
"c" => RequestType::Community,
|
||||||
"front" => RequestType::Front,
|
"front" => RequestType::Front,
|
||||||
|
@ -94,8 +94,6 @@ async fn get_feed(
|
||||||
_ => return Err(ErrorBadRequest(LemmyError::from(anyhow!("wrong_type")))),
|
_ => return Err(ErrorBadRequest(LemmyError::from(anyhow!("wrong_type")))),
|
||||||
};
|
};
|
||||||
|
|
||||||
let param = path.1.to_owned();
|
|
||||||
|
|
||||||
let builder = blocking(context.pool(), move |conn| match request_type {
|
let builder = blocking(context.pool(), move |conn| match request_type {
|
||||||
RequestType::User => get_feed_user(conn, &sort_type, param),
|
RequestType::User => get_feed_user(conn, &sort_type, param),
|
||||||
RequestType::Community => get_feed_community(conn, &sort_type, param),
|
RequestType::Community => get_feed_community(conn, &sort_type, param),
|
||||||
|
|
|
@ -6,7 +6,7 @@ use lemmy_utils::settings::Settings;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
pub fn config(cfg: &mut web::ServiceConfig, rate_limit: &RateLimit) {
|
pub fn config(cfg: &mut web::ServiceConfig, rate_limit: &RateLimit) {
|
||||||
let client = Client::build()
|
let client = Client::builder()
|
||||||
.header("User-Agent", "pict-rs-frontend, v0.1.0")
|
.header("User-Agent", "pict-rs-frontend, v0.1.0")
|
||||||
.timeout(Duration::from_secs(30))
|
.timeout(Duration::from_secs(30))
|
||||||
.finish();
|
.finish();
|
||||||
|
|
Loading…
Reference in a new issue