server: update various dependencies

This commit is contained in:
Valentin Tolmer
2023-02-23 16:58:22 +01:00
committed by nitnelave
parent dce73f91ef
commit 28607c4744
7 changed files with 53 additions and 37 deletions

View File

@@ -12,6 +12,7 @@ use crate::{
},
};
use anyhow::Context as AnyhowContext;
use base64::Engine;
use juniper::{graphql_object, FieldResult, GraphQLInputObject, GraphQLObject};
use tracing::{debug, debug_span, Instrument};
@@ -89,7 +90,7 @@ impl<Handler: BackendHandler> Mutation<Handler> {
let user_id = UserId::new(&user.id);
let avatar = user
.avatar
.map(base64::decode)
.map(|bytes| base64::engine::general_purpose::STANDARD.decode(bytes))
.transpose()
.context("Invalid base64 image")?
.map(JpegPhoto::try_from)
@@ -146,7 +147,7 @@ impl<Handler: BackendHandler> Mutation<Handler> {
.ok_or_else(field_error_callback(&span, "Unauthorized user update"))?;
let avatar = user
.avatar
.map(base64::decode)
.map(|bytes| base64::engine::general_purpose::STANDARD.decode(bytes))
.transpose()
.context("Invalid base64 image")?
.map(JpegPhoto::try_from)

View File

@@ -18,7 +18,7 @@ use actix_server::ServerBuilder;
use actix_service::map_config;
use actix_web::{dev::AppConfig, web, App, HttpResponse};
use anyhow::{Context, Result};
use hmac::{Hmac, NewMac};
use hmac::Hmac;
use sha2::Sha512;
use std::collections::HashSet;
use std::path::PathBuf;
@@ -80,7 +80,7 @@ fn http_config<Backend>(
let enable_password_reset = mail_options.enable_password_reset;
cfg.app_data(web::Data::new(AppState::<Backend> {
backend_handler: AccessControlledBackendHandler::new(backend_handler),
jwt_key: Hmac::new_varkey(jwt_secret.unsecure().as_bytes()).unwrap(),
jwt_key: hmac::Mac::new_from_slice(jwt_secret.unsecure().as_bytes()).unwrap(),
jwt_blacklist: RwLock::new(jwt_blacklist),
server_url,
mail_options,