shift get_public_ips to json_api.php

This commit is contained in:
FreddleSpl0it
2022-10-11 17:40:46 +02:00
parent ef70457a48
commit 3912fcb238
4 changed files with 41 additions and 21 deletions

View File

@@ -47,7 +47,9 @@ $(document).ready(function() {
if (mailcow_info.branch === "master"){
check_update(mailcow_info.version_tag, mailcow_info.project_url);
}
update_container_stats()
// get public ips
get_public_ips();
update_container_stats();
});
jQuery(function($){
if (localStorage.getItem("current_page") === null) {
@@ -1218,6 +1220,20 @@ function update_container_stats(timeout=5){
// run again in n seconds
setTimeout(update_container_stats, timeout * 1000);
}
// get public ips
function get_public_ips(){
window.fetch("/api/v1/get/status/host/ip", {method:'GET',cache:'no-cache'}).then(function(response) {
return response.json();
}).then(function(data) {
console.log(data);
if (data){
// display host ips
$("#host_ipv4").text(data.ipv4);
$("#host_ipv6").text(data.ipv6);
}
});
}
// format hosts uptime seconds to readable string
function formatUptime(seconds){
seconds = Number(seconds);