in static/plugins/downloads.js [4:20]
async function fetch_download_stats(prefs) {
let qs = new URLSearchParams(document.location.hash);
let project = qs.get("project");
const outer_chart_area = document.getElementById('chart_area');
if (!project || project.length < 2 || project.search(/[^-\/a-z0-9]+/) !== -1) {
outer_chart_area.innerText = "Please enter a valid project name (for instance, netbeans) in the field above to " +
"fetch download statistics. For podling projects, you may need to add the 'incubator/' prefix, e.g. " +
"'incubator/ponymail'. Due to caching, new data may take up to two hours to show in the charts."
return
}
let duration = "60d"; // TODO: Make configurable
outer_chart_area.innerText = "Fetching data, please wait...";
let download_stats = await (await fetch(`/api/downloads?project=${project}&duration=${duration}&meta=yes`)).json();
show_download_stats(project, download_stats, duration);
}