]> cat aescling's git repositories - mastodon.git/blob - app/controllers/public_timelines_controller.rb
Merge branch 'master' into glitch-soc/merge-upstream
[mastodon.git] / app / controllers / public_timelines_controller.rb
1 # frozen_string_literal: true
2
3 class PublicTimelinesController < ApplicationController
4 before_action :set_pack
5 layout 'public'
6
7 before_action :authenticate_user!, if: :whitelist_mode?
8 before_action :require_enabled!
9 before_action :set_body_classes
10 before_action :set_instance_presenter
11
12 def show
13 @initial_state_json = ActiveModelSerializers::SerializableResource.new(
14 InitialStatePresenter.new(settings: { known_fediverse: Setting.show_known_fediverse_at_about_page }, token: current_session&.token),
15 serializer: InitialStateSerializer
16 ).to_json
17 end
18
19 private
20
21 def require_enabled!
22 not_found unless Setting.timeline_preview
23 end
24
25 def set_body_classes
26 @body_classes = 'with-modals'
27 end
28
29 def set_instance_presenter
30 @instance_presenter = InstancePresenter.new
31 end
32
33 def set_pack
34 use_pack 'about'
35 end
36 end
This page took 0.106064 seconds and 4 git commands to generate.