Container links now use ServerIP address

This commit is contained in:
lllllllillllllillll 2023-12-12 21:03:37 -08:00
parent a396764880
commit 23ec95c6a6
3 changed files with 13 additions and 11 deletions

2
app.js
View file

@ -39,7 +39,7 @@ app.use([
// Start Express server
const server = app.listen(PORT, async () => {
console.log(`App listening on port ${PORT}`);
console.log(`App listening on port ${PORT}`);
});
// Start Socket.io

View file

@ -1,6 +1,6 @@
module.exports.dashCard = function dashCard(data) {
let { name, service, id, state, image, external_port, internal_port, ports, volumes, environment_variables, labels } = data;
let { name, service, id, state, image, external_port, internal_port, ports, volumes, environment_variables, labels, IPv4 } = data;
//disable controls for a docker container depending on its name
let enabled = "";
@ -160,7 +160,7 @@ module.exports.dashCard = function dashCard(data) {
</div>
<div class="d-flex align-items-baseline">
<div class="h1 me-2" title="${name}">
<a href="http://localhost:${external_port}" target="_blank">
<a href="http://${IPv4}:${external_port}" target="_blank">
${shortened_name}
</a>
</div>

View file

@ -6,20 +6,21 @@ const { Readable } = require('stream');
const Containers = require('../database/ContainerSettings');
// export docker
module.exports.docker = docker;
let IPv4 = '';
networkInterfaces().then(data => {
IPv4 = data[0].ip4;
});
let hidden = '';
module.exports.hiddenContainers = async function () {
hidden = await Containers.findAll({ where: {visibility:false}});
hidden = hidden.map(a => a.name);
}
async () => {
let netif = await networkInterfaces();
console.log(netif);
}
// export docker
module.exports.docker = docker;
module.exports.serverStats = async function () {
const cpuUsage = await currentLoad();
const ramUsage = await mem();
@ -164,6 +165,7 @@ module.exports.containerList = async function () {
volumes: volumes_list,
environment_variables: environment_variables,
labels: labels,
IPv4: IPv4
}
let dockerCard = dashCard(container_info);