end
format.json do
- mark_cacheable!
-
render_cached_json(['activitypub', 'actor', @account], content_type: 'application/activity+json') do
ActiveModelSerializers::SerializableResource.new(@account, serializer: ActivityPub::ActorSerializer, adapter: ActivityPub::Adapter)
end
before_action :set_cache_headers
def show
- skip_session!
-
render_cached_json(['activitypub', 'collection', @account, params[:id]], content_type: 'application/activity+json') do
ActiveModelSerializers::SerializableResource.new(
collection_presenter,
before_action :set_cache_headers
def show
- unless page_requested?
- skip_session!
- expires_in 1.minute, public: true
- end
+ expires_in 1.minute, public: true unless page_requested?
render json: outbox_presenter, serializer: ActivityPub::OutboxSerializer, adapter: ActivityPub::Adapter, content_type: 'application/activity+json'
end
end
def mark_cacheable!
- skip_session!
expires_in 0, public: true
end
-
- def skip_session!
- request.session_options[:skip] = true
- end
end
def check_account_suspension
if @account.suspended?
- skip_session!
expires_in(3.minutes, public: true)
gone
end
before_action :set_cache_headers
def show
- skip_session!
render plain: Setting.custom_css || '', content_type: 'text/css'
end
end
def show
respond_to do |format|
format.json do
- skip_session!
-
render_cached_json(['activitypub', 'emoji', @emoji], content_type: 'application/activity+json') do
ActiveModelSerializers::SerializableResource.new(@emoji, serializer: ActivityPub::EmojiSerializer, adapter: ActivityPub::Adapter)
end
format.json do
raise Mastodon::NotPermittedError if params[:page].present? && @account.user_hides_network?
- if params[:page].blank?
- skip_session!
- expires_in 3.minutes, public: true
- end
+ expires_in 3.minutes, public: true if params[:page].blank?
render json: collection_presenter,
serializer: ActivityPub::CollectionSerializer,
format.json do
raise Mastodon::NotPermittedError if params[:page].present? && @account.user_hides_network?
- if params[:page].blank?
- skip_session!
- expires_in 3.minutes, public: true
- end
+ expires_in 3.minutes, public: true if params[:page].blank?
render json: collection_presenter,
serializer: ActivityPub::CollectionSerializer,
def show
respond_to do |format|
format.html do
- if current_account.nil?
- skip_session!
- expires_in 10.seconds, public: true
- end
+ expires_in 10.seconds, public: true if current_account.nil?
@body_classes = 'with-modals'
end
format.json do
- mark_cacheable! unless @stream_entry.hidden?
-
render_cached_json(['activitypub', 'note', @status], content_type: 'application/activity+json', public: !@stream_entry.hidden?) do
ActiveModelSerializers::SerializableResource.new(@status, serializer: ActivityPub::NoteSerializer, adapter: ActivityPub::Adapter)
end
end
def activity
- skip_session!
-
render_cached_json(['activitypub', 'activity', @status], content_type: 'application/activity+json', public: !@stream_entry.hidden?) do
ActiveModelSerializers::SerializableResource.new(@status, serializer: ActivityPub::ActivitySerializer, adapter: ActivityPub::Adapter)
end
def embed
raise ActiveRecord::RecordNotFound if @status.hidden?
- skip_session!
expires_in 180, public: true
response.headers['X-Frame-Options'] = 'ALLOWALL'
@autoplay = ActiveModel::Type::Boolean.new.cast(params[:autoplay])
end
def replies
- skip_session!
-
render json: replies_collection_presenter,
serializer: ActivityPub::CollectionSerializer,
adapter: ActivityPub::Adapter,
def show
respond_to do |format|
format.html do
- unless user_signed_in?
- skip_session!
- expires_in 5.minutes, public: true
- end
+ expires_in 5.minutes, public: true unless @stream_entry.hidden?
- redirect_to short_account_status_url(params[:account_username], @stream_entry.activity) if @type == 'status'
+ redirect_to short_account_status_url(params[:account_username], @stream_entry.activity)
end
format.atom do
- unless @stream_entry.hidden?
- skip_session!
- expires_in 3.minutes, public: true
- end
+ expires_in 3.minutes, public: true unless @stream_entry.hidden?
render xml: OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.entry(@stream_entry, true))
end
def set_stream_entry
@stream_entry = @account.stream_entries.where(activity_type: 'Status').find(params[:id])
- @type = @stream_entry.activity_type.downcase
+ @type = 'status'
raise ActiveRecord::RecordNotFound if @stream_entry.activity.nil?
authorize @stream_entry.activity, :show? if @stream_entry.hidden?