${primary} + ${currentTab === 'RIVAL' ? '' : ` + + + `} @@ -593,6 +606,38 @@ if(window.lucide) lucide.createIcons(); } + // ---------- 숏폼 큐 ---------- + /** 큐에 이미 담긴 videoId 를 받아둔다. 실패해도 피드 자체는 보여야 하므로 조용히 넘긴다. */ + async function loadQueued(){ + try { + const jobs = await api(SF_API + '/jobs') || []; + queued = new Set(jobs.map(j => j.videoId).filter(Boolean)); + } catch(e){ /* 큐를 못 읽어도 피드는 정상 동작 */ } + } + + async function sendToQueue(id){ + const it = items.find(v => v.id === id); + if(!it) return; + const btn = document.getElementById('sfBtn-' + id); + if(btn){ + btn.disabled = true; + btn.innerHTML = ' 보내는 중...'; + if(window.lucide) lucide.createIcons(); + } + try { + await api(SF_API + '/jobs', { + method:'POST', headers:{'Content-Type':'application/json'}, + body: JSON.stringify({ youtubeUrl: 'https://www.youtube.com/watch?v=' + it.videoId }) + }); + queued.add(it.videoId); + render(); + toast('숏폼 큐에 담았습니다 — 숏폼 큐에서 Opal 실행하세요'); + } catch(e){ + toast('숏폼 큐 등록 실패: ' + e.message, true); + render(); + } + } + // ---------- 카드 액션 ---------- async function toggleBookmark(id, current){ try { @@ -868,7 +913,7 @@ // ---------- init ---------- (async () => { const preselect = restoreFilters(); - await loadFilterOptions(preselect); + await Promise.all([loadFilterOptions(preselect), loadQueued()]); await loadFeed(); })(); /*]]>*/