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.
- package/CHANGELOG.md +10 -0
- package/dist/bin.js.map +1 -1
- package/dist/docs/400-reference/200-configuration.md +35 -0
- package/dist/docs/400-reference/500-server/400-notifications.md +4 -0
- package/dist/exports/client.d.ts.map +1 -1
- package/dist/exports/client.js +49 -7
- package/dist/exports/client.js.map +1 -1
- package/dist/internal/server/coordinator/server-child.js +25 -1
- package/dist/internal/server/coordinator/server-child.js.map +1 -1
- package/dist/push/THIRD_PARTY_NOTICES.md +30 -0
- package/dist/push/badge.png +0 -0
- package/dist/push/icon.png +0 -0
- package/dist/push/sw.js +88 -0
- package/dist/push/sw.js.map +1 -0
- package/docs/400-reference/200-configuration.md +35 -0
- package/docs/400-reference/500-server/400-notifications.md +4 -0
- package/package.json +2 -2
- package/src/internal/client/background-notifications.ts +3 -1
- package/src/internal/client/host/hosted-pages/browser-notification-settings.tsx +8 -3
- package/src/internal/client/push-assets/badge.png +0 -0
- package/src/internal/client/push-assets/icon.png +0 -0
- package/src/internal/client/push-service-worker.ts +118 -0
- package/src/internal/client/register-push-worker.ts +63 -0
- package/src/internal/server/http/routes.ts +47 -2
- package/src/internal/shared/routes.ts +2 -0
|
@@ -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",
|