removed axios / vuejs stuff
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Paul 2023-07-13 22:25:21 +02:00
parent 6c77212eba
commit 2daa8927d1
8 changed files with 33 additions and 72 deletions

View File

@ -22,6 +22,7 @@ func GetStatic(staticfiles *embed.FS, c echo.Context) (err error) {
} else if strings.HasSuffix(name, ".css") {
c.Response().Header().Set(echo.HeaderContentType, "text/css")
}
c.Response().Header().Add(echo.HeaderCacheControl, "max-age=172800")
return c.String(http.StatusOK, string(content))
}

View File

@ -15,6 +15,7 @@ func (t *Template) Render(w io.Writer, name string, data interface{}, c echo.Con
if strings.HasSuffix(name, ".html") {
c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTMLCharsetUTF8)
}
c.Response().Header().Add(echo.HeaderCacheControl, "max-age=172800")
return t.templates.ExecuteTemplate(w, name, data)
}
@ -38,29 +39,6 @@ func BuildTemplates(templatefiles *embed.FS) (builttemplates *Template, err erro
return
}
/*
// BuildTemplatesDir converts packr packages to html/template
func BuildTemplatesDir(dir string) (builttemplates *Template, err error) {
tmpl := template.New("templates")
err = pkger.Walk(dir, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
freader, _ := pkger.Open(path)
tmplContent, err := ioutil.ReadAll(freader)
tmpl.New(info.Name()).Parse(string(tmplContent))
fmt.Println(info.Name(), tmplContent)
return err
})
builttemplates = &Template{
templates: tmpl,
}
return
}*/
// Template is a template struct
type Template struct {
templates *template.Template

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,29 +1,25 @@
var vue = new Vue({
el: '#dip_main_div',
function main() {
let dip_ip = document.getElementById("dip_ip");
let dip_hostname = document.getElementById("dip_hostname");
let dip_city = document.getElementById("dip_city");
let dip_as_number = document.getElementById("dip_as_number");
let dip_as_org = document.getElementById("dip_as_org");
data () {
return {
title: "Public IP Address service",
dip: {"ip": null,
"hostname": null,
"city": null,
"country": null},
}
},
mounted () {
var ip = "";
if (window.location.pathname.length > 4) {
ip = window.location.pathname.split("/")[1];
console.log(ip);
}
axios.get(`/json/${ip}`)
.then(response => {
this.dip = response.data
})
.catch(err => {
// Manage the state of the application if the request
// has failed
});
var ip = "";
if (window.location.pathname.length > 4) {
ip = window.location.pathname.split("/")[1];
console.log(ip);
}
});
fetch(`/json/${ip}`).then((response) => {
response.json().then((res) => {
dip_ip.innerHTML = res["ip"];
dip_hostname.innerHTML = res["hostname"];
dip_city.innerHTML = res["city"];
dip_as_number.innerHTML = res["as"]["number"];
dip_as_org.innerHTML = res["as"]["org"];
});
});
}
main();

File diff suppressed because one or more lines are too long

View File

@ -1,15 +1,13 @@
<head>
<title>{{ .Title }}</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="static/css/main.css" />
<link rel="stylesheet" href="static/css/uikit.min.css" />
<link rel="stylesheet" href="static/css/font-awesome.min.css" />
<script src="static/js/uikit.min.js"></script>
<script src="static/js/uikit-icons.min.js"></script>
<script src="static/js/axios.min.js"></script>
<script src="static/js/vue.min.js"></script>
</head>

View File

@ -8,29 +8,27 @@
<caption>IP informations</caption>
<tr>
<td>IP</td>
<td>{{ "{{" }} dip.ip {{ "}}" }}</td>
<td id="dip_ip"></td>
</tr>
<tr>
<td>Reverse DNS</td>
<td>{{ "{{" }} dip.hostname {{ "}}" }}</td>
<td id="dip_hostname"></td>
</tr>
<tr>
<td>City</td>
<td>{{ "{{" }} dip.city {{ "}}" }}</td>
<td id="dip_city"></td>
</tr>
<tr>
<td>Country</td>
<td>{{ "{{" }} dip.country {{ "}}" }}</td>
<td id="dip_country"></td>
</tr>
<tr>
<td>AS number</td>
<td>{{ "{{" }} dip.as.number {{ "}}" }}</td>
<td id="dip_as_number"></td>
</tr>
<tr>
<td>AS name</td>
<td>
{{ "{{" }} dip.as.org {{ "}}" }}
</td>
<td id="dip_as_org"></td>
</tr>
</div>
{{ template "footer_js.html" .}}