Fix situations in which instance actor can be set to a Mastodon-incompatible name (#22307)
* Validate internal actor * Use “internal.actor” by default for the server actor username * Fix instance actor username on the fly if it includes ':' * Change actor name from internal.actor to mastodon.internal
This commit is contained in:
parent
9b3e22c40d
commit
d1387579b9
3 changed files with 7 additions and 5 deletions
|
@ -13,9 +13,11 @@ module AccountFinderConcern
|
|||
end
|
||||
|
||||
def representative
|
||||
Account.find(-99).tap(&:ensure_keys!)
|
||||
actor = Account.find(-99).tap(&:ensure_keys!)
|
||||
actor.update!(username: 'mastodon.internal') if actor.username.include?(':')
|
||||
actor
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
Account.create!(id: -99, actor_type: 'Application', locked: true, username: Rails.configuration.x.local_domain)
|
||||
Account.create!(id: -99, actor_type: 'Application', locked: true, username: 'mastodon.internal')
|
||||
end
|
||||
|
||||
def find_local(username)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue