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

@@ -34,7 +34,7 @@ DEFAULTS = {
"MISSING_HOURS": "24",
"MLG_HEADER_BYTES": "2048",
"ENABLE_LOGGING": "true",
"LOG_FILE": r"C:\SeismoEmitter\agent_logs\series3_watcher.log",
"LOG_FILE": r"C:\Program Files\Series3Watcher\agent_logs\series3_watcher.log",
"LOG_RETENTION_DAYS": "30",
"COLORIZE": "false",
}
@@ -206,7 +206,12 @@ class SettingsDialog:
# Connection
self.var_api_enabled = tk.BooleanVar(value=v["API_ENABLED"].lower() in ("1","true","yes","on"))
self.var_api_url = tk.StringVar(value=v["API_URL"])
# Strip the fixed endpoint suffix so the dialog shows just the base URL
_raw_url = v["API_URL"]
_suffix = "/api/series3/heartbeat"
if _raw_url.endswith(_suffix):
_raw_url = _raw_url[:-len(_suffix)]
self.var_api_url = tk.StringVar(value=_raw_url)
self.var_api_interval = tk.StringVar(value=v["API_INTERVAL_SECONDS"])
self.var_source_id = tk.StringVar(value=v["SOURCE_ID"])
self.var_source_type = tk.StringVar(value=v["SOURCE_TYPE"])
@@ -277,10 +282,40 @@ class SettingsDialog:
_add_label_check(f, 0, "API Enabled", self.var_api_enabled)
_add_label_entry(
f, 1, "terra-view URL", self.var_api_url,
hint="http://192.168.x.x:8000/api/heartbeat",
# URL row — entry + Test button in an inner frame
tk.Label(f, text="Terra-View URL", anchor="w").grid(
row=1, column=0, sticky="w", padx=(8, 4), pady=4
)
url_frame = tk.Frame(f)
url_frame.grid(row=1, column=1, sticky="ew", padx=(0, 8), pady=4)
url_frame.columnconfigure(0, weight=1)
url_entry = ttk.Entry(url_frame, textvariable=self.var_api_url, width=32)
url_entry.grid(row=0, column=0, sticky="ew")
# Placeholder hint behaviour
_hint = "http://192.168.x.x:8000"
if not self.var_api_url.get():
url_entry.config(foreground="grey")
url_entry.insert(0, _hint)
def _on_focus_in(e):
if url_entry.get() == _hint:
url_entry.delete(0, tk.END)
url_entry.config(foreground="black")
def _on_focus_out(e):
if not url_entry.get():
url_entry.config(foreground="grey")
url_entry.insert(0, _hint)
self.var_api_url.set("")
url_entry.bind("<FocusIn>", _on_focus_in)
url_entry.bind("<FocusOut>", _on_focus_out)
self._test_btn = ttk.Button(url_frame, text="Test", width=6,
command=self._test_connection)
self._test_btn.grid(row=0, column=1, padx=(4, 0))
self._test_status = tk.Label(url_frame, text="", anchor="w", width=20)
self._test_status.grid(row=0, column=2, padx=(6, 0))
_add_label_spinbox(f, 2, "API Interval (sec)", self.var_api_interval, 30, 3600)
@@ -289,6 +324,40 @@ class SettingsDialog:
_add_label_entry(f, 4, "Source Type", self.var_source_type, readonly=True)
def _test_connection(self):
"""POST a minimal ping to the Terra-View heartbeat endpoint and show result."""
import urllib.request
import urllib.error
self._test_status.config(text="Testing...", foreground="grey")
self._test_btn.config(state="disabled")
self.root.update_idletasks()
raw = self.var_api_url.get().strip()
if not raw or raw == "http://192.168.x.x:8000":
self._test_status.config(text="Enter a URL first", foreground="orange")
self._test_btn.config(state="normal")
return
url = raw.rstrip("/") + "/health"
try:
req = urllib.request.Request(url)
with urllib.request.urlopen(req, timeout=5) as resp:
if resp.status == 200:
self._test_status.config(text="Connected!", foreground="green")
else:
self._test_status.config(
text="HTTP {}".format(resp.status), foreground="orange"
)
except urllib.error.URLError as e:
reason = str(e.reason) if hasattr(e, "reason") else str(e)
self._test_status.config(text="Failed: {}".format(reason[:30]), foreground="red")
except Exception as e:
self._test_status.config(text="Error: {}".format(str(e)[:30]), foreground="red")
finally:
self._test_btn.config(state="normal")
def _build_tab_paths(self, nb):
f = self._tab_frame(nb, "Paths")
@@ -376,13 +445,12 @@ class SettingsDialog:
if source_id.startswith("Defaults to hostname"):
source_id = ""
# Resolve api_url placeholder
# Resolve api_url — append the fixed endpoint, strip placeholder
api_url = self.var_api_url.get().strip()
if api_url.startswith("http://192.168"):
# This is the hint — only keep it if it looks like a real URL
pass # leave as-is; user may have typed it intentionally
if api_url == "http://192.168.x.x:8000/api/heartbeat":
if api_url == "http://192.168.x.x:8000" or not api_url:
api_url = ""
else:
api_url = api_url.rstrip("/") + "/api/series3/heartbeat"
values = {
"API_ENABLED": "true" if self.var_api_enabled.get() else "false",