Add status posting via TwAPI.
[akkoma] / lib / pleroma / web / router.ex
1 defmodule Pleroma.Web.Router do
2 use Pleroma.Web, :router
3
4 alias Pleroma.{Repo, User}
5
6 def user_fetcher(username) do
7 {:ok, Repo.get_by(User, %{nickname: username})}
8 end
9
10 pipeline :api do
11 plug :accepts, ["json"]
12 end
13
14 pipeline :authenticated_api do
15 plug :accepts, ["json"]
16 plug :fetch_session
17 plug Pleroma.Plugs.AuthenticationPlug, fetcher: &Pleroma.Web.Router.user_fetcher/1
18 end
19
20 scope "/api", Pleroma.Web do
21 pipe_through :authenticated_api
22
23 post "/account/verify_credentials.json", TwitterAPI.Controller, :verify_credentials
24 post "/statuses/update.json", TwitterAPI.Controller, :status_update
25 end
26 end