registration API
This commit is contained in:
parent
210362e665
commit
7e14eefc81
27 changed files with 216 additions and 136 deletions
13
app/controllers/api/apps_controller.rb
Normal file
13
app/controllers/api/apps_controller.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
class Api::AppsController < ApplicationController
|
||||
respond_to :json
|
||||
|
||||
def create
|
||||
@app = Doorkeeper::Application.create!(app_params)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def app_params
|
||||
params.permit(:name, :redirect_uri)
|
||||
end
|
||||
end
|
|
@ -17,16 +17,33 @@ class Api::StatusesController < ApiController
|
|||
render action: :show
|
||||
end
|
||||
|
||||
def destroy
|
||||
@status = Status.where(account_id: current_user.account).find(params[:id])
|
||||
RemoveStatusService.new.(@status)
|
||||
render_empty
|
||||
end
|
||||
|
||||
def reblog
|
||||
@status = ReblogService.new.(current_user.account, Status.find(params[:id])).reload
|
||||
render action: :show
|
||||
end
|
||||
|
||||
def unreblog
|
||||
RemoveStatusService.new.(Status.where(account_id: current_user.account, reblog_of_id: params[:id]).first!)
|
||||
@status = Status.find(params[:id])
|
||||
render action: :show
|
||||
end
|
||||
|
||||
def favourite
|
||||
@status = FavouriteService.new.(current_user.account, Status.find(params[:id])).status.reload
|
||||
render action: :show
|
||||
end
|
||||
|
||||
def unfavourite
|
||||
@status = UnfavouriteService.new.(current_user.account, Status.find(params[:id])).status.reload
|
||||
render action: :show
|
||||
end
|
||||
|
||||
def home
|
||||
@statuses = Feed.new(:home, current_user.account).get(20, params[:max_id]).to_a
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue