Update web ui settings

This commit is contained in:
fhs52267
2026-03-22 15:25:05 +01:00
parent 49984b6900
commit 7e6710b28e
3 changed files with 36 additions and 53 deletions

View File

@@ -1,12 +1,10 @@
ARG BUILD_FROM
FROM ghcr.io/yeraze/meshmonitor:latest
ARG BUILD_FROM=ghcr.io/yeraze/meshmonitor:latest
FROM $BUILD_FROM
# Home Assistant requirements
USER root
RUN apk add --no-cache jq
RUN apt-get update && apt-get install -y jq curl && rm -rf /var/lib/apt/lists/*
# Copy local files
COPY run.sh /
COPY run.sh /run.sh
RUN chmod a+x /run.sh
ENTRYPOINT [ "/run.sh" ]

View File

@@ -1,31 +1,25 @@
name: "MeshMonitor"
description: "Web tool for monitoring a Meshtastic Node Deployment"
version: "3.9.5.2"
description: "Meshtastic Monitoring Dashboard"
version: "0.1.0"
slug: "meshmonitor"
init: false
arch:
- aarch64
- amd64
startup: services
boot: auto
ingress: true
ingress_port: 3001
panel_icon: "mdi:mesh-network"
panel_icon: mdi:access-point-network
panel_title: "MeshMonitor"
map:
- "config:rw"
- "share:rw"
ports:
3001/tcp: 8080
ports_description:
3001/tcp: "Web Interface (Optional direct access)"
options:
meshtastic_node_ip: "192.168.1.xxx"
meshtastic_tcp_port: 4403
admin_password: "changeme"
session_secret: "generate_a_random_string_here"
disable_anonymous: true
debug_level: "info"
MESHTASTIC_NODE_IP: "192.168.1.100"
MESHTASTIC_TCP_PORT: 4403
SESSION_SECRET: "change_me_to_a_secure_random_string"
DISABLE_ANONYMOUS: false
schema:
meshtastic_node_ip: "str"
meshtastic_tcp_port: "int"
admin_password: "str"
session_secret: "str"
disable_anonymous: "bool"
debug_level: "list(error|warn|info|debug)"
MESHTASTIC_NODE_IP: str
MESHTASTIC_TCP_PORT: port
SESSION_SECRET: str
DISABLE_ANONYMOUS: bool

View File

@@ -1,34 +1,25 @@
#!/bin/sh
#!/bin/bash
CONFIG_PATH=/data/options.json
# --- Mapping HA Options to MeshMonitor Env Vars ---
export MESHTASTIC_NODE_IP=$(jq --raw-output '.meshtastic_node_ip' $CONFIG_PATH)
export MESHTASTIC_TCP_PORT=$(jq --raw-output '.meshtastic_tcp_port // 4403' $CONFIG_PATH)
export ADMIN_PASSWORD=$(jq --raw-output '.admin_password // "changeme"' $CONFIG_PATH)
export SESSION_SECRET=$(jq --raw-output '.session_secret // "default_secret"' $CONFIG_PATH)
export DISABLE_ANONYMOUS=$(jq --raw-output '.disable_anonymous // true' $CONFIG_PATH)
export DEBUG_LEVEL=$(jq --raw-output '.debug_level // "info"' $CONFIG_PATH)
export MESHTASTIC_NODE_IP=$(jq --raw-output '.MESHTASTIC_NODE_IP' $CONFIG_PATH)
export MESHTASTIC_TCP_PORT=$(jq --raw-output '.MESHTASTIC_TCP_PORT' $CONFIG_PATH)
export SESSION_SECRET=$(jq --raw-output '.SESSION_SECRET' $CONFIG_PATH)
export DISABLE_ANONYMOUS=$(jq --raw-output '.DISABLE_ANONYMOUS' $CONFIG_PATH)
# --- Fixed Add-on Environment Settings ---
export PORT=3001
export NODE_ENV=production
export DATABASE_PATH="/data/meshmonitor.db"
export PORT=3001
# Ingress/Iframe requirements
export TRUST_PROXY=true
export ALLOWED_ORIGINS="*"
export COOKIE_SECURE=false
export BASE_URL="./"
export COOKIE_SAMESITE="none"
export COOKIE_SECURE=true
# --- Ingress Path Resolution Patch ---
# This ensures that the frontend assets (JS/CSS) are requested relative
# to the Home Assistant Ingress sub-path instead of the root IP.
echo "Applying Ingress path patches..."
find /app/dist/client -type f -name "*.html" -exec sed -i 's/src="\//src=".\//g' {} +
find /app/dist/client -type f -name "*.html" -exec sed -i 's/href="\//href=".\//g' {} +
find /app/dist/client -type f -name "*.js" -exec sed -i 's/\"\/assets\//\".\/assets\//g' {} +
# Fetch the dynamic Home Assistant Ingress URL so assets load properly
if [ -n "$SUPERVISOR_TOKEN" ]; then
export BASE_URL=$(curl -s -H "Authorization: Bearer ${SUPERVISOR_TOKEN}" http://supervisor/addons/self/info | jq --raw-output '.data.ingress_url')
echo "Ingress BASE_URL set to: $BASE_URL"
fi
echo "Starting MeshMonitor on port $PORT..."
echo "Database located at $DATABASE_PATH"
cd /app
echo "Starting MeshMonitor for node: $MESHTASTIC_NODE_IP..."
exec node dist/server/server.js