bep40 commited on
Commit
dfb6d11
·
verified ·
1 Parent(s): 4806890

fix: update _wallPosts + refreshShortAISlider after uploadToWall + default channel vtv6

Browse files
Files changed (1) hide show
  1. static/yt_live.js +25 -1
static/yt_live.js CHANGED
@@ -14,7 +14,7 @@
14
  {id:'vtv9',name:'VTV9',badge:'Miền Bắc'},{id:'vtv10',name:'VTV10',badge:'Cần Thơ'},
15
  {id:'vtvprime',name:'VTVPrime',badge:'Prime'},
16
  ];
17
- const DEFAULT_CHANNEL = 'vtv3';
18
  const NEEDS_PROXY = /fptplay\.net/;
19
  const STREAMS = {};
20
  let _currentCh = null, _hls = null, _loading = false, _blockInserted = false;
@@ -197,6 +197,30 @@
197
  console.log('[VTV Upload] Parsed data:', data);
198
  if (data && data.ok === true) {
199
  recStatus('✅ Đã tạo Short AI! Xem trong mục Tường AI.', 'ok');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  return data;
201
  } else {
202
  throw new Error(data && data.error ? data.error : 'Upload thất bại (ok=false)');
 
14
  {id:'vtv9',name:'VTV9',badge:'Miền Bắc'},{id:'vtv10',name:'VTV10',badge:'Cần Thơ'},
15
  {id:'vtvprime',name:'VTVPrime',badge:'Prime'},
16
  ];
17
+ const DEFAULT_CHANNEL = 'vtv6';
18
  const NEEDS_PROXY = /fptplay\.net/;
19
  const STREAMS = {};
20
  let _currentCh = null, _hls = null, _loading = false, _blockInserted = false;
 
197
  console.log('[VTV Upload] Parsed data:', data);
198
  if (data && data.ok === true) {
199
  recStatus('✅ Đã tạo Short AI! Xem trong mục Tường AI.', 'ok');
200
+ // CRITICAL FIX: Update _wallPosts and refresh slider immediately
201
+ if (data.post) {
202
+ if (typeof _wallPosts !== 'undefined') {
203
+ _wallPosts.unshift(data.post);
204
+ console.log('[VTV Upload] Added post to _wallPosts, total:', _wallPosts.length);
205
+ }
206
+ // Refresh Short AI slider on home view
207
+ if (typeof refreshShortAISlider === 'function') {
208
+ setTimeout(() => {
209
+ refreshShortAISlider();
210
+ console.log('[VTV Upload] refreshShortAISlider called');
211
+ }, 300);
212
+ }
213
+ // Switch to home so user can see the new slide
214
+ if (typeof switchCat === 'function') {
215
+ setTimeout(() => {
216
+ switchCat('home');
217
+ setTimeout(() => {
218
+ const s = document.getElementById('short-ai-section');
219
+ if (s) s.scrollIntoView({behavior:'smooth', block:'start'});
220
+ }, 500);
221
+ }, 800);
222
+ }
223
+ }
224
  return data;
225
  } else {
226
  throw new Error(data && data.error ? data.error : 'Upload thất bại (ok=false)');