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>
100 lines
4.0 KiB
HTML
100 lines
4.0 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Test AudiOhm API</title>
|
|
<style>
|
|
body { font-family: Arial; padding: 20px; background: #1a1a1a; color: #fff; }
|
|
.test { margin: 20px 0; padding: 15px; background: #2a2a2a; border-radius: 8px; }
|
|
.pass { color: #4ade80; }
|
|
.fail { color: #f87171; }
|
|
pre { background: #1a1a1a; padding: 10px; overflow-x: auto; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>🧪 Test API AudiOhm</h1>
|
|
<div id="results"></div>
|
|
|
|
<script>
|
|
const results = document.getElementById('results');
|
|
|
|
async function testAPI() {
|
|
let token = localStorage.getItem('token');
|
|
|
|
if (!token) {
|
|
// Login first
|
|
addTest('POST /api/v1/auth/login', async () => {
|
|
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 (data.access_token) {
|
|
localStorage.setItem('token', data.access_token);
|
|
token = data.access_token;
|
|
return { status: '✅', token: token.substring(0, 20) + '...' };
|
|
}
|
|
throw new Error('No token');
|
|
});
|
|
}
|
|
|
|
// Test Playlists
|
|
await addTest('GET /api/v1/playlists', async () => {
|
|
const response = await fetch('/api/v1/playlists', {
|
|
headers: { 'Authorization': `Bearer ${token}` }
|
|
});
|
|
const data = await response.json();
|
|
return { status: response.ok ? '✅' : '❌', count: data.length, data: data };
|
|
});
|
|
|
|
// Test Trending
|
|
await addTest('GET /api/v1/music/trending', async () => {
|
|
const response = await fetch('/api/v1/music/trending', {
|
|
headers: { 'Authorization': `Bearer ${token}` }
|
|
});
|
|
const data = await response.json();
|
|
return { status: response.ok ? '✅' : '❌', count: data.length };
|
|
});
|
|
|
|
// Test Liked Tracks
|
|
await addTest('GET /api/v1/library/liked-tracks', async () => {
|
|
const response = await fetch('/api/v1/library/liked-tracks', {
|
|
headers: { 'Authorization': `Bearer ${token}` }
|
|
});
|
|
const data = await response.json();
|
|
if (data.detail) throw new Error(data.detail);
|
|
return { status: response.ok ? '✅' : '❌', count: data.length };
|
|
});
|
|
|
|
// Test History
|
|
await addTest('GET /api/v1/library/history', async () => {
|
|
const response = await fetch('/api/v1/library/history', {
|
|
headers: { 'Authorization': `Bearer ${token}` }
|
|
});
|
|
const data = await response.json();
|
|
if (data.detail) throw new Error(data.detail);
|
|
return { status: response.ok ? '✅' : '❌', count: data.length };
|
|
});
|
|
}
|
|
|
|
async function addTest(name, testFn) {
|
|
const div = document.createElement('div');
|
|
div.className = 'test';
|
|
results.appendChild(div);
|
|
|
|
try {
|
|
const result = await testFn();
|
|
div.innerHTML = `<span class="${result.status === '✅' ? 'pass' : 'fail'}">${result.status}</span> <strong>${name}</strong><br><pre>${JSON.stringify(result, null, 2)}</pre>`;
|
|
} catch (error) {
|
|
div.innerHTML = `<span class="fail">❌</span> <strong>${name}</strong><br><pre>${error.message}</pre>`;
|
|
}
|
|
}
|
|
|
|
testAPI();
|
|
</script>
|
|
</body>
|
|
</html>
|