You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
799 B

  1. # frozen_string_literal: true
  2. class PublicTimelinesController < ApplicationController
  3. layout 'public'
  4. before_action :authenticate_user!, if: :whitelist_mode?
  5. before_action :require_enabled!
  6. before_action :set_body_classes
  7. before_action :set_instance_presenter
  8. def show
  9. @initial_state_json = ActiveModelSerializers::SerializableResource.new(
  10. InitialStatePresenter.new(settings: { known_fediverse: Setting.show_known_fediverse_at_about_page }, token: current_session&.token),
  11. serializer: InitialStateSerializer
  12. ).to_json
  13. end
  14. private
  15. def require_enabled!
  16. not_found unless Setting.timeline_preview
  17. end
  18. def set_body_classes
  19. @body_classes = 'with-modals'
  20. end
  21. def set_instance_presenter
  22. @instance_presenter = InstancePresenter.new
  23. end
  24. end