add noindex

This commit is contained in:
Pete Matsyburka
2024-04-20 15:47:48 +03:00
parent abbd3e809a
commit e7eb1d4f12
3 changed files with 8 additions and 0 deletions
@@ -8,6 +8,7 @@ module Api
skip_authorization_check skip_authorization_check
before_action :set_cors_headers before_action :set_cors_headers
before_action :set_noindex_headers
def show def show
blob_uuid, purp, exp = ApplicationRecord.signed_id_verifier.verified(params[:signed_uuid]) blob_uuid, purp, exp = ApplicationRecord.signed_id_verifier.verified(params[:signed_uuid])
@@ -7,6 +7,9 @@ module Api
skip_before_action :authenticate_user! skip_before_action :authenticate_user!
skip_authorization_check skip_authorization_check
before_action :set_cors_headers
before_action :set_noindex_headers
# rubocop:disable Metrics # rubocop:disable Metrics
def show def show
Rollbar.info('Blob legacy') if defined?(Rollbar) Rollbar.info('Blob legacy') if defined?(Rollbar)
@@ -66,6 +66,10 @@ module Api
current_user&.account current_user&.account
end end
def set_noindex_headers
headers['X-Robots-Tag'] = 'noindex'
end
def set_cors_headers def set_cors_headers
headers['Access-Control-Allow-Origin'] = '*' headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, PATCH, DELETE, OPTIONS' headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, PATCH, DELETE, OPTIONS'