feat: Add mastodon link
This commit is contained in:
parent
565e824902
commit
e0e3cd4102
@ -41,6 +41,7 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||
<link rel="stylesheet" href="assets/css/styles.min.css">
|
||||
<link rel="stylesheet" href="assets/css/fixes.min.css">
|
||||
<link rel="stylesheet" href="assets/css/profile.min.css">
|
||||
<link rel="me" href="https://mastodon.woodburn.au/@nathanwoodburn" />
|
||||
</head>
|
||||
|
||||
<body class="about-body" style="text-align: center;color: rgb(255,255,255);background: transparent;"><script src="https://nathan.woodburn/handshake.js" domain="nathan.woodburn"></script>
|
||||
|
@ -38,6 +38,7 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700">
|
||||
<link rel="stylesheet" href="assets/css/styles.min.css">
|
||||
<link rel="stylesheet" href="assets/css/profile.min.css">
|
||||
<link rel="me" href="https://mastodon.woodburn.au/@nathanwoodburn" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -2,3 +2,12 @@ img.no-drag {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
img.fog {
|
||||
pointer-events: none;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
|
89
assets/js/info.js
Normal file
89
assets/js/info.js
Normal file
@ -0,0 +1,89 @@
|
||||
// On load
|
||||
onload = function() {
|
||||
dockerInfo();
|
||||
systemUptime();
|
||||
systemLoad();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
// On tick
|
||||
setInterval(function() {
|
||||
dockerInfo();
|
||||
systemUptime();
|
||||
systemLoad();
|
||||
|
||||
console.log("Updated");
|
||||
}, 1000);
|
||||
|
||||
const api = "https://glances.woodburn.au/api/3/";
|
||||
|
||||
// Docker info function
|
||||
function dockerInfo() {
|
||||
// Get the containers.name values from the json
|
||||
// Replace the interHTML for #containers with the container name
|
||||
fetch(api + "docker")
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
// Loop through the containers and get the name and the status
|
||||
// Display in a containers running and containers stopped
|
||||
let runningContainers = [];
|
||||
let stoppedContainers = [];
|
||||
for (let i = 0; i < data.containers.length; i++) {
|
||||
if (data.containers[i].Status === "running") {
|
||||
runningContainers.push(data.containers[i].name);
|
||||
} else {
|
||||
stoppedContainers.push(data.containers[i].name);
|
||||
}
|
||||
}
|
||||
// Create the containersName variable
|
||||
let containersName = "Total Containers: " + data.containers.length + "<br>";
|
||||
containersName += "Running Containers: " + runningContainers.length + "<br>";
|
||||
containersName += "Stopped Containers: " + stoppedContainers.length + "<br><br>";
|
||||
// Loop through the running containers and add them to the containersName variable
|
||||
|
||||
document.getElementById("containers").innerHTML = containersName;
|
||||
})
|
||||
.catch(err => console.log(err));
|
||||
};
|
||||
|
||||
// System uptime function
|
||||
function systemUptime() {
|
||||
fetch(api + "uptime")
|
||||
.then(response => response.text())
|
||||
.then(data => {
|
||||
// Get text data remove the quotes
|
||||
let uptime = data.replace(/['"]+/g, '');
|
||||
document.getElementById("uptime").innerHTML = uptime;
|
||||
})
|
||||
.catch(err => console.log(err));
|
||||
};
|
||||
|
||||
function systemLoad() {
|
||||
fetch(api + "mem").then(response => response.json()).then(data => {
|
||||
// Get percentage of memory used
|
||||
let memPercent = data.percent + "% RAM";
|
||||
document.getElementById("mem").innerHTML = memPercent;
|
||||
}).catch(err => console.log(err));
|
||||
|
||||
fetch(api + "cpu").then(response => response.json()).then(data => {
|
||||
// Get total CPU used
|
||||
let cpuPercent = data.total + "% CPU";
|
||||
document.getElementById("cpu").innerHTML = cpuPercent;
|
||||
}).catch(err => console.log(err));
|
||||
|
||||
fetch(api + "fs").then(response => response.json()).then(data => {
|
||||
// For each file system get percent disk used
|
||||
let diskPercent = data[0].percent + "% Disk";
|
||||
// Get GB of storage left
|
||||
let diskFree = data[0].free;
|
||||
// Convert to GB
|
||||
diskFree = diskFree / 1000000000;
|
||||
// Round to 2 decimal places
|
||||
diskFree = diskFree.toFixed(2);
|
||||
// Add to the diskPercent variable
|
||||
diskPercent += "<br>" + diskFree + " GB Free";
|
||||
document.getElementById("disk").innerHTML = diskPercent;
|
||||
}).catch(err => console.log(err));
|
||||
};
|
@ -38,6 +38,7 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700">
|
||||
<link rel="stylesheet" href="assets/css/styles.min.css">
|
||||
<link rel="stylesheet" href="assets/css/profile.min.css">
|
||||
<link rel="me" href="https://mastodon.woodburn.au/@nathanwoodburn" />
|
||||
</head>
|
||||
|
||||
<body style="text-align: center;">
|
||||
|
@ -51,6 +51,7 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||
<link rel="stylesheet" href="assets/css/styles.min.css">
|
||||
<link rel="stylesheet" href="assets/css/index.min.css">
|
||||
<link rel="stylesheet" href="assets/css/profile.min.css">
|
||||
<link rel="me" href="https://mastodon.woodburn.au/@nathanwoodburn" />
|
||||
</head>
|
||||
|
||||
<body id="page-top" data-bs-spy="scroll" data-bs-target="#mainNav" data-bs-offset="77"><script src="https://nathan.woodburn/handshake.js" domain="nathan.woodburn"></script>
|
||||
|
@ -38,6 +38,7 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700">
|
||||
<link rel="stylesheet" href="assets/css/styles.min.css">
|
||||
<link rel="stylesheet" href="assets/css/profile.min.css">
|
||||
<link rel="me" href="https://mastodon.woodburn.au/@nathanwoodburn" />
|
||||
</head>
|
||||
|
||||
<body style="background: url("assets/img/bg/back.webp") center / cover no-repeat;">
|
||||
|
@ -42,6 +42,7 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||
<link rel="stylesheet" href="assets/css/animate.min.min.css">
|
||||
<link rel="stylesheet" href="assets/css/GridSystem-1.min.css">
|
||||
<link rel="stylesheet" href="assets/css/profile.min.css">
|
||||
<link rel="me" href="https://mastodon.woodburn.au/@nathanwoodburn" />
|
||||
</head>
|
||||
|
||||
<body style="background: url("assets/img/links-bg.webp") center / cover no-repeat, #000000;">
|
||||
|
@ -39,6 +39,7 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||
<link rel="stylesheet" href="assets/css/styles.min.css">
|
||||
<link rel="stylesheet" href="assets/css/podcast.min.css">
|
||||
<link rel="stylesheet" href="assets/css/profile.min.css">
|
||||
<link rel="me" href="https://mastodon.woodburn.au/@nathanwoodburn" />
|
||||
</head>
|
||||
|
||||
<body id="page-top" data-bs-spy="scroll" data-bs-target="#mainNav" data-bs-offset="77">
|
||||
|
@ -39,6 +39,7 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome.min.css">
|
||||
<link rel="stylesheet" href="assets/css/styles.min.css">
|
||||
<link rel="stylesheet" href="assets/css/profile.min.css">
|
||||
<link rel="me" href="https://mastodon.woodburn.au/@nathanwoodburn" />
|
||||
</head>
|
||||
|
||||
<body id="page-top" data-bs-spy="scroll" data-bs-target="#mainNav" data-bs-offset="77"><!-- Google Tag Manager (noscript) -->
|
||||
|
@ -39,6 +39,7 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||
<link rel="stylesheet" href="assets/css/styles.min.css">
|
||||
<link rel="stylesheet" href="assets/css/Footer-Dark-icons.min.css">
|
||||
<link rel="stylesheet" href="assets/css/resume.min.css">
|
||||
<link rel="me" href="https://mastodon.woodburn.au/@nathanwoodburn" />
|
||||
</head>
|
||||
|
||||
<body style="width: 90%;margin-left: 5%;margin-right: 5%;">
|
||||
|
Loading…
Reference in New Issue
Block a user