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 ARG BUILD_FROM=ghcr.io/yeraze/meshmonitor:latest
FROM ghcr.io/yeraze/meshmonitor:latest FROM $BUILD_FROM
# Home Assistant requirements
USER root 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 /run.sh
COPY run.sh /
RUN chmod a+x /run.sh RUN chmod a+x /run.sh
ENTRYPOINT [ "/run.sh" ] ENTRYPOINT [ "/run.sh" ]

View File

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

View File

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