updated dipjson management
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
Paul 2020-05-03 13:00:08 +02:00
parent 823bf0a613
commit ca3719a6e5
3 changed files with 8 additions and 20 deletions

View File

@ -5,7 +5,7 @@
&copy; {{ now.Format "2006" }} <a href="https://git.paulbsd.com/paulbsd">paulbsd</a>. <br> &copy; {{ now.Format "2006" }} <a href="https://git.paulbsd.com/paulbsd">paulbsd</a>. <br>
{{ with .Site.Params.copyright }}{{ . | markdownify}}{{ end }} {{ with .Site.Params.copyright }}{{ . | markdownify}}{{ end }}
</footer> </footer>
<footer id="footer-right">Your IP address : <a id="dip">{{ "{{" }} dipjson.ip {{ "}}" }}/{{ "{{" }} dipjson.hostname {{ "}}" }}</a></footer> <footer id="footer-right">Your IP address : <a id="dip">{{ "{{" }} returnstring {{ "}}" }}</a></footer>
</div> </div>
</div> </div>
</footer> </footer>

View File

@ -8,20 +8,5 @@
<script> <script>
hljs.initHighlightingOnLoad(); hljs.initHighlightingOnLoad();
</script> </script>
<!--
{{ "<!-- MathJax -->" | safeHTML }}
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
-->
<!--
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
-->
<script type="text/javascript" src="https://raw.githubusercontent.com/jeresig/jquery.hotkeys/master/jquery.hotkeys.js"> <script type="text/javascript" src="https://raw.githubusercontent.com/jeresig/jquery.hotkeys/master/jquery.hotkeys.js">
</script> </script>

View File

@ -5,8 +5,8 @@ var dip = new Vue({
data () { data () {
return { return {
title: "Public IP Address Service", dipjson: {"ip": "", "hostname": "", "city": "", "country": ""},
dipjson: {"ip": null, "hostname": null, "city": null, "country": null}, returnstring: "",
autorefresh: false, autorefresh: false,
interval: null, interval: null,
} }
@ -22,10 +22,13 @@ var dip = new Vue({
axios.get("https://ip.paulbsd.com/json") axios.get("https://ip.paulbsd.com/json")
.then(response => { .then(response => {
this.dipjson = response.data; this.dipjson = response.data;
if (this.dipjson.hostname != "") {
this.returnstring = this.dipjson.ip + '/' + this.dipjson.hostname;
} else {
this.returnstring = this.dipjson.ip;
}
}) })
.catch(err => { .catch(err => {
// Manage the state of the application if the request
// has failed
}); });
}, },
runTimer: function () { runTimer: function () {