forked from mirrors/akkoma
Ensure scrubbers are loaded by the compiler
This commit is contained in:
parent
6cb40bee26
commit
2fdfed50f0
|
@ -39,6 +39,8 @@ def start_pleroma do
|
||||||
|
|
||||||
Enum.each(@apps, &Application.ensure_all_started/1)
|
Enum.each(@apps, &Application.ensure_all_started/1)
|
||||||
|
|
||||||
|
Pleroma.Application.load_all_pleroma_modules()
|
||||||
|
|
||||||
oban_config = [
|
oban_config = [
|
||||||
crontab: [],
|
crontab: [],
|
||||||
repo: Pleroma.Repo,
|
repo: Pleroma.Repo,
|
||||||
|
|
|
@ -17,6 +17,13 @@ def run(["http", url]) do
|
||||||
|> IO.inspect()
|
|> IO.inspect()
|
||||||
end
|
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
|
def run(["home_timeline", nickname]) do
|
||||||
start_pleroma()
|
start_pleroma()
|
||||||
user = Repo.get_by!(User, nickname: nickname)
|
user = Repo.get_by!(User, nickname: nickname)
|
||||||
|
|
|
@ -48,7 +48,6 @@ def start(_type, _args) do
|
||||||
# due to protocol consolidation warnings
|
# due to protocol consolidation warnings
|
||||||
Code.compiler_options(warnings_as_errors: false)
|
Code.compiler_options(warnings_as_errors: false)
|
||||||
Config.Holder.save_default()
|
Config.Holder.save_default()
|
||||||
Pleroma.HTML.compile_scrubbers()
|
|
||||||
Pleroma.Config.Oban.warn()
|
Pleroma.Config.Oban.warn()
|
||||||
Config.DeprecationWarnings.warn()
|
Config.DeprecationWarnings.warn()
|
||||||
Pleroma.Web.Plugs.HTTPSecurityPlug.warn_if_disabled()
|
Pleroma.Web.Plugs.HTTPSecurityPlug.warn_if_disabled()
|
||||||
|
|
|
@ -8,20 +8,6 @@ defmodule Pleroma.HTML do
|
||||||
|
|
||||||
@cachex Pleroma.Config.get([:cachex, :provider], Cachex)
|
@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(scrubber) when is_atom(scrubber), do: [scrubber]
|
||||||
defp get_scrubbers(scrubbers) when is_list(scrubbers), do: scrubbers
|
defp get_scrubbers(scrubbers) when is_list(scrubbers), do: scrubbers
|
||||||
defp get_scrubbers(_), do: [Pleroma.HTML.Scrubber.Default]
|
defp get_scrubbers(_), do: [Pleroma.HTML.Scrubber.Default]
|
||||||
|
|
Loading…
Reference in a new issue