aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/home_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/home_controller.rb')
-rw-r--r--app/controllers/home_controller.rb43
1 files changed, 4 insertions, 39 deletions
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index 702889cd0..72573d231 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -1,47 +1,16 @@
# frozen_string_literal: true
class HomeController < ApplicationController
- before_action :redirect_unauthenticated_to_permalinks!
before_action :authenticate_user!
- before_action :set_referrer_policy_header
- def index
- @body_classes = 'app-body'
- end
-
- private
-
- def redirect_unauthenticated_to_permalinks!
- return if user_signed_in?
+ include WebAppControllerConcern
- matches = request.path.match(/\A\/web\/(statuses|accounts)\/([\d]+)\z/)
+ def index; end
- if matches
- case matches[1]
- when 'statuses'
- status = Status.find_by(id: matches[2])
-
- if status&.distributable?
- redirect_to(ActivityPub::TagManager.instance.url_for(status))
- return
- end
- when 'accounts'
- account = Account.find_by(id: matches[2])
-
- if account
- redirect_to(ActivityPub::TagManager.instance.url_for(account))
- return
- end
- end
- end
-
- matches = request.path.match(%r{\A/web/timelines/tag/(?<tag>.+)\z})
-
- redirect_to(matches ? tag_path(CGI.unescape(matches[:tag])) : default_redirect_path)
- end
+ private
def default_redirect_path
- if request.path.start_with?('/web') || whitelist_mode?
+ if whitelist_mode?
new_user_session_path
elsif single_user_mode?
short_account_path(Account.local.without_suspended.where('id > 0').first)
@@ -49,8 +18,4 @@ class HomeController < ApplicationController
about_path
end
end
-
- def set_referrer_policy_header
- response.headers['Referrer-Policy'] = 'origin'
- end
end