jaynesmax commited on
Commit
bd9925d
Β·
verified Β·
1 Parent(s): 5bce5df

Upload index.html

Browse files
Files changed (1) hide show
  1. index.html +27 -18
index.html CHANGED
@@ -1499,7 +1499,7 @@ const TRANSLATED_KEY = JM_CONFIG.TRANSLATED_KEY;
1499
  const TRANSLATED2_BASE = JM_CONFIG.CONTENT_URL + '/functions/v1/movie-zilizotafsriwa2';
1500
  const TR2_PREFIX = 'n2-';
1501
  // movie-public2 β€” Absalom Family (Season Zilizotafsiriwa). Project ile ile ya CONTENT_URL. Id zake zinaanza na 'ab-'.
1502
- const ABSALOM_BASE = JM_CONFIG.CONTENT_URL + '/functions/v1/movie-public2';
1503
  const AB_PREFIX = 'ab-';
1504
  const AB_MAX_POSTS = 1000; // posts zisizozidi 1000 kwenye orodha
1505
  // Jina la kipindi: "EP1" / "Episode 1" / "1" -> "1" (ili ionekane kama Episode 1 na download iwe na namba); vinginevyo jina kamili
@@ -3798,6 +3798,29 @@ async function loadLive() {
3798
  }
3799
 
3800
  // ── ZILIZOTAFSIRIWA (movies/series za DJ β€” mradi tofauti) ──
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3801
  async function fetchTranslatedList() {
3802
  const card = (m, idPrefix) => ({
3803
  id: idPrefix + m.id, kind: 'translated', title: m.title,
@@ -3817,25 +3840,11 @@ async function fetchTranslatedList() {
3817
  const d = await r.json();
3818
  return (Array.isArray(d) ? d : []).map(m => card(m, TR2_PREFIX));
3819
  })();
3820
- const absP = (async () => { // movie-public2 (Absalom): posts zenye angalau MP4 moja, kwa kurasa 50
3821
- const out = [];
3822
- for (let off = 0; off < AB_MAX_POSTS; off += 50) {
3823
- const r = await fetch(ABSALOM_BASE + '?limit=50&offset=' + off, { headers: { apikey: SUPABASE_ANON_KEY } });
3824
- if (!r.ok) throw new Error(T('err_generic') + ' ' + r.status);
3825
- const d = await r.json();
3826
- if (!d.ok) throw new Error(d.error || 'Absalom imekataa ombi.');
3827
- (d.posts || []).forEach(p => {
3828
- if (!(p.episodes || []).some(e => e && e.mp4_url)) return;
3829
- out.push(card({ id: String(p.slug || '').replace(/^absalom-/, ''), title: p.title, dj: p.dj,
3830
- poster_url: p.poster, category: p.kind === 'series' ? 'series' : 'movie' }, AB_PREFIX));
3831
- });
3832
- if (d.done || !d.count) break;
3833
- }
3834
- return out;
3835
- })();
3836
  const [a, b, c] = await Promise.allSettled([oldP, newP, absP]);
3837
  if (a.status === 'rejected' && b.status === 'rejected' && c.status === 'rejected') throw a.reason;
3838
- const fresh = (b.status === 'fulfilled' ? b.value : []).concat(c.status === 'fulfilled' ? c.value : []),
 
3839
  older = a.status === 'fulfilled' ? a.value : [];
3840
  const seen = new Set(fresh.map(x => String(x.title || '').trim().toLowerCase()));
3841
  return fresh.concat(older.filter(x => !seen.has(String(x.title || '').trim().toLowerCase())));
 
1499
  const TRANSLATED2_BASE = JM_CONFIG.CONTENT_URL + '/functions/v1/movie-zilizotafsriwa2';
1500
  const TR2_PREFIX = 'n2-';
1501
  // movie-public2 β€” Absalom Family (Season Zilizotafsiriwa). Project ile ile ya CONTENT_URL. Id zake zinaanza na 'ab-'.
1502
+ const ABSALOM_BASE = JM_CONFIG.CONTENT_URL + '/functions/v1/movie-zilizotafsriwa3';
1503
  const AB_PREFIX = 'ab-';
1504
  const AB_MAX_POSTS = 1000; // posts zisizozidi 1000 kwenye orodha
1505
  // Jina la kipindi: "EP1" / "Episode 1" / "1" -> "1" (ili ionekane kama Episode 1 na download iwe na namba); vinginevyo jina kamili
 
3798
  }
3799
 
3800
  // ── ZILIZOTAFSIRIWA (movies/series za DJ β€” mradi tofauti) ──
3801
+ // Orodha ya Absalom: cards=1 (bila vipindi) + has_mp4=1; inahifadhiwa kwenye kumbukumbu dakika 10 ili tab/home zisipakie tena
3802
+ let absCardsCache = null, absCardsAt = 0, absCardsP = null;
3803
+ function absalomCardsCached() {
3804
+ if (absCardsCache && Date.now() - absCardsAt < 10 * 60 * 1000) return Promise.resolve(absCardsCache);
3805
+ if (!absCardsP) {
3806
+ absCardsP = (async () => {
3807
+ const out = [];
3808
+ for (let off = 0; off < AB_MAX_POSTS; off += 100) {
3809
+ const r = await fetch(ABSALOM_BASE + '?cards=1&has_mp4=1&limit=100&offset=' + off, { headers: { apikey: SUPABASE_ANON_KEY } });
3810
+ if (!r.ok) throw new Error(T('err_generic') + ' ' + r.status);
3811
+ const d = await r.json();
3812
+ if (!d.ok) throw new Error(d.error || 'Absalom imekataa ombi.');
3813
+ (d.posts || []).forEach(p => out.push({ id: String(p.slug || '').replace(/^absalom-/, ''), title: p.title, dj: p.dj,
3814
+ poster_url: p.poster, category: p.kind === 'series' ? 'series' : 'movie' }));
3815
+ if (d.done || !d.count) break;
3816
+ }
3817
+ absCardsCache = out; absCardsAt = Date.now();
3818
+ return out;
3819
+ })().finally(() => { absCardsP = null; });
3820
+ }
3821
+ return absCardsP;
3822
+ }
3823
+
3824
  async function fetchTranslatedList() {
3825
  const card = (m, idPrefix) => ({
3826
  id: idPrefix + m.id, kind: 'translated', title: m.title,
 
3840
  const d = await r.json();
3841
  return (Array.isArray(d) ? d : []).map(m => card(m, TR2_PREFIX));
3842
  })();
3843
+ const absP = absalomCardsCached(); // movie-public2: posts zenye MP4 (jibu jepesi, cache ya dakika 10)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3844
  const [a, b, c] = await Promise.allSettled([oldP, newP, absP]);
3845
  if (a.status === 'rejected' && b.status === 'rejected' && c.status === 'rejected') throw a.reason;
3846
+ const absItems = c.status === 'fulfilled' ? c.value.map(m => card(m, AB_PREFIX)) : [];
3847
+ const fresh = (b.status === 'fulfilled' ? b.value : []).concat(absItems),
3848
  older = a.status === 'fulfilled' ? a.value : [];
3849
  const seen = new Set(fresh.map(x => String(x.title || '').trim().toLowerCase()));
3850
  return fresh.concat(older.filter(x => !seen.has(String(x.title || '').trim().toLowerCase())));