")
461 | .text(dp).html()))
462 | .append($("
").html($("")
463 | .text(r[d]).html()))).html();
464 | }
465 | }
466 | function deepdive(_, _, row, el) {
467 | try {
468 | var tinfo = el.closest('tr').data('uniqueid');
469 | if(tinfo)
470 | $('#detailtag').html("("+tinfo+")");
471 | else
472 | $('#detailtag').html('');
473 | } catch(err) {
474 | console.log("Ignore this error");
475 | $('#detailtag').html('');
476 | }
477 | /* Show the updaterecord button by default and hide it later
478 | if user is not admin and not self */
479 | $('#updaterecord').show();
480 | $('#cvereject').addClass("d-none");
481 | $('#cvedetails').addClass('d-none');
482 | if("username" in row) {
483 | if(check_admin() || (row.username == client.user)) {
484 | $('#updaterecord').show();
485 | $('.selfadmin').show();
486 | } else {
487 | $('#updaterecord').hide();
488 | $('.selfadmin').hide();
489 | }
490 | $('#updaterecord').html("Update User");
491 | } else if(("cve_id" in row) && ("state" in row)) {
492 | $('#cveUpdateModal .mtitle').html("("+row.cve_id+")");
493 | if (row.state == "RESERVED") {
494 | $('#updaterecord').html("Edit & Publish CVE").show();
495 | $('#cveUpdateModal .cveupdate').html("Publish CVE");
496 | $('#cvedetails').addClass('d-none');
497 | $('#cvereject').removeClass('d-none');
498 | } else if (row.state == "PUBLISHED") {
499 | $('#updaterecord').html("Update CVE").show();
500 | $('#cvedetails').removeClass('d-none');
501 | $('#cveUpdateModal .cveupdate').html("Update CVE");
502 | $('#cvereject').removeClass("d-none");
503 | } else {
504 | if(row.state == "REJECTED") {
505 | $('#cvereject').addClass('d-none');
506 | $('#cvedetails').removeClass('d-none');
507 | }
508 | $('#updaterecord').hide();
509 | }
510 | } else
511 | $('#updaterecord').hide();
512 | display_object(row);
513 | $('#deepDive').data('crecord',row).modal();
514 | }
515 | async function display_cvedetails(cve) {
516 | if(!cve)
517 | cve = $('#deepDive').data('crecord').cve_id;
518 | let f = await client.getcvedetail(cve);
519 | if("error" in f) {
520 | swal_error("Unable to view CVE due to error: " + f.error +
521 | ": " + f.message);
522 | return;
523 | }
524 | if(("containers" in f) && ("cna" in f.containers))
525 | display_object(f.containers.cna);
526 | else
527 | swal_error("Required information in cna.container is not " +
528 | "available or missing ");
529 | }
530 | function swapout(w) {
531 | $(w).parent().find('table tbody tr').toggleClass('d-none');
532 | if($(w).html().indexOf('View') > -1)
533 | $(w).html('Hide JSON');
534 | else
535 | $(w).html('View JSON');
536 | }
537 | function display_object(obj) {
538 | let tjson = ' | '+
539 | ' ' +
540 | JSON.stringify(obj,null,3) + ' | ';
541 | let alink = ' View JSON';
543 | let ttable = ' ';
544 | var html = Object.keys(obj).reduce(function(h,d) {
545 | return objwalk(h,d,obj);
546 | },alink+ttable+""+tjson);
547 | $('#deepDive .modal-body').html(html+' ');
548 | }
549 | function add_user_modal() {
550 | $('#addUserModal').modal();
551 | $('#addUserModal form').trigger('reset');
552 | $('.addUserModal .form-control').removeClass('is-valid is-invalid');
553 | $('#addUserModal .mtitle').html("Add User");
554 | $('#addUserModal').removeClass("updateUser").addClass("addUser");
555 | $('#addUserModal .updateuser').hide();
556 | $('#addUserModal .adduser').show();
557 | if(!('usertable' in client)) {
558 | console.log("Creating users table in the background");
559 | show_users_table();
560 | $('#users-tab').tab('show');
561 | }
562 | }
563 | function user_active_view(active) {
564 | if(active) {
565 | $('#addUserModal .active').prop({checked:true}).addClass('enabled');
566 | $('#addUserModal span.round').prop({title:'Active'});
567 | $('#addUserModal span.uspan').removeClass('text-danger')
568 | .addClass('text-primary').html(' [Active] ');
569 | } else {
570 | $('#addUserModal .active').prop({checked:false})
571 | .removeClass('enabled');
572 | $('#addUserModal span.round').prop({title:'Inactive'});
573 | $('#addUserModal span.uspan').removeClass('text-primary')
574 | .addClass('text-danger').html(' [Inactive] ');
575 | }
576 | }
577 | function user_update_modal(mr) {
578 | $('#addUserModal').modal();
579 | $('#addUserModal').removeClass("addUser").addClass("updateUser");
580 | /* update button remains hidden until some values change in the form*/
581 | $('#updateButton').hide();
582 | $('#addUserModal .adduser').hide();
583 | $('#addUserModal .mtitle').html("Update User ("+mr.username+")");
584 | $('#addUserModal .username').val(mr.username).data('oldvalue',mr.username);
585 | $('#addUserModal .form-control').removeClass('is-valid is-invalid');
586 | if('name' in mr) {
587 | if('first' in mr.name)
588 | $('#addUserModal .name_first').val(mr.name.first)
589 | .data('oldvalue',mr.name.first);
590 | if('last' in mr.name)
591 | $('#addUserModal .name_last').val(mr.name.last)
592 | .data('oldvalue',mr.name.last);
593 | }
594 | if('active' in mr)
595 | user_active_view(mr.active);
596 | if(mr.authority.active_roles.length) {
597 | /* Handle user roles currently only ADMIN or Nothing*/
598 | let vroles = mr.authority.active_roles.join(",")
599 | $('#addUserModal .active_roles').val(vroles).data('oldvalue',vroles);
600 | } else {
601 | $('#addUserModal .active_roles').val('');
602 | }
603 | }
604 | function checkchange(w) {
605 | if(get_deep(w,'validity.valid') != undefined) {
606 | if(w.validity.valid == false)
607 | $(w).removeClass('is-valid').addClass('is-invalid');
608 | if (w.validity.valid == true)
609 | $(w).removeClass('invalid').addClass('is-valid');
610 | }
611 | if($('#addUserModal').hasClass("updateUser")) {
612 | if(($(w).data('oldvalue') != $(w).val()) && $(w).hasClass('is-valid'))
613 | $('#updateButton').show();
614 | }
615 | }
616 | function vreplace(s,v) {
617 | var vr = v.split("|");
618 | for(var i=0; i li.erow:nth-of-type(n+2)').remove();
629 | $('#cveform').trigger('reset');
630 | $('#cveUpdateModal').modal();
631 | var mr = $('#deepDive').data('crecord');
632 | if(('state' in mr) && (mr.state == 'PUBLISHED')) {
633 | let c = await client.getcvedetail(mr.cve_id);
634 | console.log(c);
635 | if(('containers' in c) && (c.containers.cna))
636 | json_edit(JSON.stringify(c.containers.cna,null,3));
637 | else if('error' in c)
638 | swal_error("Error in fetching details of CVE "+c.error+" : "+
639 | c.message);
640 | else
641 | swal_error("Unknown error when fetching details of CVE. "+
642 | "See console log for details");
643 | } else {
644 | let mjson = JSON.stringify(_cna_template,null,2)
645 | .replace(/\$\{([^\}]+)\}/g,vreplace);
646 | json_edit(mjson);
647 | }
648 | }
649 | function mupdate() {
650 | var mr = $('#deepDive').data('crecord');
651 | if(!mr)
652 | return;
653 | $('#deepDive').modal('hide');
654 | if('username' in mr) {
655 | user_update_modal(mr);
656 | } else {
657 | cve_update_modal(mr);
658 | }
659 | }
660 | async function show_table(fun,fvars,msg,tag,fld,pmd,clm,tbn,uid,show) {
661 | if(show) {
662 | if(tbn in client) {
663 | top_alert("success","Showing Cached data. If needed click on Refresh Icon.",1000);
664 | return;
665 | }
666 | }
667 | let m;
668 | try {
669 | m = await client[fun].apply(client,fvars);
670 | } catch(err) {
671 | swal_error("Error in collecting data, potentially network error OR "+
672 | " asynchronous decryption in progress. "+
673 | "Try again in a few seconds.");
674 | console.log(err);
675 | return;
676 | }
677 | if(!(fld in m)) {
678 | Swal.fire({
679 | title: "No data to display!",
680 | text: msg,
681 | icon: "warning",
682 | confirmButtonText: "OK",
683 | timer: 1800
684 | });
685 | return;
686 | }
687 | /* totalCount itemsPerPage pageCount currentPage prevPage nextPage */
688 | if(('totalCount' in m) && (m.totalCount > m[fld].length)) {
689 | for(var i=m[fld].length; i nameB) {
748 | return 1;
749 | }
750 | return 0;
751 | }
752 | function show_users_table(show) {
753 | let fun = "listusers";
754 | let tag = "USER-";
755 | let fld = "users";
756 | let uid = "username";
757 | let tbn = "usertable";
758 | let msg = "No Users to display";
759 | let pmd = {active: "UNKNOWN"};
760 | let clm = [{field:'name', title:'Full name', formatter: gname,
761 | sortable:true, sorter:gsort},
762 | {field:'username', title:'Username',sortable: true},
763 | {field: 'active', title: 'Active',sortable: true}];
764 | show_table(fun,undefined,msg,tag,fld,pmd,clm,tbn,uid,show);
765 | }
766 | function wdate(reserved,row) {
767 | if(get_deep(row,'time.modified'))
768 | return get_deep(row,'time.modified');
769 | return reserved;
770 | }
771 | function wsort(d1,d2,row1,row2) {
772 | let dateA = wdate(d1,row1);
773 | let dateB = wdate(d2,row2);
774 | if (dateA < dateB) {
775 | return -1;
776 | }
777 | if (dateA > dateB) {
778 | return 1;
779 | }
780 | return 0;
781 | }
782 | function show_cve_table(show) {
783 | let fun = "getcveids";
784 | let year = $('#year').val();
785 | let fvars = undefined;
786 | if(parseInt(year) > 0) {
787 | /* Add Year to the getcveids API endpoint */
788 | fvars = [undefined,undefined,{cve_id_year: year}];
789 | }
790 | let tag = "CVE-9999-";
791 | let fld = "cve_ids";
792 | let uid = "cve_id";
793 | let tbn = "cvetable";
794 | let msg = "No CVE data to display";
795 | let pmd = {state: "UNKNOWN",reserved: (new Date(0)).toISOString()};
796 | let clm = [{field:'cve_id', title: 'CVE', sortable: true},
797 | {field: 'state', title: 'State', sortable: true},
798 | {field: 'reserved', title: 'Date', sortable: true,
799 | formatter: wdate, sorter: wsort}];
800 | show_table(fun,fvars,msg,tag,fld,pmd,clm,tbn,uid,show);
801 | }
802 | async function reserve() {
803 | let vars = {};
804 | $('#reserveCVEModal .form-control').each(function(_,x) {
805 | vars[x.name] = $(x).val();
806 | });
807 | $('#reserveCVEModal').modal('hide');
808 | let y = await client.reservecve(vars.amount,vars.cve_year,vars.batch_type);
809 | if("error" in y) {
810 | swal_error("Error while logging in: "+y.error+" "+y.message);
811 | return;
812 | } else if('cve_ids' in y) {
813 | Swal.fire({
814 | title: "CVE Reserve success!",
815 | text: "Reserved " + y.cve_ids.length+" CVE's.",
816 | icon: "success",
817 | timer: 1800
818 | });
819 | for(var i=0; i[" + String(f.active)+"]",4000);
1006 | setTimeout(function() {
1007 | /* Just clear out warning */
1008 | lock_unlock(0,w);
1009 | $('#addUserModal').modal('hide');
1010 | },2000);
1011 | setTimeout(function() {
1012 | f.warn = 0;
1013 | client.usertable.bootstrapTable('updateByUniqueId',username,f);
1014 | },4000);
1015 | }
1016 |
1017 | }
1018 | function set_copy_pass(secret){
1019 | $("#cpassword").remove();
1020 | var ppass = $('').val(secret).attr("id","cpassword").
1021 | addClass("passform").on("click",selectpass).
1022 | attr("readonly","readonly");
1023 | $('#addUserModal').append(ppass);
1024 | selectpass("cpassword");
1025 | }
1026 | async function adduser() {
1027 | let usermodel = {username: "", name: {first:"",last: ""},
1028 | active: true,authority: {active_roles: []} };
1029 | let username = $('#addUserModal .username').val();
1030 | let fname = $('#addUserModal .name_first').val() || "";
1031 | let lname = $('#addUserModal .name_last').val() || "";
1032 | let role = $('#addUserModal .active_roles').val();
1033 | if(!username) {
1034 | $('#addUserModal .username').addClass('is-invalid');
1035 | return;
1036 | };
1037 | $('#addUserModal .username').removeClass('is-invalid');
1038 | usermodel['username'] = username.toLowerCase();
1039 | usermodel['name'] = { first: fname, last: lname};
1040 | if(role)
1041 | usermodel['authority']['active_roles'].push(role);
1042 | let f = await client.createuser(usermodel);
1043 | if('error' in f) {
1044 | swal_error(f.error + ": " + f.message);
1045 | return;
1046 | }
1047 | if('created' in f) {
1048 | let fn = simpleCopy(f.created);
1049 | fn.new = 1;
1050 | client.usertable.bootstrapTable('insertRow',
1051 | {index: 0,
1052 | row: fn});
1053 | set_copy_pass(fn.secret);
1054 | Swal.fire({
1055 | title: "User Created!",
1056 | text: f.message + " API-Key secret is copied to your clipboard!",
1057 | icon: "success",
1058 | timer: 3800
1059 | }).then(function() {
1060 | $('#users-tab').click();
1061 | setTimeout(function() {
1062 | fn.new = 0;
1063 | client.usertable
1064 | .bootstrapTable('updateByUniqueId',{id: username,
1065 | row: fn,
1066 | replace:true});
1067 |
1068 | },1000);
1069 | });
1070 | }
1071 | $('#addUserModal').modal('hide');
1072 | }
1073 | function get_json_data() {
1074 | try {
1075 | return JSON.parse($('#mjson .jsoneditor')[0]
1076 | .env.editor.getValue());
1077 | } catch (err) {
1078 | console.log(err);
1079 | swal_error("Error in collecting JSON. See console log for details");
1080 | return {};
1081 | }
1082 |
1083 | }
1084 | function from_json(w) {
1085 | let json_data = get_json_data();
1086 | if(!json_data)
1087 | return;
1088 | $('#nice .frow').each(function(_,el) {
1089 | var field = $(el).data("rclass");
1090 | if(field in json_data) {
1091 | let diff = json_data[field].length - $(el).find("> .erow").length;
1092 | if(diff > 0) {
1093 | /* Add elements */
1094 | for(var i=1; i <= diff; i++)
1095 | $(el).find(".addrow").click();
1096 | } else if (diff < 0) {
1097 | /* Remove elements */
1098 | for(var i=1; i <= Math.abs(diff); i++)
1099 | $(el).find(".deleterow").click();
1100 | }
1101 | /* Check if Range is selected for affected version */
1102 | var versionRange = undefined;
1103 | json_data[field].forEach(function(x) {
1104 | if('versions' in x) {
1105 | x.versions.forEach(function(y) {
1106 | /* if( ('lessThan' in y) || ('lessThanOrEqual' in y)) */
1107 | ['lessThan','lessThanOrEqual'].forEach(function(q) {
1108 | if(q in y) {
1109 | versionRange = q
1110 | $(el).find('.versionRangeType').val(q).trigger('change');
1111 | }
1112 | })
1113 | })
1114 | }
1115 | });
1116 | $(el).find('.versionRangeEnabled').prop('checked',versionRange ? true: false)
1117 | .trigger('change');
1118 |
1119 | }
1120 | });
1121 | $('#nice .form-control').each(function(_,v) {
1122 | let props = $(v).data("field");
1123 | if(props) {
1124 | let oval = get_deep(json_data,props);
1125 | if(oval && oval[0] != '$') {
1126 | /* Value map exists and does not begin with $ */
1127 | $(v).val(oval);
1128 | if(oval != $(v).val()) {
1129 | /* In case of select field */
1130 | add_option(v,oval,oval,1);
1131 | }
1132 | clearoff(v);
1133 | }
1134 | }
1135 | });
1136 | }
1137 | async function publish_cve() {
1138 | try {
1139 | if($('#nice-or-json').find(".active.show").attr("id") == "nice") {
1140 | if(to_json() == false) {
1141 | $('#cveform .is-invalid').focus();
1142 | swal_error("Some required fields are missing or incomplete");
1143 | return;
1144 | }
1145 | }
1146 | let editor = $('#mjson .jsoneditor')[0].env.editor;
1147 | let pubcve = JSON.parse(editor.getValue());
1148 | let mr = $('#deepDive').data('crecord');
1149 | /* Override some fields on submit*/
1150 | if(get_deep(client,'userobj.org_UUID') && client.org)
1151 | pubcve["providerMetadata"] = { orgId: client.userobj.org_UUID,
1152 | shortName: client.org };
1153 | if(get_deep(client,'constructor.name') && client._version)
1154 | pubcve["x_generator"] = {engine: client.constructor.name + "/" +
1155 | client._version };
1156 | let cve = mr.cve_id;
1157 | let ispublic = mr.state != "RESERVED";
1158 | let rejected = false;
1159 | let d = await client.publishcve(cve,pubcve,ispublic,rejected);
1160 | if("error" in d) {
1161 | swal_error("Failed to publish CVE, Error : "+d.error);
1162 | console.log(d);
1163 | return;
1164 | }
1165 | if(("created" in d) || ("updated" in d)) {
1166 | let note = "Published";
1167 | let fnote = "created";
1168 | if(ispublic) {
1169 | note = "Updated";
1170 | fnote = "updated";
1171 | }
1172 | Swal.fire({
1173 | title: "CVE "+note+" Successfully!",
1174 | text: d.message,
1175 | icon: "success",
1176 | timer: 1800
1177 | });
1178 | let u = client.cvetable.bootstrapTable('getRowByUniqueId',cve);
1179 | u.state = get_deep(d,fnote+'.cveMetadata.state');
1180 | let modified = get_deep(d,fnote+'.cveMetadata.datePublished');
1181 | if(modified)
1182 | set_deep(u,'time.modified',modified);
1183 | u.new = 1;
1184 | client.cvetable.bootstrapTable('updateByUniqueId',{id: cve,
1185 | row: u });
1186 | $('#cveUpdateModal').modal('hide');
1187 | } else {
1188 | console.log(d);
1189 | swal_error("Unknown error CVE could not be updated. See console "+
1190 | " log for details!");
1191 | }
1192 | }catch(err) {
1193 | console.log(err);
1194 | swal_error("Could not publish this CVE. Fix the errors please!");
1195 | }
1196 | }
1197 | function to_json(w) {
1198 | let json_data = get_json_data();
1199 | let value_check = true;
1200 | $('#nice .form-control').not('.d-none').each(function(_,v) {
1201 | if($(v).val()) {
1202 | let props = $(v).data("field");
1203 | if(!props) return;
1204 | json_data = set_deep(json_data,props,$(v).val());
1205 | $(v).removeClass('is-invalid').addClass('is-valid');
1206 | } else {
1207 | if(v.required) {
1208 | value_check = false;
1209 | $(v).removeClass('is-valid').addClass('is-invalid');
1210 | } else {
1211 | let props = $(v).data("field");
1212 | if(!props) return;
1213 | /* Delete the field if exists */
1214 | json_data = set_deep(json_data,props,undefined);
1215 | }
1216 | }
1217 | });
1218 | let editor = $('#mjson .jsoneditor')[0].env.editor;
1219 | editor.setValue(JSON.stringify(json_data,null,2));
1220 | return value_check;
1221 | }
1222 | function update_related(w) {
1223 | /* Function to update the data-field of a related item*/
1224 | /* data-related="versionRangeValue" data-relatedfield="affected.0.versions.0.$" */
1225 | let related = $(w).data("related");
1226 | if($(w).val()) {
1227 | let field = $(w).data("relatedfield").replace("$",$(w).val());
1228 | $(w).parent().find("."+related).attr("data-field",field);
1229 | } else {
1230 | $(w).parent().find("."+related).removeAttr("data-field");
1231 | }
1232 | }
1233 | function clearoff(w) {
1234 | if($(w).val() && (get_deep(w,'validity.valid') == true))
1235 | $(w).removeClass('is-invalid').addClass('is-valid');
1236 | }
1237 | function disable_encryption() {
1238 | if(!('dfetch' in client)) {
1239 | console.log("Encryption seems to be disabled already");
1240 | return;
1241 | }
1242 | check_create_key(client.user).then(function(ekey) {
1243 | let encBuffer = URItoarrayBuffer(client.key);
1244 | decryptMessage(encBuffer,ekey.privateKey)
1245 | .then(function(encKey) {
1246 | client.key = encKey;
1247 | store.setItem(store_tag+"key",client.key);
1248 | $('.encryption').toggleClass("d-none");
1249 | client.rfetch = client.dfetch;
1250 | delete client.dfetch;
1251 | top_alert("warning","Encryption is now disabled for your API keys!");
1252 | });
1253 | });
1254 | }
1255 | function activate_encryption() {
1256 | if('dfetch' in client) {
1257 | console.log("Encrypt/Decrypt API is already enabled ");
1258 | return;
1259 | }
1260 | client.dfetch = client.rfetch;
1261 | client.rfetch = function(path,opts,qvars) {
1262 | return check_create_key(client.user).then(function(ekey) {
1263 | let encKey = client.key;
1264 | let encBuffer = URItoarrayBuffer(client.key);
1265 | return decryptMessage(encBuffer,ekey.privateKey)
1266 | .then(function(rawKey) {
1267 | client.key = rawKey;
1268 | return client.dfetch(path,opts,qvars)
1269 | .then(function(u) {
1270 | client.key = encKey;
1271 | return u;
1272 | });
1273 | });
1274 | });
1275 | };
1276 | $('.encryption').toggleClass("d-none");
1277 | top_alert("success","Encryption is now enabled for your API Key",4000);
1278 | }
1279 | function enable_encryption() {
1280 | $.getScript("encrypt-storage.js").done(function() {
1281 | try {
1282 | let m = new URL(client.key);
1283 | console.log("Already Encrypted");
1284 | return;
1285 | } catch (_) {
1286 | /* Encrypt storage using RSA keys*/
1287 | try {
1288 | check_create_key(client.user).then(function(newkey) {
1289 | encryptMessage(client.key,newkey.publicKey)
1290 | .then(function(encBuffer) {
1291 | arrayBuffertoURI(encBuffer)
1292 | .then(function(encURL) {
1293 | client.key = encURL;
1294 | store.setItem(store_tag+"key",encURL);
1295 | activate_encryption();
1296 | });
1297 | });
1298 | });
1299 | } catch(err) {
1300 | console.log(err);
1301 | top_alert("warning","Encrypting API key failed, see console log for errors");
1302 | };
1303 | }
1304 | });
1305 | }
1306 | async function showorg() {
1307 | let m = await client.getorg(client.org);
1308 | display_object(m);
1309 | $('#deepDive').modal();
1310 | $('#updaterecord').hide();
1311 | }
1312 | async function reject_cve(confirm) {
1313 | $('#deepDive').modal('hide');
1314 | var mr = $('#deepDive').data('crecord');
1315 | if(!('cve_id' in mr))
1316 | swal_error("Error there seems to no CVE number selected");
1317 | if(confirm) {
1318 | let reason = $('#rejectcveModal .description').val();
1319 | if(reason.length < 3) {
1320 | swal_error("Please provide a description or reason for rejection of this CVE");
1321 | return;
1322 | }
1323 | let rejcve = {"rejectedReasons": [{"lang": "en","value": reason }]};
1324 | if(get_deep(client,'userobj.org_UUID') && client.org)
1325 | rejcve["providerMetadata"] = { orgId: client.userobj.org_UUID,
1326 | shortName: client.org };
1327 | if(get_deep(client,'constructor.name') && client._version)
1328 | rejcve["x_generator"] = {engine: client.constructor.name + "/" +
1329 | client._version };
1330 | let cve = mr.cve_id;
1331 | let ispublic = mr.state != "RESERVED";
1332 | let rejected = true;
1333 | let d = await client.publishcve(cve,rejcve,ispublic,rejected);
1334 | if("error" in d) {
1335 | swal_error("Failed to publish CVE, Error : "+d.error);
1336 | console.log(d);
1337 | return;
1338 | }
1339 | if(("created" in d) || ("updated" in d)) {
1340 | let note = "Rejected";
1341 | let fnote = "created";
1342 | if(ispublic) {
1343 | note = "Updated";
1344 | fnote = "updated";
1345 | }
1346 | Swal.fire({
1347 | title: "CVE "+note+" Successfully!",
1348 | text: d.message,
1349 | icon: "success",
1350 | timer: 1800
1351 | });
1352 | $('#rejectcveModal').modal("hide");
1353 | let u = client.cvetable.bootstrapTable('getRowByUniqueId',cve);
1354 | u.state = get_deep(d,fnote+'.cveMetadata.state');
1355 | let modified = get_deep(d,fnote+'.cveMetadata.datePublished');
1356 | if(modified)
1357 | set_deep(u,'time.modified',modified);
1358 | u.new = 1;
1359 | client.cvetable.bootstrapTable('updateByUniqueId',{id: cve,
1360 | row: u });
1361 | $('#cveUpdateModal').modal('hide');
1362 | } else {
1363 | console.log(d);
1364 | swal_error("Unknown error CVE could not be updated. See console "+
1365 | " log for details!");
1366 | }
1367 | } else {
1368 | $('#rejectcveModal').modal()
1369 | $('#rejectcveModal').find(".cve").val(mr.cve_id);
1370 | }
1371 |
1372 | }
1373 |
--------------------------------------------------------------------------------
|