is this what i was meant to do?
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
parent
120719f28c
commit
1b182b07dc
3 changed files with 60 additions and 12 deletions
|
|
@ -13,16 +13,6 @@ defmodule Pleroma.Web.ApiSpec.RemoteInteractionOperation do
|
||||||
apply(__MODULE__, operation, [])
|
apply(__MODULE__, operation, [])
|
||||||
end
|
end
|
||||||
|
|
||||||
def remote_subscribe_operation do
|
|
||||||
%Operation{
|
|
||||||
tags: ["Remote interaction"],
|
|
||||||
summary: "Remote Subscribe",
|
|
||||||
operationId: "RemoteInteractionController.remote_subscribe",
|
|
||||||
parameters: [],
|
|
||||||
responses: %{200 => Operation.response("Web Page", "text/html", %Schema{type: :string})}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
def remote_interaction_operation do
|
def remote_interaction_operation do
|
||||||
%Operation{
|
%Operation{
|
||||||
tags: ["Remote interaction"],
|
tags: ["Remote interaction"],
|
||||||
|
|
@ -49,6 +39,64 @@ defmodule Pleroma.Web.ApiSpec.RemoteInteractionOperation do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def follow_operation do
|
||||||
|
%Operation{
|
||||||
|
tags: ["Remote interaction"],
|
||||||
|
summary: "Display follow form",
|
||||||
|
operationId: "RemoteInteractionController.follow",
|
||||||
|
parameters: [],
|
||||||
|
responses: %{
|
||||||
|
200 => Operation.response("Web Page", "text/html", %Schema{type: :string}),
|
||||||
|
302 => Operation.response("Redirect to the status page", nil, nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def do_follow_operation do
|
||||||
|
%Operation{
|
||||||
|
tags: ["Remote interaction"],
|
||||||
|
summary: "Perform follow activity",
|
||||||
|
operationId: "RemoteInteractionController.do_follow",
|
||||||
|
parameters: [],
|
||||||
|
responses: %{
|
||||||
|
200 => Operation.response("Web page", "text/html", %Schema{type: :string}),
|
||||||
|
302 => Operation.response("Redirect to the account page", nil, nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def authorize_interaction_operation do
|
||||||
|
%Operation{
|
||||||
|
tags: ["Remote interaction"],
|
||||||
|
summary: "Authorize remote interaction",
|
||||||
|
operationId: "RemoteInteractionController.authorize_interaction",
|
||||||
|
parameters: [],
|
||||||
|
responses: %{
|
||||||
|
302 => Operation.response("Redirect to remote_interaction path", nil, nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def show_subscribe_form_operation do
|
||||||
|
%Operation{
|
||||||
|
tags: ["Remote interaction"],
|
||||||
|
summary: "Show remote subscribe form",
|
||||||
|
operationId: "RemoteInteractionController.show_subscribe_form",
|
||||||
|
parameters: [],
|
||||||
|
responses: %{200 => Operation.response("Web Page", "text/html", %Schema{type: :string})}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def remote_subscribe_operation do
|
||||||
|
%Operation{
|
||||||
|
tags: ["Remote interaction"],
|
||||||
|
summary: "Remote Subscribe",
|
||||||
|
operationId: "RemoteInteractionController.remote_subscribe",
|
||||||
|
parameters: [],
|
||||||
|
responses: %{200 => Operation.response("Web Page", "text/html", %Schema{type: :string})}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
def show_subscribe_form_operation do
|
def show_subscribe_form_operation do
|
||||||
%Operation{
|
%Operation{
|
||||||
tags: ["Remote interaction"],
|
tags: ["Remote interaction"],
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ defmodule Pleroma.Web.PleromaAPI.UtilController do
|
||||||
alias Pleroma.Web.CommonAPI
|
alias Pleroma.Web.CommonAPI
|
||||||
alias Pleroma.Web.Plugs.OAuthScopesPlug
|
alias Pleroma.Web.Plugs.OAuthScopesPlug
|
||||||
|
|
||||||
plug(Pleroma.Web.ApiSpec.CastAndValidate, [replace_params: false])
|
plug(Pleroma.Web.ApiSpec.CastAndValidate, replace_params: false)
|
||||||
|
|
||||||
plug(
|
plug(
|
||||||
OAuthScopesPlug,
|
OAuthScopesPlug,
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ defmodule Pleroma.Web.RemoteInteraction.RemoteInteractionController do
|
||||||
plug(
|
plug(
|
||||||
Pleroma.Web.Plugs.OAuthScopesPlug,
|
Pleroma.Web.Plugs.OAuthScopesPlug,
|
||||||
%{fallback: :proceed_unauthenticated, scopes: ["follow", "write:follows"]}
|
%{fallback: :proceed_unauthenticated, scopes: ["follow", "write:follows"]}
|
||||||
when action in [:do_follow]
|
when action == :do_follow
|
||||||
)
|
)
|
||||||
|
|
||||||
defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.RemoteInteractionOperation
|
defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.RemoteInteractionOperation
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue