use crate::{code_migrations::run_advanced_migrations, root_span_builder::QuieterRootSpanBuilder};
use activitypub_federation::config::{FederationConfig, FederationMiddleware};
use actix_cors::Cors;
-use actix_web::{middleware, web::Data, App, HttpServer, Result};
+use actix_web::{
+ middleware::{self, ErrorHandlers},
+ web::Data,
+ App,
+ HttpServer,
+ Result,
+};
use lemmy_api_common::{
context::LemmyContext,
lemmy_db_views::structs::SiteView,
use lemmy_utils::{
error::LemmyError,
rate_limit::RateLimitCell,
+ response::jsonify_plain_text_errors,
settings::SETTINGS,
SYNCHRONOUS_FEDERATION,
};
let pool = build_db_pool(&settings).await?;
// Run the Code-required migrations
- run_advanced_migrations(&pool, &settings).await?;
+ run_advanced_migrations(&mut (&pool).into(), &settings).await?;
// Initialize the secrets
- let secret = Secret::init(&pool)
+ let secret = Secret::init(&mut (&pool).into())
.await
.expect("Couldn't initialize secrets.");
// Make sure the local site is set up.
- let site_view = SiteView::read_local(&pool)
+ let site_view = SiteView::read_local(&mut (&pool).into())
.await
.expect("local site not set up");
let local_site = site_view.local_site;
.retry_count(settings.retry_count)
.debug(*SYNCHRONOUS_FEDERATION)
.http_signature_compat(true)
- .url_verifier(Box::new(VerifyUrlData(context.pool().clone())))
+ .url_verifier(Box::new(VerifyUrlData(context.inner_pool().clone())))
.build()
.await?;
.wrap(middleware::Compress::default())
.wrap(cors_config)
.wrap(TracingLogger::<QuieterRootSpanBuilder>::new())
+ .wrap(ErrorHandlers::new().default_handler(jsonify_plain_text_errors))
.app_data(Data::new(context.clone()))
.app_data(Data::new(rate_limit_cell.clone()))
.wrap(FederationMiddleware::new(federation_config.clone()));