From ec5db753b9b7386db5a124a13fb97d367e328a9a Mon Sep 17 00:00:00 2001 From: FloatingGhost Date: Sat, 5 Aug 2023 14:03:21 +0100 Subject: [PATCH] Prevent elixir compiler from yeeting our modules --- lib/pleroma/application.ex | 16 ++++++++++++++++ mix.exs | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index db49ccfae..f2ff36603 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -53,6 +53,7 @@ def start(_type, _args) do Config.DeprecationWarnings.warn() Pleroma.Web.Plugs.HTTPSecurityPlug.warn_if_disabled() Pleroma.ApplicationRequirements.verify!() + load_all_pleroma_modules() load_custom_modules() Pleroma.Docs.JSON.compile() limiters_setup() @@ -144,6 +145,21 @@ def load_custom_modules do end end + def load_all_pleroma_modules do + :code.all_available() + |> Enum.filter(fn {mod, _, _} -> + mod + |> to_string() + |> String.starts_with?("Elixir.Pleroma.") + end) + |> Enum.map(fn {mod, _, _} -> + mod + |> to_string() + |> String.to_existing_atom() + end) + |> Code.ensure_all_loaded!() + end + defp cachex_children do [ build_cachex("used_captcha", ttl_interval: seconds_valid_interval()), diff --git a/mix.exs b/mix.exs index e0a1ba9c7..2b555f39b 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Pleroma.Mixfile do def project do [ app: :pleroma, - version: version("3.10.1"), + version: version("3.10.2"), elixir: "~> 1.14", elixirc_paths: elixirc_paths(Mix.env()), compilers: [:phoenix] ++ Mix.compilers(),