force bearer auth
All checks were successful
Build and Test / account (push) Successful in 3m3s

no idea if this is right but i want to protect accounts
This commit is contained in:
red binder 2026-08-11 04:35:12 +02:00
commit 82b5bb36c5

View file

@ -647,7 +647,7 @@ impl<'r> FromRequest<'r> for DeviceHeaders {
#[get("/v1/api/people/@me/devices")] #[get("/v1/api/people/@me/devices")]
pub fn get_user_devices( pub fn get_user_devices(
auth: Auth<false>, auth: Auth<true>,
headers: DeviceHeaders, headers: DeviceHeaders,
) -> Xml<DevicesWrapper> { ) -> Xml<DevicesWrapper> {
let now = chrono::Utc::now().naive_utc(); let now = chrono::Utc::now().naive_utc();
@ -670,21 +670,21 @@ pub fn get_user_devices(
} }
#[get("/v1/api/people/@me/devices/status")] #[get("/v1/api/people/@me/devices/status")]
pub fn get_device_status(_auth: Auth<false>) -> Xml<EmptyDeviceResponse> { pub fn get_device_status(_auth: Auth<true>) -> Xml<EmptyDeviceResponse> {
Xml(EmptyDeviceResponse { Xml(EmptyDeviceResponse {
device: String::new(), device: String::new(),
}) })
} }
#[put("/v1/api/people/@me/devices/@current/inactivate")] #[put("/v1/api/people/@me/devices/@current/inactivate")]
pub fn inactivate_current_device(_auth: Auth<false>) -> () { pub fn inactivate_current_device(_auth: Auth<true>) -> () {
// just 200 // just 200
} }
#[post("/v1/api/people/@me/deletion")] #[post("/v1/api/people/@me/deletion")]
pub async fn delete_account( pub async fn delete_account(
database: &State<Pool>, database: &State<Pool>,
auth: Auth<false>, auth: Auth<true>,
) -> Result<(), Option<Errors<'static>>> { ) -> Result<(), Option<Errors<'static>>> {
let db = database.inner(); let db = database.inner();
@ -706,7 +706,7 @@ pub async fn delete_account(
#[put("/v1/api/people/@me", data = "<data>")] #[put("/v1/api/people/@me", data = "<data>")]
pub async fn update_account( pub async fn update_account(
database: &State<Pool>, database: &State<Pool>,
auth: Auth<false>, auth: Auth<true>,
data: Xml<UpdateAccountData>, data: Xml<UpdateAccountData>,
) -> Result<(), Option<Errors<'static>>> { ) -> Result<(), Option<Errors<'static>>> {
let db = database.inner(); let db = database.inner();
@ -764,7 +764,7 @@ pub fn get_own_emails(user: Auth<false>) -> Xml<EmailsWrapper> {
#[put("/v1/api/people/@me/emails/@primary", data = "<data>")] #[put("/v1/api/people/@me/emails/@primary", data = "<data>")]
pub async fn update_primary_email( pub async fn update_primary_email(
database: &State<Pool>, database: &State<Pool>,
auth: Auth<false>, auth: Auth<true>,
data: Xml<UpdateEmailRequest>, data: Xml<UpdateEmailRequest>,
) -> Result<(), Option<Errors<'static>>> { ) -> Result<(), Option<Errors<'static>>> {
let db = database.inner(); let db = database.inner();