From dc908ef2519ea467aa3e5df94268610d62558f22 Mon Sep 17 00:00:00 2001 From: Zaine Date: Thu, 19 Mar 2026 17:58:56 +0000 Subject: [PATCH] main changes --- app.js | 71 ++++ index.html | 943 +++++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 914 insertions(+), 100 deletions(-) diff --git a/app.js b/app.js index 696d290..ae5fa68 100644 --- a/app.js +++ b/app.js @@ -14,6 +14,9 @@ const orgRoamBtn = document.getElementById("orgRoamBtn"); const orgRoamResult = document.getElementById("orgRoamResult"); const orgRoamLogs = document.getElementById("orgRoamLogs"); +const orgRoamBtn2 = document.getElementById("orgRoamBtn2"); + +let emacsEventSource = null; let webEventSource = null; let roamEventSource = null; @@ -190,6 +193,73 @@ async function pollRoamStatus() { }, 2000); } +/* ========================================= +ORG ROAM BUILD 2 (EXAMPLE OF SECOND BUILD BUTTON) +========================================= */ + +async function rerunEmacs() { + + if (!confirm("Rerun Emacs now?")) return; + + orgRoamBtn2.disabled = true; + orgRoamResult.textContent = "πŸ”„ Running Emacs..."; + roamDot.className = "dot yellow"; + orgRoamLogs.textContent = ""; + + try { + + const res = await fetch("/api/rerun-emacs", { method: "POST" }); + if (!res.ok) throw new Error(); + + closeStream(emacsEventSource); + + startLogStream("/api/rerun-emacs/logs", orgRoamLogs, src => emacsEventSource = src); + + pollEmacsStatus(); + + } catch { + + orgRoamResult.textContent = "❌ Could not start Emacs"; + orgRoamBtn2.disabled = false; + roamDot.className = "dot red"; + + } + +} +async function pollEmacsStatus() { + + const interval = setInterval(async () => { + + const res = await fetch("/api/rerun-emacs/status"); + const status = await res.json(); + + if (!status.running) { + + clearInterval(interval); + closeStream(emacsEventSource); + + orgRoamBtn2.disabled = false; + + if (status.lastExitCode === 0 || status.lastExitCode === 124) { + + orgRoamResult.textContent = "βœ… Emacs completed"; + roamDot.className = "dot green"; + + } else { + + orgRoamResult.textContent = + "⚠ Emacs finished with issue (code " + status.lastExitCode + ")"; + + roamDot.className = "dot red"; + + } + + } + + }, 2000); + +} + /* ========================================= DAILY MESSAGE ========================================= */ @@ -250,3 +320,4 @@ startCountdown(); fetchHealth(); buildBtn.addEventListener("click", runWebBuild); orgRoamBtn.addEventListener("click", runOrgRoamBuild); +orgRoamBtn2.addEventListener("click", rerunEmacs); diff --git a/index.html b/index.html index 7333bab..e61c8a6 100644 --- a/index.html +++ b/index.html @@ -2,126 +2,869 @@ + Home Server Control - + + + -
+
+ +
-

🏠 Home Server Control

-
-
-

πŸ’Œ Daily Message

-

-
-
-

⏳ Countdown

-

-
+
- -
- 🟒 All Systems Running Normally + +
+
+
Home
+ Server Control_
+
+
--:--:--
+
+
Checking status...
+
+
- -
-
- Server - -
-
- Website - -
-
- Org Notes - + +
+
+ All Systems Running Normally +
+ + +
+
+ +
+
Server
+
Online
+
+ +
+
Website
+
Idle
+
+
+
+ +
+
Org Notes
+
Idle
+
+
+
+ +
+
Uptime
+
β€”
+
+
+
- -
-

πŸ“‘ Server Status

-

- Health: - Checking... -

-

-
+ + - -
-

🌍 Website

+
+
+
πŸ’Œ  Daily Message
+
+

+
- -

πŸ’€ Waiting for action

+
+
+
⏳  Countdown
+ +
+
+
--
Days
+
--
Hours
+
--
Mins
+
--
Secs
+
+
- + + - -
+ - -
-

πŸ“š Knowledge Base

+ + - -

πŸ’€ Waiting for action

+
+
+
πŸ“‘  Server Status
+ Checking +
- + +
+
Days up
β€”
+
Hours
β€”
+
Minutes
β€”
+
Started at
β€”
+
- -
+
+
Ping History (30 checks)β€”
+
+
+
+
-
+ +
Actions
- + +
+
+
🌍  Website Deploy
+
+
+ + +
+

πŸ’€ Waiting for action

+
+ + +
+ + +
+
+
πŸ“š  Knowledge Base
+
+
+ + + + +
+ + + + +

πŸ’€ Waiting for action

+
+ + +
+ + + + + + +