agent-relay-server 0.4.19 → 0.4.20

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-relay-server",
3
- "version": "0.4.19",
3
+ "version": "0.4.20",
4
4
  "description": "Lightweight HTTP message relay for inter-agent communication across machines",
5
5
  "module": "src/index.ts",
6
6
  "type": "module",
@@ -192,8 +192,13 @@
192
192
  registerTaskEvents(this, es);
193
193
  }
194
194
 
195
+ function baseUrl() {
196
+ const href = window.location.href.split("?")[0].split("#")[0];
197
+ return href.endsWith("/") ? href : href + "/";
198
+ }
199
+
195
200
  function buildEventsUrl(authToken) {
196
- const eventUrl = new URL(window.location.origin + "/api/events");
201
+ const eventUrl = new URL("api/events", baseUrl());
197
202
  if (authToken) eventUrl.searchParams.set("token", authToken);
198
203
  return eventUrl.toString();
199
204
  }
@@ -258,7 +263,7 @@
258
263
  opts.body = JSON.stringify(body);
259
264
  }
260
265
 
261
- const response = await fetch(window.location.origin + "/api" + path, opts);
266
+ const response = await fetch(new URL("api" + path, baseUrl()), opts);
262
267
  if (!response.ok) {
263
268
  if (response.status === 401) this.authNeeded = true;
264
269
  const text = await response.text();
package/public/index.html CHANGED
@@ -855,7 +855,7 @@
855
855
  <script src="https://cdn.jsdelivr.net/npm/@tabler/core@latest/dist/js/tabler.min.js"></script>
856
856
  <script src="https://cdn.jsdelivr.net/npm/apexcharts@latest/dist/apexcharts.min.js"></script>
857
857
  <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3/dist/cdn.min.js"></script>
858
- <script src="/dashboard.js"></script>
858
+ <script src="dashboard.js"></script>
859
859
 
860
860
  </body>
861
861
  </html>