Spaces:
Sleeping
Sleeping
Nathan commited on
Commit ·
2cb7484
1
Parent(s): 3672121
UI: Added Recent Productions gallery with YouTube links
Browse filesFiles changed (3)
239 unmodified lines24024124224324424579 unmodified lines325326327328329330239 unmodified lines</div></div><div class="panel"><h3 class="panel-title"><i data-lucide="terminal"></i> Cloud Execution Logs</h3><div class="log-container" id="activity-log">79 unmodified linesfunction logout() { localStorage.removeItem('saas_token'); location.reload(); }async function checkAuth() {if (!authToken) return;try {239 unmodified lines24024124224324424524624724824925025125279 unmodified lines332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378239 unmodified lines</div></div><div class="panel"><h3 class="panel-title"><i data-lucide="video"></i> Recent Productions</h3><div id="video-gallery" style="display: grid; gap: 15px;"><div style="text-align: center; color: var(--text-dim); padding: 20px; font-size: 0.8rem;">No videos produced yet.</div></div></div><div class="panel"><h3 class="panel-title"><i data-lucide="terminal"></i> Cloud Execution Logs</h3><div class="log-container" id="activity-log">79 unmodified linesfunction logout() { localStorage.removeItem('saas_token'); location.reload(); }async function updateLogs() {try {const logRes = await fetch('/api/logs', { headers: { 'Authorization': `Bearer ${authToken}` } });const logs = await logRes.json();const logList = document.getElementById('activity-log');logList.innerHTML = '';const gallery = document.getElementById('video-gallery');const publishedVideos = logs.filter(l => l.type === 'VIDEO_PUBLISHED');if (publishedVideos.length > 0) {gallery.innerHTML = '';publishedVideos.forEach(v => {const item = document.createElement('div');item.style.cssText = "display: flex; align-items: center; gap: 12px; background: rgba(99, 102, 241, 0.05); padding: 12px; border-radius: 16px; border: 1px solid var(--glass-border);";item.innerHTML = `<div style="width: 40px; height: 40px; background: var(--accent); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: white;"><i data-lucide="play" style="width: 20px;"></i></div><div style="flex: 1;"><div style="font-size: 0.8rem; font-weight: 700; color: var(--text);">${v.msg}</div><a href="${v.metadata?.url}" target="_blank" style="font-size: 0.7rem; color: var(--accent-light); text-decoration: none; font-weight: 600;">View on YouTube ↗</a></div>`;gallery.appendChild(item);});lucide.createIcons();}logs.forEach(l => {const item = document.createElement('div');item.style.marginBottom = '10px';item.innerHTML = `<span style="color: var(--accent);">[${new Date(l.time).toLocaleTimeString()}]</span> ${l.msg}`;logList.appendChild(item);});} catch (e) {console.error("Log update failed", e);}}async function checkAuth() {if (!authToken) return;try {
643 unmodified lines644645646647648649650651643 unmodified lines});app.get('/api/logs', authenticateToken, async (req, res) => {const { data: logs } = await db.from('activity').select('*').eq('user_id', req.userId).order('created_at', { ascending: false }).limit(10);res.json((logs || []).map(l => ({ time: l.created_at, msg: l.message })));});app.listen(PORT, '0.0.0.0', () => {643 unmodified lines644645646647648649650651652653654655656657658659660661643 unmodified lines});app.get('/api/logs', authenticateToken, async (req, res) => {const { data: logs } = await db.from('activity').select('created_at, message, type, metadata').eq('user_id', req.userId).order('created_at', { ascending: false }).limit(20);res.json((logs || []).map(l => ({time: l.created_at,msg: l.message,type: l.type,metadata: l.metadata})));});app.listen(PORT, '0.0.0.0', () => {
104 unmodified lines105106107108109110111112113114115104 unmodified linesawait log(`✅ Success! Published to YouTube: ${uploadResult.id}`, currentUserId);// Record publication for the counterawait db.from('activity').insert([{user_id: currentUserId,type: 'VIDEO_PUBLISHED',message: `Video Published: ${result.title}`}]);// 4. Cleanup to save storage (ONLY IF UPLOAD WAS SUCCESSFUL)104 unmodified lines105106107108109110111112113114115116117118119120104 unmodified linesawait log(`✅ Success! Published to YouTube: ${uploadResult.id}`, currentUserId);// Record publication with metadata for the dashboardawait db.from('activity').insert([{user_id: currentUserId,type: 'VIDEO_PUBLISHED',message: result.title,metadata: {videoId: uploadResult.id,url: `https://youtube.com/shorts/${uploadResult.id}`,thumbnail: result.thumbnail || ''}}]);// 4. Cleanup to save storage (ONLY IF UPLOAD WAS SUCCESSFUL)
dashboard/index.html+48
server.js+12-2
utils/autonomous-agent.js+7-2