node_info_controller.rb 760 B

123456789101112131415161718192021
  1. # frozen_string_literal: true
  2. module WellKnown
  3. class NodeInfoController < ActionController::Base # rubocop:disable Rails/ApplicationController
  4. include CacheConcern
  5. # Prevent `active_model_serializer`'s `ActionController::Serialization` from calling `current_user`
  6. # and thus re-issuing session cookies
  7. serialization_scope nil
  8. def index
  9. expires_in 3.days, public: true
  10. render_with_cache json: {}, serializer: NodeInfo::DiscoverySerializer, adapter: NodeInfo::Adapter, expires_in: 3.days, root: 'nodeinfo'
  11. end
  12. def show
  13. expires_in 30.minutes, public: true
  14. render_with_cache json: {}, serializer: NodeInfo::Serializer, adapter: NodeInfo::Adapter, expires_in: 30.minutes, root: 'nodeinfo'
  15. end
  16. end
  17. end