Merge branch 'fix-losing-relay-private-keys' into 'main'

Federation fixes

See merge request framasoft/mobilizon!1410
This commit is contained in:
Thomas Citharel 2023-06-06 10:54:00 +00:00
commit cde171d497
2 changed files with 8 additions and 2 deletions

View file

@ -307,7 +307,7 @@ config :mobilizon, Oban,
crontab: [ crontab: [
{"@hourly", Mobilizon.Service.Workers.BuildSiteMap, queue: :background}, {"@hourly", Mobilizon.Service.Workers.BuildSiteMap, queue: :background},
{"17 4 * * *", Mobilizon.Service.Workers.RefreshGroups, queue: :background}, {"17 4 * * *", Mobilizon.Service.Workers.RefreshGroups, queue: :background},
{"36 * * * *", Mobilizon.Service.Workers.RefreshInstances, queue: :background}, {"36 3 * * *", Mobilizon.Service.Workers.RefreshInstances, queue: :background},
{"@hourly", Mobilizon.Service.Workers.CleanOrphanMediaWorker, queue: :background}, {"@hourly", Mobilizon.Service.Workers.CleanOrphanMediaWorker, queue: :background},
{"@hourly", Mobilizon.Service.Workers.CleanUnconfirmedUsersWorker, queue: :background}, {"@hourly", Mobilizon.Service.Workers.CleanUnconfirmedUsersWorker, queue: :background},
{"@hourly", Mobilizon.Service.Workers.ExportCleanerWorker, queue: :background}, {"@hourly", Mobilizon.Service.Workers.ExportCleanerWorker, queue: :background},

View file

@ -23,7 +23,13 @@ defmodule Mobilizon.Federation.ActivityPub.Relay do
def init do def init do
# Wait for everything to settle. # Wait for everything to settle.
Process.sleep(1000 * 5) Process.sleep(1000 * 5)
get_actor() relay = get_actor()
unless Regex.match?(~r/BEGIN RSA PRIVATE KEY/, relay.keys) do
{:ok, relay} = Actors.actor_key_rotation(relay)
end
relay
end end
@spec get_actor() :: Actor.t() | no_return @spec get_actor() :: Actor.t() | no_return