Clarify download states and make the empty page useful

This commit is contained in:
Jonathan Sykes
2026-10-03 16:05:42 +08:00
parent 0374e19396
commit cf9b6f4133
9 changed files with 458 additions and 92 deletions

View File

@@ -45,5 +45,11 @@
return () => { alive = false; clearInterval(timer); clearInterval(diskTimer); };
} });
}
const api = { configure, breakdown, bytes }; if (typeof module !== 'undefined') module.exports = api; else root.Downloads = api;
function getJobs() { return adapter && typeof adapter.jobs === 'function' ? adapter.jobs() : []; }
function action(id, act) { if (adapter && typeof adapter.action === 'function') return adapter.action(id, act); }
function getFiles() { return adapter && typeof adapter.files === 'function' ? adapter.files() : Promise.resolve([]); }
function getPlaylists() { return adapter && typeof adapter.playlists === 'function' ? adapter.playlists() : []; }
function getSlots() { return adapter && typeof adapter.slots === 'function' ? adapter.slots() : 4; }
function snapshot() { return { jobs: getJobs(), slots: getSlots(), playlists: getPlaylists() }; }
const api = { configure, breakdown, bytes, getJobs, action, getFiles, getPlaylists, getSlots, snapshot }; if (typeof module !== 'undefined') module.exports = api; else root.Downloads = api;
})(typeof window !== 'undefined' ? window : globalThis);