Merge remote-tracking branch 'origin/master' into gs-master
Conflicts: app/controllers/home_controller.rb app/controllers/stream_entries_controller.rb app/javascript/mastodon/locales/ja.json app/javascript/mastodon/locales/pl.json
This commit is contained in:
9
app/controllers/api/web/base_controller.rb
Normal file
9
app/controllers/api/web/base_controller.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Api::Web::BaseController < Api::BaseController
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
rescue_from ActionController::InvalidAuthenticityToken do
|
||||
render json: { error: "Can't verify CSRF token authenticity." }, status: 422
|
||||
end
|
||||
end
|
||||
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Api::Web::EmbedsController < Api::BaseController
|
||||
class Api::Web::EmbedsController < Api::Web::BaseController
|
||||
respond_to :json
|
||||
|
||||
before_action :require_user!
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Api::Web::PushSubscriptionsController < Api::BaseController
|
||||
class Api::Web::PushSubscriptionsController < Api::Web::BaseController
|
||||
respond_to :json
|
||||
|
||||
before_action :require_user!
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
def create
|
||||
active_session = current_session
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Api::Web::SettingsController < Api::BaseController
|
||||
class Api::Web::SettingsController < Api::Web::BaseController
|
||||
respond_to :json
|
||||
|
||||
before_action :require_user!
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
class HomeController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
|
||||
before_action :set_pack
|
||||
before_action :set_referrer_policy_header
|
||||
before_action :set_initial_state_json
|
||||
|
||||
def index
|
||||
@@ -67,4 +69,8 @@ class HomeController < ApplicationController
|
||||
about_path
|
||||
end
|
||||
end
|
||||
|
||||
def set_referrer_policy_header
|
||||
response.headers['Referrer-Policy'] = 'origin'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -13,6 +13,7 @@ class StatusesController < ApplicationController
|
||||
before_action :set_link_headers
|
||||
before_action :check_account_suspension
|
||||
before_action :redirect_to_original, only: [:show]
|
||||
before_action :set_referrer_policy_header, only: [:show]
|
||||
before_action :set_cache_headers
|
||||
|
||||
def show
|
||||
@@ -83,4 +84,9 @@ class StatusesController < ApplicationController
|
||||
def redirect_to_original
|
||||
redirect_to ::TagManager.instance.url_for(@status.reblog) if @status.reblog?
|
||||
end
|
||||
|
||||
def set_referrer_policy_header
|
||||
return if @status.public_visibility? || @status.unlisted_visibility?
|
||||
response.headers['Referrer-Policy'] = 'origin'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,8 +16,7 @@ class StreamEntriesController < ApplicationController
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
use_pack 'public'
|
||||
@ancestors = @stream_entry.activity.reply? ? cache_collection(@stream_entry.activity.ancestors(current_account), Status) : []
|
||||
@descendants = cache_collection(@stream_entry.activity.descendants(current_account), Status)
|
||||
redirect_to short_account_status_url(params[:account_username], @stream_entry.activity) if @type == 'status'
|
||||
end
|
||||
|
||||
format.atom do
|
||||
|
||||
Reference in New Issue
Block a user