daily logging improvements
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
0b33eec1c2
commit
a124122dd4
3 changed files with 11 additions and 17 deletions
|
@ -10,10 +10,11 @@ use ruma::api::client::{
|
|||
get_media_preview,
|
||||
},
|
||||
};
|
||||
use tracing::{debug, error, info, warn};
|
||||
use tracing::{debug, error, warn};
|
||||
use webpage::HTML;
|
||||
|
||||
use crate::{
|
||||
debug_warn,
|
||||
service::media::{FileMeta, UrlPreviewData},
|
||||
services, utils, Error, Result, Ruma, RumaResponse,
|
||||
};
|
||||
|
@ -324,17 +325,14 @@ pub(crate) async fn get_content_thumbnail_route(
|
|||
cache_control: Some(CACHE_CONTROL_IMMUTABLE.into()),
|
||||
})
|
||||
} else if &*body.server_name != services().globals.server_name() && body.allow_remote {
|
||||
// we'll lie to the client and say the blocked server's media was not found and
|
||||
// log. the client has no way of telling anyways so this is a security bonus.
|
||||
if services()
|
||||
.globals
|
||||
.prevent_media_downloads_from()
|
||||
.contains(&body.server_name.clone())
|
||||
{
|
||||
info!(
|
||||
"Received request for remote media `{}` but server is in our media server blocklist. Returning 404.",
|
||||
mxc
|
||||
);
|
||||
// we'll lie to the client and say the blocked server's media was not found and
|
||||
// log. the client has no way of telling anyways so this is a security bonus.
|
||||
debug_warn!("Received request for media `{}` on blocklisted server", mxc);
|
||||
return Err(Error::BadRequest(ErrorKind::NotFound, "Media not found."));
|
||||
}
|
||||
|
||||
|
@ -402,17 +400,14 @@ pub(crate) async fn get_content_thumbnail_v1_route(
|
|||
async fn get_remote_content(
|
||||
mxc: &str, server_name: &ruma::ServerName, media_id: String, allow_redirect: bool, timeout_ms: Duration,
|
||||
) -> Result<get_content::v3::Response, Error> {
|
||||
// we'll lie to the client and say the blocked server's media was not found and
|
||||
// log. the client has no way of telling anyways so this is a security bonus.
|
||||
if services()
|
||||
.globals
|
||||
.prevent_media_downloads_from()
|
||||
.contains(&server_name.to_owned())
|
||||
{
|
||||
info!(
|
||||
"Received request for remote media `{}` but server is in our media server blocklist. Returning 404.",
|
||||
mxc
|
||||
);
|
||||
// we'll lie to the client and say the blocked server's media was not found and
|
||||
// log. the client has no way of telling anyways so this is a security bonus.
|
||||
debug_warn!("Received request for media `{}` on blocklisted server", mxc);
|
||||
return Err(Error::BadRequest(ErrorKind::NotFound, "Media not found."));
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ use tracing::{debug, error, info, trace, warn};
|
|||
|
||||
use super::state_compressor::CompressedStateEvent;
|
||||
use crate::{
|
||||
debug_info,
|
||||
debug_error, debug_info,
|
||||
service::{pdu, Arc, BTreeMap, HashMap, Result},
|
||||
services, Error, PduEvent,
|
||||
};
|
||||
|
@ -1103,7 +1103,7 @@ impl Service {
|
|||
events_all.insert(next_id);
|
||||
},
|
||||
Err(e) => {
|
||||
warn!("Failed to fetch event {next_id}: {e}");
|
||||
debug_error!("Failed to fetch event {next_id}: {e}");
|
||||
back_off((*next_id).to_owned()).await;
|
||||
},
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ use ErrorKind::{
|
|||
TooLarge, Unauthorized, Unknown, UnknownToken, Unrecognized, UserDeactivated, WrongRoomKeysVersion,
|
||||
};
|
||||
|
||||
use crate::{debug_info, RumaResponse};
|
||||
use crate::RumaResponse;
|
||||
|
||||
pub(crate) type Result<T, E = Error> = std::result::Result<T, E>;
|
||||
|
||||
|
@ -139,7 +139,6 @@ impl Error {
|
|||
_ => (Unknown, StatusCode::INTERNAL_SERVER_ERROR),
|
||||
};
|
||||
|
||||
debug_info!("Returning an error: {status_code}: {message}");
|
||||
RumaResponse(UiaaResponse::MatrixError(RumaError {
|
||||
body: ErrorBody::Standard {
|
||||
kind,
|
||||
|
|
Loading…
Add table
Reference in a new issue