router: change scrobble timeline route from now-playing to scrobbles

This commit is contained in:
Ariadne Conill 2019-09-29 00:18:06 +00:00
parent 8b34b221cb
commit a6e1469767
3 changed files with 6 additions and 4 deletions

View File

@ -440,7 +440,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa
* Response: the archive of the pack with a 200 status code, 403 if the pack is not set as shared, * Response: the archive of the pack with a 200 status code, 403 if the pack is not set as shared,
404 if the pack does not exist 404 if the pack does not exist
## `GET /api/v1/pleroma/accounts/:uid/now-playing` ## `GET /api/v1/pleroma/accounts/:id/scrobbles`
### Requests a list of current and recent Listen activities for an account ### Requests a list of current and recent Listen activities for an account
* Method `GET` * Method `GET`
* Authentication: not required * Authentication: not required
@ -450,11 +450,13 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa
```json ```json
[ [
{ {
"account": {...},
"id": "1234", "id": "1234",
"title": "Some Title", "title": "Some Title",
"artist": "Some Artist", "artist": "Some Artist",
"album": "Some Album", "album": "Some Album",
"length": 180000 "length": 180000,
"created_at": "2019-09-28T12:40:45.000Z"
} }
] ]
``` ```

View File

@ -110,7 +110,7 @@ def update_now_playing(%{assigns: %{user: user}} = conn, %{"title" => _} = param
end end
end end
def user_now_playing(%{assigns: %{user: reading_user}} = conn, params) do def user_scrobbles(%{assigns: %{user: reading_user}} = conn, params) do
with %User{} = user <- User.get_cached_by_nickname_or_id(params["id"], for: reading_user) do with %User{} = user <- User.get_cached_by_nickname_or_id(params["id"], for: reading_user) do
params = Map.put(params, "type", ["Listen"]) params = Map.put(params, "type", ["Listen"])

View File

@ -310,7 +310,7 @@ defmodule Pleroma.Web.Router do
scope "/api/v1/pleroma", Pleroma.Web.PleromaAPI do scope "/api/v1/pleroma", Pleroma.Web.PleromaAPI do
pipe_through([:api, :oauth_read_or_public]) pipe_through([:api, :oauth_read_or_public])
get("/accounts/:id/now-playing", PleromaAPIController, :user_now_playing) get("/accounts/:id/scrobbles", PleromaAPIController, :user_scrobbles)
end end
scope "/api/v1", Pleroma.Web.MastodonAPI do scope "/api/v1", Pleroma.Web.MastodonAPI do