mirror of
https://github.com/kikobar/mastodon.git
synced 2024-11-19 13:47:35 +00:00
bafd22ecf4
Fix #2196 - Respond with 201 when Salmon accepted, 400 when unverified Fix #2629 - Correctly handle confirm_domain? for local accounts Unify rules for extracting author acct from XML, prefer <email>, fall back to <name> + <uri> (see also #2017, #2172)
28 lines
495 B
Ruby
28 lines
495 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Api::SalmonController < ApiController
|
|
before_action :set_account
|
|
respond_to :txt
|
|
|
|
def update
|
|
payload = request.body.read
|
|
|
|
if !payload.nil? && verify?(payload)
|
|
SalmonWorker.perform_async(@account.id, payload.force_encoding('UTF-8'))
|
|
head 201
|
|
else
|
|
head 202
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def set_account
|
|
@account = Account.find(params[:id])
|
|
end
|
|
|
|
def verify?(payload)
|
|
VerifySalmonService.new.call(payload)
|
|
end
|
|
end
|