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.

37 lines
1021 B

  1. class AccountsController < ApplicationController
  2. layout 'public'
  3. before_action :set_account
  4. before_action :set_webfinger_header
  5. def show
  6. @statuses = @account.statuses.order('id desc').with_includes.with_counters
  7. respond_to do |format|
  8. format.html { @statuses = @statuses.paginate(page: params[:page], per_page: 10)}
  9. format.atom
  10. end
  11. end
  12. def followers
  13. @followers = @account.followers.order('follows.created_at desc').paginate(page: params[:page], per_page: 6)
  14. end
  15. def following
  16. @following = @account.following.order('follows.created_at desc').paginate(page: params[:page], per_page: 6)
  17. end
  18. private
  19. def set_account
  20. @account = Account.find_by!(username: params[:username], domain: nil)
  21. end
  22. def set_webfinger_header
  23. response.headers['Link'] = "<#{webfinger_account_url}>; rel=\"lrdd\"; type=\"application/xrd+xml\""
  24. end
  25. def webfinger_account_url
  26. webfinger_url(resource: "acct:#{@account.acct}@#{Rails.configuration.x.local_domain}")
  27. end
  28. end