add media-endpoint to config query
This commit is contained in:
parent
d9fd1bb08d
commit
a16f93d4c3
1 changed files with 23 additions and 17 deletions
|
@ -2,6 +2,10 @@ defmodule ChiyaWeb.Indie.MicropubHandler do
|
||||||
@behaviour PlugMicropub.HandlerBehaviour
|
@behaviour PlugMicropub.HandlerBehaviour
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
|
use Phoenix.VerifiedRoutes,
|
||||||
|
endpoint: ChiyaWeb.Endpoint,
|
||||||
|
router: ChiyaWeb.Router
|
||||||
|
|
||||||
alias ChiyaWeb.Indie.Properties, as: Props
|
alias ChiyaWeb.Indie.Properties, as: Props
|
||||||
alias ChiyaWeb.Indie.Token
|
alias ChiyaWeb.Indie.Token
|
||||||
|
|
||||||
|
@ -104,23 +108,25 @@ defmodule ChiyaWeb.Indie.MicropubHandler do
|
||||||
:ok ->
|
:ok ->
|
||||||
channels = Chiya.Channels.list_channels()
|
channels = Chiya.Channels.list_channels()
|
||||||
|
|
||||||
{:ok,
|
config = %{
|
||||||
%{
|
"media-endpoint" => url(~p"/indie/micropub/media"),
|
||||||
"destination" => [],
|
"destination" => [],
|
||||||
"post-types" => [
|
"post-types" => [
|
||||||
%{
|
%{
|
||||||
"type" => "note",
|
"type" => "note",
|
||||||
"name" => "Note"
|
"name" => "Note"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"channels" =>
|
"channels" =>
|
||||||
Enum.map(channels, fn c ->
|
Enum.map(channels, fn c ->
|
||||||
%{
|
%{
|
||||||
"uid" => c.slug,
|
"uid" => c.slug,
|
||||||
"name" => c.name
|
"name" => c.name
|
||||||
}
|
}
|
||||||
end)
|
end)
|
||||||
}}
|
}
|
||||||
|
|
||||||
|
{:ok, config}
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
{:error, :insufficient_scope}
|
{:error, :insufficient_scope}
|
||||||
|
|
Loading…
Reference in a new issue