1
0
Fork 0
forked from mirrors/akkoma

Ensure scrubbers are loaded by the compiler

This commit is contained in:
sadposter 2023-08-15 22:09:10 +01:00
parent 6cb40bee26
commit 2fdfed50f0
8 changed files with 9 additions and 15 deletions

View file

@ -39,6 +39,8 @@ def start_pleroma do
Enum.each(@apps, &Application.ensure_all_started/1)
Pleroma.Application.load_all_pleroma_modules()
oban_config = [
crontab: [],
repo: Pleroma.Repo,

View file

@ -17,6 +17,13 @@ def run(["http", url]) do
|> IO.inspect()
end
def run(["get_object", url]) do
start_pleroma()
Pleroma.Object.Fetcher.fetch_object_from_id(url)
|> IO.inspect()
end
def run(["home_timeline", nickname]) do
start_pleroma()
user = Repo.get_by!(User, nickname: nickname)

View file

@ -48,7 +48,6 @@ def start(_type, _args) do
# due to protocol consolidation warnings
Code.compiler_options(warnings_as_errors: false)
Config.Holder.save_default()
Pleroma.HTML.compile_scrubbers()
Pleroma.Config.Oban.warn()
Config.DeprecationWarnings.warn()
Pleroma.Web.Plugs.HTTPSecurityPlug.warn_if_disabled()

View file

@ -8,20 +8,6 @@ defmodule Pleroma.HTML do
@cachex Pleroma.Config.get([:cachex, :provider], Cachex)
def compile_scrubbers do
dir = Path.join(:code.priv_dir(:pleroma), "scrubbers")
dir
|> Pleroma.Utils.compile_dir()
|> case do
{:error, _errors, _warnings} ->
raise "Compiling scrubbers failed"
{:ok, _modules, _warnings} ->
:ok
end
end
defp get_scrubbers(scrubber) when is_atom(scrubber), do: [scrubber]
defp get_scrubbers(scrubbers) when is_list(scrubbers), do: scrubbers
defp get_scrubbers(_), do: [Pleroma.HTML.Scrubber.Default]