debug(sync): endpoint diag multi-endpoints (Data API + InnerTube) + bouton UI

This commit is contained in:
2026-09-27 08:26:10 -04:00
parent 720367fe13
commit fdb5a48023
5 changed files with 95 additions and 1 deletions
@@ -101,7 +101,12 @@
class="rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 transition hover:border-slate-500">
{{ ytChannelsLoading() ? 'Chargement…' : (ytChannels().length ? 'Recharger' : 'Lister mes chaînes') }}
</button>
<button type="button" (click)="loadDiag()" [disabled]="diagLoading()"
class="rounded-md border border-slate-700 bg-slate-800 px-3 py-1.5 text-sm text-slate-200 transition hover:border-slate-500">
{{ diagLoading() ? 'Diagnostic…' : '🩺 Diagnostic complet' }}
</button>
</div>
<pre *ngIf="diagResult()" class="mt-2 max-h-64 overflow-auto whitespace-pre-wrap rounded-lg border border-slate-700 bg-slate-950 p-2 text-xs text-slate-300">{{ diagResult() }}</pre>
<div *ngIf="ytChannelsError()" class="mt-2 rounded-lg border border-red-700 bg-red-900/30 p-2 text-xs text-red-200">{{ ytChannelsError() }}</div>
<div *ngIf="ytChannels().length" class="mt-3 space-y-2">
<label *ngFor="let c of ytChannels()" class="flex cursor-pointer items-center gap-3 rounded-lg border border-slate-700 bg-slate-800/60 px-3 py-2 text-sm transition hover:border-slate-500">
@@ -249,6 +249,24 @@ export class ImportComponent implements OnInit {
ytSelectedChannelId = signal<string>('');
ytSavingChannel = signal(false);
ytChannelSaved = signal<string | null>(null);
diagLoading = signal(false);
diagResult = signal<string | null>(null);
loadDiag(): void {
if (this.diagLoading()) return;
this.diagLoading.set(true);
this.diagResult.set(null);
this.api.diag().subscribe({
next: (res) => {
this.diagResult.set(JSON.stringify(res, null, 1));
this.diagLoading.set(false);
},
error: (e) => {
this.diagResult.set(`Erreur diag : ${e?.error?.error || e?.message || 'diag_failed'}`);
this.diagLoading.set(false);
},
});
}
loadYtChannels(): void {
if (!this.isConnected('google') || this.ytChannelsLoading()) return;
+5
View File
@@ -101,6 +101,11 @@ export class OAuthImportService {
saveYtChannel(channelId: string | null, pageId: string | null): Observable<{ selected: { channelId: string | null; pageId: string | null } }> {
return this.http.put<any>(`/api/oauth/google/yt-channel`, { channelId, pageId });
}
/** Diagnostic : état de chaque endpoint authentifié (Data API + InnerTube). */
diag(): Observable<any> {
return this.http.get<any>(`/api/oauth/google/diag`);
}
}
/** Parse local du `watch-history.json` de Google Takeout (confidentiel : rien n'est uploadé tel quel). */