mirror of
https://github.com/genuinetools/reg.git
synced 2024-05-12 01:28:31 -04:00
fix javascript
Signed-off-by: Jess Frazelle <acidburn@google.com>
This commit is contained in:
parent
1d006c17ef
commit
e1d409fefd
|
@ -6,6 +6,7 @@ import (
|
|||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
|
@ -255,7 +256,7 @@ func (rc *registryController) vulnerabilitiesHandler(w http.ResponseWriter, r *h
|
|||
}
|
||||
}
|
||||
|
||||
if r.Header.Get("Accept-Encoding") == "application/json" {
|
||||
if strings.HasSuffix(r.URL.String(), ".json") {
|
||||
js, err := json.Marshal(result)
|
||||
if err != nil {
|
||||
logrus.WithFields(logrus.Fields{
|
||||
|
|
|
@ -216,6 +216,7 @@ func main() {
|
|||
mux.HandleFunc("/repo/{repo}/{tag}/", rc.vulnerabilitiesHandler)
|
||||
mux.HandleFunc("/repo/{repo}/{tag}/vulns", rc.vulnerabilitiesHandler)
|
||||
mux.HandleFunc("/repo/{repo}/{tag}/vulns/", rc.vulnerabilitiesHandler)
|
||||
mux.HandleFunc("/repo/{repo}/{tag}/vulns.json", rc.vulnerabilitiesHandler)
|
||||
mux.PathPrefix("/static/").Handler(http.StripPrefix("/static/", staticHandler))
|
||||
mux.Handle("/", staticHandler)
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ function search(search_val){
|
|||
function loadVulnerabilityCount(url){
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', url);
|
||||
xhr.setRequestHeader("Accept-Encoding", "text/json")
|
||||
xhr.onload = function() {
|
||||
if (xhr.status === 200) {
|
||||
var report = JSON.parse(xhr.responseText);
|
||||
|
@ -65,18 +64,6 @@ if (el.textContent == 'Parent Directory'){
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
var rows = document.querySelectorAll('tr:not(.parent)');
|
||||
Array.prototype.forEach.call(rows, function(item, index){
|
||||
if (index !== 0) {
|
||||
var date_holder = item.querySelectorAll('td:nth-child(3)')[0];
|
||||
var date = date_holder.textContent;
|
||||
date = prettyDate(date);
|
||||
date_holder.innerHTML = date;
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
var cells = document.querySelectorAll('td a');
|
||||
Array.prototype.forEach.call(cells, function(item, index){
|
||||
var link = item.getAttribute('href');
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
<script type="text/javascript">
|
||||
var ajaxCalls = [
|
||||
{{ range $key, $value := .Repositories }}
|
||||
'/repo/{{ $value.Name | urlquery }}/{{ $value.Tag }}/vulns',
|
||||
'/repo/{{ $value.Name | urlquery }}/{{ $value.Tag }}/vulns.json',
|
||||
{{ end }}
|
||||
];
|
||||
window.onload = function() {
|
||||
|
|
Loading…
Reference in a new issue