From b090705b4c3693cdb19803634562efa61755b811 Mon Sep 17 00:00:00 2001 From: Chuck Date: Thu, 14 May 2026 10:34:53 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20MD5=E2=86=92SHA-256,=20shellcheck=20warn?= =?UTF-8?q?ings,=20and=20broken=20doc=20links?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit config_service.py: replace MD5 with SHA-256 for config change detection; same semantics (equality comparison), no stored hashes affected. Shell scripts — shellcheck warnings: - diagnose_web_interface.sh: remove useless cat (SC2002) - dev_plugin_setup.sh: restructure A&&B||C into if/then (SC2015) - fix_assets_permissions.sh: remove unused REAL_HOME block (SC2034) - install_web_service.sh: remove unused USER_HOME assignment (SC2034) - diagnose_web_ui.sh: remove unused SUDO assignments (SC2034) - diagnose_plugin_permissions.sh: remove unused BLUE color var (SC2034) - first_time_install.sh: remove unused CLEAR var, PACKAGE_NAME assignment, and replace loop variable with _ (SC2034) docs/PLUGIN_ARCHITECTURE_SPEC.md: fix 10 broken TOC anchor links to include section numbers matching the actual headings (MD051). Co-Authored-By: Claude Sonnet 4.6 --- docs/PLUGIN_ARCHITECTURE_SPEC.md | 20 ++++++++++---------- first_time_install.sh | 6 +----- scripts/dev/dev_plugin_setup.sh | 4 +++- scripts/diagnose_plugin_permissions.sh | 1 - scripts/diagnose_web_interface.sh | 2 +- scripts/diagnose_web_ui.sh | 5 +---- scripts/fix_perms/fix_assets_permissions.sh | 6 ------ scripts/install/install_web_service.sh | 3 --- src/config_service.py | 4 ++-- 9 files changed, 18 insertions(+), 33 deletions(-) diff --git a/docs/PLUGIN_ARCHITECTURE_SPEC.md b/docs/PLUGIN_ARCHITECTURE_SPEC.md index e21ffe33..fbd45b34 100644 --- a/docs/PLUGIN_ARCHITECTURE_SPEC.md +++ b/docs/PLUGIN_ARCHITECTURE_SPEC.md @@ -34,16 +34,16 @@ This document outlines the transformation of the LEDMatrix project into a modula ## Table of Contents -1. [Current Architecture Analysis](#current-architecture-analysis) -2. [Plugin System Design](#plugin-system-design) -3. [Plugin Store & Discovery](#plugin-store--discovery) -4. [Web UI Transformation](#web-ui-transformation) -5. [Migration Strategy](#migration-strategy) -6. [Plugin Developer Guidelines](#plugin-developer-guidelines) -7. [Technical Implementation Details](#technical-implementation-details) -8. [Best Practices & Standards](#best-practices--standards) -9. [Security Considerations](#security-considerations) -10. [Implementation Roadmap](#implementation-roadmap) +1. [Current Architecture Analysis](#1-current-architecture-analysis) +2. [Plugin System Design](#2-plugin-system-design) +3. [Plugin Store & Discovery](#3-plugin-store--discovery) +4. [Web UI Transformation](#4-web-ui-transformation) +5. [Migration Strategy](#5-migration-strategy) +6. [Plugin Developer Guidelines](#6-plugin-developer-guidelines) +7. [Technical Implementation Details](#7-technical-implementation-details) +8. [Best Practices & Standards](#8-best-practices--standards) +9. [Security Considerations](#9-security-considerations) +10. [Implementation Roadmap](#10-implementation-roadmap) --- diff --git a/first_time_install.sh b/first_time_install.sh index 9f98c91e..4b9ac4a6 100644 --- a/first_time_install.sh +++ b/first_time_install.sh @@ -259,8 +259,6 @@ else fi echo "" -CLEAR=' -' CURRENT_STEP="Install system dependencies" echo "Step 1: Installing system dependencies..." echo "----------------------------------------" @@ -671,8 +669,6 @@ if [ -f "$PROJECT_ROOT_DIR/requirements.txt" ]; then echo "[$PACKAGE_NUM/$TOTAL_PACKAGES] Installing: $line" # Check if package is already installed (basic check - may not catch all cases) - PACKAGE_NAME=$(echo "$line" | sed -E 's/[<>=!].*$//' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//') - # Try installing with verbose output and timeout (if available) # Use --no-cache-dir to avoid cache issues, --verbose for diagnostics INSTALL_OUTPUT=$(mktemp) @@ -1479,7 +1475,7 @@ echo "WiFi Connection Status:" if command -v nmcli >/dev/null 2>&1; then WIFI_STATUS=$(nmcli -t -f DEVICE,TYPE,STATE device status 2>/dev/null | grep -i wifi || echo "") if [ -n "$WIFI_STATUS" ]; then - echo "$WIFI_STATUS" | while IFS=':' read -r device type state; do + echo "$WIFI_STATUS" | while IFS=':' read -r _ type state; do if [ "$state" = "connected" ]; then SSID=$(nmcli -t -f active,ssid device wifi 2>/dev/null | grep "^yes:" | cut -d: -f2 | head -1) if [ -n "$SSID" ]; then diff --git a/scripts/dev/dev_plugin_setup.sh b/scripts/dev/dev_plugin_setup.sh index d53fd315..c05044b1 100755 --- a/scripts/dev/dev_plugin_setup.sh +++ b/scripts/dev/dev_plugin_setup.sh @@ -203,7 +203,9 @@ link_github_plugin() { log_info "Repository already exists at $target_dir" if [[ -d "$target_dir/.git" ]]; then log_info "Updating repository..." - (cd "$target_dir" && git pull --rebase || true) + if cd "$target_dir"; then + git pull --rebase || true + fi fi else # Clone the repository diff --git a/scripts/diagnose_plugin_permissions.sh b/scripts/diagnose_plugin_permissions.sh index 64a7bd66..3e3b3104 100755 --- a/scripts/diagnose_plugin_permissions.sh +++ b/scripts/diagnose_plugin_permissions.sh @@ -13,7 +13,6 @@ echo "" RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' -BLUE='\033[0;34m' NC='\033[0m' # No Color # Get the actual user diff --git a/scripts/diagnose_web_interface.sh b/scripts/diagnose_web_interface.sh index 6ae07507..b9b304c3 100644 --- a/scripts/diagnose_web_interface.sh +++ b/scripts/diagnose_web_interface.sh @@ -41,7 +41,7 @@ if [ -f "$PROJECT_DIR/config/config.json" ]; then echo -e "${GREEN}✓ Config file found${NC}" # Check web_display_autostart setting - AUTOSTART=$(cat "$PROJECT_DIR/config/config.json" | grep -o '"web_display_autostart"[[:space:]]*:[[:space:]]*[a-z]*' | grep -o '[a-z]*$') + AUTOSTART=$(grep -o '"web_display_autostart"[[:space:]]*:[[:space:]]*[a-z]*' "$PROJECT_DIR/config/config.json" | grep -o '[a-z]*$') if [ "$AUTOSTART" == "true" ]; then echo -e "${GREEN}✓ web_display_autostart: true${NC}" diff --git a/scripts/diagnose_web_ui.sh b/scripts/diagnose_web_ui.sh index cd5d11cf..e2226f1a 100755 --- a/scripts/diagnose_web_ui.sh +++ b/scripts/diagnose_web_ui.sh @@ -16,11 +16,8 @@ YELLOW='\033[1;33m' NC='\033[0m' # No Color # Check if running as root or with sudo -if [ "$EUID" -ne 0 ]; then +if [ "$EUID" -ne 0 ]; then echo -e "${YELLOW}Warning: Some checks require sudo. Running what we can...${NC}" - SUDO="" -else - SUDO="" fi PROJECT_DIR="${HOME}/LEDMatrix" diff --git a/scripts/fix_perms/fix_assets_permissions.sh b/scripts/fix_perms/fix_assets_permissions.sh index 604b244e..9000a338 100644 --- a/scripts/fix_perms/fix_assets_permissions.sh +++ b/scripts/fix_perms/fix_assets_permissions.sh @@ -7,12 +7,6 @@ echo "Fixing LEDMatrix assets directory permissions..." # Get the real user (not root when running with sudo) REAL_USER=${SUDO_USER:-$USER} -# Resolve the home directory of the real user robustly -if command -v getent >/dev/null 2>&1; then - REAL_HOME=$(getent passwd "$REAL_USER" | cut -d: -f6) -else - REAL_HOME=$(eval echo ~"$REAL_USER") -fi REAL_GROUP=$(id -gn "$REAL_USER") # Get the project directory diff --git a/scripts/install/install_web_service.sh b/scripts/install/install_web_service.sh index 3653be13..23575080 100644 --- a/scripts/install/install_web_service.sh +++ b/scripts/install/install_web_service.sh @@ -14,9 +14,6 @@ else ACTUAL_USER=$(whoami) fi -# Get the home directory of the actual user -USER_HOME=$(eval echo ~$ACTUAL_USER) - # Determine the Project Root Directory (parent of scripts/install/) PROJECT_ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd) diff --git a/src/config_service.py b/src/config_service.py index 44f16af3..c409236f 100644 --- a/src/config_service.py +++ b/src/config_service.py @@ -114,9 +114,9 @@ class ConfigService: self._start_file_watching() def _calculate_checksum(self, config: Dict[str, Any]) -> str: - """Calculate MD5 checksum of configuration.""" + """Calculate checksum of configuration for change detection.""" config_str = json.dumps(config, sort_keys=True) - return hashlib.md5(config_str.encode()).hexdigest() + return hashlib.sha256(config_str.encode()).hexdigest() def _load_config(self) -> bool: """