1 defmodule Pleroma.Web.Router do
2 use Pleroma.Web, :router
4 alias Pleroma.{Repo, User}
6 def user_fetcher(username) do
7 {:ok, Repo.get_by(User, %{nickname: username})}
11 plug :accepts, ["json"]
13 plug Pleroma.Plugs.AuthenticationPlug, %{fetcher: &Pleroma.Web.Router.user_fetcher/1, optional: true}
16 pipeline :authenticated_api do
17 plug :accepts, ["json"]
19 plug Pleroma.Plugs.AuthenticationPlug, %{fetcher: &Pleroma.Web.Router.user_fetcher/1}
22 scope "/api", Pleroma.Web do
24 get "/statuses/public_timeline.json", TwitterAPI.Controller, :public_timeline
25 get "/statuses/public_and_external_timeline.json", TwitterAPI.Controller, :public_timeline
28 scope "/api", Pleroma.Web do
29 pipe_through :authenticated_api
31 post "/account/verify_credentials.json", TwitterAPI.Controller, :verify_credentials
32 post "/statuses/update.json", TwitterAPI.Controller, :status_update