|
|
@ -6,7 +6,14 @@ class AuthorizeFollowController < ApplicationController
|
|
|
|
before_action :authenticate_user!
|
|
|
|
before_action :authenticate_user!
|
|
|
|
|
|
|
|
|
|
|
|
def new
|
|
|
|
def new
|
|
|
|
@account = FollowRemoteAccountService.new.call(params[:acct])
|
|
|
|
uri = Addressable::URI.parse(params[:acct])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if uri.path && %w(http https).include?(uri.scheme)
|
|
|
|
|
|
|
|
set_account_from_url
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
set_account_from_acct
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
render :error if @account.nil?
|
|
|
|
render :error if @account.nil?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
@ -21,4 +28,14 @@ class AuthorizeFollowController < ApplicationController
|
|
|
|
rescue ActiveRecord::RecordNotFound, Mastodon::NotPermitted
|
|
|
|
rescue ActiveRecord::RecordNotFound, Mastodon::NotPermitted
|
|
|
|
render :error
|
|
|
|
render :error
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def set_account_from_url
|
|
|
|
|
|
|
|
@account = FetchRemoteAccountService.new.call(params[:acct])
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def set_account_from_acct
|
|
|
|
|
|
|
|
@account = FollowRemoteAccountService.new.call(params[:acct])
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|