Merge pull request 'devel' (#211) from devel into main

Reviewed-on: #211
This commit is contained in:
inhji 2023-07-17 19:39:43 +02:00
commit e4a1eb39c5

View file

@ -2,6 +2,10 @@ defmodule ChiyaWeb.Indie.MicropubHandler do
@behaviour PlugMicropub.HandlerBehaviour
require Logger
use Phoenix.VerifiedRoutes,
endpoint: ChiyaWeb.Endpoint,
router: ChiyaWeb.Router
alias ChiyaWeb.Indie.Properties, as: Props
alias ChiyaWeb.Indie.Token
@ -104,23 +108,25 @@ defmodule ChiyaWeb.Indie.MicropubHandler do
:ok ->
channels = Chiya.Channels.list_channels()
{:ok,
%{
"destination" => [],
"post-types" => [
%{
"type" => "note",
"name" => "Note"
}
],
"channels" =>
Enum.map(channels, fn c ->
%{
"uid" => c.slug,
"name" => c.name
}
end)
}}
config = %{
"media-endpoint" => url(~p"/indie/micropub/media"),
"destination" => [],
"post-types" => [
%{
"type" => "note",
"name" => "Note"
}
],
"channels" =>
Enum.map(channels, fn c ->
%{
"uid" => c.slug,
"name" => c.name
}
end)
}
{:ok, config}
_ ->
{:error, :insufficient_scope}