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:
@@ -7,6 +7,7 @@ module Public
|
||||
before_action :set_team, only: %i[
|
||||
details dashboard roster edit update invite create_invitation
|
||||
assign_self_staff clear_self_staff remove_member destroy_invitation
|
||||
youtube_connect youtube_disconnect
|
||||
]
|
||||
|
||||
def new
|
||||
@@ -114,6 +115,27 @@ module Public
|
||||
redirect_to public_team_details_path(@team), notice: "Invito annullato"
|
||||
end
|
||||
|
||||
def youtube_connect
|
||||
require_club_owner_for_team!(@team)
|
||||
@team.entitlements.assert_can_connect_youtube!
|
||||
|
||||
if ENV["YOUTUBE_CLIENT_ID"].blank?
|
||||
redirect_to public_team_details_path(@team), alert: "YouTube OAuth non configurato sul server"
|
||||
return
|
||||
end
|
||||
|
||||
state = Youtube::OauthState.for_team(team_id: @team.id, user_id: current_user.id)
|
||||
redirect_to Youtube::OauthUrl.build(state: state), allow_other_host: true
|
||||
rescue Teams::EntitlementError => e
|
||||
redirect_to public_team_details_path(@team), alert: e.message
|
||||
end
|
||||
|
||||
def youtube_disconnect
|
||||
require_club_owner_for_team!(@team)
|
||||
@team.youtube_credential&.destroy!
|
||||
redirect_to public_team_details_path(@team), notice: "Canale YouTube scollegato"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def load_team_details!
|
||||
|
||||
Reference in New Issue
Block a user