debug(sync): endpoint diag multi-endpoints (Data API + InnerTube) + bouton UI
This commit is contained in:
+23
-1
@@ -108,7 +108,7 @@ import {
|
||||
fetchGoogleLiked, fetchTwitchProfile, fetchTwitchFollows, hasGoogleWriteScope,
|
||||
fetchGoogleWatchLater, pushGoogleWatchLater, fetchInnerTubeHistory,
|
||||
fetchInnerTubeWatchLaterViaLib, pushInnerTubeWatchLater, fetchGoogleWatchLaterId,
|
||||
fetchAccountChannels,
|
||||
fetchAccountChannels, diagnoseInnertube,
|
||||
} from './oauth.mjs';
|
||||
import { getSearchMode, getYtDlpBin, hasCookiesFile, metricsSnapshot } from './providers/youtube-common.mjs';
|
||||
import { ytScrapeCacheStats } from './providers/youtube.mjs';
|
||||
@@ -585,6 +585,28 @@ r.get('/oauth/google/yt-channels', authMiddlewareCookieAware, oauthLimiter, asyn
|
||||
}
|
||||
});
|
||||
|
||||
// Diagnostic : état de chaque endpoint InnerTube authentifié + Data API.
|
||||
r.get('/oauth/google/diag', authMiddlewareCookieAware, oauthLimiter, async (req, res) => {
|
||||
try {
|
||||
const conn = await freshOAuthToken(req.user.id, 'google');
|
||||
const dataApi = {};
|
||||
try {
|
||||
await fetchGoogleWatchLaterId(conn.accessToken);
|
||||
dataApi.watchLaterId = true;
|
||||
} catch (e) {
|
||||
dataApi.watchLaterId = false;
|
||||
dataApi.watchLaterError = String(e?.message || '').slice(0, 80);
|
||||
}
|
||||
const innertube = await diagnoseInnertube(conn);
|
||||
try {
|
||||
console.log(`[oauth] diag user=${req.user?.id} ${JSON.stringify({ dataApi, innertube }).slice(0, 800)}`);
|
||||
} catch {}
|
||||
return res.json({ dataApi, innertube });
|
||||
} catch (error) {
|
||||
return res.status(error?.status || 502).json({ error: error?.message || 'diag_failed' });
|
||||
}
|
||||
});
|
||||
|
||||
r.put('/oauth/google/yt-channel', authMiddlewareCookieAware, oauthLimiter, (req, res) => {
|
||||
try {
|
||||
const channelId = String(req.body?.channelId || '').trim().slice(0, 64) || null;
|
||||
|
||||
Reference in New Issue
Block a user