fix: add more cors shit
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful

can someone please just make cors disappear? god i hate this shit.
This commit is contained in:
Radical 2025-07-19 23:03:23 +02:00
parent 2fbf41ba8c
commit 252b9a3dc6

View file

@ -1,5 +1,5 @@
use argon2::Argon2; use argon2::Argon2;
use axum::{http::header, Router}; use axum::{http::{header, Method}, Router};
use clap::Parser; use clap::Parser;
use diesel_async::pooled_connection::AsyncDieselConnectionManager; use diesel_async::pooled_connection::AsyncDieselConnectionManager;
use diesel_async::pooled_connection::deadpool::Pool; use diesel_async::pooled_connection::deadpool::Pool;
@ -131,22 +131,28 @@ async fn main() -> Result<(), Error> {
.allow_origin(AllowOrigin::predicate(|_origin, _request_head| { .allow_origin(AllowOrigin::predicate(|_origin, _request_head| {
true true
})) }))
.allow_methods(AllowMethods::list([ .allow_methods(vec![
"GET".parse().unwrap(), Method::GET,
"POST".parse().unwrap(), Method::POST,
"PUT".parse().unwrap(), Method::PUT,
"PATCH".parse().unwrap(), Method::DELETE,
"DELETE".parse().unwrap(), Method::HEAD,
"OPTIONS".parse().unwrap(), Method::OPTIONS,
])) Method::CONNECT,
.allow_headers(AllowHeaders::list([ Method::PATCH,
Method::TRACE,
])
.allow_headers(vec![
header::ACCEPT,
header::ACCEPT_LANGUAGE,
header::AUTHORIZATION, header::AUTHORIZATION,
header::CONTENT_LANGUAGE,
header::CONTENT_TYPE, header::CONTENT_TYPE,
header::ORIGIN, header::ORIGIN,
header::ACCEPT, header::ACCEPT,
header::COOKIE, header::COOKIE,
"x-requested-with".parse().unwrap(), "x-requested-with".parse().unwrap(),
])) ])
// Allow credentials // Allow credentials
.allow_credentials(true); .allow_credentials(true);