X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fpleroma_api%2Fcontrollers%2Fscrobble_controller.ex;h=4463ec47741762244640da303617f26ed951bdc3;hb=2019f3b3ff365b61c14f01c736a6dcb68cb36624;hp=ac6cd8eddb9aa95a6c0876847a61d2a427a3f8ef;hpb=e653edd182338fa8f4396341cea26cd5568f0107;p=akkoma
diff --git a/lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex b/lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex
index ac6cd8edd..4463ec477 100644
--- a/lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex
+++ b/lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.PleromaAPI.ScrobbleController do
@@ -7,12 +7,18 @@ defmodule Pleroma.Web.PleromaAPI.ScrobbleController do
import Pleroma.Web.ControllerHelper, only: [add_link_headers: 2, fetch_integer_param: 2]
+ alias Pleroma.Plugs.OAuthScopesPlug
alias Pleroma.User
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.CommonAPI
alias Pleroma.Web.MastodonAPI.StatusView
- def update_now_playing(%{assigns: %{user: user}} = conn, %{"title" => _} = params) do
+ plug(OAuthScopesPlug, %{scopes: ["read"]} when action == :user_scrobbles)
+ plug(OAuthScopesPlug, %{scopes: ["write"]} when action != :user_scrobbles)
+
+ plug(Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug)
+
+ def new_scrobble(%{assigns: %{user: user}} = conn, %{"title" => _} = params) do
params =
if !params["length"] do
params