async function loadProductNames()

in custom/cve5/asfpreload.js [9:75]


async function loadProductNames() {
    var projects = []
    var pmcs = userPMCS.split(',');
    var res;
    const abortController = new AbortController()
    setTimeout(() => abortController.abort(), 5000)
    try {
	var response = await fetch('https://whimsy.apache.org/public/committee-info.json', {
	    method: 'GET',
	    credentials: 'omit',
	    headers: {
		'Accept': 'application/json, text/plain, */*'
	    },
	    redirect: 'error',
	    signal: abortController.signal
	});
	if (!response.ok) {
	    errMsg.textContent = "Failed Apache project list";
	    infoMsg.textContent = "";
	    throw Error(id + ' ' + response.statusText);
	} else {
	    res = await response.json();
	    if (res.committees) {
		for (var committee in res.committees)
		    if (pmcs.includes(committee) || pmcs.includes('security')) {
			res.committees[committee].display_name &&
			    projects.push('Apache ' + res.committees[committee].display_name);
		    }
	    }
	}
    } catch (error) {
	errMsg.textContent = error;
    }
    try {
	    const abortController = new AbortController()
	    setTimeout(() => abortController.abort(), 5000)
	var response = await fetch('https://whimsy.apache.org/public/public_podlings.json', {
	    method: 'GET',
	    credentials: 'omit',
	    headers: {
		'Accept': 'application/json, text/plain, */*'
	    },
	    redirect: 'error',
	    signal: abortController.signal
	});
	if (!response.ok) {
	    errMsg.textContent = "Failed Apache podling list";
	    infoMsg.textContent = "";
	    throw Error(id + ' ' + response.statusText);
	} else {
	    var resp = await response.json();
	    if (resp.podling) {
		for (var committee in resp.podling) {
		    if (pmcs.includes(committee) || pmcs.includes('security')) {
                        if (resp.podling[committee].status && resp.podling[committee].status == "current") {
			    if (resp.podling[committee].name && !res.committees[committee])
			        projects.push('Apache ' + resp.podling[committee].name + " (incubating)");
                        }
		    }
                }
	    }
	}
    } catch (error) {
	errMsg.textContent = error;
    }
    return (projects);
}