mirror of
https://github.com/PucelaBits/websegura.git
synced 2024-07-07 05:22:21 +02:00
add result description
This commit is contained in:
parent
17250485b0
commit
c15192ec42
41
.eleventy.js
41
.eleventy.js
@ -8,12 +8,8 @@ module.exports = function (eleventyConfig) {
|
|||||||
eleventyConfig.addPassthroughCopy("assets");
|
eleventyConfig.addPassthroughCopy("assets");
|
||||||
eleventyConfig.addPassthroughCopy("images");
|
eleventyConfig.addPassthroughCopy("images");
|
||||||
|
|
||||||
eleventyConfig.addFilter("color", (grade) => {
|
eleventyConfig.addFilter("color", (security) => {
|
||||||
if (!grade || grade === "") { // for those cases where crawling fails
|
switch (security.grade[0]) {
|
||||||
return "inherit";
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (grade[0]) {
|
|
||||||
case 'A':
|
case 'A':
|
||||||
case 'B':
|
case 'B':
|
||||||
return "#3fad4645";
|
return "#3fad4645";
|
||||||
@ -23,10 +19,41 @@ module.exports = function (eleventyConfig) {
|
|||||||
case 'E':
|
case 'E':
|
||||||
case 'F':
|
case 'F':
|
||||||
return "#d9534f45"
|
return "#d9534f45"
|
||||||
default: return "inherit";
|
default:
|
||||||
|
return "inherit";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
eleventyConfig.addFilter("abbr", (security) => {
|
||||||
|
let abbr = "";
|
||||||
|
switch (security.grade[0]) {
|
||||||
|
case 'A':
|
||||||
|
abbr = "El sitio es muy seguro.";
|
||||||
|
break;
|
||||||
|
case 'B':
|
||||||
|
abbr = "El sitio es seguro.";
|
||||||
|
break;
|
||||||
|
case 'C':
|
||||||
|
abbr = "El sitio podría mejorar su seguridad."
|
||||||
|
break;
|
||||||
|
case 'D':
|
||||||
|
abbr = "El sitio debería mejorar su seguridad."
|
||||||
|
break;
|
||||||
|
case 'E':
|
||||||
|
abbr = "El sitio es inseguro."
|
||||||
|
break;
|
||||||
|
case 'F':
|
||||||
|
abbr = "El sitio es muy inseguro."
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
abbr = "Desconocido.";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
abbr += ` Pasaron ${security.tests_passed} de las ${security.tests_quantity} comprobaciones realizadas`;
|
||||||
|
return abbr;
|
||||||
|
});
|
||||||
|
|
||||||
eleventyConfig.addFilter("urlEncode", (value) => {
|
eleventyConfig.addFilter("urlEncode", (value) => {
|
||||||
return encodeURIComponent(value);
|
return encodeURIComponent(value);
|
||||||
});
|
});
|
||||||
|
@ -15,8 +15,8 @@ layout: base
|
|||||||
<tbody>
|
<tbody>
|
||||||
{% for web in results.meta %}
|
{% for web in results.meta %}
|
||||||
{% set security = results[web.url | replace(".", "!")] %}
|
{% set security = results[web.url | replace(".", "!")] %}
|
||||||
<tr style="background-color: {{ security.grade | color }}">
|
<tr style="background-color: {{ security | color }}">
|
||||||
<td>{{ security.grade }}</td>
|
<td><abbr title="{{ security | abbr }}">{{ security.grade }}</abbr></td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://observatory.mozilla.org/analyze/{{ web.url }}" target="_blank" alt="Detalles técnicos" title="Detalles técnicos">{{ web.url | replace("www.", "") }}</a>
|
<a href="https://observatory.mozilla.org/analyze/{{ web.url }}" target="_blank" alt="Detalles técnicos" title="Detalles técnicos">{{ web.url | replace("www.", "") }}</a>
|
||||||
</td>
|
</td>
|
||||||
|
Loading…
Reference in New Issue
Block a user