2018-12-23 20:04:54 +00:00
|
|
|
# Pleroma: A lightweight social networking server
|
2020-03-03 22:44:49 +00:00
|
|
|
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
2018-12-23 20:04:54 +00:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2017-09-06 17:06:25 +00:00
|
|
|
defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
2020-04-06 07:20:44 +00:00
|
|
|
@moduledoc """
|
|
|
|
Contains stubs for unimplemented Mastodon API endpoints.
|
|
|
|
|
|
|
|
Note: instead of routing directly to this controller's action,
|
|
|
|
it's preferable to define an action in relevant (non-generic) controller,
|
|
|
|
set up OAuth rules for it and call this controller's function from it.
|
|
|
|
"""
|
|
|
|
|
2017-09-06 17:06:25 +00:00
|
|
|
use Pleroma.Web, :controller
|
2019-07-28 20:30:10 +00:00
|
|
|
|
2017-11-19 01:22:07 +00:00
|
|
|
require Logger
|
2017-09-06 17:06:25 +00:00
|
|
|
|
2020-04-22 15:50:25 +00:00
|
|
|
plug(
|
|
|
|
:skip_plug,
|
2020-06-24 07:53:10 +00:00
|
|
|
[Pleroma.Web.Plugs.OAuthScopesPlug, Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug]
|
2020-04-22 15:50:25 +00:00
|
|
|
when action in [:empty_array, :empty_object]
|
|
|
|
)
|
2020-04-06 07:20:44 +00:00
|
|
|
|
2019-08-26 12:16:40 +00:00
|
|
|
action_fallback(Pleroma.Web.MastodonAPI.FallbackController)
|
2018-06-03 17:28:11 +00:00
|
|
|
|
2017-09-09 17:19:13 +00:00
|
|
|
def empty_array(conn, _) do
|
2020-04-06 07:20:44 +00:00
|
|
|
Logger.debug("Unimplemented, returning an empty array (list)")
|
2017-09-09 17:19:13 +00:00
|
|
|
json(conn, [])
|
|
|
|
end
|
2017-11-10 13:24:39 +00:00
|
|
|
|
2018-03-09 18:56:21 +00:00
|
|
|
def empty_object(conn, _) do
|
2020-04-06 07:20:44 +00:00
|
|
|
Logger.debug("Unimplemented, returning an empty object (map)")
|
2018-08-14 02:27:28 +00:00
|
|
|
json(conn, %{})
|
|
|
|
end
|
2017-09-06 17:06:25 +00:00
|
|
|
end
|