omni-notify-mcp 1.3.314 → 1.3.315

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -388,12 +388,13 @@ class ServedWebview {
388
388
  forget() { }
389
389
  release() { }
390
390
  /**
391
- * One browser of this page: the address it opened (its `search`), a post that reaches that browser alone, and
391
+ * One browser of this page: the address it opened (its `search`), the public address base it came through the gateway
392
+ * on (`base`, undefined on this machine), a post that reaches that browser alone, and
392
393
  * `guard(work, { saidOnce })` for the work a service starts on its own clock (a change watch) — the same owner a browser's
393
394
  * message runs under. `saidOnce` says a failure that persists across the watch's ticks is told to this browser once.
394
395
  */
395
396
  viewerOf(socket) {
396
- const viewer = { search: socket.at, post: (message) => writeFrame(socket, postFrame(message, this.served)) };
397
+ const viewer = { search: socket.at, base: socket.base, post: (message) => writeFrame(socket, postFrame(message, this.served)) };
397
398
  viewer.guard = (work, options = {}) => this.guarded(socket, viewer, work, options.saidOnce === true);
398
399
  return viewer;
399
400
  }
@@ -1045,6 +1046,16 @@ class WebHost {
1045
1046
  socket.end("HTTP/1.1 403 Forbidden\r\nConnection: close\r\n\r\n");
1046
1047
  return;
1047
1048
  }
1049
+ try {
1050
+ socket.base = publicBase(request);
1051
+ }
1052
+ catch (err) {
1053
+ if (!(err instanceof TypeError))
1054
+ throw err;
1055
+ // OWNER: this socket request's trigger root — a gateway name that is not a host name is answered 400, and no address is built on it.
1056
+ socket.end("HTTP/1.1 400 Bad Request\r\nConnection: close\r\n\r\n");
1057
+ return;
1058
+ }
1048
1059
  const accept = crypto.createHash("sha1").update(key + WS_GUID).digest("base64");
1049
1060
  socket.write(`HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: ${accept}\r\n\r\n`);
1050
1061
  socket.setNoDelay(true);
@@ -1137,7 +1148,21 @@ function peekedRosterPage(label, home, back) {
1137
1148
  }
1138
1149
  function closedPage(extension, page) {
1139
1150
  return `<!DOCTYPE html><html><head><meta charset="utf-8">${PHONE_VIEWPORT}<title>${escapeAttribute(extension)} · ${escapeAttribute(page.title)}</title></head>
1140
- <body style="font:14px system-ui,sans-serif;padding:24px;background:#1e1e1e;color:#ccc">⚪ ${escapeAttribute(page.title)} is not open in VS Code right now, so there is nothing to show here — this page loads it the moment it opens.<script>setTimeout(function () { location.reload(); }, 5000);</script></body></html>`;
1151
+ <body style="font:14px system-ui,sans-serif;padding:24px;background:#1e1e1e;color:#ccc">⚪ ${escapeAttribute(page.title)} is not open in VS Code right now, so there is nothing to show here — this page loads it the moment it opens.<div id="said" style="margin-top:8px"></div>
1152
+ <script>(function () {
1153
+ var opened = false;
1154
+ var socket = new WebSocket((location.protocol === "https:" ? "wss:" : "ws:") + "//" + location.host + "/__bullseye/ws?page=${encodeURIComponent(page.name)}&peek=1");
1155
+ function awaitHost() {
1156
+ document.getElementById("said").textContent = "⏳ This page's host is not answering — this page reloads the moment it does";
1157
+ fetch("/__bullseye/health", { cache: "no-store" }).then(function (r) { if (r.ok) location.reload(); else if (r.status === 401) location.assign("/"); else setTimeout(awaitHost, 1000); }, function () { setTimeout(awaitHost, 1000); });
1158
+ }
1159
+ socket.addEventListener("open", function () {
1160
+ opened = true;
1161
+ fetch("/__bullseye/health", { cache: "no-store" }).then(function (r) { return r.json(); }).then(function (health) { if (health.pages[${JSON.stringify(page.name)}].live) location.reload(); });
1162
+ });
1163
+ socket.addEventListener("message", function (event) { if (JSON.parse(String(event.data)).type === "reload") location.reload(); });
1164
+ socket.addEventListener("close", function () { if (opened) awaitHost(); else document.getElementById("said").textContent = "⚠️ This page could not reach its host, so it cannot load the page when it opens — reload it to try again"; });
1165
+ })();</script></body></html>`;
1141
1166
  }
1142
1167
  function send(response, status, type, body, headers = {}) {
1143
1168
  const payload = Buffer.isBuffer(body) ? body : Buffer.from(String(body), "utf8");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omni-notify-mcp",
3
- "version": "1.3.314",
3
+ "version": "1.3.315",
4
4
  "description": "Reach your AI agents from anywhere — and let them reach you. One stdio process serves the whole tool surface to Claude Code, GitHub Copilot Chat and Codex: desktop, Telegram, Slack, ntfy, Discord, Teams and SMS are configured in one file, and agents notify you when long work finishes or a decision is needed, ask you a question and wait for your answer, and receive and reply to the messages you send them — with Do Not Disturb and idle detection deciding what actually gets through.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",