Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,36 +15,66 @@ if (isset($_POST['clear'])) {
|
|
| 15 |
<title>Suno Callbacks</title>
|
| 16 |
<style>
|
| 17 |
body { font-family: Arial; padding: 20px; }
|
| 18 |
-
table { width: 100%; border-collapse: collapse; }
|
| 19 |
th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
|
| 20 |
th { background-color: #667eea; color: white; }
|
| 21 |
.success { background: #d4edda; }
|
| 22 |
.error { background: #f8d7da; }
|
| 23 |
audio { width: 200px; }
|
|
|
|
|
|
|
|
|
|
| 24 |
</style>
|
| 25 |
</head>
|
| 26 |
<body>
|
| 27 |
-
<h1
|
| 28 |
-
|
| 29 |
-
<
|
| 30 |
-
<
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
</body>
|
| 50 |
</html>
|
|
|
|
| 15 |
<title>Suno Callbacks</title>
|
| 16 |
<style>
|
| 17 |
body { font-family: Arial; padding: 20px; }
|
| 18 |
+
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
|
| 19 |
th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
|
| 20 |
th { background-color: #667eea; color: white; }
|
| 21 |
.success { background: #d4edda; }
|
| 22 |
.error { background: #f8d7da; }
|
| 23 |
audio { width: 200px; }
|
| 24 |
+
.controls { margin-bottom: 20px; }
|
| 25 |
+
button { background: #667eea; color: white; border: none; padding: 10px 20px; cursor: pointer; }
|
| 26 |
+
button:hover { background: #5a6fde; }
|
| 27 |
</style>
|
| 28 |
</head>
|
| 29 |
<body>
|
| 30 |
+
<h1>🎵 Suno Callbacks (<?php echo count($logData); ?>)</h1>
|
| 31 |
+
|
| 32 |
+
<div class="controls">
|
| 33 |
+
<form method="POST">
|
| 34 |
+
<button type="submit" name="clear">🗑️ Clear All Logs</button>
|
| 35 |
+
</form>
|
| 36 |
+
</div>
|
| 37 |
+
|
| 38 |
+
<?php if (empty($logData)): ?>
|
| 39 |
+
<p>No callbacks received yet. Callbacks will appear here when Suno API sends them.</p>
|
| 40 |
+
<p>Callback URL: <code>https://1hit.no/wav/cb.php</code></p>
|
| 41 |
+
<?php else: ?>
|
| 42 |
+
<table>
|
| 43 |
+
<tr>
|
| 44 |
+
<th>Time</th>
|
| 45 |
+
<th>Task ID</th>
|
| 46 |
+
<th>Status</th>
|
| 47 |
+
<th>Audio</th>
|
| 48 |
+
<th>Actions</th>
|
| 49 |
+
</tr>
|
| 50 |
+
<?php foreach(array_reverse($logData) as $log): ?>
|
| 51 |
+
<tr class="<?php echo (isset($log['callback_data']['code']) && $log['callback_data']['code'] == 200) ? 'success' : 'error'; ?>">
|
| 52 |
+
<td><?php echo htmlspecialchars($log['timestamp']); ?></td>
|
| 53 |
+
<td><?php echo htmlspecialchars($log['callback_data']['data']['taskId'] ?? 'N/A'); ?></td>
|
| 54 |
+
<td>
|
| 55 |
+
<?php
|
| 56 |
+
if (isset($log['callback_data']['code']) && $log['callback_data']['code'] == 200) {
|
| 57 |
+
echo '✅ Success';
|
| 58 |
+
} else {
|
| 59 |
+
echo '❌ Error';
|
| 60 |
+
}
|
| 61 |
+
?>
|
| 62 |
+
</td>
|
| 63 |
+
<td>
|
| 64 |
+
<?php if(isset($log['callback_data']['data']['response']['audioWavUrl'])): ?>
|
| 65 |
+
<audio controls src="<?php echo htmlspecialchars($log['callback_data']['data']['response']['audioWavUrl']); ?>"></audio>
|
| 66 |
+
<?php else: ?>
|
| 67 |
+
No audio
|
| 68 |
+
<?php endif; ?>
|
| 69 |
+
</td>
|
| 70 |
+
<td>
|
| 71 |
+
<?php if(isset($log['callback_data']['data']['response']['audioWavUrl'])): ?>
|
| 72 |
+
<a href="<?php echo htmlspecialchars($log['callback_data']['data']['response']['audioWavUrl']); ?>" download>⬇ Download</a>
|
| 73 |
+
<?php endif; ?>
|
| 74 |
+
</td>
|
| 75 |
+
</tr>
|
| 76 |
+
<?php endforeach; ?>
|
| 77 |
+
</table>
|
| 78 |
+
<?php endif; ?>
|
| 79 |
</body>
|
| 80 |
</html>
|