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:
@@ -3,7 +3,12 @@
|
||||
<% if @team.club %>
|
||||
<p>Società: <%= @team.club.name %> · <%= link_to "Pagamenti e fatture", admin_billing_path(club_id: @team.club.id) %></p>
|
||||
<% end %>
|
||||
<p>YouTube: <%= @team.youtube_credential ? "Connesso" : link_to("Connetti", "/api/v1/teams/#{@team.id}/youtube/authorize") %></p>
|
||||
<% yt = Youtube::TeamStatus.new(@team) %>
|
||||
<p>YouTube: <%= yt.channel_title || "—" %> · <%= yt.selectable? ? "pronto" : "non pronto" %></p>
|
||||
<% if @team.entitlements.plan.youtube_mode == "team" && @team.youtube_credential.blank? %>
|
||||
<p><%= link_to "Collega (da account titolare sul sito)", public_team_details_path(@team) %></p>
|
||||
<% end %>
|
||||
<p><%= link_to "Token canale Match Live TV (Light)", admin_youtube_platform_path %></p>
|
||||
|
||||
<h3>Partite</h3>
|
||||
<ul>
|
||||
|
||||
15
backend/app/views/admin/youtube/platform_token.html.erb
Normal file
15
backend/app/views/admin/youtube/platform_token.html.erb
Normal file
@@ -0,0 +1,15 @@
|
||||
<h1>Token canale Match Live TV</h1>
|
||||
|
||||
<% if @channel_title.present? %>
|
||||
<p>Canale: <strong><%= @channel_title %></strong></p>
|
||||
<% end %>
|
||||
|
||||
<% if @refresh_token.present? %>
|
||||
<p>Aggiungi in <code>/opt/matchlivetv/infra/.env</code> (o locale <code>infra/.env</code>):</p>
|
||||
<pre style="background:#111;color:#eee;padding:12px;overflow:auto">YOUTUBE_PLATFORM_REFRESH_TOKEN=<%= @refresh_token %></pre>
|
||||
<p class="muted">Copia ora: non verrà mostrato di nuovo. Poi riavvia il container Rails.</p>
|
||||
<% else %>
|
||||
<p class="muted">Google non ha restituito un refresh token. Ripeti il collegamento con <code>prompt=consent</code> (revoca l’accesso precedente in Google Account).</p>
|
||||
<% end %>
|
||||
|
||||
<p><%= link_to "← Dashboard admin", admin_root_path %></p>
|
||||
46
backend/app/views/public/teams/_youtube.html.erb
Normal file
46
backend/app/views/public/teams/_youtube.html.erb
Normal file
@@ -0,0 +1,46 @@
|
||||
<% yt = Youtube::TeamStatus.new(team) %>
|
||||
<% return unless entitlements.youtube_enabled? %>
|
||||
|
||||
<section class="card team-youtube" id="youtube">
|
||||
<h2>YouTube Live</h2>
|
||||
|
||||
<% if params[:youtube] == "connected" %>
|
||||
<p class="notice" style="color:#2e7d32;margin-bottom:12px">Canale YouTube collegato con successo.</p>
|
||||
<% end %>
|
||||
|
||||
<% if entitlements.plan.youtube_mode == "matchlivetv_light" %>
|
||||
<p>
|
||||
Con il piano <strong>Premium Light</strong> la diretta va sul canale ufficiale
|
||||
<strong>Match Live TV</strong>. Non serve collegare un canale della società.
|
||||
</p>
|
||||
<% if yt.selectable? %>
|
||||
<p class="muted">Canale pronto · seleziona «YouTube Live» nell’app mobile.</p>
|
||||
<% else %>
|
||||
<p class="muted">Canale Match Live TV in configurazione lato server. Contatta il supporto se YouTube non compare in app.</p>
|
||||
<% end %>
|
||||
<% elsif entitlements.premium_full? %>
|
||||
<% cred = team.youtube_credential %>
|
||||
<% if cred %>
|
||||
<p>
|
||||
Canale collegato:
|
||||
<strong><%= cred.channel_title.presence || cred.channel_id || "YouTube" %></strong>
|
||||
</p>
|
||||
<%= button_to "Scollega canale", public_team_youtube_disconnect_path(team),
|
||||
method: :delete,
|
||||
class: "btn btn-secondary",
|
||||
form: { data: { turbo_confirm: "Scollegare il canale YouTube? Le dirette future richiederanno un nuovo collegamento." } } %>
|
||||
<% else %>
|
||||
<p class="muted">
|
||||
Collega il canale YouTube della società per trasmettere dall’app con la piattaforma «YouTube Live».
|
||||
</p>
|
||||
<% if ENV["YOUTUBE_CLIENT_ID"].present? %>
|
||||
<%= link_to "Collega canale YouTube", public_team_youtube_connect_path(team), class: "btn btn-primary" %>
|
||||
<% else %>
|
||||
<p class="muted">OAuth YouTube non ancora configurato sul server.</p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<p class="muted">YouTube sul canale della società richiede il piano Premium Full.</p>
|
||||
<%= link_to "Vedi piani", public_prezzi_path, class: "btn btn-secondary" %>
|
||||
<% end %>
|
||||
</section>
|
||||
@@ -92,6 +92,8 @@
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= render "public/teams/youtube", team: @team, entitlements: @entitlements %>
|
||||
|
||||
<%= render "public/teams/streaming_staff", team: @team, club: @club, can_manage: @can_manage,
|
||||
entitlements: @entitlements, owner_membership: @owner_membership,
|
||||
staff_memberships: @staff_memberships, pending_invitations: @pending_invitations,
|
||||
|
||||
Reference in New Issue
Block a user