Add very basic oauth and mastodon api support.
This commit is contained in:
parent
4e785df984
commit
2a298d70f9
16 changed files with 286 additions and 0 deletions
0
lib/pleroma/web/mastodon_api/mastodon_api.ex
Normal file
0
lib/pleroma/web/mastodon_api/mastodon_api.ex
Normal file
32
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
Normal file
32
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
||||
use Pleroma.Web, :controller
|
||||
alias Pleroma.{Repo, App}
|
||||
|
||||
def create_app(conn, params) do
|
||||
with cs <- App.register_changeset(%App{}, params) |> IO.inspect,
|
||||
{:ok, app} <- Repo.insert(cs) |> IO.inspect do
|
||||
res = %{
|
||||
id: app.id,
|
||||
client_id: app.client_id,
|
||||
client_secret: app.client_secret
|
||||
}
|
||||
|
||||
json(conn, res)
|
||||
end
|
||||
end
|
||||
|
||||
def verify_credentials(%{assigns: %{user: user}} = conn, params) do
|
||||
account = %{
|
||||
id: user.id,
|
||||
username: user.nickname,
|
||||
acct: user.nickname,
|
||||
display_name: user.name,
|
||||
locked: false,
|
||||
created_at: user.inserted_at,
|
||||
note: user.bio,
|
||||
url: ""
|
||||
}
|
||||
|
||||
json(conn, account)
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue