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:
parent
f13a03bead
commit
ee31a680b5
|
|
@ -668,6 +668,10 @@ impl Client {
|
||||||
|
|
||||||
#[instrument(level = "debug", skip_all, err)]
|
#[instrument(level = "debug", skip_all, err)]
|
||||||
pub async fn sign_out(&self) -> Result<(), AppResponseError> {
|
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.gotrue_client.logout(&self.access_token()?).await?;
|
||||||
self.token.write().unset();
|
self.token.write().unset();
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,10 @@ impl ClientToken {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_empty(&self) -> bool {
|
||||||
|
self.token.is_none()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn try_get(&self) -> Result<String, Error> {
|
pub fn try_get(&self) -> Result<String, Error> {
|
||||||
match &self.token {
|
match &self.token {
|
||||||
None => Err(anyhow::anyhow!("No access token")),
|
None => Err(anyhow::anyhow!("No access token")),
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ pub fn workspace_scope() -> Scope {
|
||||||
.service(
|
.service(
|
||||||
web::resource("{workspace_id}/collab/{object_id}")
|
web::resource("{workspace_id}/collab/{object_id}")
|
||||||
.app_data(
|
.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::post().to(create_collab_handler))
|
||||||
.route(web::get().to(get_collab_handler))
|
.route(web::get().to(get_collab_handler))
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ use actix_identity::IdentityMiddleware;
|
||||||
use actix_session::storage::RedisSessionStore;
|
use actix_session::storage::RedisSessionStore;
|
||||||
use actix_session::SessionMiddleware;
|
use actix_session::SessionMiddleware;
|
||||||
use actix_web::cookie::Key;
|
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 actix::Actor;
|
||||||
use anyhow::{Context, Error};
|
use anyhow::{Context, Error};
|
||||||
|
|
@ -119,7 +119,6 @@ pub async fn run(
|
||||||
// .wrap(DecryptPayloadMiddleware)
|
// .wrap(DecryptPayloadMiddleware)
|
||||||
.wrap(RequestIdMiddleware)
|
.wrap(RequestIdMiddleware)
|
||||||
.wrap(access_control.clone())
|
.wrap(access_control.clone())
|
||||||
.app_data(web::JsonConfig::default().limit(4096))
|
|
||||||
.service(user_scope())
|
.service(user_scope())
|
||||||
.service(workspace_scope())
|
.service(workspace_scope())
|
||||||
.service(collab_scope())
|
.service(collab_scope())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue