@fungi.computer/oyster 0.37.0 → 0.37.1

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.
@@ -53,6 +53,13 @@ export async function previewOrigins(env) {
53
53
  }
54
54
  export class PreviewRefused extends Error {
55
55
  }
56
+ // Public suffix rules only: a private-suffix preview domain still makes every
57
+ // workspace-* host one site, so the gate refuses siblings that browsers might
58
+ // treat as separate sites. Loaded on demand like previewOrigins' parser.
59
+ async function publicSite() {
60
+ const { getDomain } = await import("tldts");
61
+ return (url) => getDomain(url.hostname, { allowPrivateDomains: false });
62
+ }
56
63
  // The retained flat hostname uses the Computer's non-secret identity. Fleet
57
64
  // IDs have a computer_ prefix; configured standalone IDs can be simple labels.
58
65
  const hostnameComputer = z.string().regex(/^(?:computer_)?[a-z0-9]+$/u);
@@ -90,8 +97,12 @@ export function createStandalonePreview(storage, computerId, origins, native) {
90
97
  if (incoming.origin !== target.origin ||
91
98
  !incoming.pathname.startsWith(target.pathname))
92
99
  return new Response(null, { status: 404 });
100
+ const policy = {
101
+ entryUrl: entryUrl(origins, computerId, port),
102
+ site: await publicSite(),
103
+ };
93
104
  return access
94
- .gate(port, entryUrl(origins, computerId, port), async (admitted) => {
105
+ .gate(port, policy, async (admitted) => {
95
106
  const service = new URL("http://localhost");
96
107
  service.pathname = incoming.pathname;
97
108
  service.search = incoming.search;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/oyster",
3
- "version": "0.37.0",
3
+ "version": "0.37.1",
4
4
  "author": "Levi <levi@technomancy.dev>",
5
5
  "description": "Oyster by Fungi: open-source Apps for people and AI agents. Try with one command or run on your own Cloudflare account.",
6
6
  "homepage": "https://docs.fungi.computer/oyster",
@@ -366,7 +366,7 @@
366
366
  "@fungi.computer/capnweb": "0.12.0-fungi.0",
367
367
  "@fungi.computer/caps": "0.12.0",
368
368
  "@fungi.computer/carrier": "0.2.5",
369
- "@fungi.computer/computer": "0.14.3",
369
+ "@fungi.computer/computer": "0.14.4",
370
370
  "@fungi.computer/computer-contract": "0.5.4",
371
371
  "@fungi.computer/darkroom": "0.11.5",
372
372
  "@fungi.computer/ear-tag": "0.1.0",