"video\/mp4"
]
},
- settings: %{
+ settings: Map.get(user.info, "settings") || %{
onboarded: true,
home: %{
shows: %{
end
end
+ def put_settings(%{assigns: %{user: user}} = conn, %{"data" => settings} = _params) do
+ with new_info <- Map.put(user.info, "settings", settings),
+ change <- User.info_changeset(user, %{info: new_info}),
+ {:ok, _user} <- User.update_and_set_cache(change) do
+ conn
+ |> json(%{})
+ else e ->
+ conn
+ |> json(%{error: inspect(e)})
+ end
+ end
+
def login(conn, _) do
conn
|> render(MastodonView, "login.html", %{error: false})
post("/media", MastodonAPIController, :upload)
end
+ scope "/api/web", Pleroma.Web.MastodonAPI do
+ pipe_through(:authenticated_api)
+
+ put("/settings", MastodonAPIController, :put_settings)
+ end
+
scope "/api/v1", Pleroma.Web.MastodonAPI do
pipe_through(:api)
get("/instance", MastodonAPIController, :masto_instance)