ported sdk and this works

This commit is contained in:
2026-10-04 21:44:03 -07:00
parent 3ee95c1bf5
commit 63b1a494cb
67 changed files with 6177 additions and 53 deletions

View File

@@ -129,13 +129,7 @@ function buildProxyUrl(rawUrl, headersObj = {}) {
}
async function fetchSources() {
try {
const res = await fetch(`${API_BASE}/api/sources`);
const data = await res.json();
currentSources = data.sources || [];
} catch (_) {
currentSources = [];
}
currentSources = Vyla.sources();
}
async function startConcurrentDiscovery(it, s = null, e = null) {
@@ -153,10 +147,8 @@ async function startConcurrentDiscovery(it, s = null, e = null) {
if (session !== discoverySession) return;
const sourcePromises = currentSources.map(async (src) => {
let epQuery = s && e ? `&season=${s}&episode=${e}` : '';
try {
const res = await fetch(`${API_BASE}/api/stream?provider=${src.key}&tmdbId=${it.id}${epQuery}`);
const data = await res.json();
const data = await Vyla.stream(src.key, it.id, s, e);
if (session !== discoverySession) return;
if (data.success && data.stream) {
@@ -287,10 +279,7 @@ async function loadSubtitles(id, s, e) {
activeSubtitles = [];
try {
let epQuery = s && e ? `&season=${s}&episode=${e}` : '';
const res = await fetch(`${API_BASE}/api/subtitles?tmdbId=${id}${epQuery}`);
const data = await res.json();
activeSubtitles = data.subtitles || [];
activeSubtitles = await Vyla.subtitles(id, s, e);
activeSubtitles.forEach((sub, idx) => {
const track = document.createElement('track');