Require follow and read OAuth scopes for GET /api/v1/apps
This commit is contained in:
parent
baa8196fc9
commit
eab6291094
|
@ -36,7 +36,7 @@ def create_operation do
|
||||||
operationId: "AppController.create",
|
operationId: "AppController.create",
|
||||||
requestBody: Helpers.request_body("Parameters", create_request(), required: true),
|
requestBody: Helpers.request_body("Parameters", create_request(), required: true),
|
||||||
responses: %{
|
responses: %{
|
||||||
200 => Operation.response("App", "application/json", create_response()),
|
200 => create_response(),
|
||||||
422 =>
|
422 =>
|
||||||
Operation.response(
|
Operation.response(
|
||||||
"Unprocessable Entity",
|
"Unprocessable Entity",
|
||||||
|
@ -135,29 +135,7 @@ defp create_request do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp create_response do
|
defp create_response do
|
||||||
%Schema{
|
Operation.response("App", "application/json", App)
|
||||||
title: "AppCreateResponse",
|
|
||||||
description: "Response schema for an app",
|
|
||||||
type: :object,
|
|
||||||
properties: %{
|
|
||||||
id: %Schema{type: :string},
|
|
||||||
name: %Schema{type: :string},
|
|
||||||
client_id: %Schema{type: :string},
|
|
||||||
client_secret: %Schema{type: :string},
|
|
||||||
redirect_uri: %Schema{type: :string},
|
|
||||||
vapid_key: %Schema{type: :string},
|
|
||||||
website: %Schema{type: :string, nullable: true}
|
|
||||||
},
|
|
||||||
example: %{
|
|
||||||
"id" => "123",
|
|
||||||
"name" => "My App",
|
|
||||||
"client_id" => "TWhM-tNSuncnqN7DBJmoyeLnk6K3iJJ71KKXxgL1hPM",
|
|
||||||
"client_secret" => "ZEaFUFmF0umgBX1qKJDjaU99Q31lDkOU8NutzTOoliw",
|
|
||||||
"vapid_key" =>
|
|
||||||
"BCk-QqERU0q-CfYZjcuB6lnyyOYfJ2AifKqfeGIm7Z-HiTU5T9eTG5GxVA0_OH5mMlI4UkkDTpaZwozy0TzdZ2M=",
|
|
||||||
"website" => "https://myapp.com/"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
defp array_of_apps do
|
defp array_of_apps do
|
||||||
|
|
|
@ -20,7 +20,7 @@ defmodule Pleroma.Web.MastodonAPI.AppController do
|
||||||
|
|
||||||
plug(:skip_auth when action in [:create, :verify_credentials])
|
plug(:skip_auth when action in [:create, :verify_credentials])
|
||||||
|
|
||||||
plug(:skip_plug, OAuthScopesPlug when action in [:index])
|
plug(OAuthScopesPlug, %{scopes: ["follow", "read"]} when action in [:index])
|
||||||
|
|
||||||
plug(Pleroma.Web.ApiSpec.CastAndValidate)
|
plug(Pleroma.Web.ApiSpec.CastAndValidate)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue