801e6a050b
- Documentation archivée et réorganisée - Backend: Ajout tests, migrations, library service, rate limiting - Frontend: Suppression Flutter, focus sur interface web HTML/JS - Tailwind CSS ajouté pour le style - Améliorations UX et corrections bugs Generated with [Claude Code](https://claude.com/claude-code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
142 lines
5.5 KiB
HTML
142 lines
5.5 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Diagnostic AudiOhm</title>
|
|
<style>
|
|
body { font-family: monospace; padding: 20px; background: #1a1a2e; color: #eee; }
|
|
.test { margin: 10px 0; padding: 10px; border: 1px solid #444; }
|
|
.pass { background: #1b4332; }
|
|
.fail { background: #4a1a1a; }
|
|
button { padding: 10px 20px; margin: 5px; cursor: pointer; }
|
|
pre { background: #0d0d1a; padding: 10px; overflow-x: auto; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>🔧 Diagnostic AudiOhm</h1>
|
|
|
|
<div class="test" id="test-api">Test API...</div>
|
|
<div class="test" id="test-auth">Test Auth...</div>
|
|
<div class="test" id="test-trending">Test Trending...</div>
|
|
<div class="test" id="test-stream">Test Stream URL...</div>
|
|
|
|
<h2>Actions</h2>
|
|
<button onclick="testAll()">Exécuter tous les tests</button>
|
|
<button onclick="testLogin()">Test Login</button>
|
|
|
|
<h2>Résultats</h2>
|
|
<pre id="output">Cliquez sur un bouton pour commencer...</pre>
|
|
|
|
<script>
|
|
let authToken = null;
|
|
|
|
function log(msg) {
|
|
const output = document.getElementById('output');
|
|
output.textContent += msg + '\n';
|
|
}
|
|
|
|
function updateStatus(id, passed, msg) {
|
|
const el = document.getElementById(id);
|
|
el.className = 'test ' + (passed ? 'pass' : 'fail');
|
|
el.textContent = msg;
|
|
}
|
|
|
|
async function testAPI() {
|
|
try {
|
|
const response = await fetch('/api/v1/music/trending?limit=1');
|
|
const data = await response.json();
|
|
updateStatus('test-api', response.ok, `API: ${response.status} - ${response.statusText}`);
|
|
log('✅ API accessible');
|
|
log('Données: ' + JSON.stringify(data[0], null, 2).substring(0, 200) + '...');
|
|
} catch (error) {
|
|
updateStatus('test-api', false, 'API: Error - ' + error.message);
|
|
log('❌ API error: ' + error.message);
|
|
}
|
|
}
|
|
|
|
async function testLogin() {
|
|
try {
|
|
const response = await fetch('/api/v1/auth/login', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({
|
|
email: 'admin@example.com',
|
|
password: 'admin123'
|
|
})
|
|
});
|
|
const data = await response.json();
|
|
if (response.ok && data.access_token) {
|
|
authToken = data.access_token;
|
|
updateStatus('test-auth', true, 'Auth: ✅ Connecté');
|
|
log('✅ Login réussi');
|
|
log('Token: ' + authToken.substring(0, 20) + '...');
|
|
} else {
|
|
updateStatus('test-auth', false, 'Auth: ❌ ' + JSON.stringify(data));
|
|
log('❌ Login failed: ' + JSON.stringify(data));
|
|
}
|
|
} catch (error) {
|
|
updateStatus('test-auth', false, 'Auth: Error - ' + error.message);
|
|
log('❌ Auth error: ' + error.message);
|
|
}
|
|
}
|
|
|
|
async function testTrending() {
|
|
if (!authToken) {
|
|
await testLogin();
|
|
}
|
|
if (!authToken) {
|
|
updateStatus('test-trending', false, 'Trending: Pas de token');
|
|
return;
|
|
}
|
|
|
|
try {
|
|
const response = await fetch('/api/v1/music/trending?limit=2', {
|
|
headers: { 'Authorization': 'Bearer ' + authToken }
|
|
});
|
|
const data = await response.json();
|
|
updateStatus('test-trending', response.ok, `Trending: ${response.status} - ${data.length} pistes`);
|
|
log('✅ Trending: ' + data.length + ' pistes trouvées');
|
|
log('Piste 1: ' + data[0].title);
|
|
} catch (error) {
|
|
updateStatus('test-trending', false, 'Trending: Error - ' + error.message);
|
|
log('❌ Trending error: ' + error.message);
|
|
}
|
|
}
|
|
|
|
async function testStream() {
|
|
const youtubeId = 'NqDGkdDh8WE';
|
|
try {
|
|
const response = await fetch(`/api/v1/music/youtube/${youtubeId}/stream`);
|
|
const data = await response.json();
|
|
if (response.ok && data.stream_url) {
|
|
updateStatus('test-stream', true, 'Stream: ✅ URL obtenue');
|
|
log('✅ Stream URL obtenue');
|
|
log('URL: ' + data.stream_url.substring(0, 100) + '...');
|
|
} else {
|
|
updateStatus('test-stream', false, 'Stream: ❌ ' + JSON.stringify(data));
|
|
log('❌ Stream failed: ' + JSON.stringify(data));
|
|
}
|
|
} catch (error) {
|
|
updateStatus('test-stream', false, 'Stream: Error - ' + error.message);
|
|
log('❌ Stream error: ' + error.message);
|
|
}
|
|
}
|
|
|
|
async function testAll() {
|
|
document.getElementById('output').textContent = '=== Tests en cours ===\n';
|
|
await testAPI();
|
|
await testLogin();
|
|
await testTrending();
|
|
await testStream();
|
|
log('\n=== Tests terminés ===');
|
|
}
|
|
|
|
// Auto-run on load
|
|
window.onload = function() {
|
|
log('Page chargée - Prêt à tester');
|
|
log('Date: ' + new Date().toISOString());
|
|
};
|
|
</script>
|
|
</body>
|
|
</html>
|