MySafeCode commited on
Commit
f5b96f5
·
verified ·
1 Parent(s): 897f827

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +53 -23
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>Suno Callbacks (<?php echo count($logData); ?>)</h1>
28
- <form method="POST"><button type="submit" name="clear">Clear Logs</button></form>
29
- <table>
30
- <tr><th>Time</th><th>Task ID</th><th>Status</th><th>Audio</th><th>Actions</th></tr>
31
- <?php foreach(array_reverse($logData) as $log): ?>
32
- <tr class="<?php echo ($log['callback_data']['code']??0)==200?'success':'error'; ?>">
33
- <td><?php echo $log['timestamp']; ?></td>
34
- <td><?php echo $log['callback_data']['data']['taskId']??'N/A'; ?></td>
35
- <td><?php echo ($log['callback_data']['code']??0)==200?'✅':'❌'; ?></td>
36
- <td>
37
- <?php if(isset($log['callback_data']['data']['response']['audioWavUrl'])): ?>
38
- <audio controls src="<?php echo htmlspecialchars($log['callback_data']['data']['response']['audioWavUrl']); ?>"></audio>
39
- <?php endif; ?>
40
- </td>
41
- <td>
42
- <?php if(isset($log['callback_data']['data']['response']['audioWavUrl'])): ?>
43
- <a href="<?php echo htmlspecialchars($log['callback_data']['data']['response']['audioWavUrl']); ?>" download>Download</a>
44
- <?php endif; ?>
45
- </td>
46
- </tr>
47
- <?php endforeach; ?>
48
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>