Update templates/index.html
Browse files- templates/index.html +55 -79
templates/index.html
CHANGED
|
@@ -3,116 +3,93 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>Suno Docker Studio</title>
|
| 7 |
-
<script src="https://
|
| 8 |
<style>
|
| 9 |
:root { --primary: #6366f1; --bg: #0b0f1a; --card: #161e2d; --input: #242f41; }
|
| 10 |
-
body { background: var(--bg); color: #e2e8f0; font-family:
|
| 11 |
-
.container { width: 100%; max-width:
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
input:focus { border-color: var(--primary); }
|
| 20 |
-
|
| 21 |
-
.flex-row { display: flex; gap: 10px; align-items: flex-end; }
|
| 22 |
-
button { padding: 12px 20px; background: var(--primary); border: none; color: white; font-weight: bold; border-radius: 8px; cursor: pointer; transition: 0.2s; }
|
| 23 |
-
button:hover { filter: brightness(1.2); transform: translateY(-1px); }
|
| 24 |
-
.btn-gen { width: 100%; margin-top: 25px; padding: 16px; font-size: 16px; background: #4f46e5; }
|
| 25 |
-
|
| 26 |
-
#log { margin-top: 20px; background: #000; padding: 15px; height: 130px; overflow-y: auto; font-family: 'Consolas', monospace; font-size: 12px; border-radius: 8px; color: #34d399; border: 1px solid #1e293b; }
|
| 27 |
-
.download-link { display: none; background: #059669; text-decoration: none; padding: 16px; text-align: center; border-radius: 8px; font-weight: bold; color: white; margin-top: 20px; animation: slideUp 0.3s ease-out; }
|
| 28 |
-
|
| 29 |
-
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
|
| 30 |
</style>
|
| 31 |
</head>
|
| 32 |
<body>
|
| 33 |
|
| 34 |
<div class="container">
|
| 35 |
-
<
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
| 37 |
<label>API Token</label>
|
| 38 |
-
<div
|
| 39 |
<input type="password" id="tk" placeholder="sk-...">
|
| 40 |
-
<button onclick="
|
| 41 |
-
</div>
|
| 42 |
-
|
| 43 |
-
<hr style="border: 0; border-top: 1px solid #2d3748; margin: 25px 0;">
|
| 44 |
-
|
| 45 |
-
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px;">
|
| 46 |
-
<div>
|
| 47 |
-
<label>Model</label>
|
| 48 |
-
<select id="mdl">
|
| 49 |
-
<option value="V5">V5 (Standard)</option>
|
| 50 |
-
<option value="V4_5ALL">V4.5 (Experimental)</option>
|
| 51 |
-
</select>
|
| 52 |
-
</div>
|
| 53 |
-
<div>
|
| 54 |
-
<label>Title</label>
|
| 55 |
-
<input type="text" id="title" placeholder="Song Name">
|
| 56 |
-
</div>
|
| 57 |
</div>
|
| 58 |
|
| 59 |
<label>Source MP3 URL</label>
|
| 60 |
-
<input type="text" id="url" placeholder="Direct
|
| 61 |
|
| 62 |
-
<label>
|
| 63 |
-
<input type="text" id="style" placeholder="e.g.
|
| 64 |
|
| 65 |
-
<label>Lyrics
|
| 66 |
-
<textarea id="lyr" rows="
|
| 67 |
|
| 68 |
-
<
|
| 69 |
-
<input type="checkbox" id="instr" style="width:
|
| 70 |
-
</
|
| 71 |
|
| 72 |
-
<button
|
| 73 |
|
| 74 |
-
<div id="log">Logs:
|
| 75 |
-
|
| 76 |
-
<a id="dl" href="#" class="download-link">📥 Download From Docker Storage</a>
|
| 77 |
</div>
|
| 78 |
|
| 79 |
<script>
|
| 80 |
-
//
|
| 81 |
const socket = io({
|
| 82 |
-
transports: ['websocket', 'polling'],
|
| 83 |
-
|
|
|
|
| 84 |
});
|
| 85 |
|
|
|
|
|
|
|
| 86 |
socket.on('connect', () => {
|
| 87 |
-
|
| 88 |
-
|
|
|
|
| 89 |
});
|
| 90 |
|
| 91 |
socket.on('disconnect', () => {
|
| 92 |
-
|
| 93 |
-
|
|
|
|
| 94 |
});
|
| 95 |
|
| 96 |
-
function
|
| 97 |
-
|
| 98 |
-
if(!token) return alert("Enter token");
|
| 99 |
-
socket.emit('save_token', {token: token});
|
| 100 |
}
|
| 101 |
|
| 102 |
-
function
|
| 103 |
const payload = {
|
| 104 |
uploadUrl: document.getElementById('url').value,
|
| 105 |
customMode: true,
|
| 106 |
-
model:
|
| 107 |
prompt: document.getElementById('lyr').value,
|
| 108 |
style: document.getElementById('style').value,
|
| 109 |
-
title:
|
| 110 |
-
instrumental: document.getElementById('instr').checked
|
| 111 |
};
|
| 112 |
-
|
| 113 |
socket.emit('start_gen', payload);
|
| 114 |
document.getElementById('dl').style.display = 'none';
|
| 115 |
-
addLog("🚀
|
| 116 |
}
|
| 117 |
|
| 118 |
function addLog(msg) {
|
|
@@ -121,16 +98,15 @@
|
|
| 121 |
log.scrollTop = log.scrollHeight;
|
| 122 |
}
|
| 123 |
|
| 124 |
-
socket.on('status', (
|
| 125 |
-
addLog(
|
| 126 |
-
if(
|
| 127 |
-
const
|
| 128 |
-
//
|
| 129 |
-
|
| 130 |
-
dl.style.display = 'block';
|
| 131 |
}
|
| 132 |
});
|
| 133 |
</script>
|
| 134 |
|
| 135 |
</body>
|
| 136 |
-
</html>
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Suno AI Docker Studio</title>
|
| 7 |
+
<script src="https://cdn.socket.io/4.7.5/socket.io.min.js"></script>
|
| 8 |
<style>
|
| 9 |
:root { --primary: #6366f1; --bg: #0b0f1a; --card: #161e2d; --input: #242f41; }
|
| 10 |
+
body { background: var(--bg); color: #e2e8f0; font-family: sans-serif; padding: 20px; display: flex; justify-content: center; }
|
| 11 |
+
.container { width: 100%; max-width: 600px; background: var(--card); padding: 30px; border-radius: 12px; border: 1px solid #2d3748; }
|
| 12 |
+
label { display: block; margin: 15px 0 5px; font-size: 13px; color: #94a3b8; }
|
| 13 |
+
input, textarea, select { width: 100%; padding: 12px; background: var(--input); border: 1px solid #334155; border-radius: 8px; color: white; box-sizing: border-box; margin-bottom: 10px; }
|
| 14 |
+
button { width: 100%; padding: 15px; background: var(--primary); border: none; color: white; font-weight: bold; border-radius: 8px; cursor: pointer; }
|
| 15 |
+
#log { margin-top: 20px; background: #000; padding: 15px; height: 150px; overflow-y: auto; font-family: monospace; font-size: 12px; border-radius: 8px; color: #10b981; }
|
| 16 |
+
.dl-link { display: none; background: #059669; text-decoration: none; padding: 15px; text-align: center; border-radius: 8px; font-weight: bold; color: white; margin-top: 15px; }
|
| 17 |
+
.status-header { display: flex; justify-content: space-between; align-items: center; }
|
| 18 |
+
#status-indicator { font-size: 12px; padding: 4px 8px; border-radius: 4px; background: #ef4444; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</style>
|
| 20 |
</head>
|
| 21 |
<body>
|
| 22 |
|
| 23 |
<div class="container">
|
| 24 |
+
<div class="status-header">
|
| 25 |
+
<h3>Suno Studio</h3>
|
| 26 |
+
<span id="status-indicator">OFFLINE</span>
|
| 27 |
+
</div>
|
| 28 |
+
|
| 29 |
<label>API Token</label>
|
| 30 |
+
<div style="display:flex; gap:10px;">
|
| 31 |
<input type="password" id="tk" placeholder="sk-...">
|
| 32 |
+
<button onclick="saveTk()" style="width:auto;">Link</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
</div>
|
| 34 |
|
| 35 |
<label>Source MP3 URL</label>
|
| 36 |
+
<input type="text" id="url" placeholder="Direct audio link">
|
| 37 |
|
| 38 |
+
<label>Style & Genre</label>
|
| 39 |
+
<input type="text" id="style" placeholder="e.g. Hindi, slow">
|
| 40 |
|
| 41 |
+
<label>Lyrics</label>
|
| 42 |
+
<textarea id="lyr" rows="4"></textarea>
|
| 43 |
|
| 44 |
+
<div style="margin-bottom:20px;">
|
| 45 |
+
<input type="checkbox" id="instr" style="width:auto;"> <span>Instrumental Mode</span>
|
| 46 |
+
</div>
|
| 47 |
|
| 48 |
+
<button onclick="start()">Generate & Auto-Save</button>
|
| 49 |
|
| 50 |
+
<div id="log">Logs: Initialization...</div>
|
| 51 |
+
<a id="dl" href="#" class="dl-link">📥 Download From Docker</a>
|
|
|
|
| 52 |
</div>
|
| 53 |
|
| 54 |
<script>
|
| 55 |
+
// Docker-optimized Socket.IO configuration
|
| 56 |
const socket = io({
|
| 57 |
+
transports: ['websocket', 'polling'], // Critical for Docker ingress
|
| 58 |
+
upgrade: true,
|
| 59 |
+
rememberUpgrade: true
|
| 60 |
});
|
| 61 |
|
| 62 |
+
const statusInd = document.getElementById('status-indicator');
|
| 63 |
+
|
| 64 |
socket.on('connect', () => {
|
| 65 |
+
statusInd.innerText = "ONLINE";
|
| 66 |
+
statusInd.style.background = "#10b981";
|
| 67 |
+
addLog("Connected to Docker container.");
|
| 68 |
});
|
| 69 |
|
| 70 |
socket.on('disconnect', () => {
|
| 71 |
+
statusInd.innerText = "OFFLINE";
|
| 72 |
+
statusInd.style.background = "#ef4444";
|
| 73 |
+
addLog("Connection lost.");
|
| 74 |
});
|
| 75 |
|
| 76 |
+
function saveTk() {
|
| 77 |
+
socket.emit('save_token', {token: document.getElementById('tk').value});
|
|
|
|
|
|
|
| 78 |
}
|
| 79 |
|
| 80 |
+
function start() {
|
| 81 |
const payload = {
|
| 82 |
uploadUrl: document.getElementById('url').value,
|
| 83 |
customMode: true,
|
| 84 |
+
model: "V5",
|
| 85 |
prompt: document.getElementById('lyr').value,
|
| 86 |
style: document.getElementById('style').value,
|
| 87 |
+
title: "Suno_Track",
|
| 88 |
+
instrumental: document.getElementById('instr').checked
|
| 89 |
};
|
|
|
|
| 90 |
socket.emit('start_gen', payload);
|
| 91 |
document.getElementById('dl').style.display = 'none';
|
| 92 |
+
addLog("🚀 Task submitted...");
|
| 93 |
}
|
| 94 |
|
| 95 |
function addLog(msg) {
|
|
|
|
| 98 |
log.scrollTop = log.scrollHeight;
|
| 99 |
}
|
| 100 |
|
| 101 |
+
socket.on('status', (d) => {
|
| 102 |
+
addLog(d.msg);
|
| 103 |
+
if(d.done) {
|
| 104 |
+
const btn = document.getElementById('dl');
|
| 105 |
+
btn.href = `./get_music/${d.file_name}`; // Relative path for Docker
|
| 106 |
+
btn.style.display = 'block';
|
|
|
|
| 107 |
}
|
| 108 |
});
|
| 109 |
</script>
|
| 110 |
|
| 111 |
</body>
|
| 112 |
+
</html>
|