mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-19 11:45:01 +00:00
Merge branch 'develop' of ssh.gitgud.io:lambadalambda/pleroma into develop
This commit is contained in:
commit
42633406b3
3 changed files with 21 additions and 21 deletions
|
@ -26,8 +26,8 @@ defmodule Pleroma.Web.Router do
|
||||||
scope "/api", Pleroma.Web do
|
scope "/api", Pleroma.Web do
|
||||||
pipe_through :api
|
pipe_through :api
|
||||||
|
|
||||||
get "/help/test", TwitterAPI.Controller, :help_test
|
get "/help/test", TwitterAPI.UtilController, :help_test
|
||||||
get "/statusnet/config", TwitterAPI.Controller, :config
|
get "/statusnet/config", TwitterAPI.UtilController, :config
|
||||||
|
|
||||||
get "/statuses/public_timeline", TwitterAPI.Controller, :public_timeline
|
get "/statuses/public_timeline", TwitterAPI.Controller, :public_timeline
|
||||||
get "/statuses/public_and_external_timeline", TwitterAPI.Controller, :public_and_external_timeline
|
get "/statuses/public_and_external_timeline", TwitterAPI.Controller, :public_and_external_timeline
|
||||||
|
|
18
lib/pleroma/web/twitter_api/controllers/util_controller.ex
Normal file
18
lib/pleroma/web/twitter_api/controllers/util_controller.ex
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
defmodule Pleroma.Web.TwitterAPI.UtilController do
|
||||||
|
use Pleroma.Web, :controller
|
||||||
|
alias Pleroma.Web
|
||||||
|
|
||||||
|
def help_test(conn, _params) do
|
||||||
|
json(conn, "ok")
|
||||||
|
end
|
||||||
|
|
||||||
|
def config(conn, _params) do
|
||||||
|
json(conn, %{
|
||||||
|
site: %{
|
||||||
|
name: Web.base_url,
|
||||||
|
server: Web.base_url,
|
||||||
|
textlimit: -1
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
|
@ -2,7 +2,7 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
|
||||||
use Pleroma.Web, :controller
|
use Pleroma.Web, :controller
|
||||||
alias Pleroma.Web.TwitterAPI.{TwitterAPI, UserView}
|
alias Pleroma.Web.TwitterAPI.{TwitterAPI, UserView}
|
||||||
alias Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter
|
alias Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter
|
||||||
alias Pleroma.{Web, Repo, Activity}
|
alias Pleroma.{Repo, Activity}
|
||||||
alias Pleroma.Web.ActivityPub.ActivityPub
|
alias Pleroma.Web.ActivityPub.ActivityPub
|
||||||
alias Ecto.Changeset
|
alias Ecto.Changeset
|
||||||
|
|
||||||
|
@ -122,30 +122,12 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
|
||||||
|> send_resp(200, response)
|
|> send_resp(200, response)
|
||||||
end
|
end
|
||||||
|
|
||||||
def help_test(conn, _params) do
|
|
||||||
conn |> json_reply(200, Poison.encode!("ok"))
|
|
||||||
end
|
|
||||||
|
|
||||||
def upload_json(conn, %{"media" => media}) do
|
def upload_json(conn, %{"media" => media}) do
|
||||||
response = TwitterAPI.upload(media, "json")
|
response = TwitterAPI.upload(media, "json")
|
||||||
conn
|
conn
|
||||||
|> json_reply(200, response)
|
|> json_reply(200, response)
|
||||||
end
|
end
|
||||||
|
|
||||||
def config(conn, _params) do
|
|
||||||
response = %{
|
|
||||||
site: %{
|
|
||||||
name: Web.base_url,
|
|
||||||
server: Web.base_url,
|
|
||||||
textlimit: -1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|> Poison.encode!
|
|
||||||
|
|
||||||
conn
|
|
||||||
|> json_reply(200, response)
|
|
||||||
end
|
|
||||||
|
|
||||||
def favorite(%{assigns: %{user: user}} = conn, %{"id" => id}) do
|
def favorite(%{assigns: %{user: user}} = conn, %{"id" => id}) do
|
||||||
activity = Repo.get(Activity, id)
|
activity = Repo.get(Activity, id)
|
||||||
{:ok, status} = TwitterAPI.favorite(user, activity)
|
{:ok, status} = TwitterAPI.favorite(user, activity)
|
||||||
|
|
Loading…
Reference in a new issue