Feat: v1.4.1 - Windows installer updated.

This commit is contained in:
serversdwn
2026-03-16 20:00:42 -04:00
parent 1b8c63025f
commit e67b6eb89f
8 changed files with 160 additions and 21 deletions

View File

@@ -1,5 +1,5 @@
"""
Series 3 Watcher — v1.4.0
Series 3 Watcher — v1.4.1
Environment:
- Python 3.8 (Windows 7 compatible)
@@ -17,6 +17,7 @@ Key Features:
import os
import re
import sys
import time
import json
import threading
@@ -62,7 +63,7 @@ def load_config(path: str) -> Dict[str, Any]:
"OK_HOURS": float(get_int("OK_HOURS", 12)),
"MISSING_HOURS": float(get_int("MISSING_HOURS", 24)),
"ENABLE_LOGGING": get_bool("ENABLE_LOGGING", True),
"LOG_FILE": get_str("LOG_FILE", r"C:\SeismoEmitter\agent_logs\series3_watcher.log"),
"LOG_FILE": get_str("LOG_FILE", r"C:\Program Files\Series3Watcher\agent_logs\series3_watcher.log"),
"LOG_RETENTION_DAYS": get_int("LOG_RETENTION_DAYS", 30),
"COLORIZE": get_bool("COLORIZE", False), # Win7 default off
"MLG_HEADER_BYTES": max(256, min(get_int("MLG_HEADER_BYTES", 2048), 65536)),
@@ -216,7 +217,19 @@ def scan_latest(
# --- API heartbeat / SFM telemetry helpers ---
VERSION = "1.4.0"
VERSION = "1.4.1"
def _read_log_tail(log_file: str, n: int = 25) -> Optional[list]:
"""Return the last n lines of the log file as a list of strings, or None on failure."""
if not log_file:
return None
try:
with open(log_file, "r", errors="replace") as f:
lines = f.readlines()
return [l.rstrip("\n") for l in lines[-n:]]
except Exception:
return None
def send_api_payload(payload: dict, api_url: str) -> Optional[dict]:
@@ -301,7 +314,10 @@ def run_watcher(state: Dict[str, Any], stop_event: threading.Event) -> None:
state["log_dir"] — directory containing the log file
state["cfg"] — loaded config dict
"""
here = os.path.dirname(__file__) or "."
if getattr(sys, "frozen", False):
here = os.path.dirname(os.path.abspath(sys.executable))
else:
here = os.path.dirname(os.path.abspath(__file__)) or "."
config_path = os.path.join(here, "config.ini")
state["status"] = "starting"
@@ -441,6 +457,7 @@ def run_watcher(state: Dict[str, Any], stop_event: threading.Event) -> None:
if now_ts - last_api_ts >= interval:
hb_payload = build_sfm_payload(latest, cfg)
hb_payload["version"] = VERSION
hb_payload["log_tail"] = _read_log_tail(cfg.get("LOG_FILE", ""), 25)
response = send_api_payload(hb_payload, cfg.get("API_URL", ""))
last_api_ts = now_ts
# Surface update signal to tray