feat: Add mastodon link

This commit is contained in:
Nathan Woodburn 2023-10-23 22:33:57 +11:00
parent 565e824902
commit e0e3cd4102
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
14 changed files with 221 additions and 113 deletions

View File

@ -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/styles.min.css">
<link rel="stylesheet" href="assets/css/fixes.min.css"> <link rel="stylesheet" href="assets/css/fixes.min.css">
<link rel="stylesheet" href="assets/css/profile.min.css"> <link rel="stylesheet" href="assets/css/profile.min.css">
<link rel="me" href="https://mastodon.woodburn.au/@nathanwoodburn" />
</head> </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> <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>

View File

@ -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="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/styles.min.css">
<link rel="stylesheet" href="assets/css/profile.min.css"> <link rel="stylesheet" href="assets/css/profile.min.css">
<link rel="me" href="https://mastodon.woodburn.au/@nathanwoodburn" />
</head> </head>
<body> <body>

View File

@ -2,3 +2,12 @@ img.no-drag {
pointer-events: none; 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
View 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));
};

View File

@ -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="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/styles.min.css">
<link rel="stylesheet" href="assets/css/profile.min.css"> <link rel="stylesheet" href="assets/css/profile.min.css">
<link rel="me" href="https://mastodon.woodburn.au/@nathanwoodburn" />
</head> </head>
<body style="text-align: center;"> <body style="text-align: center;">

View File

@ -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/styles.min.css">
<link rel="stylesheet" href="assets/css/index.min.css"> <link rel="stylesheet" href="assets/css/index.min.css">
<link rel="stylesheet" href="assets/css/profile.min.css"> <link rel="stylesheet" href="assets/css/profile.min.css">
<link rel="me" href="https://mastodon.woodburn.au/@nathanwoodburn" />
</head> </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> <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>

View File

@ -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="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/styles.min.css">
<link rel="stylesheet" href="assets/css/profile.min.css"> <link rel="stylesheet" href="assets/css/profile.min.css">
<link rel="me" href="https://mastodon.woodburn.au/@nathanwoodburn" />
</head> </head>
<body style="background: url(&quot;assets/img/bg/back.webp&quot;) center / cover no-repeat;"> <body style="background: url(&quot;assets/img/bg/back.webp&quot;) center / cover no-repeat;">

View File

@ -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/animate.min.min.css">
<link rel="stylesheet" href="assets/css/GridSystem-1.min.css"> <link rel="stylesheet" href="assets/css/GridSystem-1.min.css">
<link rel="stylesheet" href="assets/css/profile.min.css"> <link rel="stylesheet" href="assets/css/profile.min.css">
<link rel="me" href="https://mastodon.woodburn.au/@nathanwoodburn" />
</head> </head>
<body style="background: url(&quot;assets/img/links-bg.webp&quot;) center / cover no-repeat, #000000;"> <body style="background: url(&quot;assets/img/links-bg.webp&quot;) center / cover no-repeat, #000000;">

File diff suppressed because one or more lines are too long

View File

@ -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/styles.min.css">
<link rel="stylesheet" href="assets/css/podcast.min.css"> <link rel="stylesheet" href="assets/css/podcast.min.css">
<link rel="stylesheet" href="assets/css/profile.min.css"> <link rel="stylesheet" href="assets/css/profile.min.css">
<link rel="me" href="https://mastodon.woodburn.au/@nathanwoodburn" />
</head> </head>
<body id="page-top" data-bs-spy="scroll" data-bs-target="#mainNav" data-bs-offset="77"> <body id="page-top" data-bs-spy="scroll" data-bs-target="#mainNav" data-bs-offset="77">

View File

@ -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/fonts/font-awesome.min.css">
<link rel="stylesheet" href="assets/css/styles.min.css"> <link rel="stylesheet" href="assets/css/styles.min.css">
<link rel="stylesheet" href="assets/css/profile.min.css"> <link rel="stylesheet" href="assets/css/profile.min.css">
<link rel="me" href="https://mastodon.woodburn.au/@nathanwoodburn" />
</head> </head>
<body id="page-top" data-bs-spy="scroll" data-bs-target="#mainNav" data-bs-offset="77"><!-- Google Tag Manager (noscript) --> <body id="page-top" data-bs-spy="scroll" data-bs-target="#mainNav" data-bs-offset="77"><!-- Google Tag Manager (noscript) -->

View File

@ -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/styles.min.css">
<link rel="stylesheet" href="assets/css/Footer-Dark-icons.min.css"> <link rel="stylesheet" href="assets/css/Footer-Dark-icons.min.css">
<link rel="stylesheet" href="assets/css/resume.min.css"> <link rel="stylesheet" href="assets/css/resume.min.css">
<link rel="me" href="https://mastodon.woodburn.au/@nathanwoodburn" />
</head> </head>
<body style="width: 90%;margin-left: 5%;margin-right: 5%;"> <body style="width: 90%;margin-left: 5%;margin-right: 5%;">