Skip to content

An open source, self-hosted, real-time port monitoring and discovery tool.

Feature/docker api migration (#36)

Mostafa Wahied00147dc62836
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644
index 0000000..9b42d5f
--- /dev/null
+++ b/.github/workflows/lint.yml
@@ -0,0 +1,34 @@
+name: Lint
+
+on:
+ pull_request:
+ branches: [ "main", "**" ]
+
+jobs:
+ eslint:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: '22'
+
+ - name: Install dependencies (root)
+ run: |
+ npm ci
+
+ - name: Install dependencies (backend)
+ run: |
+ cd backend
+ npm ci
+
+ - name: Install dependencies (frontend)
+ run: |
+ cd frontend
+ npm ci
+
+ - name: Run ESLint
+ run: npm run lint
diff --git a/Dockerfile b/Dockerfile
index 9dcceb5..df749d0 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,5 @@
# Frontend Build Stage
-FROM node:20-bookworm AS frontend-build
+FROM node:20-bookworm-slim AS frontend-build
WORKDIR /app/frontend
# Copy package files
@@ -11,18 +11,18 @@ RUN npm ci --include=dev && npm cache clean --force && rm -rf ~/.npm
# Copy source and build
COPY frontend/ ./
-# Build with verbose output for debugging
-RUN npm run build --verbose
-
-# Verify build output exists
-RUN ls -la dist/ && echo "Frontend build verification complete"
+# Build the frontend
+RUN npm run build
# Backend Build Stage
-FROM node:20-bookworm AS backend-build
+FROM node:20-bookworm-slim AS backend-build
WORKDIR /app/backend
# Install build dependencies for native modules
-RUN apt-get update && apt-get install -y \
+RUN apt-get clean && \
+ rm -rf /var/lib/apt/lists/* && \
+ apt-get update --allow-releaseinfo-change && \
+ apt-get install -y --no-install-recommends \
python3 \
make \
g++ \
@@ -42,7 +42,10 @@ COPY backend/ ./
FROM node:20-slim AS production
# Install only runtime dependencies
-RUN apt-get update && apt-get install -y --no-install-recommends \
+RUN apt-get clean && \
+ rm -rf /var/lib/apt/lists/* && \
+ apt-get update --allow-releaseinfo-change && \
+ apt-get install -y --no-install-recommends \
ca-certificates \
iproute2 \
iputils-ping \
@@ -62,9 +65,6 @@ COPY --from=backend-build /app/backend ./backend/
# Copy built frontend assets
COPY --from=frontend-build /app/frontend/dist ./backend/public/
-# Verify frontend files were copied to backend
-RUN ls -la ./backend/public/ && echo "Frontend files copied successfully"
-
# Create data directory
RUN mkdir -p /data
diff --git a/backend/collectors/base_collector.js b/backend/collectors/base_collector.js
index c9f2337..f66fba3 100644
--- a/backend/collectors/base_collector.js
+++ b/backend/collectors/base_collector.js
@@ -98,7 +98,8 @@ class BaseCollector {
},
};
} catch (error) {
- this.logger.error(`Error collecting all data: ${error.message}`);
+ this.logger.error('Error collecting all data', { err: error });
+
return {
platform: this.platform,
platformName: this.platformName,
diff --git a/backend/collectors/docker_collector.js b/backend/collectors/docker_collector.js
index 2342525..b214b9d 100644
--- a/backend/collectors/docker_collector.js
+++ b/backend/collectors/docker_collector.js
@@ -13,6 +13,7 @@ const execAsync = util.promisify(exec);
const fs = require("fs");
const os = require("os");
const ProcParser = require("../lib/proc-parser");
+const DockerAPIClient = require("../lib/docker-api");
class DockerCollector extends BaseCollector {
/**
@@ -25,39 +26,61 @@ class DockerCollector extends BaseCollector {
this.platformName = "Docker";
this.name = "Docker Collector";
this.procParser = new ProcParser();
+ this.dockerApi = new DockerAPIClient();
+ }
+
+ async initialize() {
+ return await this.dockerApi.connect();
}
/**
- * Get Docker system information
+ * Initialize Docker API (async initialization)
+ * @private
+ */
+ async _initializeDocker() {
+ try {
+ return await this.dockerApi.connect();
+ } catch (error) {
+ this.logWarn('Docker API initialization failed:', error.message);
+ return false;
+ }
+ }
+
+ /**
+ * Get Docker system information using structured API data
* @returns {Promise<Object>} System information
*/
async getSystemInfo() {
try {
- const { stdout: versionOutput } = await execAsync("docker version");
- const { stdout: infoOutput } = await execAsync("docker info");
- const serverVersion = this._extractDockerVersion(versionOutput);
- const info = this._parseDockerInfo(infoOutput);
+ await this.dockerApi._ensureConnected();
+ const [versionInfo, systemInfo] = await Promise.all([
+ this.dockerApi.getSystemVersion(),
+ this.dockerApi.getSystemInfo()
+ ]);
+
+ const serverVersion = versionInfo.server;
+
return {
type: "system",
- hostname: info.name || "docker-host",
+ hostname: systemInfo.Name || "docker-host",
version: serverVersion || "unknown",
platform: "docker",
docker_version: serverVersion,
- containers_running: info.containersRunning || 0,
- containers_total: info.containers || 0,
- images: info.images || 0,
- kernel_version: info.kernelVersion,
- operating_system: info.operatingSystem,
- os_type: info.osType,
- architecture: info.architecture,
- ncpu: info.cpus || 0,
- memory: info.memory || 0,
+ containers_running: systemInfo.ContainersRunning || 0,
+ containers_total: systemInfo.Containers || 0,
+ images: systemInfo.Images || 0,
+ kernel_version: systemInfo.KernelVersion,
+ operating_system: systemInfo.OperatingSystem,
+ os_type: systemInfo.OSType,
+ architecture: systemInfo.Architecture,
+ ncpu: systemInfo.NCPU || 0,
+ memory: systemInfo.MemTotal || 0,
platform_data: {
description: `Docker ${serverVersion}`,
- storage_driver: info.storageDriver,
- logging_driver: info.loggingDriver,
- cgroup_driver: info.cgroupDriver,
- swarm_status: info.swarmStatus || "inactive",
+ storage_driver: systemInfo.Driver,
+ logging_driver: systemInfo.LoggingDriver,
+ cgroup_driver: systemInfo.CgroupDriver,
+ swarm_status: systemInfo.Swarm?.LocalNodeState || "inactive",
},
};
} catch (err) {
@@ -76,171 +99,6 @@ class DockerCollector extends BaseCollector {
}
}
- /**
- * Parse Docker version output to extract server version
- * @param {string} output Docker version command output
- * @returns {string} Server version
- */
- _extractDockerVersion(output) {
- const lines = output.split("\n");
- let inServerSection = false;
-
- for (const line of lines) {
- if (line.trim().startsWith("Server:")) {
- inServerSection = true;
- continue;
- }
-
- if (inServerSection && line.trim().startsWith("Version:")) {
- return line.split(":")[1].trim();
- }
- }
-
- return "unknown";
- }
-
- /**
- * Parse Docker info output to extract system information
- * @param {string} output Docker info command output
- * @returns {Object} Parsed information
- */
- _parseDockerInfo(output) {
- const lines = output.split("\n");
- const info = {
- name: "",
- containersRunning: 0,
- containers: 0,
- images: 0,
- kernelVersion: "",
- operatingSystem: "",
- osType: "",
- architecture: "",
- cpus: 0,
- memory: 0,
- storageDriver: "",
- loggingDriver: "",
- cgroupDriver: "",
- swarmStatus: "inactive",
- };
-
- for (const line of lines) {
- const trimmedLine = line.trim();
-
- if (trimmedLine.startsWith("Name:")) {
- info.name = trimmedLine.split(":")[1].trim();
- } else if (trimmedLine.startsWith("Containers:")) {
- info.containers = parseInt(trimmedLine.split(":")[1].trim(), 10) || 0;
- } else if (trimmedLine.startsWith("Running:")) {
- info.containersRunning =
- parseInt(trimmedLine.split(":")[1].trim(), 10) || 0;
- } else if (trimmedLine.startsWith("Images:")) {
- info.images = parseInt(trimmedLine.split(":")[1].trim(), 10) || 0;
- } else if (trimmedLine.startsWith("Kernel Version:")) {
- info.kernelVersion = trimmedLine.split(":")[1].trim();
- } else if (trimmedLine.startsWith("Operating System:")) {
- info.operatingSystem = trimmedLine.split(":")[1].trim();
- } else if (trimmedLine.startsWith("OSType:")) {
- info.osType = trimmedLine.split(":")[1].trim();
- } else if (trimmedLine.startsWith("Architecture:")) {
- info.architecture = trimmedLine.split(":")[1].trim();
- } else if (trimmedLine.startsWith("CPUs:")) {
- info.cpus = parseInt(trimmedLine.split(":")[1].trim(), 10) || 0;
- } else if (trimmedLine.startsWith("Total Memory:")) {
- const memString = trimmedLine.split(":")[1].trim();
- const valueMatch = memString.match(/([\d.]+)/);
-
- if (valueMatch) {
- let value = parseFloat(valueMatch[1]);
- const unit = (memString.match(/[a-zA-Z]+/) || [""])[0].toUpperCase();
-
- const unitMap = {
- GIB: 1024 * 1024 * 1024,
- GB: 1000 * 1000 * 1000,
- MIB: 1024 * 1024,
- MB: 1000 * 1000,
- KIB: 1024,
- KB: 1000,
- B: 1,
- };
-
- if (unitMap[unit]) {
- info.memory = Math.round(value * unitMap[unit]);
- } else {
- if (value < 1024) {
- info.memory = Math.round(value * 1024 * 1024 * 1024);
- } else {
- info.memory = Math.round(value);
- }
- }
- } else {
- info.memory = 0;
- }
- } else if (trimmedLine.startsWith("Storage Driver:")) {
- info.storageDriver = trimmedLine.split(":")[1].trim();
- } else if (trimmedLine.startsWith("Logging Driver:")) {
- info.loggingDriver = trimmedLine.split(":")[1].trim();
- } else if (trimmedLine.startsWith("Cgroup Driver:")) {
- info.cgroupDriver = trimmedLine.split(":")[1].trim();
- } else if (trimmedLine.startsWith("Swarm:")) {
- info.swarmStatus = trimmedLine.split(":")[1].trim();
- }
- }
-
- return info;
- }
-
- /**
- * Parse `docker ps` output to extract port information.
- * @param {string} output The raw output from the `docker ps` command.
- * @returns {Array} A list of normalized port entries.
- */
- parseDockerOutput(output) {
- const entries = [];
- if (!output) return entries;
-
- const lines = output.trim().split("\n");
- for (const line of lines) {
- if (!line) continue;
-
- const [name, portsStr, id] = line.split(":::");
- if (!portsStr) continue;
-
- const portMappings = portsStr.split(", ");
- for (const mapping of portMappings) {
- const [hostPart, targetPart] = mapping.split("->");
- if (!hostPart || !targetPart) continue;
-
- const targetMatch = targetPart.match(/(\d+)\/(tcp|udp)/);
- if (!targetMatch) continue;
-
- const targetPort = parseInt(targetMatch[1], 10);
- const protocol = targetMatch[2];
-
- const lastColonIndex = hostPart.lastIndexOf(":");
- if (lastColonIndex === -1) continue;
-
- const hostIp = hostPart.substring(0, lastColonIndex);
- const hostPort = parseInt(hostPart.substring(lastColonIndex + 1), 10);
-
- if (!hostIp || isNaN(hostPort)) continue;
-
- entries.push(
- this.normalizePortEntry({
- source: "docker",
- owner: name,
- protocol: protocol,
- host_ip: hostIp,
- host_port: hostPort,
- target: targetPort,
- container_id: id,
- app_id: id,
- pids: [],
- })
- );
- }
- }
- return entries;
- }
/**
* Get Docker applications (containers)
@@ -248,22 +106,16 @@ class DockerCollector extends BaseCollector {
*/
async getApplications() {
try {
- const { stdout } = await execAsync('docker ps -a --format "{{json .}}"');
- const containers = stdout
- .trim()
- .split("\n")
- .filter(Boolean)
- .map((line) => JSON.parse(line));
-
+ const containers = await this.dockerApi.listContainers();
return containers.map((container) => ({
type: "application",
id: container.ID,
- name: container.Names,
+ name: container.Names, // This is already a string from listContainers()
status: container.State,
version: "N/A",
image: container.Image,
command: container.Command,
- created: container.CreatedAt,
+ created: container.Created,
platform: "docker",
platform_data: {
type: "container",
@@ -421,10 +273,53 @@ class DockerCollector extends BaseCollector {
*/
async _getDockerContainerPorts() {
try {
- const { stdout: dockerOutput } = await execAsync(
- 'docker ps --format "{{.Names}}:::{{.Ports}}:::{{.ID}}"'
- );
- return this.parseDockerOutput(dockerOutput);
+ const containers = await this.dockerApi.listContainers();
+ const portEntries = [];
+
+ for (const container of containers) {
+ const containerName = container.Names;
+ const containerId = container.ID;
+
+ // Skip containers without port mappings
+ if (!container.Ports || container.Ports.length === 0) {
+ continue;
+ }
+
+ // Use the raw port data from dockerode instead of CLI parsing
+ const rawPorts = await this.dockerApi.docker.getContainer(container.ID).inspect();
+ const portBindings = rawPorts.NetworkSettings.Ports || {};
+
+ // Process each port mapping
+ for (const [containerPort, hostBindings] of Object.entries(portBindings)) {
+ if (!hostBindings) continue;
+
+ const [port, protocol] = containerPort.split('/');
+ const targetPort = parseInt(port, 10);
+
+ for (const binding of hostBindings) {
+ const hostIp = binding.HostIp || '0.0.0.0';
+ const hostPort = parseInt(binding.HostPort, 10);
+
+ if (!hostIp || isNaN(hostPort)) continue;
+
+ portEntries.push(
+ this.normalizePortEntry({
+ source: "docker",
+ owner: containerName,
+ protocol: protocol,
+ host_ip: hostIp,
+ host_port: hostPort,
+ target: `${containerId}:${targetPort}`,
+ container_id: containerId,
+ app_id: containerName,
+ pids: [],
+ })
+ );
+ }
+ }
+ }
+
+ return portEntries;
} catch (err) {
this.logWarn("Failed to get Docker container ports:", err.message);
return [];
@@ -439,41 +334,25 @@ class DockerCollector extends BaseCollector {
*/
async _getHostNetworkContainers() {
try {
- const { stdout } = await execAsync(
- 'docker ps --format "{{.ID}}:::{{.Names}}:::{{.Image}}"'
- );
- const lines = stdout.trim().split("\n").filter(Boolean);
+ const containerList = await this.dockerApi.listContainers();
- if (lines.length === 0) {
+ if (containerList.length === 0) {
return [];
}
- const promises = lines.map(async (line) => {
- const [containerId, containerName, image] = line.split(":::");
+ const promises = containerList.map(async (container) => {
+ const containerId = container.ID;
+ const containerName = container.Names;
+ const image = container.Image;
try {
- const [inspectResult, pids] = await Promise.all([
- execAsync(
- `docker inspect ${containerId} --format "{{.HostConfig.NetworkMode}}:::{{json .Config.ExposedPorts}}"`
- ),
+ const [inspection, pids] = await Promise.all([
+ this.dockerApi.inspectContainer(containerId),
this._getContainerProcesses(containerId),
]);
- const inspectOutput = inspectResult.stdout.trim();
- const parts = inspectOutput.split(":::");
- const networkMode = parts[0];
- const exposedPortsJson =
- parts.length > 1 ? parts.slice(1).join(":::") : "null";
-
- let exposedPorts;
- try {
- exposedPorts = JSON.parse(exposedPortsJson);
- } catch (e) {
- this.logWarn(
- `Could not parse ExposedPorts JSON for container ${containerId}: ${exposedPortsJson}`
- );
- exposedPorts = null;
- }
+ const networkMode = inspection.HostConfig?.NetworkMode || '';
+ const exposedPorts = inspection.Config?.ExposedPorts || {};
const internalPorts = [];
if (exposedPorts && typeof exposedPorts === 'object') {
@@ -514,8 +393,8 @@ class DockerCollector extends BaseCollector {
}
});
- const containers = (await Promise.all(promises)).filter(Boolean);
- return containers;
+ const finalContainers = (await Promise.all(promises)).filter(Boolean);
+ return finalContainers;
} catch (err) {
this.logWarn("Failed to get host network containers:", err.message);
return [];
@@ -530,13 +409,7 @@ class DockerCollector extends BaseCollector {
*/
async _getContainerProcesses(containerId) {
try {
- const { stdout } = await execAsync(`docker top ${containerId} -o pid`);
- const lines = stdout.trim().split("\n");
- const pids = lines
- .slice(1)
- .map((line) => parseInt(line.trim(), 10))
- .filter((pid) => !isNaN(pid));
- return pids;
+ return await this.dockerApi.getContainerProcesses(containerId);
} catch (err) {
this.logWarn(
`Failed to get processes for container ${containerId}:`,
@@ -555,19 +428,30 @@ class DockerCollector extends BaseCollector {
*/
async _checkIfPortBelongsToDocker(port) {
try {
- const { stdout: portCheck } = await execAsync(
- `docker ps --filter "publish=${port.host_port}" --format "{{.Names}}:::{{.ID}}" 2>/dev/null || echo ""`
- );
-
- if (portCheck.trim()) {
- const [containerName, containerId] = portCheck.trim().split(":::");
- return {
- containerName: containerName,
- containerId: containerId,
- target: `${containerId.substring(0, 12)}:${port.host_port}`,
- };
+ // Use Docker API to find containers with published ports
+ const containers = await this.dockerApi.listContainers();
+
+ for (const container of containers) {
+ // Check if this container publishes the port we're looking for
+ const inspection = await this.dockerApi.inspectContainer(container.ID);
+ const portBindings = inspection.NetworkSettings?.Ports || {};
+
+ for (const [, hostBindings] of Object.entries(portBindings)) {
+ if (!hostBindings) continue;
+
+ for (const binding of hostBindings) {
+ if (parseInt(binding.HostPort, 10) === port.host_port) {
+ return {
+ containerName: container.Names,
+ containerId: container.ID,
+ target: `${container.ID}:${port.host_port}`,
+ };
+ }
+ }
+ }
}
+ // If not found by published ports, try to find by process name
if (port.owner && port.owner !== "unknown") {
const containerInfo = await this._getContainerByProcessName(
port.owner,
@@ -604,9 +488,9 @@ class DockerCollector extends BaseCollector {
cgroupOutput.includes("docker") ||
cgroupOutput.includes("containerd")
) {
- const dockerMatch = cgroupOutput.match(/docker[\/\-]([a-f0-9]{64})/);
+ const dockerMatch = cgroupOutput.match(/docker[/-]([a-f0-9]{64})/);
const containerdMatch = cgroupOutput.match(
- /containerd[\/\-]([a-f0-9]{64})/
+ /containerd[/-]([a-f0-9]{64})/
);
const fullContainerId = dockerMatch
@@ -616,17 +500,17 @@ class DockerCollector extends BaseCollector {
: null;
if (fullContainerId) {
- const { stdout: nameOutput } = await execAsync(
- `docker ps --filter "id=${fullContainerId}" --format "{{.Names}}" 2>/dev/null || echo ""`
- );
- const containerName = nameOutput.trim();
+ try {
+ const inspection = await this.dockerApi.inspectContainer(fullContainerId);
+ const containerName = inspection.Name.replace(/^\//, '');
- if (containerName) {
return {
containerName: containerName,
containerId: fullContainerId,
target: `${fullContainerId.substring(0, 12)}:internal`,
};
+ } catch (err) {
+ this.logWarn(`Could not inspect container ${fullContainerId}:`, err.message);
}
}
}
@@ -647,12 +531,12 @@ class DockerCollector extends BaseCollector {
*/
async _getContainerByProcessName(processName, port) {
try {
- const { stdout } = await execAsync(
- 'docker ps --format "{{.Names}}:::{{.ID}}:::{{.Image}}"'
- );
+ const containers = await this.dockerApi.listContainers();
- for (const line of stdout.trim().split("\n").filter(Boolean)) {
- const [containerName, containerId, image] = line.split(":::");
+ for (const container of containers) {
+ const containerName = container.Names;
+ const containerId = container.ID;
+ const image = container.Image;
const nameLower = containerName.toLowerCase();
const imageLower = image.toLowerCase();
@@ -758,10 +642,10 @@ class DockerCollector extends BaseCollector {
port.container_id = containerId;
port.source = 'docker';
try {
- const { stdout } = await execAsync(`docker inspect --format '{{.Name}}' ${containerId}`);
- port.owner = stdout.trim().replace(/^\//, '');
+ const inspection = await this.dockerApi.inspectContainer(containerId);
+ port.owner = inspection.Name.replace(/^\//, '');
} catch (err) {
- // Container might have been removed
+ this.logWarn("Container inspection failed during /proc attribution:", err.message);
}
}
}
@@ -981,18 +865,18 @@ class DockerCollector extends BaseCollector {
);
return 50;
}
- } catch (e) {
- this.logWarn("Could not stat /var/run/docker.sock. Is it mounted?");
+ } catch (err) {
+ this.logWarn("Could not stat /var/run/docker.sock. Is it mounted?", err.message);
}
try {
- await execAsync("docker version");
+ await this.dockerApi.version();
this.logInfo(
"Docker command is available on the host. Assigning compatibility score (40)."
);
return 40;
} catch (err) {
- this.logInfo("Docker command not found or failed.");
+ this.logInfo("Docker command not found or failed.", err.message);
}
this.logInfo("No Docker indicators found. Incompatible (score 0).");
diff --git a/backend/collectors/truenas_collector.js b/backend/collectors/truenas_collector.js
index d20f442..5aa49a0 100644
--- a/backend/collectors/truenas_collector.js
+++ b/backend/collectors/truenas_collector.js
@@ -19,6 +19,7 @@ const util = require("util");
const execAsync = util.promisify(exec);
const fs = require("fs");
const { TrueNASClient } = require("../lib/truenas-rpc");
+const DockerAPIClient = require("../lib/docker-api");
const PerformanceTracker = require("../utils/performance-tracker");
const ProcParser = require("../lib/proc-parser");
@@ -34,6 +35,9 @@ class TrueNASCollector extends BaseCollector {
this.name = "TrueNAS Collector";
this.client = new TrueNASClient({ debug: this.debug });
this.procParser = new ProcParser();
+ this.dockerApi = new DockerAPIClient();
+ // Initialize the Docker API
+ this._initializeDocker();
// Initialize cache system
this.cache = {
@@ -79,6 +83,32 @@ class TrueNASCollector extends BaseCollector {
};
}
+ /**
+ * Initialize Docker API (async initialization)
+ * @private
+ */
+ async _initializeDocker() {
+ try {
+ return await this.dockerApi.connect();
+ } catch (error) {
+ this.logWarn('Docker API initialization failed:', error.message);
+ return false;
+ }
+ }
+
+ /**
+ * Safely convert container names to string format
+ * Docker API can return Names as either string or array depending on context
+ * @param {string|Array} names - Container names from Docker API
+ * @returns {string} - Formatted container name string
+ */
+ _formatContainerNames(names) {
+ if (Array.isArray(names)) {
+ return names.join(', ');
+ }
+ return names || 'unknown';
+ }
+
/**
* Check if this system is TrueNAS with confidence score
* @param {Object} serverConfig The server's configuration, including API keys.
@@ -189,84 +219,77 @@ class TrueNASCollector extends BaseCollector {
}
/**
- * Get Docker containers using docker command
+ * Get Docker containers using Docker API
* @returns {Promise<Array>} List of Docker containers
*/
async _getDockerContainers() {
try {
- this.log(
- 'Getting Docker containers via "docker inspect" for robust data'
- );
- const { stdout: containerIds } = await execAsync("docker ps -aq");
- if (!containerIds.trim()) {
- return [];
+ this.log('Getting Docker containers via Docker API');
+ await this.dockerApi._ensureConnected();
+
+ const containers = await this.dockerApi.listContainers({ all: true });
+
+ const containerData = [];
+ for (const container of containers) {
+ try {
+ const inspection = await this.dockerApi.inspectContainer(container.ID);
+ containerData.push({
+ id: container.ID,
+ name: this._formatContainerNames(container.Names),
+ status: this._mapDockerStatus(container.State),
+ image: container.Image,
+ command: container.Command,
+ created: container.Created,
+ ports: inspection.HostConfig.PortBindings,
+ networks: Object.keys(inspection.NetworkSettings.Networks).join(", "),
+ });
+ } catch (inspectErr) {
+ this.logWarn(`Failed to inspect container ${container.ID}: ${inspectErr.message}`);
+ containerData.push({
+ id: container.ID,
+ name: this._formatContainerNames(container.Names),
+ status: this._mapDockerStatus(container.State),
+ image: container.Image,
+ command: container.Command,
+ created: container.Created,
+ ports: {},
+ networks: '',
+ });
+ }
}
- const ids = containerIds.trim().split("\n").join(" ");
- const { stdout: inspectOutput } = await execAsync(
- `docker inspect ${ids}`
- );
-
- const containers = JSON.parse(inspectOutput).map((container) => ({
- id: container.Id,
- name: container.Name.startsWith("/")
- ? container.Name.substring(1)
- : container.Name,
- status: this._mapDockerStatus(container.State.Status),
- image: container.Config.Image,
- command: container.Path + " " + container.Args.join(" "),
- created: container.Created,
- ports: container.HostConfig.PortBindings,
- networks: Object.keys(container.NetworkSettings.Networks).join(", "),
- }));
-
- return containers;
+ return containerData;
} catch (err) {
this.logError(
- 'Error getting Docker containers via "docker inspect":',
+ 'Error getting Docker containers via Docker API:',
err.message,
err.stack
);
- return this._getDockerContainersWithPs();
+ return this._getDockerContainersAlternative();
}
}
/**
- * Fallback method to get Docker containers using 'docker ps'.
+ * Alternative method to get Docker containers using Docker API (retry with different options).
* @returns {Promise<Array>} List of Docker containers
*/
- async _getDockerContainersWithPs() {
+ async _getDockerContainersAlternative() {
try {
- this.logWarn('Falling back to "docker ps" for container collection.');
- const { stdout } = await execAsync('docker ps -a --format "{{json .}}"');
- const containers = stdout
- .split("\n")
- .filter((line) => line.trim())
- .map((line) => {
- try {
- return JSON.parse(line);
- } catch (err) {
- this.logWarn("Error parsing container JSON line:", err.message, {
- line,
- });
- return null;
- }
- })
- .filter(Boolean)
- .map((container) => ({
- id: container.ID,
- name: container.Names,
- status: this._mapDockerStatus(container.Status),
- image: container.Image,
- command: container.Command,
- created: container.CreatedAt,
- ports: container.Ports,
- networks: container.Networks,
- }));
- return containers;
+ this.logWarn('Using alternative Docker API call for container collection.');
+ const containers = await this.dockerApi.listContainers({ all: true });
+ return containers.map((container) => ({
+ id: container.ID,
+ name: this._formatContainerNames(container.Names),
+ status: this._mapDockerStatus(container.State),
+ image: container.Image,
+ command: container.Command,
+ created: container.Created,
+ ports: container.Ports,
+ networks: container.Networks || '',
+ }));
} catch (err) {
this.logError(
- 'Error getting Docker containers via fallback "docker ps":',
+ 'Error getting Docker containers via alternative Docker API call:',
err.message,
err.stack
);
@@ -411,83 +434,80 @@ class TrueNASCollector extends BaseCollector {
*/
async _getDockerPorts() {
try {
- this.log('Getting Docker port mappings via "docker ps" (for port list)');
+ this.logInfo('Getting Docker port mappings via Docker API');
this._debugNetworkInterfaces();
- const { stdout } = await execAsync(
- 'docker ps -a --no-trunc --format "{{.Names}}|{{.Ports}}|{{.ID}}"'
- );
- const lines = stdout.trim().split("\n");
+
+ await this.dockerApi._ensureConnected();
+ const containers = await this.dockerApi.listContainers({ all: true });
const ports = [];
- for (const line of lines) {
- if (!line.trim()) continue;
- const [name, portsStr, containerId] = line.split("|");
-
- if (!portsStr || portsStr === "") {
- continue;
- }
-
- const portMappings = portsStr.split(", ");
- for (const mapping of portMappings) {
+ for (const container of containers) {
+ const containerName = this._formatContainerNames(container.Names);
+ const containerId = container.ID;
+
+ const rawPorts = await this.dockerApi.docker.getContainer(container.ID).inspect();
+ const portBindings = rawPorts.NetworkSettings.Ports || {};
+
+ if (container.Ports && container.Ports.length > 0) {
+ for (const [containerPort, hostBindings] of Object.entries(portBindings)) {
+ if (!hostBindings) continue;
- if (mapping.includes("->")) {
- const [external, internal] = mapping.split("->");
-
- let hostIP = "*";
- let hostPort;
- if (external.includes(":")) {
- const parts = external.split(":");
- hostIP = this._resolveHostIP(parts[0]);
- hostPort = parts[1];
- } else {
- hostPort = external;
- hostIP = this._getServerIP();
- }
- const [containerPort, proto] = internal.split("/");
+ const [port, protocol] = containerPort.split('/');
+
+ for (const hostBinding of hostBindings) {
+ const hostIP = this._resolveHostIP(hostBinding.HostIp || '0.0.0.0');
+ const hostPort = hostBinding.HostPort;
if (hostIP.endsWith(".255")) {
this.log(
- `Skipping broadcast address port for ${name}: ${hostIP}:${hostPort}`
+ `Skipping broadcast address port for ${containerName}: ${hostIP}:${hostPort}`
);
continue;
}
ports.push({
source: "docker",
- owner: name,
- protocol: proto || "tcp",
+ owner: containerName,
+ protocol: protocol || "tcp",
host_ip: hostIP,
host_port: parseInt(hostPort, 10),
- target: containerPort,
+ target: port,
container_id: containerId,
vm_id: null,
app_id: containerId,
});
- } else if (mapping.match(/^\d+\/(tcp|udp)$/)) {
- const [port, protocol] = mapping.split('/');
- const portNum = parseInt(port, 10);
- if (!isNaN(portNum)) {
- ports.push({
- source: "docker",
- owner: name,
- protocol: protocol || "tcp",
- host_ip: "0.0.0.0",
- host_port: portNum,
- target: `${containerId.substring(0, 12)}:${portNum}(internal)`,
- container_id: containerId,
- vm_id: null,
- app_id: containerId,
- internal: true
- });
- }
- } else {
- // Pattern didn't match - this is normal for some Docker port formats
+ }
+ }
+ }
+
+ // Also check for internal-only ports
+ const containerInspection = await this.dockerApi.inspectContainer(containerId);
+ const exposedPorts = containerInspection.Config.ExposedPorts || {};
+
+ for (const [exposedPort] of Object.entries(exposedPorts)) {
+ const [port, protocol] = exposedPort.split('/');
+ const portNum = parseInt(port, 10);
+
+ // Check if this port is not already published (has actual host bindings, not null)
+ const isPublished = portBindings[exposedPort] && portBindings[exposedPort] !== null;
+
+ if (!isNaN(portNum) && !isPublished) {
+ ports.push({
+ source: "docker",
+ owner: containerName,
+ protocol: protocol || "tcp",
+ host_ip: "0.0.0.0",
+ host_port: portNum,
+ target: `${containerId.substring(0, 12)}:${portNum}(internal)`,
+ container_id: containerId,
+ vm_id: null,
+ app_id: containerId,
+ internal: true
+ });
}
}
}
- this.log(`Total ports collected: ${ports.length}`);
-
return ports;
} catch (err) {
this.logError(
@@ -755,7 +775,7 @@ class TrueNASCollector extends BaseCollector {
if (cols.length < 4) continue;
const protocol = cols[0].toLowerCase();
- if (!protocol.includes('tcp') && !protocol.includes('udp')) return;
+ if (!protocol.includes('tcp') && !protocol.includes('udp')) continue;
const localAddr = cols[3];
if (!localAddr || !localAddr.includes(':')) continue;
@@ -956,24 +976,24 @@ class TrueNASCollector extends BaseCollector {
perf.start("pid-to-container-mapping");
const pidToContainerMap = new Map();
try {
- const { stdout: inspectLines } = await execAsync(
- `docker ps -q | xargs docker inspect --format '{{.State.Pid}}::{{.Id}}::{{.Name}}'`
- );
- inspectLines
- .trim()
- .split("\n")
- .forEach((line) => {
- if (!line) return;
- const [pid, id, rawName] = line.split("::");
- if (pid && id && rawName && pid !== "0") {
- pidToContainerMap.set(parseInt(pid, 10), {
- id: id,
- name: rawName.startsWith("/")
- ? rawName.substring(1)
- : rawName,
+ await this.dockerApi._ensureConnected();
+ const containers = await this.dockerApi.listContainers();
+
+ for (const container of containers) {
+ try {
+ const inspection = await this.dockerApi.inspectContainer(container.ID);
+ const pid = inspection.State.Pid;
+ if (pid && pid !== 0) {
+ pidToContainerMap.set(pid, {
+ id: container.ID,
+ name: this._formatContainerNames(container.Names),
});
}
- });
+ } catch (inspectErr) {
+ this.logWarn(`Failed to inspect container ${container.ID} for PID mapping: ${inspectErr.message}`);
+ }
+ }
+
this.log(
`Successfully built PID-to-Container map with ${pidToContainerMap.size} entries.`
);
@@ -1021,7 +1041,7 @@ class TrueNASCollector extends BaseCollector {
for (const port of dockerPorts) {
// Use different key pattern for internal vs external ports
- const key = port.internal
+ const key = port.internal
? `${port.container_id}:${port.host_port}:internal`
: `${port.host_ip}:${port.host_port}`;
port.created =
@@ -1084,27 +1104,25 @@ class TrueNASCollector extends BaseCollector {
port.source === "system"
) {
try {
- const { stdout } = await execAsync(
- 'docker ps --filter "name=portracker" --format "{{.ID}}|{{.Names}}"'
- );
- const lines = stdout.trim().split("\n");
-
- if (lines.length > 0 && lines[0]) {
- const [containerId, containerName] = lines[0].split("|");
-
- if (containerId) {
- this.log(
- `Re-classifying our own application port ${ourPort} from system/node to ${containerName}`
- );
- port.source = "docker";
- port.owner = containerName;
- port.container_id = containerId;
- port.app_id = containerId;
- port.target = port.host_port;
-
- port.created =
- containerCreationTimeMap.get(containerId) || port.created;
- }
+ await this.dockerApi._ensureConnected();
+ const containers = await this.dockerApi.listContainers();
+ const portrackerContainer = containers.find(c => c.Names.includes('portracker'));
+
+ if (portrackerContainer) {
+ const containerId = portrackerContainer.ID;
+ const containerName = this._formatContainerNames(portrackerContainer.Names);
+
+ this.log(
+ `Re-classifying our own application port ${ourPort} from system/node to ${containerName}`
+ );
+ port.source = "docker";
+ port.owner = containerName;
+ port.container_id = containerId;
+ port.app_id = containerId;
+ port.target = port.host_port;
+
+ port.created =
+ containerCreationTimeMap.get(containerId) || port.created;
}
} catch (e) {
this.logWarn(
@@ -1240,6 +1258,7 @@ class TrueNASCollector extends BaseCollector {
try {
this.client.close();
} catch (closeErr) {
+ this.logWarn("Error while closing TrueNAS client:", closeErr.message);
}
}
}
@@ -1369,10 +1388,22 @@ class TrueNASCollector extends BaseCollector {
const hostContainerIds = await this._getCachedOrFresh(
"hostNetworkContainers",
async () => {
- const { stdout } = await execAsync(
- `docker ps --filter network=host --format '{{.ID}}'`
- );
- return stdout.trim().split("\n").filter(Boolean);
+ await this.dockerApi._ensureConnected();
+ const containers = await this.dockerApi.listContainers();
+ const hostContainers = [];
+
+ for (const container of containers) {
+ try {
+ const inspection = await this.dockerApi.inspectContainer(container.ID);
+ if (inspection.HostConfig.NetworkMode === 'host') {
+ hostContainers.push(container.ID);
+ }
+ } catch (inspectErr) {
+ this.logWarn(`Failed to inspect container ${container.ID} for network mode: ${inspectErr.message}`);
+ }
+ }
+
+ return hostContainers;
},
120000 // 2 minute cache
);
@@ -1392,34 +1423,17 @@ class TrueNASCollector extends BaseCollector {
for (const containerId of hostContainerIds) {
try {
- // Use standard, compatible ps flags. We ask for PID and command.
- const { stdout: topOutput } = await execAsync(
- `docker top ${containerId} -eo pid,comm`
- );
-
- const lines = topOutput.trim().split("\n").slice(1); // Skip header
- for (const line of lines) {
- const parts = line.trim().split(/\s+/);
- if (parts.length < 1) continue;
+ await this.dockerApi._ensureConnected();
+ const pids = await this.dockerApi.getContainerProcesses(containerId);
+ const containerName = idToNameMap.get(containerId.substring(0, 12)) || `container-${containerId.substring(0, 12)}`;
- const pid = parseInt(parts[0], 10);
- const command = parts.slice(1).join(" ");
-
- // We are interested in the main process, not system/root processes.
- if (
- !isNaN(pid) &&
- pid > 0 &&
- command !== "sh" &&
- command !== "bash"
- ) {
+ for (const pid of pids) {
+ if (pid > 0) {
const fullId = dockerContainers.find((c) =>
c.id.startsWith(containerId)
)?.id;
- const containerName = idToNameMap.get(
- containerId.substring(0, 12)
- );
+
if (fullId && containerName) {
- // On host-networked containers, the PID inside is the PID outside.
pidToContainerMap.set(pid, {
id: fullId,
name: containerName,
@@ -1428,9 +1442,8 @@ class TrueNASCollector extends BaseCollector {
}
}
} catch (err) {
- // Log the error but don't crash the whole collection.
this.logWarn(
- `Could not run 'docker top' for container ${containerId.substring(
+ `Could not get container processes for ${containerId.substring(
0,
12
)}. It may have stopped.`,
@@ -1476,14 +1489,16 @@ class TrueNASCollector extends BaseCollector {
try {
this.log(
- "Collecting TrueNAS system info via Docker host information (hybrid approach)"
+ "Collecting TrueNAS system info via Docker API"
);
perf.start("docker-version-info");
- const { stdout: versionOutput } = await execAsync("docker version");
- const { stdout: infoOutput } = await execAsync("docker info");
- const serverVersion = this._extractDockerVersion(versionOutput);
- const dockerInfo = this._parseDockerInfo(infoOutput);
+ await this.dockerApi._ensureConnected();
+ const [versionInfo, systemInfo] = await Promise.all([
+ this.dockerApi.getSystemVersion(),
+ this.dockerApi.getSystemInfo()
+ ]);
+ // serverVersion may be available via versionInfo.server, but not required here
perf.end("docker-version-info");
perf.start("proc-meminfo");
@@ -1507,8 +1522,8 @@ class TrueNASCollector extends BaseCollector {
"Failed to get memory info from /proc/meminfo:",
memErr.message
);
- totalMemoryGB = dockerInfo.memory
- ? (dockerInfo.memory / (1024 * 1024 * 1024)).toFixed(2)
+ totalMemoryGB = systemInfo.MemTotal
+ ? systemInfo.MemTotal
: 0;
}
perf.end("proc-meminfo");
@@ -1577,11 +1592,11 @@ class TrueNASCollector extends BaseCollector {
if (versionFile.trim()) {
truenasVersion = versionFile.trim();
} else if (
- dockerInfo.kernelVersion &&
- dockerInfo.kernelVersion.includes("truenas")
+ systemInfo.KernelVersion &&
+ systemInfo.KernelVersion.includes("truenas")
) {
// Try to extract version from kernel if possible
- const versionMatch = dockerInfo.kernelVersion.match(
+ const versionMatch = systemInfo.KernelVersion.match(
/truenas-(\d+\.\d+\.\d+)/i
);
if (versionMatch && versionMatch[1]) {
@@ -1610,23 +1625,23 @@ class TrueNASCollector extends BaseCollector {
return {
type: "system",
- hostname: dockerInfo.name || "truenas-system",
+ hostname: systemInfo.Name || "truenas-system",
platform: "truenas",
version: truenasVersion,
system_product: systemProduct,
enhanced: false,
- kernel_version: dockerInfo.kernelVersion,
+ kernel_version: systemInfo.KernelVersion,
operating_system: formattedOS,
- os_type: dockerInfo.osType,
- architecture: dockerInfo.architecture,
- ncpu: dockerInfo.cpus,
+ os_type: systemInfo.OSType,
+ architecture: systemInfo.Architecture,
+ ncpu: systemInfo.NCPU,
memory: totalMemoryGB,
model: cpuModel,
uptime: uptime,
uptime_seconds: uptimeSeconds,
- containers_running: dockerInfo.containersRunning,
- containers_total: dockerInfo.containers,
- docker_images: dockerInfo.images,
+ containers_running: systemInfo.ContainersRunning,
+ containers_total: systemInfo.Containers,
+ docker_images: systemInfo.Images,
platform_data: {
description: `TrueNAS SCALE${
truenasVersion ? ` ${truenasVersion}` : ""
@@ -1648,98 +1663,6 @@ class TrueNASCollector extends BaseCollector {
}
}
- /**
- * Parse Docker version output to extract server version (copied from DockerCollector)
- * @param {string} output Docker version command output
- * @returns {string} Server version
- */
- _extractDockerVersion(output) {
- const lines = output.split("\n");
- let inServerSection = false;
- for (const line of lines) {
- if (line.trim().startsWith("Server:")) {
- inServerSection = true;
- continue;
- }
- if (inServerSection && line.trim().startsWith("Version:")) {
- return line.split(":")[1].trim();
- }
- }
- return "unknown";
- }
-
- /**
- * Parse Docker info output to extract system information (copied from DockerCollector)
- * @param {string} output Docker info command output
- * @returns {Object} Parsed information
- */
- _parseDockerInfo(output) {
- const lines = output.split("\n");
- const info = {
- name: "",
- containersRunning: 0,
- containers: 0,
- images: 0,
- kernelVersion: "",
- operatingSystem: "",
- osType: "",
- architecture: "",
- cpus: 0,
- memory: 0,
- storageDriver: "",
- loggingDriver: "",
- cgroupDriver: "",
- swarmStatus: "inactive",
- };
- for (const line of lines) {
- const trimmedLine = line.trim();
- if (trimmedLine.startsWith("Name:")) {
- info.name = trimmedLine.split(":")[1].trim();
- } else if (trimmedLine.startsWith("Containers:")) {
- info.containers = parseInt(trimmedLine.split(":")[1].trim(), 10) || 0;
- } else if (trimmedLine.startsWith("Running:")) {
- info.containersRunning =
- parseInt(trimmedLine.split(":")[1].trim(), 10) || 0;
- } else if (trimmedLine.startsWith("Images:")) {
- info.images = parseInt(trimmedLine.split(":")[1].trim(), 10) || 0;
- } else if (trimmedLine.startsWith("Kernel Version:")) {
- info.kernelVersion = trimmedLine.split(":")[1].trim();
- } else if (trimmedLine.startsWith("Operating System:")) {
- info.operatingSystem = trimmedLine.split(":")[1].trim();
- } else if (trimmedLine.startsWith("OSType:")) {
- info.osType = trimmedLine.split(":")[1].trim();
- } else if (trimmedLine.startsWith("Architecture:")) {
- info.architecture = trimmedLine.split(":")[1].trim();
- } else if (trimmedLine.startsWith("CPUs:")) {
- info.cpus = parseInt(trimmedLine.split(":")[1].trim(), 10) || 0;
- } else if (trimmedLine.startsWith("Total Memory:")) {
- const memParts = trimmedLine.split(":")[1].trim().split(" ");
- if (memParts.length >= 1) {
- const value = parseFloat(memParts[0]);
- const unit = memParts[1] || "B";
- if (unit.toUpperCase() === "GIB") {
- info.memory = value * 1024 * 1024 * 1024;
- } else if (unit.toUpperCase() === "MIB") {
- info.memory = value * 1024 * 1024;
- } else if (unit.toUpperCase() === "KIB") {
- info.memory = value * 1024;
- } else {
- info.memory = value;
- }
- }
- } else if (trimmedLine.startsWith("Storage Driver:")) {
- info.storageDriver = trimmedLine.split(":")[1].trim();
- } else if (trimmedLine.startsWith("Logging Driver:")) {
- info.loggingDriver = trimmedLine.split(":")[1].trim();
- } else if (trimmedLine.startsWith("Cgroup Driver:")) {
- info.cgroupDriver = trimmedLine.split(":")[1].trim();
- } else if (trimmedLine.startsWith("Swarm:")) {
- info.swarmStatus = trimmedLine.split(":")[1].trim();
- }
- }
- return info;
- }
-
/**
* Collect enhanced features using API key
*/
@@ -1910,22 +1833,17 @@ class TrueNASCollector extends BaseCollector {
*/
async _getDockerNameToIdMap() {
try {
- const { stdout } = await execAsync(
- 'docker ps --no-trunc --format "{{.Names}}\t{{.ID}}"'
- );
+ await this.dockerApi._ensureConnected();
+ const containers = await this.dockerApi.listContainers();
const nameToId = new Map();
- stdout
- .trim()
- .split("\n")
- .forEach((line) => {
- if (line.trim()) {
- const [name, id] = line.split("\t");
- if (name && id) {
- nameToId.set(name, id);
- }
+ containers.forEach((container) => {
+ container.Names.forEach(name => {
+ if (name) {
+ nameToId.set(name.trim(), container.ID);
}
});
+ });
return nameToId;
} catch (err) {
diff --git a/backend/db.js b/backend/db.js
index 7ed5ce6..2a40b45 100644
--- a/backend/db.js
+++ b/backend/db.js
@@ -120,17 +120,7 @@ if (!tableExists) {
FOREIGN KEY (parentId) REFERENCES servers(id)
);
`);
- for (const server of existingServers) {
- const insertColumns = Object.keys(server)
- .filter((key) => key !== "type")
- .join(", ");
- const placeholders = Object.keys(server)
- .filter((key) => key !== "type")
- .map(() => "?")
- .join(", ");
- const values = Object.keys(server)
- .filter((key) => key !== "type")
- .map((key) => server[key]);
+ for (const server of existingServers) {
// Assumes 'id', 'label', 'url' are always present in old data
db.prepare(
`
diff --git a/backend/index.js b/backend/index.js
index 0cc3375..7b96639 100644
--- a/backend/index.js
+++ b/backend/index.js
@@ -30,11 +30,7 @@ const pingDebugStats = {
lastSummaryTime: Date.now()
};
-/**
- * Logs ping debug messages with rate limiting to reduce log spam, emitting summaries every 30 seconds or when forced.
- * @param {string} message - The debug message to log.
- * @param {boolean} [force=false] - If true, logs the message regardless of rate limits.
- */
+
function logPingDebug(message, force = false) {
pingDebugStats.count++;
const now = Date.now();
@@ -71,12 +67,6 @@ const WELL_KNOWN_PORTS = {
9000: { name: 'Management', type: 'web', description: 'Common management interface port' },
};
-/**
- * Determines the service type and metadata for a given port and optional owner string.
- * @param {number|string} port - The port number to classify.
- * @param {string} [owner] - Optional process or service owner name for heuristic detection.
- * @return {Object} An object containing the service name, type, and description.
- */
function detectServiceType(port, owner) {
const portNum = parseInt(port, 10);
@@ -114,12 +104,6 @@ function detectServiceType(port, owner) {
return { name: 'Service', type: 'service', description: 'Application service' };
}
-/**
- * Determines the Docker host IP address for the current environment.
- *
- * Returns the appropriate host IP for Docker containers, handling Docker Desktop, macOS, Windows, and Linux environments. Attempts to extract the gateway IP from `/proc/net/route` on Linux systems; falls back to `172.17.0.1` if detection fails.
- * @return {string} The Docker host IP address.
- */
function getDockerHostIP() {
const platform = os.platform();
@@ -156,10 +140,7 @@ function getDockerHostIP() {
return "172.17.0.1";
}
-/**
- * Determines if the current environment is Docker Desktop.
- * @return {boolean} True if running inside Docker Desktop, otherwise false.
- */
+
function isDockerDesktopEnvironment() {
try {
if (process.env.DOCKER_DESKTOP === 'true') {
@@ -202,18 +183,7 @@ function isDockerDesktopEnvironment() {
}
}
-/**
- * Tests the reachability of a service over HTTP or HTTPS by sending HEAD and GET requests.
- *
- * Attempts a HEAD request first; if unsuccessful, falls back to a GET request. Measures response time, captures status codes, and detects single-page application (SPA) patterns in 404 HTML responses. Returns detailed information about reachability, protocol, method, response time, and SPA detection.
- *
- * @param {string} scheme - The protocol to use ("http" or "https").
- * @param {string} host_ip - The target host IP address.
- * @param {number} port - The target port number.
- * @param {string} [path="/"] - The request path.
- * @param {boolean} [isDebugEnabled=false] - Enables debug logging if true.
- * @return {Promise<Object>} An object indicating reachability, status code, protocol, method, response time, and SPA detection if applicable.
- */
+
async function testProtocol(scheme, host_ip, port, path = "/", isDebugEnabled = false) {
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), PING_TIMEOUT);
@@ -335,6 +305,7 @@ async function testProtocol(scheme, host_ip, port, path = "/", isDebugEnabled =
}
}
+
/**
* Determines the status and accessibility of a service based on its type and HTTP(S) response data.
*
diff --git a/backend/lib/docker-api.js b/backend/lib/docker-api.js
new file mode 100644
index 0000000..a104354
--- /dev/null
+++ b/backend/lib/docker-api.js
@@ -0,0 +1,218 @@
+const Docker = require('dockerode');
+const fs = require('fs');
+const path = require('path');
+const { Logger } = require('./logger');
+
+class DockerAPIClient {
+ constructor(options = {}) {
+ this.logger = new Logger('DockerAPI');
+ this.docker = this._initializeDocker(options);
+ this.isConnected = false;
+ this.deploymentPattern = null;
+ }
+
+ _initializeDocker(options) {
+ const dockerHost = options.dockerHost ?? process.env.DOCKER_HOST;
+ const defaultSocket = options.socketPath ?? process.env.DOCKER_SOCK ?? '/var/run/docker.sock';
+ const tlsVerify = options.tlsVerify ?? (process.env.DOCKER_TLS_VERIFY === '1');
+ const certPath = options.certPath ?? process.env.DOCKER_CERT_PATH;
+
+ // 1) Unix domain socket (default and unix://)
+ if (!dockerHost || dockerHost.startsWith('unix://')) {
+ this.deploymentPattern = 'socket';
+ const socketPath = dockerHost?.replace(/^unix:\/\//, '') || defaultSocket;
+ return new Docker({ socketPath });
+ }
+
+ // 2) Windows named pipe
+ if (dockerHost.startsWith('npipe://')) {
+ this.deploymentPattern = 'npipe';
+ return new Docker({ socketPath: dockerHost });
+ }
+
+ // 3) TCP/HTTP(S)
+ const urlStr = dockerHost.replace(/^tcp:\/\//, 'http://');
+ const u = new URL(urlStr);
+ const dockerOpts = {
+ host: u.hostname,
+ port: u.port ? Number(u.port) : (tlsVerify ? 2376 : 2375),
+ protocol: (u.protocol || 'http:').slice(0, -1) // 'http' | 'https'
+ };
+
+ if (tlsVerify && certPath) {
+ try {
+ dockerOpts.protocol = 'https';
+ dockerOpts.ca = fs.readFileSync(path.join(certPath, 'ca.pem'));
+ dockerOpts.cert = fs.readFileSync(path.join(certPath, 'cert.pem'));
+ dockerOpts.key = fs.readFileSync(path.join(certPath, 'key.pem'));
+ } catch (certError) {
+ this.logger.warn('Failed to load TLS certificates, falling back to HTTP:', certError.message);
+ dockerOpts.protocol = 'http';
+ }
+ }
+
+ this.deploymentPattern = 'proxy';
+ return new Docker(dockerOpts);
+ }
+
+ async connect() {
+ try {
+ this.logger.debug(`Attempting Docker API connection (${this.deploymentPattern})`);
+ await this.docker.ping();
+ this.isConnected = true;
+ this.logger.info(`Docker API connected successfully (${this.deploymentPattern})`);
+ return true;
+ } catch (error) {
+ this.logger.error(`Docker API connection failed (${this.deploymentPattern})`, { err: error });
+ this.isConnected = false;
+ return false;
+ }
+ }
+
+ async _ensureConnected() {
+ if (!this.isConnected) {
+ this.logger.debug('Docker API not connected, attempting to connect...');
+ const connected = await this.connect();
+ if (!connected) {
+ this.logger.error('Failed to establish Docker API connection in _ensureConnected');
+ throw new Error('Docker API connection failed');
+ }
+ }
+ }
+
+ async listContainers(options = {}) {
+ await this._ensureConnected();
+
+ try {
+ const containers = await this.docker.listContainers({
+ all: options.all || false,
+ filters: options.filters || {}
+ });
+
+ return containers.map(container => ({
+ ID: container.Id.substring(0, 12),
+ Names: container.Names.map(name => name.replace(/^\//, '')).join(','),
+ Image: container.Image,
+ Command: container.Command,
+ Created: container.Created,
+ Status: container.Status,
+ State: container.State,
+ Ports: this._formatPorts(container.Ports),
+ // Include other container properties but don't override our processed fields
+ Labels: container.Labels,
+ NetworkSettings: container.NetworkSettings,
+ Mounts: container.Mounts,
+ HostConfig: container.HostConfig
+ }));
+ } catch (error) {
+ this.logger.error('listContainers failed:', error.message);
+ throw error;
+ }
+ }
+
+ async inspectContainer(containerId) {
+ await this._ensureConnected();
+
+ try {
+ const container = this.docker.getContainer(containerId);
+ return await container.inspect();
+ } catch (error) {
+ this.logger.error(`inspectContainer failed for ${containerId}:`, error.message);
+ throw error;
+ }
+ }
+
+ async getContainerHealth(containerId) {
+ try {
+ const inspection = await this.inspectContainer(containerId);
+
+ return {
+ status: inspection.State.Status,
+ health: inspection.State.Health?.Status || 'none',
+ startedAt: inspection.State.StartedAt,
+ finishedAt: inspection.State.FinishedAt,
+ restartCount: inspection.RestartCount,
+ pid: inspection.State.Pid
+ };
+ } catch (error) {
+ this.logger.warn(`getContainerHealth failed for ${containerId}:`, error.message);
+ return {
+ status: 'unknown',
+ health: 'unknown',
+ startedAt: null,
+ finishedAt: null,
+ restartCount: 0,
+ pid: null
+ };
+ }
+ }
+
+ async getContainerProcesses(containerId) {
+ await this._ensureConnected();
+
+ try {
+ const container = this.docker.getContainer(containerId);
+ const { Processes, Titles } = await container.top({ ps_args: '-o pid' });
+ const pidIndex = Titles.findIndex(t => t.toLowerCase() === 'pid');
+ if (pidIndex === -1) {
+ return [];
+ }
+ return Processes
+ .map(row => parseInt(row[pidIndex], 10))
+ .filter(Number.isInteger);
+ } catch (error) {
+ this.logger.warn(`getContainerProcesses failed for ${containerId}:`, error.message);
+ return [];
+ }
+ }
+
+ _formatPorts(ports) {
+ if (!ports || ports.length === 0) return '';
+
+ return ports.map(port => {
+ if (port.PublicPort) {
+ return `${port.IP || '0.0.0.0'}:${port.PublicPort}->${port.PrivatePort}/${port.Type}`;
+ } else {
+ return `${port.PrivatePort}/${port.Type}`;
+ }
+ }).join(', ');
+ }
+
+ async isAvailable() {
+ return await this.connect();
+ }
+
+ // Additional utility methods for common operations
+ async getSystemVersion() {
+ await this._ensureConnected();
+
+ try {
+ const versionInfo = await this.docker.version();
+ return {
+ version: versionInfo.Version || 'unknown',
+ apiVersion: versionInfo.ApiVersion || 'unknown',
+ minApiVersion: versionInfo.MinAPIVersion || 'unknown',
+ gitCommit: versionInfo.GitCommit || 'unknown',
+ goVersion: versionInfo.GoVersion || 'unknown',
+ os: versionInfo.Os || 'unknown',
+ arch: versionInfo.Arch || 'unknown'
+ };
+ } catch (error) {
+ this.logger.error('getSystemVersion failed', { err: error });
+ throw error;
+ }
+ }
+
+ async getSystemInfo() {
+ await this._ensureConnected();
+
+ try {
+ return await this.docker.info();
+ } catch (error) {
+ this.logger.error('getSystemInfo failed:', error.message);
+ throw error;
+ }
+ }
+}
+
+module.exports = DockerAPIClient;
\ No newline at end of file
diff --git a/backend/lib/proc-parser.js b/backend/lib/proc-parser.js
index 743d7c2..ed205bf 100644
--- a/backend/lib/proc-parser.js
+++ b/backend/lib/proc-parser.js
@@ -28,11 +28,11 @@ class ProcParser {
this.procPath = procPath;
for (const testPath of procPaths) {
try {
- const stats = require('fs').statSync(path.join(testPath, 'net', 'tcp'));
+ require('fs').statSync(path.join(testPath, 'net', 'tcp'));
this.procPath = testPath;
this.logger.debug(`Using /proc path: ${this.procPath}`);
break;
- } catch (err) {
+ } catch {
// Continue to next path
}
}
diff --git a/backend/lib/tn-ws.js b/backend/lib/tn-ws.js
index 426fcb0..732ede2 100644
--- a/backend/lib/tn-ws.js
+++ b/backend/lib/tn-ws.js
@@ -13,11 +13,7 @@ const {
// Initialize centralized logger
const logger = new Logger("TrueNAS-WS", { debug: process.env.DEBUG === 'true' });
-/**
- * Logs a debug message for the TrueNAS WebSocket client using the centralized logger.
- * @param {string} message - The debug message to log.
- * @param {...any} args - Additional arguments to include in the log message.
- */
+// Helper to log debug messages consistently
function debugWS(message, ...args) {
logger.debug(message, ...args);
}
diff --git a/backend/lib/truenas-auto-discover.js b/backend/lib/truenas-auto-discover.js
index d7c5657..5e7e650 100644
--- a/backend/lib/truenas-auto-discover.js
+++ b/backend/lib/truenas-auto-discover.js
@@ -9,11 +9,7 @@ const { Logger } = require('./logger');
// Initialize logger for auto-discovery
const logger = new Logger("TrueNAS-Discovery", { debug: process.env.DEBUG === 'true' });
-/**
- * Logs a debug message using the TrueNAS-Discovery logger.
- * @param {string} message - The debug message to log.
- * @param {...any} args - Additional arguments to include in the log message.
- */
+// Helper function for debug logging
function debugDiscovery(message, ...args) {
logger.debug(message, ...args);
}
@@ -195,7 +191,7 @@ function callSocketMethod(socketPath, method, options = {}) {
* If running inside a container, attempts to detect the default gateway IP and includes additional container-specific addresses.
* @returns {Array<string>} Array of host addresses to attempt for network connections.
*/
-function detectHostAddresses(options = {}) {
+function detectHostAddresses() {
const hostAddresses = [];
hostAddresses.push("127.0.0.1", "localhost");
diff --git a/backend/lib/truenas-rpc.js b/backend/lib/truenas-rpc.js
index 1179b45..d0369be 100644
--- a/backend/lib/truenas-rpc.js
+++ b/backend/lib/truenas-rpc.js
@@ -54,7 +54,7 @@ class TrueNASClient {
if (!this.apiKey) {
if (this.appDebugEnabled) {
this.logger.info(
- "ℹ️ No API key provided - TrueNAS enhanced features will be disabled. Setting up graceful degradation."
+ "No API key provided - TrueNAS enhanced features will be disabled. Setting up graceful degradation."
);
}
this._setupGracefulDegradation();
@@ -83,11 +83,7 @@ class TrueNASClient {
if (this.appDebugEnabled) {
this.logger.warn(`WebSocket connection failed: ${wsError.message}`);
}
- this.logError(
- "WebSocket connection error:",
- wsError.message,
- wsError.stack || "(no stack)"
- );
+ this.logger.error("WebSocket connection error", { err: wsError });
this._setupGracefulDegradation();
}
}
@@ -123,7 +119,7 @@ class TrueNASClient {
try {
if (this.appDebugEnabled) {
- this.logger.debug(`Calling TrueNAS API method: ${method} with params:`, params);
+ this.logger.debug(`Calling TrueNAS API method: ${method}`);
}
const result = await this.client(method, params);
if (this.appDebugEnabled) {
@@ -134,11 +130,7 @@ class TrueNASClient {
if (this.appDebugEnabled) {
this.logger.warn(`Error calling TrueNAS API method ${method}:`, err.message);
}
- this.logError(
- `TrueNAS RPC Error for method '${method}':`,
- err.message,
- err.stack || "(no stack)"
- );
+ this.logger.error(`TrueNAS RPC Error for method '${method}'`, { err });
throw err;
}
}
diff --git a/backend/package-lock.json b/backend/package-lock.json
index 9f743a5..6af3412 100644
--- a/backend/package-lock.json
+++ b/backend/package-lock.json
@@ -13,6 +13,7 @@
"better-sqlite3": "^11.10.0",
"cors": "^2.8.5",
"debug": "^4.4.1",
+ "dockerode": "^4.0.2",
"express": "^4.18.2",
"node-fetch": "^3.3.2",
"ws": "^8.14.2"
@@ -21,6 +22,126 @@
"nodemon": "^3.1.0"
}
},
+ "node_modules/@balena/dockerignore": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/@balena/dockerignore/-/dockerignore-1.0.2.tgz",
+ "integrity": "sha512-wMue2Sy4GAVTk6Ic4tJVcnfdau+gx2EnG7S+uAEe+TWJFqE4YoWN4/H8MSLj4eYJKxGg26lZwboEniNiNwZQ6Q==",
+ "license": "Apache-2.0"
+ },
+ "node_modules/@grpc/grpc-js": {
+ "version": "1.13.4",
+ "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.13.4.tgz",
+ "integrity": "sha512-GsFaMXCkMqkKIvwCQjCrwH+GHbPKBjhwo/8ZuUkWHqbI73Kky9I+pQltrlT0+MWpedCoosda53lgjYfyEPgxBg==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@grpc/proto-loader": "^0.7.13",
+ "@js-sdsl/ordered-map": "^4.4.2"
+ },
+ "engines": {
+ "node": ">=12.10.0"
+ }
+ },
+ "node_modules/@grpc/proto-loader": {
+ "version": "0.7.15",
+ "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.7.15.tgz",
+ "integrity": "sha512-tMXdRCfYVixjuFK+Hk0Q1s38gV9zDiDJfWL3h1rv4Qc39oILCu1TRTDt7+fGUI8K4G1Fj125Hx/ru3azECWTyQ==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "lodash.camelcase": "^4.3.0",
+ "long": "^5.0.0",
+ "protobufjs": "^7.2.5",
+ "yargs": "^17.7.2"
+ },
+ "bin": {
+ "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/@js-sdsl/ordered-map": {
+ "version": "4.4.2",
+ "resolved": "https://registry.npmjs.org/@js-sdsl/ordered-map/-/ordered-map-4.4.2.tgz",
+ "integrity": "sha512-iUKgm52T8HOE/makSxjqoWhe95ZJA1/G1sYsGev2JDKUSS14KAgg1LHb+Ba+IPow0xflbnSkOsZcO08C7w1gYw==",
+ "license": "MIT",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/js-sdsl"
+ }
+ },
+ "node_modules/@protobufjs/aspromise": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
+ "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@protobufjs/base64": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz",
+ "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@protobufjs/codegen": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz",
+ "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@protobufjs/eventemitter": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz",
+ "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@protobufjs/fetch": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz",
+ "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "@protobufjs/aspromise": "^1.1.1",
+ "@protobufjs/inquire": "^1.1.0"
+ }
+ },
+ "node_modules/@protobufjs/float": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz",
+ "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@protobufjs/inquire": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz",
+ "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@protobufjs/path": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz",
+ "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@protobufjs/pool": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz",
+ "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@protobufjs/utf8": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz",
+ "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/@types/node": {
+ "version": "24.2.1",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-24.2.1.tgz",
+ "integrity": "sha512-DRh5K+ka5eJic8CjH7td8QpYEV6Zo10gfRkjHCO3weqZHWDtAaSTFtl4+VMqOJ4N5jcuhZ9/l+yy8rVgw7BQeQ==",
+ "license": "MIT",
+ "dependencies": {
+ "undici-types": "~7.10.0"
+ }
+ },
"node_modules/accepts": {
"version": "1.3.8",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
@@ -34,6 +155,30 @@
"node": ">= 0.6"
}
},
+ "node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
"node_modules/anymatch": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
@@ -54,6 +199,15 @@
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
"license": "MIT"
},
+ "node_modules/asn1": {
+ "version": "0.2.6",
+ "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz",
+ "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==",
+ "license": "MIT",
+ "dependencies": {
+ "safer-buffer": "~2.1.0"
+ }
+ },
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
@@ -98,6 +252,15 @@
],
"license": "MIT"
},
+ "node_modules/bcrypt-pbkdf": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
+ "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "tweetnacl": "^0.14.3"
+ }
+ },
"node_modules/better-sqlite3": {
"version": "11.10.0",
"resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-11.10.0.tgz",
@@ -229,6 +392,15 @@
"ieee754": "^1.1.13"
}
},
+ "node_modules/buildcheck": {
+ "version": "0.0.6",
+ "resolved": "https://registry.npmjs.org/buildcheck/-/buildcheck-0.0.6.tgz",
+ "integrity": "sha512-8f9ZJCUXyT1M35Jx7MkBgmBMo3oHTTBIPLiY9xyL0pl3T5RwcPEY8cUHr5LBNfu/fk6c2T4DJZuVM/8ZZT2D2A==",
+ "optional": true,
+ "engines": {
+ "node": ">=10.0.0"
+ }
+ },
"node_modules/bytes": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
@@ -298,6 +470,38 @@
"integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==",
"license": "ISC"
},
+ "node_modules/cliui": {
+ "version": "8.0.1",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
+ "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",
+ "license": "ISC",
+ "dependencies": {
+ "string-width": "^4.2.0",
+ "strip-ansi": "^6.0.1",
+ "wrap-ansi": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "license": "MIT",
+ "dependencies": {
+ "color-name": "~1.1.4"
+ },
+ "engines": {
+ "node": ">=7.0.0"
+ }
+ },
+ "node_modules/color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "license": "MIT"
+ },
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
@@ -366,6 +570,20 @@
"node": ">= 0.10"
}
},
+ "node_modules/cpu-features": {
+ "version": "0.0.10",
+ "resolved": "https://registry.npmjs.org/cpu-features/-/cpu-features-0.0.10.tgz",
+ "integrity": "sha512-9IkYqtX3YHPCzoVg1Py+o9057a3i0fp7S530UWokCSaFVTc7CwXPRiOjRjBQQ18ZCNafx78YfnG+HALxtVmOGA==",
+ "hasInstallScript": true,
+ "optional": true,
+ "dependencies": {
+ "buildcheck": "~0.0.6",
+ "nan": "^2.19.0"
+ },
+ "engines": {
+ "node": ">=10.0.0"
+ }
+ },
"node_modules/data-uri-to-buffer": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz",
@@ -453,6 +671,39 @@
"node": ">=8"
}
},
+ "node_modules/docker-modem": {
+ "version": "5.0.6",
+ "resolved": "https://registry.npmjs.org/docker-modem/-/docker-modem-5.0.6.tgz",
+ "integrity": "sha512-ens7BiayssQz/uAxGzH8zGXCtiV24rRWXdjNha5V4zSOcxmAZsfGVm/PPFbwQdqEkDnhG+SyR9E3zSHUbOKXBQ==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "debug": "^4.1.1",
+ "readable-stream": "^3.5.0",
+ "split-ca": "^1.0.1",
+ "ssh2": "^1.15.0"
+ },
+ "engines": {
+ "node": ">= 8.0"
+ }
+ },
+ "node_modules/dockerode": {
+ "version": "4.0.7",
+ "resolved": "https://registry.npmjs.org/dockerode/-/dockerode-4.0.7.tgz",
+ "integrity": "sha512-R+rgrSRTRdU5mH14PZTCPZtW/zw3HDWNTS/1ZAQpL/5Upe/ye5K9WQkIysu4wBoiMwKynsz0a8qWuGsHgEvSAA==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@balena/dockerignore": "^1.0.2",
+ "@grpc/grpc-js": "^1.11.1",
+ "@grpc/proto-loader": "^0.7.13",
+ "docker-modem": "^5.0.6",
+ "protobufjs": "^7.3.2",
+ "tar-fs": "~2.1.2",
+ "uuid": "^10.0.0"
+ },
+ "engines": {
+ "node": ">= 8.0"
+ }
+ },
"node_modules/dunder-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
@@ -473,6 +724,12 @@
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
"license": "MIT"
},
+ "node_modules/emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "license": "MIT"
+ },
"node_modules/encodeurl": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
@@ -536,6 +793,15 @@
"node": ">= 0.4"
}
},
+ "node_modules/escalade": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
+ "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
@@ -792,6 +1058,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/get-caller-file": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
+ "license": "ISC",
+ "engines": {
+ "node": "6.* || 8.* || >= 10.*"
+ }
+ },
"node_modules/get-intrinsic": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
@@ -1008,6 +1283,15 @@
"node": ">=0.10.0"
}
},
+ "node_modules/is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/is-glob": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
@@ -1031,6 +1315,18 @@
"node": ">=0.12.0"
}
},
+ "node_modules/lodash.camelcase": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
+ "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==",
+ "license": "MIT"
+ },
+ "node_modules/long": {
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz",
+ "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==",
+ "license": "Apache-2.0"
+ },
"node_modules/math-intrinsics": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
@@ -1146,6 +1442,13 @@
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"license": "MIT"
},
+ "node_modules/nan": {
+ "version": "2.23.0",
+ "resolved": "https://registry.npmjs.org/nan/-/nan-2.23.0.tgz",
+ "integrity": "sha512-1UxuyYGdoQHcGg87Lkqm3FzefucTa0NAiOcuRsDmysep3c1LVCRK2krrUDafMWtjSG04htvAmvg96+SDknOmgQ==",
+ "license": "MIT",
+ "optional": true
+ },
"node_modules/napi-build-utils": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz",
@@ -1346,6 +1649,30 @@
"node": ">=10"
}
},
+ "node_modules/protobufjs": {
+ "version": "7.5.3",
+ "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.5.3.tgz",
+ "integrity": "sha512-sildjKwVqOI2kmFDiXQ6aEB0fjYTafpEvIBs8tOR8qI4spuL9OPROLVu2qZqi/xgCfsHIwVqlaF8JBjWFHnKbw==",
+ "hasInstallScript": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "@protobufjs/aspromise": "^1.1.2",
+ "@protobufjs/base64": "^1.1.2",
+ "@protobufjs/codegen": "^2.0.4",
+ "@protobufjs/eventemitter": "^1.1.0",
+ "@protobufjs/fetch": "^1.1.0",
+ "@protobufjs/float": "^1.0.2",
+ "@protobufjs/inquire": "^1.1.0",
+ "@protobufjs/path": "^1.1.2",
+ "@protobufjs/pool": "^1.1.0",
+ "@protobufjs/utf8": "^1.1.0",
+ "@types/node": ">=13.7.0",
+ "long": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ }
+ },
"node_modules/proxy-addr": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
@@ -1463,6 +1790,15 @@
"node": ">=8.10.0"
}
},
+ "node_modules/require-directory": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
+ "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
@@ -1700,6 +2036,29 @@
"node": ">=10"
}
},
+ "node_modules/split-ca": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/split-ca/-/split-ca-1.0.1.tgz",
+ "integrity": "sha512-Q5thBSxp5t8WPTTJQS59LrGqOZqOsrhDGDVm8azCqIBjSBd7nd9o2PM+mDulQQkh8h//4U6hFZnc/mul8t5pWQ==",
+ "license": "ISC"
+ },
+ "node_modules/ssh2": {
+ "version": "1.16.0",
+ "resolved": "https://registry.npmjs.org/ssh2/-/ssh2-1.16.0.tgz",
+ "integrity": "sha512-r1X4KsBGedJqo7h8F5c4Ybpcr5RjyP+aWIG007uBPRjmdQWfEiVLzSK71Zji1B9sKxwaCvD8y8cwSkYrlLiRRg==",
+ "hasInstallScript": true,
+ "dependencies": {
+ "asn1": "^0.2.6",
+ "bcrypt-pbkdf": "^1.0.2"
+ },
+ "engines": {
+ "node": ">=10.16.0"
+ },
+ "optionalDependencies": {
+ "cpu-features": "~0.0.10",
+ "nan": "^2.20.0"
+ }
+ },
"node_modules/statuses": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
@@ -1718,6 +2077,32 @@
"safe-buffer": "~5.2.0"
}
},
+ "node_modules/string-width": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "license": "MIT",
+ "dependencies": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/strip-json-comments": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
@@ -1812,6 +2197,12 @@
"node": "*"
}
},
+ "node_modules/tweetnacl": {
+ "version": "0.14.5",
+ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
+ "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==",
+ "license": "Unlicense"
+ },
"node_modules/type-is": {
"version": "1.6.18",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
@@ -1832,6 +2223,12 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/undici-types": {
+ "version": "7.10.0",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.10.0.tgz",
+ "integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==",
+ "license": "MIT"
+ },
"node_modules/unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
@@ -1856,6 +2253,19 @@
"node": ">= 0.4.0"
}
},
+ "node_modules/uuid": {
+ "version": "10.0.0",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz",
+ "integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==",
+ "funding": [
+ "https://github.com/sponsors/broofa",
+ "https://github.com/sponsors/ctavan"
+ ],
+ "license": "MIT",
+ "bin": {
+ "uuid": "dist/bin/uuid"
+ }
+ },
"node_modules/vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
@@ -1874,6 +2284,23 @@
"node": ">= 8"
}
},
+ "node_modules/wrap-ansi": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
+ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
+ }
+ },
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
@@ -1900,6 +2327,42 @@
"optional": true
}
}
+ },
+ "node_modules/y18n": {
+ "version": "5.0.8",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
+ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/yargs": {
+ "version": "17.7.2",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
+ "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",
+ "license": "MIT",
+ "dependencies": {
+ "cliui": "^8.0.1",
+ "escalade": "^3.1.1",
+ "get-caller-file": "^2.0.5",
+ "require-directory": "^2.1.1",
+ "string-width": "^4.2.3",
+ "y18n": "^5.0.5",
+ "yargs-parser": "^21.1.1"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/yargs-parser": {
+ "version": "21.1.1",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",
+ "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=12"
+ }
}
}
}
diff --git a/backend/package.json b/backend/package.json
index 8c438eb..02ffd6c 100644
--- a/backend/package.json
+++ b/backend/package.json
@@ -18,6 +18,7 @@
"better-sqlite3": "^11.10.0",
"cors": "^2.8.5",
"debug": "^4.4.1",
+ "dockerode": "^4.0.2",
"express": "^4.18.2",
"node-fetch": "^3.3.2",
"ws": "^8.14.2"
diff --git a/eslint.config.cjs b/eslint.config.cjs
new file mode 100644
index 0000000..591d029
--- /dev/null
+++ b/eslint.config.cjs
@@ -0,0 +1,325 @@
+// Root ESLint flat config – single place to manage all rules (backend + frontend)
+// Minimal, self-contained, and includes inline logging policy rules.
+
+const js = require('@eslint/js');
+const globals = require('globals');
+let reactHooks;
+try { reactHooks = require('eslint-plugin-react-hooks'); } catch { reactHooks = null; }
+
+// Inline custom plugin: `logs`
+const logsPlugin = {
+ rules: {
+ // Disallow emojis in any logger.* arguments
+ 'no-emoji-in-logs': {
+ meta: { type: 'problem', docs: { description: 'Disallow emojis in log messages' } },
+ create(context) {
+ // Use Extended_Pictographic to avoid false positives from variation selectors/ZWJ
+ const EMOJI_RE = /\p{Extended_Pictographic}/u;
+ function hasEmoji(node) {
+ if (!node) return false;
+ if (node.type === 'Literal' && typeof node.value === 'string') return EMOJI_RE.test(node.value);
+ if (node.type === 'TemplateLiteral') {
+ return node.quasis.some((q) => EMOJI_RE.test(q.value.raw || q.value.cooked || ''));
+ }
+ return false;
+ }
+ function isLoggerCall(node) {
+ return (
+ node.callee &&
+ node.callee.type === 'MemberExpression' &&
+ node.callee.property &&
+ ['debug', 'info', 'warn', 'error', 'fatal'].includes(node.callee.property.name)
+ );
+ }
+ return {
+ CallExpression(node) {
+ if (!isLoggerCall(node)) return;
+ if ((node.arguments || []).some(hasEmoji)) {
+ context.report({ node, message: 'Emojis are not allowed in log messages.' });
+ }
+ },
+ };
+ },
+ },
+
+ // Disallow gating info/warn behind debug checks
+ 'no-debug-gated-info-warn': {
+ meta: { type: 'problem', docs: { description: 'info/warn should not be gated by debug checks' } },
+ create(context) {
+ function isInfoWarnCall(node) {
+ return (
+ node.callee &&
+ node.callee.type === 'MemberExpression' &&
+ node.callee.property &&
+ ['info', 'warn'].includes(node.callee.property.name)
+ );
+ }
+ function containsDebugCheck(test) {
+ let found = false;
+ const visited = new WeakSet();
+ function visit(n) {
+ if (!n || found) return;
+ if (typeof n !== 'object') return;
+ if (visited.has(n)) return;
+ visited.add(n);
+ switch (n.type) {
+ case 'Identifier': {
+ const name = n.name || '';
+ if (/^(debug|currentDebug|DEBUG)$/i.test(name)) found = true;
+ break;
+ }
+ case 'MemberExpression': {
+ if (n.property && /^(debugEnabled|isDebugEnabled)$/i.test(n.property.name || '')) found = true;
+ visit(n.object);
+ visit(n.property);
+ break;
+ }
+ case 'CallExpression': {
+ if (
+ n.callee &&
+ n.callee.type === 'MemberExpression' &&
+ n.callee.property &&
+ n.callee.property.name === 'isDebugEnabled'
+ ) {
+ found = true;
+ }
+ (n.arguments || []).forEach(visit);
+ visit(n.callee);
+ break;
+ }
+ default: {
+ for (const key in n) {
+ if (Object.prototype.hasOwnProperty.call(n, key)) {
+ if (key === 'parent') continue;
+ const v = n[key];
+ if (v && typeof v === 'object') {
+ if (Array.isArray(v)) v.forEach(visit);
+ else visit(v);
+ }
+ }
+ }
+ }
+ }
+ }
+ visit(test);
+ return found;
+ }
+ return {
+ CallExpression(node) {
+ if (!isInfoWarnCall(node)) return;
+ // Walk up ancestors to see if within an if/conditional using a debug check
+ const sourceCode = context.sourceCode || context.getSourceCode();
+ const ancestors = sourceCode.getAncestors(node);
+ for (let i = ancestors.length - 1; i >= 0; i--) {
+ const a = ancestors[i];
+ if (a.type === 'IfStatement' || a.type === 'ConditionalExpression') {
+ const test = a.type === 'IfStatement' ? a.test : a.test;
+ if (containsDebugCheck(test)) {
+ context.report({ node, message: 'Do not gate info/warn logs behind debug checks.' });
+ return;
+ }
+ }
+ }
+ },
+ };
+ },
+ },
+
+ // Prefer message + metadata object (soft)
+ 'logger-requires-metadata': {
+ meta: { type: 'suggestion', docs: { description: 'Prefer passing metadata object with logs' } },
+ create(context) {
+ function isLogCall(node) {
+ return (
+ node.callee &&
+ node.callee.type === 'MemberExpression' &&
+ node.callee.property &&
+ ['info', 'warn', 'error', 'debug', 'fatal'].includes(node.callee.property.name)
+ );
+ }
+ return {
+ CallExpression(node) {
+ if (!isLogCall(node)) return;
+ const args = node.arguments || [];
+ if (args.length <= 1) {
+ // One string or template only
+ if (
+ args.length === 1 &&
+ (args[0].type === 'Literal' && typeof args[0].value === 'string' || args[0].type === 'TemplateLiteral')
+ ) {
+ context.report({ node, message: 'Consider adding a metadata object to logs for context.' });
+ }
+ }
+ },
+ };
+ },
+ },
+
+ // Encourage including an Error object or { err } when logging errors
+ 'error-object-in-logger-error': {
+ meta: { type: 'suggestion', docs: { description: 'Include Error object or { err } in logger.error' } },
+ create(context) {
+ function isErrorCall(node) {
+ return (
+ node.callee &&
+ node.callee.type === 'MemberExpression' &&
+ node.callee.property &&
+ node.callee.property.name === 'error'
+ );
+ }
+ function hasErrorArg(arg) {
+ if (!arg) return false;
+ if (arg.type === 'Identifier' && /^(err|error|e)$/i.test(arg.name)) return true;
+ if (arg.type === 'NewExpression' && arg.callee && arg.callee.name === 'Error') return true;
+ if (arg.type === 'ObjectExpression') {
+ return arg.properties.some((p) => {
+ const keyName = p.key && (p.key.name || (p.key.value != null ? String(p.key.value) : ''));
+ return /^(err|error)$/i.test(keyName || '');
+ });
+ }
+ if (arg.type === 'MemberExpression') {
+ const prop = arg.property && (arg.property.name || (arg.property.value != null ? String(arg.property.value) : ''));
+ if (prop && /^(stack|message)$/i.test(prop)) return true;
+ }
+ return false;
+ }
+ return {
+ CallExpression(node) {
+ if (!isErrorCall(node)) return;
+ const args = node.arguments || [];
+ if (!args.some(hasErrorArg)) {
+ context.report({ node, message: 'Include an Error object or { err } when logging errors.' });
+ }
+ },
+ };
+ },
+ },
+
+ // Avoid logging raw req/res objects and request bodies/headers
+ 'no-raw-req-res-body-logging': {
+ meta: { type: 'suggestion', docs: { description: 'Avoid logging raw req/res or req.body/headers' } },
+ create(context) {
+ function isLogCall(node) {
+ return (
+ node.callee &&
+ node.callee.type === 'MemberExpression' &&
+ node.callee.property &&
+ ['info', 'warn', 'error', 'debug', 'fatal'].includes(node.callee.property.name)
+ );
+ }
+ function mentionsReqRes(node) {
+ let found = false;
+ const visited = new WeakSet();
+ function visit(n) {
+ if (!n || found) return;
+ if (typeof n !== 'object') return;
+ if (visited.has(n)) return;
+ visited.add(n);
+ if (n.type === 'Identifier' && /^(req|res)$/i.test(n.name)) { found = true; return; }
+ if (n.type === 'MemberExpression') {
+ const obj = n.object;
+ const prop = n.property;
+ if (obj && obj.type === 'Identifier' && /^(req|res)$/i.test(obj.name)) { found = true; }
+ const propName = prop && (prop.name || (prop.value != null ? String(prop.value) : ''));
+ if (propName && /^(body|headers|rawHeaders)$/i.test(propName)) { found = true; }
+ visit(obj); visit(prop);
+ return;
+ }
+ for (const key in n) {
+ if (Object.prototype.hasOwnProperty.call(n, key)) {
+ if (key === 'parent') continue;
+ const v = n[key];
+ if (v && typeof v === 'object') {
+ if (Array.isArray(v)) v.forEach(visit); else visit(v);
+ }
+ }
+ }
+ }
+ visit(node);
+ return found;
+ }
+ return {
+ CallExpression(node) {
+ if (!isLogCall(node)) return;
+ // Only analyze arguments, not the entire node to avoid cycles
+ const args = node.arguments || [];
+ for (const arg of args) {
+ if (mentionsReqRes(arg)) {
+ context.report({ node, message: 'Avoid logging raw req/res or request bodies/headers.' });
+ break;
+ }
+ }
+ },
+ };
+ },
+ },
+ },
+};
+
+module.exports = [
+ // Global ignores
+ { ignores: ['**/node_modules/**', '**/dist/**', '**/build/**', '**/*.min.js', '**/*.bundle.js', 'portracker.tar', 'scripts/**'] },
+
+ // Backend (Node.js, CJS)
+ {
+ files: ['backend/**/*.js'],
+ languageOptions: {
+ ecmaVersion: 'latest',
+ sourceType: 'commonjs',
+ globals: globals.node,
+ },
+ plugins: { logs: logsPlugin },
+ rules: {
+ ...js.configs.recommended.rules,
+ 'no-console': 'error',
+ // Eliminate warnings across the codebase (temporarily disable noisy rules)
+ 'no-unused-vars': 'off',
+ 'no-useless-escape': 'off',
+ 'no-empty': 'off',
+ 'logs/no-emoji-in-logs': 'error',
+ 'logs/no-debug-gated-info-warn': 'error',
+ 'logs/logger-requires-metadata': 'off',
+ 'logs/error-object-in-logger-error': 'off',
+ 'logs/no-raw-req-res-body-logging': 'off',
+ },
+ },
+
+ // Frontend (browser, ESM + JSX)
+ {
+ files: ['frontend/**/*.{js,jsx}'],
+ languageOptions: {
+ ecmaVersion: 'latest',
+ sourceType: 'module',
+ globals: globals.browser,
+ parserOptions: { ecmaFeatures: { jsx: true } },
+ },
+ plugins: { logs: logsPlugin, ...(reactHooks ? { 'react-hooks': reactHooks } : {}) },
+ rules: {
+ ...js.configs.recommended.rules,
+ 'no-console': 'error',
+ 'no-unused-vars': 'off',
+ 'no-useless-escape': 'off',
+ 'no-empty': 'off',
+ ...(reactHooks ? { 'react-hooks/rules-of-hooks': 'error', 'react-hooks/exhaustive-deps': 'warn' } : {}),
+ 'logs/no-emoji-in-logs': 'error',
+ 'logs/no-debug-gated-info-warn': 'error',
+ 'logs/logger-requires-metadata': 'off',
+ 'logs/error-object-in-logger-error': 'off',
+ 'logs/no-raw-req-res-body-logging': 'off',
+ },
+ },
+
+ // Allow console in logger implementation files
+ {
+ files: ['backend/lib/logger.js', 'frontend/src/lib/logger.js'],
+ // Disable console rule and custom logging plugin rules so logger impls don't self-flag
+ rules: {
+ 'no-console': 'off',
+ 'logs/no-emoji-in-logs': 'off',
+ 'logs/no-debug-gated-info-warn': 'off',
+ 'logs/logger-requires-metadata': 'off',
+ 'logs/error-object-in-logger-error': 'off',
+ 'logs/no-raw-req-res-body-logging': 'off',
+ },
+ },
+];
diff --git a/frontend/eslint.config.js b/frontend/eslint.config.js
deleted file mode 100644
index ec2b712..0000000
--- a/frontend/eslint.config.js
+++ /dev/null
@@ -1,33 +0,0 @@
-import js from '@eslint/js'
-import globals from 'globals'
-import reactHooks from 'eslint-plugin-react-hooks'
-import reactRefresh from 'eslint-plugin-react-refresh'
-
-export default [
- { ignores: ['dist'] },
- {
- files: ['**/*.{js,jsx}'],
- languageOptions: {
- ecmaVersion: 2020,
- globals: globals.browser,
- parserOptions: {
- ecmaVersion: 'latest',
- ecmaFeatures: { jsx: true },
- sourceType: 'module',
- },
- },
- plugins: {
- 'react-hooks': reactHooks,
- 'react-refresh': reactRefresh,
- },
- rules: {
- ...js.configs.recommended.rules,
- ...reactHooks.configs.recommended.rules,
- 'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
- 'react-refresh/only-export-components': [
- 'warn',
- { allowConstantExport: true },
- ],
- },
- },
-]
diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx
index 37f9427..615bcf4 100644
--- a/frontend/src/App.jsx
+++ b/frontend/src/App.jsx
@@ -24,13 +24,7 @@ const keyOf = (srvId, p) => `${srvId}-${p.host_ip}-${p.host_port}`;
// Initialize logger for App component
const logger = new Logger('App');
-/**
- * Main React component for the server and port monitoring dashboard.
- *
- * Manages state, data fetching, transformation, and user interactions for displaying and managing servers and their network ports. Handles UI preferences, filtering, searching, note editing, port ignoring, server addition and deletion, and clipboard actions. Synchronizes relevant state with localStorage and supports auto-refresh and error fallback mechanisms.
- *
- * @return {JSX.Element} The rendered dashboard application.
- */
+
export default function App() {
const [groups, setGroups] = useState([]);
const [loading, setLoading] = useState(true);
diff --git a/frontend/src/components/server/ActionButton.jsx b/frontend/src/components/server/ActionButton.jsx
index 5730462..018a852 100644
--- a/frontend/src/components/server/ActionButton.jsx
+++ b/frontend/src/components/server/ActionButton.jsx
@@ -5,7 +5,6 @@ export function ActionButton({
itemKey,
actionFeedback,
onClick,
- // eslint-disable-next-line no-unused-vars
icon: Icon,
title,
loading = false,
diff --git a/frontend/src/components/server/ServerSection.jsx b/frontend/src/components/server/ServerSection.jsx
index 5a8618e..3e90583 100644
--- a/frontend/src/components/server/ServerSection.jsx
+++ b/frontend/src/components/server/ServerSection.jsx
@@ -63,7 +63,7 @@ function ServerSectionComponent({
onInfoCardLayoutChange,
}) {
// Initialize logger for ServerSection component
- const logger = new Logger('ServerSection');
+ const logger = useMemo(() => new Logger('ServerSection'), []);
const [sortConfig, setSortConfig] = useState(() => {
try {
@@ -85,6 +85,24 @@ function ServerSectionComponent({
[data]
);
+ // Safety net: sanitize bad saved sort configs on mount
+ useEffect(() => {
+ const validKeys = ["default", "host_port", "owner", "created"];
+ let { key, direction } = sortConfig;
+ let changed = false;
+ if (!validKeys.includes(key)) {
+ key = "default";
+ direction = "ascending";
+ changed = true;
+ }
+ if (direction !== "ascending" && direction !== "descending") {
+ direction = "ascending";
+ changed = true;
+ }
+ if (changed) setSortConfig({ key, direction });
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
+
const sortedPorts = useMemo(() => {
let sortablePorts = [...visiblePorts];
@@ -92,25 +110,34 @@ function ServerSectionComponent({
return sortablePorts;
}
+ const asc = sortConfig.direction === "ascending";
+ const normalizeForSort = (val) => {
+ if (val == null) return "";
+ if (Array.isArray(val)) return val.join(", ");
+ if (typeof val === "number") return String(val);
+ return String(val);
+ };
+
if (sortConfig.key) {
sortablePorts.sort((a, b) => {
+ // Numeric sorts
if (sortConfig.key === "host_port") {
- const portA = parseInt(a.host_port, 10);
- const portB = parseInt(b.host_port, 10);
- return sortConfig.direction === "ascending"
- ? portA - portB
- : portB - portA;
+ const portA = parseInt(a.host_port, 10) || 0;
+ const portB = parseInt(b.host_port, 10) || 0;
+ return asc ? portA - portB : portB - portA;
+ }
+ if (sortConfig.key === "created") {
+ const aNum = Number(a.created ?? 0);
+ const bNum = Number(b.created ?? 0);
+ return asc ? aNum - bNum : bNum - aNum;
}
- const valA = a[sortConfig.key] || "";
- const valB = b[sortConfig.key] || "";
+ // Safe string sort
+ const valA = normalizeForSort(a[sortConfig.key]).toLowerCase();
+ const valB = normalizeForSort(b[sortConfig.key]).toLowerCase();
- if (valA.toLowerCase() < valB.toLowerCase()) {
- return sortConfig.direction === "ascending" ? -1 : 1;
- }
- if (valA.toLowerCase() > valB.toLowerCase()) {
- return sortConfig.direction === "ascending" ? 1 : -1;
- }
+ if (valA < valB) return asc ? -1 : 1;
+ if (valA > valB) return asc ? 1 : -1;
return 0;
});
}
@@ -123,7 +150,7 @@ function ServerSectionComponent({
} catch (error) {
logger.warn("Failed to save sort config:", error);
}
- }, [sortConfig]);
+ }, [logger, sortConfig]);
const getSortDisplayName = (key) => {
switch (key) {
diff --git a/frontend/src/lib/logger.js b/frontend/src/lib/logger.js
index e856c13..156e97d 100644
--- a/frontend/src/lib/logger.js
+++ b/frontend/src/lib/logger.js
@@ -19,18 +19,30 @@ class Logger {
}
// Check URL parameters
- const urlParams = new URLSearchParams(window.location.search);
- if (urlParams.get('debug') === 'true') {
- return true;
+ try {
+ if (typeof window !== 'undefined' && window.location && typeof window.location.search === 'string') {
+ const urlParams = new URLSearchParams(window.location.search);
+ const dbg = urlParams.get('debug');
+ if (dbg === 'true' || dbg === '1') {
+ return true;
+ }
+ if (dbg === 'false' || dbg === '0') {
+ return false;
+ }
+ }
+ } catch {
+ // Ignore if URL parsing fails (e.g., non-browser env)
}
// Check localStorage
try {
- const stored = localStorage.getItem('portracker_debug');
- if (stored === 'true') return true;
- if (stored === 'false') return false;
- } catch {
- // localStorage might not be available
+ if (typeof localStorage !== 'undefined') {
+ const stored = localStorage.getItem('portracker_debug');
+ if (stored === 'true') return true;
+ if (stored === 'false') return false;
+ }
+ } catch {
+ // localStorage might not be available (SSR/tests)
}
return false; // Default to false for production
@@ -87,12 +99,6 @@ class Logger {
}
}
-/**
- * Creates and returns a new Logger instance for the specified component.
- * @param {string} componentName - The name of the component associated with the logger.
- * @param {Object} [options={}] - Optional configuration for the logger, such as debug settings.
- * @return {Logger} A Logger instance configured for the given component.
- */
function LoggerFactory(componentName, options = {}) {
return new Logger(componentName, options);
}
diff --git a/frontend/src/lib/utils.js b/frontend/src/lib/utils.js
index a51a331..eb455bb 100644
--- a/frontend/src/lib/utils.js
+++ b/frontend/src/lib/utils.js
@@ -45,7 +45,18 @@ export function formatCpuSpeed(mhz) {
export function formatCreatedDate(dateString) {
if (!dateString) return "N/A";
- const date = new Date(dateString.replace(" +0000 UTC", "Z"));
+
+ let date;
+ if (typeof dateString === 'number') {
+ // Unix timestamp (seconds)
+ date = new Date(dateString * 1000);
+ } else if (typeof dateString === 'string') {
+ // ISO string, possibly with UTC suffix
+ date = new Date(dateString.replace(" +0000 UTC", "Z"));
+ } else {
+ return "N/A";
+ }
+
if (isNaN(date.getTime())) return dateString;
const now = new Date();
@@ -67,7 +78,18 @@ export function formatCreatedDate(dateString) {
export function formatCreatedTooltip(dateString) {
if (!dateString) return "Created: N/A";
- const date = new Date(dateString.replace(" +0000 UTC", "Z"));
+
+ let date;
+ if (typeof dateString === 'number') {
+ // Unix timestamp (seconds)
+ date = new Date(dateString * 1000);
+ } else if (typeof dateString === 'string') {
+ // ISO string, possibly with UTC suffix
+ date = new Date(dateString.replace(" +0000 UTC", "Z"));
+ } else {
+ return "Created: N/A";
+ }
+
if (isNaN(date.getTime())) return `Created: ${dateString}`;
return (
"Created: " +
diff --git a/package-lock.json b/package-lock.json
index 950ef98..d6247a0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,9 +1,13 @@
{
- "name": "ports-tracker",
+ "name": "portracker",
+ "version": "1.0.4",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
+ "name": "portracker",
+ "version": "1.0.4",
+ "license": "MIT",
"dependencies": {
"@radix-ui/react-accordion": "^1.2.11",
"@radix-ui/react-alert-dialog": "^1.1.13",
@@ -15,6 +19,10 @@
"sqlite3": "^5.1.7"
},
"devDependencies": {
+ "@eslint/js": "^9.9.0",
+ "eslint": "^9.9.0",
+ "eslint-plugin-react-hooks": "^5.1.0",
+ "globals": "^15.11.0",
"jest": "^29.7.0"
}
},
@@ -540,6 +548,16 @@
"node": ">=6.9.0"
}
},
+ "node_modules/@babel/traverse/node_modules/globals": {
+ "version": "11.12.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz",
+ "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
"node_modules/@babel/types": {
"version": "7.27.1",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.27.1.tgz",
@@ -671,6 +689,193 @@
"node": ">=18"
}
},
+ "node_modules/@eslint-community/eslint-utils": {
+ "version": "4.7.0",
+ "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz",
+ "integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "eslint-visitor-keys": "^3.4.3"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0"
+ }
+ },
+ "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": {
+ "version": "3.4.3",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz",
+ "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/@eslint-community/regexpp": {
+ "version": "4.12.1",
+ "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz",
+ "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^12.0.0 || ^14.0.0 || >=16.0.0"
+ }
+ },
+ "node_modules/@eslint/config-array": {
+ "version": "0.21.0",
+ "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.0.tgz",
+ "integrity": "sha512-ENIdc4iLu0d93HeYirvKmrzshzofPw6VkZRKQGe9Nv46ZnWUzcF1xV01dcvEg/1wXUR61OmmlSfyeyO7EvjLxQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@eslint/object-schema": "^2.1.6",
+ "debug": "^4.3.1",
+ "minimatch": "^3.1.2"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ }
+ },
+ "node_modules/@eslint/config-helpers": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.3.1.tgz",
+ "integrity": "sha512-xR93k9WhrDYpXHORXpxVL5oHj3Era7wo6k/Wd8/IsQNnZUTzkGS29lyn3nAT05v6ltUuTFVCCYDEGfy2Or/sPA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ }
+ },
+ "node_modules/@eslint/core": {
+ "version": "0.15.2",
+ "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.15.2.tgz",
+ "integrity": "sha512-78Md3/Rrxh83gCxoUc0EiciuOHsIITzLy53m3d9UyiW8y9Dj2D29FeETqyKA+BRK76tnTp6RXWb3pCay8Oyomg==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@types/json-schema": "^7.0.15"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ }
+ },
+ "node_modules/@eslint/eslintrc": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.1.tgz",
+ "integrity": "sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ajv": "^6.12.4",
+ "debug": "^4.3.2",
+ "espree": "^10.0.1",
+ "globals": "^14.0.0",
+ "ignore": "^5.2.0",
+ "import-fresh": "^3.2.1",
+ "js-yaml": "^4.1.0",
+ "minimatch": "^3.1.2",
+ "strip-json-comments": "^3.1.1"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/@eslint/eslintrc/node_modules/argparse": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
+ "dev": true,
+ "license": "Python-2.0"
+ },
+ "node_modules/@eslint/eslintrc/node_modules/globals": {
+ "version": "14.0.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",
+ "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/@eslint/eslintrc/node_modules/js-yaml": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
+ "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "argparse": "^2.0.1"
+ },
+ "bin": {
+ "js-yaml": "bin/js-yaml.js"
+ }
+ },
+ "node_modules/@eslint/eslintrc/node_modules/strip-json-comments": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
+ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/@eslint/js": {
+ "version": "9.33.0",
+ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.33.0.tgz",
+ "integrity": "sha512-5K1/mKhWaMfreBGJTwval43JJmkip0RmM+3+IuqupeSKNC/Th2Kc7ucaq5ovTSra/OOKB9c58CGSz3QMVbWt0A==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "url": "https://eslint.org/donate"
+ }
+ },
+ "node_modules/@eslint/object-schema": {
+ "version": "2.1.6",
+ "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.6.tgz",
+ "integrity": "sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ }
+ },
+ "node_modules/@eslint/plugin-kit": {
+ "version": "0.3.5",
+ "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.3.5.tgz",
+ "integrity": "sha512-Z5kJ+wU3oA7MMIqVR9tyZRtjYPr4OC004Q4Rw7pgOKUOKkJfZ3O24nz3WYfGRpMDNmcOi3TwQOmgm7B7Tpii0w==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@eslint/core": "^0.15.2",
+ "levn": "^0.4.1"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ }
+ },
"node_modules/@floating-ui/core": {
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.7.1.tgz",
@@ -716,6 +921,72 @@
"license": "MIT",
"optional": true
},
+ "node_modules/@humanfs/core": {
+ "version": "0.19.1",
+ "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz",
+ "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=18.18.0"
+ }
+ },
+ "node_modules/@humanfs/node": {
+ "version": "0.16.6",
+ "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz",
+ "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@humanfs/core": "^0.19.1",
+ "@humanwhocodes/retry": "^0.3.0"
+ },
+ "engines": {
+ "node": ">=18.18.0"
+ }
+ },
+ "node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz",
+ "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=18.18"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/nzakas"
+ }
+ },
+ "node_modules/@humanwhocodes/module-importer": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz",
+ "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=12.22"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/nzakas"
+ }
+ },
+ "node_modules/@humanwhocodes/retry": {
+ "version": "0.4.3",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz",
+ "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=18.18"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/nzakas"
+ }
+ },
"node_modules/@istanbuljs/load-nyc-config": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz",
@@ -2258,6 +2529,13 @@
"@babel/types": "^7.20.7"
}
},
+ "node_modules/@types/estree": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
+ "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@types/graceful-fs": {
"version": "4.1.9",
"resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz",
@@ -2295,6 +2573,13 @@
"@types/istanbul-lib-report": "*"
}
},
+ "node_modules/@types/json-schema": {
+ "version": "7.0.15",
+ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
+ "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@types/node": {
"version": "22.15.21",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.21.tgz",
@@ -2336,6 +2621,29 @@
"license": "ISC",
"optional": true
},
+ "node_modules/acorn": {
+ "version": "8.15.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
+ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "acorn": "bin/acorn"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/acorn-jsx": {
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
+ "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
+ "dev": true,
+ "license": "MIT",
+ "peerDependencies": {
+ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
+ }
+ },
"node_modules/agent-base": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
@@ -3247,6 +3555,13 @@
"node": ">=4.0.0"
}
},
+ "node_modules/deep-is": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
+ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/deepmerge": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz",
@@ -3411,6 +3726,190 @@
"node": ">=8"
}
},
+ "node_modules/eslint": {
+ "version": "9.33.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.33.0.tgz",
+ "integrity": "sha512-TS9bTNIryDzStCpJN93aC5VRSW3uTx9sClUn4B87pwiCaJh220otoI0X8mJKr+VcPtniMdN8GKjlwgWGUv5ZKA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@eslint-community/eslint-utils": "^4.2.0",
+ "@eslint-community/regexpp": "^4.12.1",
+ "@eslint/config-array": "^0.21.0",
+ "@eslint/config-helpers": "^0.3.1",
+ "@eslint/core": "^0.15.2",
+ "@eslint/eslintrc": "^3.3.1",
+ "@eslint/js": "9.33.0",
+ "@eslint/plugin-kit": "^0.3.5",
+ "@humanfs/node": "^0.16.6",
+ "@humanwhocodes/module-importer": "^1.0.1",
+ "@humanwhocodes/retry": "^0.4.2",
+ "@types/estree": "^1.0.6",
+ "@types/json-schema": "^7.0.15",
+ "ajv": "^6.12.4",
+ "chalk": "^4.0.0",
+ "cross-spawn": "^7.0.6",
+ "debug": "^4.3.2",
+ "escape-string-regexp": "^4.0.0",
+ "eslint-scope": "^8.4.0",
+ "eslint-visitor-keys": "^4.2.1",
+ "espree": "^10.4.0",
+ "esquery": "^1.5.0",
+ "esutils": "^2.0.2",
+ "fast-deep-equal": "^3.1.3",
+ "file-entry-cache": "^8.0.0",
+ "find-up": "^5.0.0",
+ "glob-parent": "^6.0.2",
+ "ignore": "^5.2.0",
+ "imurmurhash": "^0.1.4",
+ "is-glob": "^4.0.0",
+ "json-stable-stringify-without-jsonify": "^1.0.1",
+ "lodash.merge": "^4.6.2",
+ "minimatch": "^3.1.2",
+ "natural-compare": "^1.4.0",
+ "optionator": "^0.9.3"
+ },
+ "bin": {
+ "eslint": "bin/eslint.js"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "url": "https://eslint.org/donate"
+ },
+ "peerDependencies": {
+ "jiti": "*"
+ },
+ "peerDependenciesMeta": {
+ "jiti": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/eslint-plugin-react-hooks": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-5.2.0.tgz",
+ "integrity": "sha512-+f15FfK64YQwZdJNELETdn5ibXEUQmW1DZL6KXhNnc2heoy/sg9VJJeT7n8TlMWouzWqSWavFkIhHyIbIAEapg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "peerDependencies": {
+ "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0"
+ }
+ },
+ "node_modules/eslint-scope": {
+ "version": "8.4.0",
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz",
+ "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "esrecurse": "^4.3.0",
+ "estraverse": "^5.2.0"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/eslint-visitor-keys": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz",
+ "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/eslint/node_modules/escape-string-regexp": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
+ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/eslint/node_modules/find-up": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
+ "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "locate-path": "^6.0.0",
+ "path-exists": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/eslint/node_modules/locate-path": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
+ "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "p-locate": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/eslint/node_modules/p-locate": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
+ "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "p-limit": "^3.0.2"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/espree": {
+ "version": "10.4.0",
+ "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz",
+ "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "acorn": "^8.15.0",
+ "acorn-jsx": "^5.3.2",
+ "eslint-visitor-keys": "^4.2.1"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
"node_modules/esprima": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
@@ -3425,6 +3924,52 @@
"node": ">=4"
}
},
+ "node_modules/esquery": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz",
+ "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "estraverse": "^5.1.0"
+ },
+ "engines": {
+ "node": ">=0.10"
+ }
+ },
+ "node_modules/esrecurse": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
+ "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "estraverse": "^5.2.0"
+ },
+ "engines": {
+ "node": ">=4.0"
+ }
+ },
+ "node_modules/estraverse": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
+ "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=4.0"
+ }
+ },
+ "node_modules/esutils": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
+ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/execa": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
@@ -3511,6 +4056,13 @@
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
"license": "MIT"
},
+ "node_modules/fast-levenshtein": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
+ "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/fb-watchman": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz",
@@ -3521,6 +4073,19 @@
"bser": "2.1.1"
}
},
+ "node_modules/file-entry-cache": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz",
+ "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "flat-cache": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=16.0.0"
+ }
+ },
"node_modules/file-uri-to-path": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
@@ -3554,6 +4119,27 @@
"node": ">=8"
}
},
+ "node_modules/flat-cache": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz",
+ "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "flatted": "^3.2.9",
+ "keyv": "^4.5.4"
+ },
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/flatted": {
+ "version": "3.3.3",
+ "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz",
+ "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==",
+ "dev": true,
+ "license": "ISC"
+ },
"node_modules/forever-agent": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
@@ -3737,14 +4323,30 @@
"url": "https://github.com/sponsors/isaacs"
}
},
+ "node_modules/glob-parent": {
+ "version": "6.0.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
+ "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "is-glob": "^4.0.3"
+ },
+ "engines": {
+ "node": ">=10.13.0"
+ }
+ },
"node_modules/globals": {
- "version": "11.12.0",
- "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz",
- "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==",
+ "version": "15.15.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-15.15.0.tgz",
+ "integrity": "sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==",
"dev": true,
"license": "MIT",
"engines": {
- "node": ">=4"
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/graceful-fs": {
@@ -3926,6 +4528,43 @@
],
"license": "BSD-3-Clause"
},
+ "node_modules/ignore": {
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
+ "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 4"
+ }
+ },
+ "node_modules/import-fresh": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz",
+ "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "parent-module": "^1.0.0",
+ "resolve-from": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/import-fresh/node_modules/resolve-from": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
+ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
"node_modules/import-local": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz",
@@ -4048,6 +4687,16 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/is-extglob": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
+ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
@@ -4068,6 +4717,19 @@
"node": ">=6"
}
},
+ "node_modules/is-glob": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
+ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-extglob": "^2.1.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/is-lambda": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz",
@@ -4853,6 +5515,13 @@
"node": ">=6"
}
},
+ "node_modules/json-buffer": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",
+ "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/json-parse-even-better-errors": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz",
@@ -4872,6 +5541,13 @@
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
"license": "MIT"
},
+ "node_modules/json-stable-stringify-without-jsonify": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",
+ "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/json-stringify-safe": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
@@ -4906,6 +5582,16 @@
"node": ">=0.6.0"
}
},
+ "node_modules/keyv": {
+ "version": "4.5.4",
+ "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
+ "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "json-buffer": "3.0.1"
+ }
+ },
"node_modules/kleur": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz",
@@ -4926,6 +5612,20 @@
"node": ">=6"
}
},
+ "node_modules/levn": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
+ "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "prelude-ls": "^1.2.1",
+ "type-check": "~0.4.0"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
"node_modules/lines-and-columns": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
@@ -4946,6 +5646,13 @@
"node": ">=8"
}
},
+ "node_modules/lodash.merge": {
+ "version": "4.6.2",
+ "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
+ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/lru-cache": {
"version": "10.4.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",
@@ -5441,6 +6148,24 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/optionator": {
+ "version": "0.9.4",
+ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz",
+ "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "deep-is": "^0.1.3",
+ "fast-levenshtein": "^2.0.6",
+ "levn": "^0.4.1",
+ "prelude-ls": "^1.2.1",
+ "type-check": "^0.4.0",
+ "word-wrap": "^1.2.5"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
"node_modules/p-limit": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
@@ -5512,6 +6237,19 @@
"node": ">=6"
}
},
+ "node_modules/parent-module": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
+ "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "callsites": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/parse-json": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz",
@@ -5643,6 +6381,16 @@
"node": ">=10"
}
},
+ "node_modules/prelude-ls": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
+ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
"node_modules/pretty-format": {
"version": "29.7.0",
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz",
@@ -6605,6 +7353,19 @@
"integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==",
"license": "Unlicense"
},
+ "node_modules/type-check": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
+ "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "prelude-ls": "^1.2.1"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
"node_modules/type-detect": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
@@ -6835,6 +7596,16 @@
"string-width": "^1.0.2 || 2 || 3 || 4"
}
},
+ "node_modules/word-wrap": {
+ "version": "1.2.5",
+ "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz",
+ "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/wrap-ansi": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
diff --git a/package.json b/package.json
index 00baebe..a572626 100644
--- a/package.json
+++ b/package.json
@@ -1,11 +1,13 @@
{
"name": "portracker",
-"version": "1.0.0",
+"version": "1.0.4",
"description": "A multi-platform port-tracking dashboard",
"main": "backend/index.js",
"scripts": {
"start": "node backend/index.js",
- "test": "jest"
+ "test": "jest",
+ "lint": "eslint .",
+ "lint:fix": "eslint . --fix"
},
"repository": {
"type": "git",
@@ -23,6 +25,10 @@
"sqlite3": "^5.1.7"
},
"devDependencies": {
- "jest": "^29.7.0"
+ "jest": "^29.7.0",
+ "eslint": "^9.9.0",
+ "@eslint/js": "^9.9.0",
+ "globals": "^15.11.0",
+ "eslint-plugin-react-hooks": "^5.1.0"
}
}