chore: unlimited json payload size (#197)

* chore: return ok when token is empty

* chore: remove json payload size limit

* chore: clippy
This commit is contained in:
Nathan.fooo 2023-12-05 22:21:11 -08:00 committed by GitHub
parent f13a03bead
commit ee31a680b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 3 deletions

View File

@ -668,6 +668,10 @@ impl Client {
#[instrument(level = "debug", skip_all, err)]
pub async fn sign_out(&self) -> Result<(), AppResponseError> {
if self.token.read().is_empty() {
return Ok(());
}
self.gotrue_client.logout(&self.access_token()?).await?;
self.token.write().unset();
Ok(())

View File

@ -26,6 +26,10 @@ impl ClientToken {
}
}
pub fn is_empty(&self) -> bool {
self.token.is_none()
}
pub fn try_get(&self) -> Result<String, Error> {
match &self.token {
None => Err(anyhow::anyhow!("No access token")),

View File

@ -43,7 +43,7 @@ pub fn workspace_scope() -> Scope {
.service(
web::resource("{workspace_id}/collab/{object_id}")
.app_data(
PayloadConfig::new(5 * 1024 * 1024), // 10 MB
PayloadConfig::new(5 * 1024 * 1024), // 5 MB
)
.route(web::post().to(create_collab_handler))
.route(web::get().to(get_collab_handler))

View File

@ -9,7 +9,7 @@ use actix_identity::IdentityMiddleware;
use actix_session::storage::RedisSessionStore;
use actix_session::SessionMiddleware;
use actix_web::cookie::Key;
use actix_web::{dev::Server, web, web::Data, App, HttpServer};
use actix_web::{dev::Server, web::Data, App, HttpServer};
use actix::Actor;
use anyhow::{Context, Error};
@ -119,7 +119,6 @@ pub async fn run(
// .wrap(DecryptPayloadMiddleware)
.wrap(RequestIdMiddleware)
.wrap(access_control.clone())
.app_data(web::JsonConfig::default().limit(4096))
.service(user_scope())
.service(workspace_scope())
.service(collab_scope())