mirror of
https://github.com/Lissy93/dashy.git
synced 2026-03-21 20:25:38 +01:00
fixing suggestions
This commit is contained in:
parent
fe3550d4bb
commit
1ce7aae08e
1 changed files with 13 additions and 2 deletions
|
|
@ -59,7 +59,7 @@ export default {
|
|||
return apiUrl;
|
||||
},
|
||||
endpointPage() {
|
||||
const page = this.total - (this.options.limit ?? 5);
|
||||
const page = Math.max(this.total - (this.options.limit ?? 5), 1);
|
||||
let apiUrl = `${widgetApiEndpoints.cveVulnerabilities}`
|
||||
+ `?resultsPerPage=${(this.options.limit ?? 5)}`
|
||||
+ `&startIndex=${page}`
|
||||
|
|
@ -116,7 +116,7 @@ export default {
|
|||
data.vulnerabilities.forEach(({ cve = {} }) => {
|
||||
cveList.push({
|
||||
id: cve.id,
|
||||
score: cve.metrics?.cvssMetricV2?.map(x => x.baseSeverity ?? 'UNSET') ?? 'UNSET',
|
||||
score: this.parseScore(cve.metrics),
|
||||
url: `https://nvd.nist.gov/vuln/detail/${cve.id}`,
|
||||
description: this.parseDescriptions(cve.descriptions),
|
||||
publishDate: cve.published,
|
||||
|
|
@ -125,6 +125,17 @@ export default {
|
|||
});
|
||||
this.cveList = cveList;
|
||||
},
|
||||
parseScore(metrics = {}) {
|
||||
if (!metrics || !metrics.cvssMetricV2) {
|
||||
return 'Unset';
|
||||
}
|
||||
for (let i = 0; i < metrics.cvssMetricV2.length; i += 1) {
|
||||
if (metrics.cvssMetricV2[i].baseSeverity !== undefined && metrics.cvssMetricV2[i].baseSeverity !== '') {
|
||||
return metrics.cvssMetricV2[i].baseSeverity;
|
||||
}
|
||||
}
|
||||
return 'Unset';
|
||||
},
|
||||
parseDescriptions(cveDescriptions = []) {
|
||||
for (let i = 0; i < cveDescriptions.length; i += 1) {
|
||||
if (cveDescriptions[i].lang === 'en') {
|
||||
|
|
|
|||
Loading…
Reference in a new issue