闭社主体 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.

20 lines
696 B

  1. class HomeController < ApplicationController
  2. before_action :authenticate_user!
  3. def index
  4. @body_classes = 'app-body'
  5. @home = Feed.new(:home, current_user.account).get(20)
  6. @mentions = Feed.new(:mentions, current_user.account).get(20)
  7. @token = find_or_create_access_token.token
  8. end
  9. private
  10. def authenticate_user!
  11. redirect_to about_path unless user_signed_in?
  12. end
  13. def find_or_create_access_token
  14. Doorkeeper::AccessToken.find_or_create_for(Doorkeeper::Application.where(superapp: true).first, current_user.id, 'read write follow', Doorkeeper.configuration.access_token_expires_in, Doorkeeper.configuration.refresh_token_enabled?)
  15. end
  16. end