mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-22 17:27:18 +00:00
change new scrobble endpoint
This commit is contained in:
parent
211008ae2f
commit
1d7cbdaf7b
|
@ -8,8 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
- Refreshing poll results for remote polls
|
- Refreshing poll results for remote polls
|
||||||
- Admin API: Add ability to require password reset
|
- Admin API: Add ability to require password reset
|
||||||
- Mastodon API: Account entities now include `follow_requests_count` (planned Mastodon 3.x addition)
|
- Mastodon API: Account entities now include `follow_requests_count` (planned Mastodon 3.x addition)
|
||||||
- Pleroma API: `GET /api/v1/pleroma/accounts/:id/now-playing` to get a list of recently scrobbled items
|
- Pleroma API: `GET /api/v1/pleroma/accounts/:id/scrobbles` to get a list of recently scrobbled items
|
||||||
- Pleroma API: `POST /api/v1/pleroma/now-playing` to scrobble a media item
|
- Pleroma API: `POST /api/v1/pleroma/scrobble` to scrobble a media item
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- **Breaking:** Elixir >=1.8 is now required (was >= 1.7)
|
- **Breaking:** Elixir >=1.8 is now required (was >= 1.7)
|
||||||
|
|
|
@ -461,7 +461,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
## `POST /api/v1/pleroma/now-playing`
|
## `POST /api/v1/pleroma/scrobble`
|
||||||
### Creates a new Listen activity for an account
|
### Creates a new Listen activity for an account
|
||||||
* Method `POST`
|
* Method `POST`
|
||||||
* Authentication: required
|
* Authentication: required
|
||||||
|
|
|
@ -12,7 +12,7 @@ defmodule Pleroma.Web.PleromaAPI.ScrobbleController do
|
||||||
alias Pleroma.Web.CommonAPI
|
alias Pleroma.Web.CommonAPI
|
||||||
alias Pleroma.Web.MastodonAPI.StatusView
|
alias Pleroma.Web.MastodonAPI.StatusView
|
||||||
|
|
||||||
def update_now_playing(%{assigns: %{user: user}} = conn, %{"title" => _} = params) do
|
def new_scrobble(%{assigns: %{user: user}} = conn, %{"title" => _} = params) do
|
||||||
params =
|
params =
|
||||||
if !params["length"] do
|
if !params["length"] do
|
||||||
params
|
params
|
||||||
|
|
|
@ -303,7 +303,7 @@ defmodule Pleroma.Web.Router do
|
||||||
|
|
||||||
scope [] do
|
scope [] do
|
||||||
pipe_through(:oauth_write)
|
pipe_through(:oauth_write)
|
||||||
post("/now-playing", ScrobbleController, :update_now_playing)
|
post("/scrobble", ScrobbleController, :new_scrobble)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -8,14 +8,14 @@ defmodule Pleroma.Web.PleromaAPI.ScrobbleControllerTest do
|
||||||
alias Pleroma.Web.CommonAPI
|
alias Pleroma.Web.CommonAPI
|
||||||
import Pleroma.Factory
|
import Pleroma.Factory
|
||||||
|
|
||||||
describe "POST /api/v1/pleroma/now-playing" do
|
describe "POST /api/v1/pleroma/scrobble" do
|
||||||
test "works correctly", %{conn: conn} do
|
test "works correctly", %{conn: conn} do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> assign(:user, user)
|
|> assign(:user, user)
|
||||||
|> post("/api/v1/pleroma/now-playing", %{
|
|> post("/api/v1/pleroma/scrobble", %{
|
||||||
"title" => "lain radio episode 1",
|
"title" => "lain radio episode 1",
|
||||||
"artist" => "lain",
|
"artist" => "lain",
|
||||||
"album" => "lain radio",
|
"album" => "lain radio",
|
||||||
|
|
Loading…
Reference in a new issue