Fix 500 callback YouTube: pagina token senza layout admin.
Il layout admin richiedeva admin_logged_in? non disponibile nel callback OAuth. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
# Callback OAuth YouTube (HTML). Non usare Api::V1 — ActionController::API non renderizza le view.
|
||||
class YoutubeOauthCallbackController < ActionController::Base
|
||||
layout "admin"
|
||||
|
||||
def show
|
||||
return redirect_to_oauth_error("Codice OAuth mancante") if params[:code].blank?
|
||||
|
||||
@@ -11,7 +9,7 @@ class YoutubeOauthCallbackController < ActionController::Base
|
||||
if ctx[:kind] == :platform
|
||||
@refresh_token = tokens[:refresh_token]
|
||||
@channel_title = tokens[:channel_title]
|
||||
return render "admin/youtube/platform_token"
|
||||
return render "admin/youtube/platform_token", layout: false
|
||||
end
|
||||
|
||||
user = User.find(ctx[:user_id])
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="it">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Token YouTube — Match Live TV</title>
|
||||
<style>
|
||||
body { font-family: system-ui, sans-serif; background: #0a0a0e; color: #f0f0f5; margin: 0; padding: 32px 20px; line-height: 1.5; }
|
||||
.wrap { max-width: 720px; margin: 0 auto; }
|
||||
h1 { font-size: 1.5rem; margin: 0 0 16px; }
|
||||
pre { background: #111; color: #eee; padding: 12px; overflow: auto; border-radius: 8px; word-break: break-all; }
|
||||
.muted { color: #999; }
|
||||
a { color: #ff6b6b; }
|
||||
.ok { color: #81c784; font-weight: 600; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrap">
|
||||
<h1>Token canale Match Live TV</h1>
|
||||
|
||||
<% if @channel_title.present? %>
|
||||
@@ -5,11 +24,20 @@
|
||||
<% 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>
|
||||
<p class="ok">Collegamento riuscito. Copia subito questa riga:</p>
|
||||
<p>Aggiungi in <code>/opt/matchlivetv/infra/.env</code>:</p>
|
||||
<pre id="yt-token">YOUTUBE_PLATFORM_REFRESH_TOKEN=<%= @refresh_token %></pre>
|
||||
<p class="muted">Non verrà mostrato di nuovo. Poi: <code>docker compose -f docker-compose.prod.yml restart rails sidekiq</code></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>
|
||||
<p class="muted">
|
||||
Google non ha restituito un refresh token. In
|
||||
<a href="https://myaccount.google.com/permissions" target="_blank" rel="noopener">account Google → accesso app</a>
|
||||
revoca «Match Live TV», poi ripeti da
|
||||
<a href="/admin/youtube/platform">/admin/youtube/platform</a>.
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<p><%= link_to "← Dashboard admin", admin_root_path %></p>
|
||||
<p><a href="/admin/">← Dashboard admin</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user