Integrazione YouTube Live: OAuth squadra, canale piattaforma Light e UI.
Collegamento da Dettagli squadra e admin per il refresh token Match Live TV; API e app mobile allineate ai piani Light/Full. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -25,9 +25,11 @@ class Plan < ApplicationRecord
|
||||
end
|
||||
|
||||
def allows_platform?(platform)
|
||||
return false if platform.to_s == "youtube" && !youtube_enabled?
|
||||
platform = platform.to_s
|
||||
return false if platform == "youtube" && !youtube_enabled?
|
||||
return true if platform == "youtube" && youtube_mode == "matchlivetv_light"
|
||||
|
||||
Array(features["platforms"]).map(&:to_s).include?(platform.to_s)
|
||||
Array(features["platforms"]).map(&:to_s).include?(platform)
|
||||
end
|
||||
|
||||
def feature(key)
|
||||
|
||||
23
backend/app/models/youtube/platform_credential.rb
Normal file
23
backend/app/models/youtube/platform_credential.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
module Youtube
|
||||
# Credenziali del canale YouTube Match Live TV (Premium Light), da ENV.
|
||||
class PlatformCredential
|
||||
attr_accessor :access_token, :expires_at
|
||||
|
||||
def refresh_token
|
||||
ENV["YOUTUBE_PLATFORM_REFRESH_TOKEN"].presence
|
||||
end
|
||||
|
||||
def expired?
|
||||
expires_at.present? && expires_at < Time.current
|
||||
end
|
||||
|
||||
def update!(attrs)
|
||||
self.access_token = attrs[:access_token] if attrs.key?(:access_token)
|
||||
self.expires_at = attrs[:expires_at] if attrs.key?(:expires_at)
|
||||
end
|
||||
|
||||
def self.configured?
|
||||
ENV["YOUTUBE_PLATFORM_REFRESH_TOKEN"].present?
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user