overmux 0.0.10 → 0.0.11

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.
@@ -1,7 +1,7 @@
1
1
  import { serve } from "@hono/node-server";
2
2
  import { chmod, link, mkdir, open, readFile, realpath, rename, rm, stat } from "node:fs/promises";
3
3
  import { createServer, isIP } from "node:net";
4
- import { dirname, isAbsolute, join, resolve } from "node:path";
4
+ import { basename, dirname, isAbsolute, join, resolve } from "node:path";
5
5
  import { createJiti } from "jiti";
6
6
  import { ZodError, z } from "zod";
7
7
  import { homedir, hostname } from "node:os";
@@ -1574,6 +1574,8 @@ const createRuntimeManifestHandler = ({ runtime }) => (context) => {
1574
1574
  };
1575
1575
  //#endregion
1576
1576
  //#region src/internal/shared/routes.ts
1577
+ const pushNotificationIconPath = "/_overmux/push/icon.png";
1578
+ const pushNotificationBadgePath = "/_overmux/push/badge.png";
1577
1579
  const runtimeWebSocketPath = "/api/socket";
1578
1580
  const viteInfrastructurePath = "/_overmux/vite/*";
1579
1581
  //#endregion
@@ -1608,6 +1610,17 @@ const registerHttpRoutes = ({ app, auth, authAssetsDirectory, backgroundNotifica
1608
1610
  path: "*",
1609
1611
  handler: createRequestLoggingMiddleware({ serverLogger })
1610
1612
  },
1613
+ ...[pushNotificationIconPath, pushNotificationBadgePath].map((path) => ({
1614
+ method: "GET",
1615
+ path,
1616
+ handler: async (context) => {
1617
+ const asset = await readFile(fileURLToPath(new URL(`../push/${basename(path)}`, import.meta.resolve("overmux"))));
1618
+ context.header("Cache-Control", "public, max-age=86400");
1619
+ context.header("Content-Type", "image/png");
1620
+ context.header("X-Content-Type-Options", "nosniff");
1621
+ return context.body(new Uint8Array(asset));
1622
+ }
1623
+ })),
1611
1624
  {
1612
1625
  method: "GET",
1613
1626
  path: "/_overmux/auth-shell/*",
@@ -1639,6 +1652,17 @@ const registerHttpRoutes = ({ app, auth, authAssetsDirectory, backgroundNotifica
1639
1652
  path: "*",
1640
1653
  handler: authentication.authenticate
1641
1654
  },
1655
+ {
1656
+ method: "GET",
1657
+ path: "/sw.js",
1658
+ handler: async (context) => {
1659
+ const script = await readFile(fileURLToPath(new URL("../push/sw.js", import.meta.resolve("overmux"))), "utf8");
1660
+ context.header("Cache-Control", "no-cache");
1661
+ context.header("Content-Type", "text/javascript; charset=UTF-8");
1662
+ context.header("X-Content-Type-Options", "nosniff");
1663
+ return context.body(script);
1664
+ }
1665
+ },
1642
1666
  {
1643
1667
  method: "POST",
1644
1668
  path: "/api/auth/logout",