1
0
Fork 0
forked from gitea/nas

Merge branch 'kb_migration' into kb_migration_development

This commit is contained in:
KMY 2023-04-27 12:07:50 +09:00
commit 98ced6d69e
165 changed files with 3605 additions and 1094 deletions

View file

@ -6,10 +6,15 @@ class Api::V1::Instances::DomainBlocksController < Api::BaseController
before_action :require_enabled_api!
before_action :set_domain_blocks
vary_by ''
vary_by '', if: -> { Setting.show_domain_blocks == 'all' }
def index
cache_even_if_authenticated!
if Setting.show_domain_blocks == 'all'
cache_even_if_authenticated!
else
cache_if_unauthenticated!
end
render json: @domain_blocks, each_serializer: REST::DomainBlockSerializer, with_comment: (Setting.show_domain_blocks_rationale == 'all' || (Setting.show_domain_blocks_rationale == 'users' && user_signed_in?))
end

View file

@ -156,8 +156,8 @@ module CacheConcern
end
class_methods do
def vary_by(value)
before_action do |controller|
def vary_by(value, **kwargs)
before_action(**kwargs) do |controller|
response.headers['Vary'] = value.respond_to?(:call) ? controller.instance_exec(&value) : value
end
end

View file

@ -1,10 +1,13 @@
# frozen_string_literal: true
class InstanceActorsController < ApplicationController
include AccountControllerConcern
class InstanceActorsController < ActivityPub::BaseController
vary_by ''
skip_before_action :check_account_confirmation
skip_around_action :set_locale
serialization_scope nil
before_action :set_account
skip_before_action :require_functional!
skip_before_action :update_user_sign_in
def show
expires_in 10.minutes, public: true