diff --git "a/index.html" "b/index.html"
--- "a/index.html"
+++ "b/index.html"
@@ -1,71 +1,4374 @@
-
-
-
-
+ }
+}
+
+async function cveReject(elem, event) {
+ var id = elem.getAttribute('data');
+ if (window.confirm('Do you want to reject ' + id + '? It cannot be undone!')) {
+ try {
+ var ret = await csClient.updateCveId(id, 'REJECTED', csCache.org);
+ if (ret.updated && ret.updated.state == 'REJECTED') {
+ var m = document.getElementById("cveStatusMessage");
+ m.innerText = "Rejected " + id;
+ await cveGetList();
+ }
+ } catch (e) {
+ portalErrorHandler(e);
+ }
+ }
+}
+
+async function cvePost() {
+ if (docEditor.validation_results && docEditor.validation_results.length == 0) {
+ /*if (save != undefined) {
+ await save();
+ }*/
+ try {
+ //if (csCache.portalType === 'test') {
+ //console.log('uploading...');
+ var j = await mainTabGroup.getValue();
+ var j = textUtil.reduceJSON(j);
+ /*var pts = j.containers.cna.problemTypes;
+ if(pts && pts.length == 1 && pts[0].descriptions && pts[0].descriptions[0].description == undefined) {
+ delete j.containers.cna.problemTypes;
+ }
+ var ims = j.containers.cna.impacts;
+ if(ims && ims.length == 1 && ims[0].descriptions && ims[0].descriptions[0].value == undefined) {
+ delete j.containers.cna.impacts;
+ }*/
+ var ret = null;
+ try {
+ var latestId = await csClient.getCveId(j.cveMetadata.cveId);
+ if (latestId.state == 'RESERVED') {
+ //console.log('Creating');
+ if (j.cveMetadata.state == 'PUBLISHED') {
+ ret = await csClient.createCve(j.cveMetadata.cveId, { cnaContainer: j.containers.cna });
+ } else if (j.cveMetadata.state == 'REJECTED') {
+ ret = await csClient.createRejectedCve(j.cveMetadata.cveId, { cnaContainer: j.containers.cna });
+ }
+ } else {
+ //console.log('uploading');
+ if (j.cveMetadata.state == 'PUBLISHED') {
+ ret = await csClient.updateCve(j.cveMetadata.cveId, { cnaContainer: j.containers.cna });
+ } else if (j.cveMetadata.state == 'REJECTED') {
+ ret = await csClient.updateRejectedCve(j.cveMetadata.cveId, { cnaContainer: j.containers.cna });
+ }
+ }
+ } catch (e) {
+ //console.log('Got error');
+ //console.log(e);
+ if (e.error) {
+ infoMsg.innerText = "";
+ errMsg.innerText = "Error publishing CVE";
+ if (e.details && e.details.errors) {
+ showJSONerrors(e.details.errors.map(
+ a => {
+ return ({
+ path: a.instancePath,
+ message: a.message
+ });
+ }
+ ));
+ } else {
+ //console.log(e);
+ cveShowError(e);
+ }
+ //cveShowError(e);
+ } else {
+ showAlert('Error publishing! Got error ' + e)
+ }
+ }
+ //console.log(ret);
+ if (ret != null && ret.message) {
+ var a = document.createElement('a');
+ a.setAttribute('href', 'https://www.cve.org/cverecord?id='+j.cveMetadata.cveId);
+ a.setAttribute('target', '_blank');
+ a.innerText = ret.message;
+ infoMsg.innerText = '';
+ infoMsg.appendChild(a);
+ hideJSONerrors();
+ }
+ //} else {
+ // showAlert('CVE posting is not currently supported by production CVE services! Try Logging to Test Portal instance');
+ //}
+ } catch (e) {
+ portalErrorHandler(e);
+ }
+ } else {
+ showAlert('Please fix errors before posting');
+ }
+}
+
+async function cveReserveAndRender(yearOffset, number) {
+ try {
+ var r = await cveReserve(yearOffset, number);
+ var m = document.getElementById("cveStatusMessage");
+ if (m && r && r.length > 0) {
+ m.innerText = "Got " + r.map(x => x.cve_id).join(', ');
+ } else {
+ m.innerText = "Failed to get a CVE ID";
+ }
+ cvePortalFilter.reset();
+ await cveGetList();
+ return r;
+ } catch (e) {
+ portalErrorHandler(e);
+ }
+}