Disable legacy media request fallbacks by default.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-07-27 02:48:55 +00:00
parent 4c35bfbda4
commit 6b7bf80de5
3 changed files with 18 additions and 2 deletions

View File

@@ -1318,6 +1318,12 @@ pub struct Config {
#[serde(default)]
pub allow_legacy_media: bool,
/// Fallback to requesting legacy unauthenticated media from remote servers.
/// Unauthenticated media was removed in ~2024Q3; enabling this adds
/// considerable federation requests which are unlikely to succeed.
#[serde(default)]
pub request_legacy_media: bool,
#[serde(default = "true_fn")]
pub freeze_legacy_media: bool,

View File

@@ -35,7 +35,9 @@ pub async fn fetch_remote_thumbnail(
.fetch_thumbnail_authenticated(mxc, user, server, timeout_ms, dim)
.await;
if let Err(Error::Request(NotFound, ..)) = &result {
if let Err(Error::Request(NotFound, ..)) = &result
&& self.services.server.config.request_legacy_media
{
return self
.fetch_thumbnail_unauthenticated(mxc, user, server, timeout_ms, dim)
.await;
@@ -58,7 +60,9 @@ pub async fn fetch_remote_content(
.fetch_content_authenticated(mxc, user, server, timeout_ms)
.await;
if let Err(Error::Request(NotFound, ..)) = &result {
if let Err(Error::Request(NotFound, ..)) = &result
&& self.services.server.config.request_legacy_media
{
return self
.fetch_content_unauthenticated(mxc, user, server, timeout_ms)
.await;

View File

@@ -1130,6 +1130,12 @@
#
#allow_legacy_media = false
# Fallback to requesting legacy unauthenticated media from remote servers.
# Unauthenticated media was removed in ~2024Q3; enabling this adds
# considerable federation requests which are unlikely to succeed.
#
#request_legacy_media = false
# This item is undocumented. Please contribute documentation for it.
#
#freeze_legacy_media = true