### Fixed
- /api/v1/accounts/lookup will now respect restrict\_unauthenticated
+- Unknown atoms in the config DB will no longer crash akkoma on boot
### Upgrade notes
- Ensure `config :tesla, :adapter` is either unset, or set to `{Tesla.Adapter.Finch, name: MyFinch}` in your .exs config
# We need to restart applications for loaded settings take effect
{logger, other} =
(Repo.all(ConfigDB) ++ deleted_settings)
+ |> Enum.reject(&invalid_key_or_group/1)
|> Enum.map(&merge_with_default/1)
|> Enum.split_with(fn {group, _, _, _} -> group == :logger end)
end
end
+ defp invalid_key_or_group(%ConfigDB{key: :invalid_atom}), do: true
+ defp invalid_key_or_group(%ConfigDB{group: :invalid_atom}), do: true
+ defp invalid_key_or_group(_), do: false
+
defp merge_with_default(%{group: group, key: key, value: value} = setting) do
default =
if group == :pleroma do
def string_to_elixir_types(value) do
if module_name?(value) do
- String.to_existing_atom("Elixir." <> value)
+ try do
+ String.to_existing_atom("Elixir." <> value)
+ rescue
+ ArgumentError -> :invalid_atom
+ end
else
value
end
assert ConfigDB.to_elixir_types("Pleroma.Bookmark") == Pleroma.Bookmark
end
+ test "removed module" do
+ assert ConfigDB.to_elixir_types("Pleroma.Nowhere") == :invalid_atom
+ end
+
test "pleroma string" do
assert ConfigDB.to_elixir_types("Pleroma") == "Pleroma"
end