forked from aeris/cryptcheck-rails
10 changed files with 349 additions and 141 deletions
@ -0,0 +1,5 @@ |
|||
$dark: #3f4853; |
|||
|
|||
$link-color: #135262; |
|||
|
|||
$nav-pills-link-active-bg: #535d6c; |
@ -0,0 +1,44 @@ |
|||
document.addEventListener("DOMContentLoaded", () => { |
|||
if (document.getElementById("pills-tab")) { |
|||
let background = [ |
|||
'#d9534f', // bad
|
|||
'#5cb85c' // good
|
|||
] |
|||
|
|||
for (const service of ["https", "smtp", "tls", "xmpp"]) { |
|||
const name = service.replace(/^\w/, c => c.toUpperCase()) |
|||
const canvas = document.getElementById(`ciphers${name}Chart`).getContext('2d') |
|||
const chart = new Chart(canvas, { |
|||
type: 'doughnut', options: { |
|||
interaction: { |
|||
intersect: false, mode: 'dataset', |
|||
}, |
|||
animations: { |
|||
tension: { |
|||
duration: 100, |
|||
easing: 'linear', |
|||
from: 1, |
|||
to: 0, |
|||
loop: false |
|||
} |
|||
}, |
|||
} |
|||
}) |
|||
|
|||
fetch(`/statistics/${service}/ciphers.json`).then((response) => { |
|||
if (response.status === 200) { |
|||
response.json().then((data) => { |
|||
console.info(data) |
|||
const labels = Object.keys(data) |
|||
const dataset = Object.values(data) |
|||
chart.data.labels = labels |
|||
chart.data.datasets = [{ |
|||
label: 'Number of request', data: dataset, backgroundColor: background |
|||
}] |
|||
chart.update() |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
}) |
@ -0,0 +1,46 @@ |
|||
document.addEventListener("DOMContentLoaded", () => { |
|||
if (document.getElementById("pills-tab")) { |
|||
let background = [ |
|||
'#d9534f', // ssl
|
|||
'#beb052', // tls
|
|||
'#beb052', // tls
|
|||
'#5cb85c' // tls1_2_only
|
|||
] |
|||
|
|||
for (const service of ["https", "smtp", "tls", "xmpp"]) { |
|||
const name = service.replace(/^\w/, c => c.toUpperCase()) |
|||
const canvas = document.getElementById(`tls${name}Chart`).getContext('2d') |
|||
const chart = new Chart(canvas, { |
|||
type: 'doughnut', options: { |
|||
interaction: { |
|||
intersect: false, mode: 'dataset', |
|||
}, |
|||
animations: { |
|||
tension: { |
|||
duration: 100, |
|||
easing: 'linear', |
|||
from: 1, |
|||
to: 0, |
|||
loop: false |
|||
} |
|||
}, |
|||
} |
|||
}) |
|||
|
|||
fetch(`/statistics/${service}/tls.json`).then((response) => { |
|||
if (response.status === 200) { |
|||
response.json().then((data) => { |
|||
console.info(data) |
|||
const labels = Object.keys(data) |
|||
const dataset = Object.values(data) |
|||
chart.data.labels = labels |
|||
chart.data.datasets = [{ |
|||
label: 'Number of request', data: dataset, backgroundColor: background |
|||
}] |
|||
chart.update() |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
}) |
@ -1,8 +1,10 @@ |
|||
import 'css/application' |
|||
|
|||
import 'bootstrap' |
|||
import Chart from 'chart.js/auto' |
|||
import ChartDataLabels from 'chartjs-plugin-datalabels' |
|||
global.Chart = Chart |
|||
Chart.register(ChartDataLabels) |
|||
|
|||
import 'js/stats/index' |
|||
import 'js/stats/ciphers' |
|||
import 'js/stats/tls' |
Loading…
Reference in new issue