From 93e62b151233cf5c71b757d4b605efa9fba779c5 Mon Sep 17 00:00:00 2001 From: Emelia Smith Date: Thu, 2 May 2024 15:54:07 +0200 Subject: [PATCH] Remove expires_in since this would affect caching between version upgrades --- .../well_known/oauth_metadata_controller.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/controllers/well_known/oauth_metadata_controller.rb b/app/controllers/well_known/oauth_metadata_controller.rb index d6c3125766..c80be2d652 100644 --- a/app/controllers/well_known/oauth_metadata_controller.rb +++ b/app/controllers/well_known/oauth_metadata_controller.rb @@ -9,8 +9,15 @@ module WellKnown serialization_scope nil def show - expires_in 3.days, public: true - render_with_cache json: ::OauthMetadataPresenter.new, serializer: ::OauthMetadataSerializer, content_type: 'application/json' + # Due to this document potentially changing between Mastodon versions (as + # new OAuth scopes are added), we don't use expires_in to cache upstream, + # instead just caching in the rails cache: + render_with_cache( + json: ::OauthMetadataPresenter.new, + serializer: ::OauthMetadataSerializer, + content_type: 'application/json', + expires_in: 15.minutes + ) end end end