2024-02-20 17:44:52 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# = Instance =
|
|
|
|
#
|
|
|
|
# Representa cada instancia del fediverso que interactúa con la Social
|
|
|
|
# Inbox.
|
2024-02-21 15:46:38 +00:00
|
|
|
class ActivityPub
|
|
|
|
class Instance < ApplicationRecord
|
|
|
|
include AASM
|
2024-02-20 17:44:52 +00:00
|
|
|
|
2024-02-21 15:46:38 +00:00
|
|
|
validates :aasm_state, presence: true, inclusion: { in: %w[paused allowed blocked] }
|
|
|
|
validates :hostname, uniqueness: true, hostname: true
|
2024-02-20 17:44:52 +00:00
|
|
|
|
2024-02-21 15:46:38 +00:00
|
|
|
has_many :activity_pubs
|
|
|
|
has_many :actors
|
2024-02-20 17:44:52 +00:00
|
|
|
|
2024-02-21 15:46:38 +00:00
|
|
|
aasm do
|
|
|
|
state :paused, initial: true
|
|
|
|
state :allowed
|
|
|
|
state :blocked
|
|
|
|
end
|
2024-02-24 16:04:52 +00:00
|
|
|
|
|
|
|
def uri
|
|
|
|
@uri ||= "https://#{hostname}/"
|
|
|
|
end
|
2024-02-20 17:44:52 +00:00
|
|
|
end
|
|
|
|
end
|