logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

mastodon_api_controller.ex (949B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
  5. @moduledoc """
  6. Contains stubs for unimplemented Mastodon API endpoints.
  7. Note: instead of routing directly to this controller's action,
  8. it's preferable to define an action in relevant (non-generic) controller,
  9. set up OAuth rules for it and call this controller's function from it.
  10. """
  11. use Pleroma.Web, :controller
  12. require Logger
  13. plug(:skip_auth when action in [:empty_array, :empty_object])
  14. action_fallback(Pleroma.Web.MastodonAPI.FallbackController)
  15. def empty_array(conn, _) do
  16. Logger.debug("Unimplemented, returning an empty array (list)")
  17. json(conn, [])
  18. end
  19. def empty_object(conn, _) do
  20. Logger.debug("Unimplemented, returning an empty object (map)")
  21. json(conn, %{})
  22. end
  23. end