Limita una diretta attiva per account e valorizza la copertina Premium Full.
Blocca la seconda diretta sullo stesso utente, registra gli abusi in admin e presenta la copertina come grafica caricata dalla società, con demo Team MLTV. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -10,6 +10,10 @@ class StreamSession < ApplicationRecord
|
||||
belongs_to :user
|
||||
belongs_to :stream_node, optional: true
|
||||
has_many :stream_events, dependent: :destroy
|
||||
has_many :occupying_concurrency_violations, class_name: "StreamConcurrencyViolation",
|
||||
foreign_key: :occupying_session_id, dependent: :nullify, inverse_of: :occupying_session
|
||||
has_many :attempted_concurrency_violations, class_name: "StreamConcurrencyViolation",
|
||||
foreign_key: :attempted_session_id, dependent: :nullify, inverse_of: :attempted_session
|
||||
has_one :score_state, dependent: :destroy
|
||||
has_one :recording
|
||||
has_many :device_states, dependent: :destroy
|
||||
@@ -84,6 +88,35 @@ class StreamSession < ApplicationRecord
|
||||
stream_node&.role.presence || ingest_role
|
||||
end
|
||||
|
||||
def match_label
|
||||
team_name = match&.team&.name
|
||||
opponent = match&.opponent_name
|
||||
return id.to_s if team_name.blank?
|
||||
|
||||
opponent.present? ? "#{team_name} vs #{opponent}" : team_name
|
||||
end
|
||||
|
||||
def client_device_label
|
||||
parts = []
|
||||
parts << client_os if client_os.present?
|
||||
device = [device_manufacturer, device_model].compact_blank.join(" ")
|
||||
parts << device if device.present?
|
||||
parts << "OS #{os_version}" if os_version.present?
|
||||
parts.join(" · ").presence
|
||||
end
|
||||
|
||||
def client_device_key
|
||||
[client_os, device_manufacturer, device_model].map { |v| v.to_s.strip.downcase }.join("|")
|
||||
end
|
||||
|
||||
def self.devices_differ?(left, right)
|
||||
ka = left.client_device_key
|
||||
kb = right.client_device_key
|
||||
return false if ka.delete("|").blank? || kb.delete("|").blank?
|
||||
|
||||
ka != kb
|
||||
end
|
||||
|
||||
def rtmp_ingest_url
|
||||
# RootEncoder richiede rtmp://host:port/app/stream (due segmenti).
|
||||
# MediaMTX path = live/match_{uuid} (no ?token= nel path).
|
||||
|
||||
Reference in New Issue
Block a user