mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-16 23:31:24 +01:00
Use UInt instead of u32 for max request size
Sometimes you just really want to upload a full disk image as media.
This commit is contained in:
parent
99924e5779
commit
5616510727
3 changed files with 8 additions and 8 deletions
|
|
@ -129,7 +129,7 @@ pub(crate) async fn get_media_config_legacy_route(
|
|||
_body: Ar<legacy_media::get_media_config::v3::Request>,
|
||||
) -> Result<Ra<legacy_media::get_media_config::v3::Response>> {
|
||||
Ok(Ra(legacy_media::get_media_config::v3::Response {
|
||||
upload_size: services().globals.max_request_size().into(),
|
||||
upload_size: services().globals.max_request_size(),
|
||||
}))
|
||||
}
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ pub(crate) async fn get_media_config_route(
|
|||
_body: Ar<authenticated_media_client::get_media_config::v1::Request>,
|
||||
) -> Result<Ra<authenticated_media_client::get_media_config::v1::Response>> {
|
||||
Ok(Ra(authenticated_media_client::get_media_config::v1::Response {
|
||||
upload_size: services().globals.max_request_size().into(),
|
||||
upload_size: services().globals.max_request_size(),
|
||||
}))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use std::{
|
|||
use reqwest::Url;
|
||||
use ruma::{
|
||||
api::federation::discovery::OldVerifyKey, OwnedServerName,
|
||||
OwnedServerSigningKeyId, RoomVersionId,
|
||||
OwnedServerSigningKeyId, RoomVersionId, UInt,
|
||||
};
|
||||
use serde::Deserialize;
|
||||
use strum::{Display, EnumIter, IntoEnumIterator};
|
||||
|
|
@ -51,7 +51,7 @@ pub(crate) struct Config {
|
|||
#[serde(default = "default_cleanup_second_interval")]
|
||||
pub(crate) cleanup_second_interval: u32,
|
||||
#[serde(default = "default_max_request_size")]
|
||||
pub(crate) max_request_size: u32,
|
||||
pub(crate) max_request_size: UInt,
|
||||
#[serde(default = "false_fn")]
|
||||
pub(crate) allow_registration: bool,
|
||||
pub(crate) registration_token: Option<String>,
|
||||
|
|
@ -466,9 +466,9 @@ fn default_cleanup_second_interval() -> u32 {
|
|||
60
|
||||
}
|
||||
|
||||
fn default_max_request_size() -> u32 {
|
||||
fn default_max_request_size() -> UInt {
|
||||
// Default to 20 MB
|
||||
20 * 1024 * 1024
|
||||
(20_u32 * 1024 * 1024).into()
|
||||
}
|
||||
|
||||
pub(crate) fn default_tracing_filter() -> EnvFilterClone {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ use ruma::{
|
|||
serde::Base64,
|
||||
DeviceId, MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedRoomAliasId,
|
||||
OwnedRoomId, OwnedServerName, OwnedUserId, RoomAliasId, RoomVersionId,
|
||||
ServerName, UserId,
|
||||
ServerName, UInt, UserId,
|
||||
};
|
||||
use tokio::sync::{broadcast, Mutex, RwLock, Semaphore};
|
||||
use tracing::{error, warn, Instrument};
|
||||
|
|
@ -381,7 +381,7 @@ impl Service {
|
|||
self.config.server_name.as_ref()
|
||||
}
|
||||
|
||||
pub(crate) fn max_request_size(&self) -> u32 {
|
||||
pub(crate) fn max_request_size(&self) -> UInt {
|
||||
self.config.max_request_size
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue