MastoAPI: Persist frontend timelines and settings.
This commit is contained in:
parent
d41bfd1d47
commit
7c47534970
@ -603,7 +603,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||||||
"video\/mp4"
|
"video\/mp4"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
settings: %{
|
settings: Map.get(user.info, "settings") || %{
|
||||||
onboarded: true,
|
onboarded: true,
|
||||||
home: %{
|
home: %{
|
||||||
shows: %{
|
shows: %{
|
||||||
@ -648,6 +648,18 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||||||
end
|
end
|
||||||
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
|
def login(conn, _) do
|
||||||
conn
|
conn
|
||||||
|> render(MastodonView, "login.html", %{error: false})
|
|> render(MastodonView, "login.html", %{error: false})
|
||||||
|
@ -120,6 +120,12 @@ defmodule Pleroma.Web.Router do
|
|||||||
post("/media", MastodonAPIController, :upload)
|
post("/media", MastodonAPIController, :upload)
|
||||||
end
|
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
|
scope "/api/v1", Pleroma.Web.MastodonAPI do
|
||||||
pipe_through(:api)
|
pipe_through(:api)
|
||||||
get("/instance", MastodonAPIController, :masto_instance)
|
get("/instance", MastodonAPIController, :masto_instance)
|
||||||
|
Loading…
Reference in New Issue
Block a user