zenjoul80 commited on
Commit
d317f76
·
verified ·
1 Parent(s): b3ae416

Update templates/index.html

Browse files
Files changed (1) hide show
  1. 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://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.js"></script>
8
  <style>
9
  :root { --primary: #6366f1; --bg: #0b0f1a; --card: #161e2d; --input: #242f41; }
10
- body { background: var(--bg); color: #e2e8f0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; padding: 20px; display: flex; justify-content: center; }
11
- .container { width: 100%; max-width: 650px; background: var(--card); padding: 30px; border-radius: 16px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); border: 1px solid #2d3748; }
12
-
13
- h2 { margin-top: 0; color: white; display: flex; align-items: center; gap: 10px; }
14
- .status-dot { width: 10px; height: 10px; background: #ef4444; border-radius: 50%; display: inline-block; }
15
- .connected { background: #10b981; box-shadow: 0 0 8px #10b981; }
16
-
17
- label { display: block; margin: 15px 0 5px; font-size: 13px; font-weight: 600; color: #94a3b8; }
18
- input, select, textarea { width: 100%; padding: 12px; background: var(--input); border: 1px solid #334155; border-radius: 8px; color: white; box-sizing: border-box; outline: none; transition: 0.2s; }
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
- <h2><span id="dot" class="status-dot"></span> Suno Docker Studio</h2>
36
-
 
 
 
37
  <label>API Token</label>
38
- <div class="flex-row">
39
  <input type="password" id="tk" placeholder="sk-...">
40
- <button onclick="saveToken()">Connect</button>
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 link to audio file">
61
 
62
- <label>Music Style</label>
63
- <input type="text" id="style" placeholder="e.g. Lofi, Indian, female voice">
64
 
65
- <label>Lyrics / Prompt</label>
66
- <textarea id="lyr" rows="5" placeholder="[Chorus]..."></textarea>
67
 
68
- <label style="display: flex; align-items: center; gap: 10px; cursor: pointer; color: white; margin-top: 15px;">
69
- <input type="checkbox" id="instr" style="width: auto; margin: 0;"> Instrumental Only
70
- </label>
71
 
72
- <button class="btn-gen" onclick="generate()">Generate & Save to Docker</button>
73
 
74
- <div id="log">Logs: App ready. Please link your token.</div>
75
-
76
- <a id="dl" href="#" class="download-link">📥 Download From Docker Storage</a>
77
  </div>
78
 
79
  <script>
80
- // Initialize Socket.io with Docker-friendly settings
81
  const socket = io({
82
- transports: ['websocket', 'polling'],
83
- reconnection: true
 
84
  });
85
 
 
 
86
  socket.on('connect', () => {
87
- document.getElementById('dot').classList.add('connected');
88
- addLog("Connected to Docker Server.");
 
89
  });
90
 
91
  socket.on('disconnect', () => {
92
- document.getElementById('dot').classList.remove('connected');
93
- addLog("Disconnected from server.");
 
94
  });
95
 
96
- function saveToken() {
97
- const token = document.getElementById('tk').value;
98
- if(!token) return alert("Enter token");
99
- socket.emit('save_token', {token: token});
100
  }
101
 
102
- function generate() {
103
  const payload = {
104
  uploadUrl: document.getElementById('url').value,
105
  customMode: true,
106
- model: document.getElementById('mdl').value,
107
  prompt: document.getElementById('lyr').value,
108
  style: document.getElementById('style').value,
109
- title: document.getElementById('title').value || "Suno_Track",
110
- instrumental: document.getElementById('instr').checked ? true : false
111
  };
112
-
113
  socket.emit('start_gen', payload);
114
  document.getElementById('dl').style.display = 'none';
115
- addLog("🚀 Request sent. Do not refresh...");
116
  }
117
 
118
  function addLog(msg) {
@@ -121,16 +98,15 @@
121
  log.scrollTop = log.scrollHeight;
122
  }
123
 
124
- socket.on('status', (data) => {
125
- addLog(data.msg);
126
- if(data.done && data.file_name) {
127
- const dl = document.getElementById('dl');
128
- // Points to the server's local music folder
129
- dl.href = `./get_music/${data.file_name}`;
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>