闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
495 B

  1. # frozen_string_literal: true
  2. class Api::SalmonController < ApiController
  3. before_action :set_account
  4. respond_to :txt
  5. def update
  6. payload = request.body.read
  7. if !payload.nil? && verify?(payload)
  8. SalmonWorker.perform_async(@account.id, payload.force_encoding('UTF-8'))
  9. head 201
  10. else
  11. head 202
  12. end
  13. end
  14. private
  15. def set_account
  16. @account = Account.find(params[:id])
  17. end
  18. def verify?(payload)
  19. VerifySalmonService.new.call(payload)
  20. end
  21. end