@volter/world-host 3.0.5 → 3.0.7
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/dist/src/twins-host.js +6 -1
- package/package.json +5 -5
- package/src/twins-host.ts +5 -1
package/dist/src/twins-host.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import { chmodSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
18
18
|
import { assertStateRemovable, serveHttp, stateDirName, withAncestryLock, withStateRemoval } from '@volter/world-core/runtime';
|
|
19
19
|
import { dirname, join, resolve } from 'node:path';
|
|
20
|
-
import { assertWorldStateRemovable, resolveCatalog, CONSOLE_BASE, consoleRedirect, initWorld, LocalBranches, loadWorldConfig, localWorldOrigin, mountWorld, pathOfWorld, worldOriginLabel, serveConsoleApart, worldDoorUnderConsole, TOKEN_HEADER, worldOfHost } from '@volter/world-runtime';
|
|
20
|
+
import { assertWorldStateRemovable, resolveCatalog, CONSOLE_BASE, consoleRedirect, initWorld, LocalBranches, loadWorldConfig, localWorldOrigin, mountWorld, pathOfWorld, worldOriginLabel, serveConsoleApart, siteOfHost, worldDoorUnderConsole, TOKEN_HEADER, worldOfHost } from '@volter/world-runtime';
|
|
21
21
|
import { issuerKeys, trustableIssuer } from '@volter/world-access';
|
|
22
22
|
export { CONSOLE_BASE };
|
|
23
23
|
const NAME = /^[a-z0-9][a-z0-9._-]{0,63}$/i;
|
|
@@ -274,6 +274,11 @@ export async function createWorldHost(options) {
|
|
|
274
274
|
const at = new URL(request.url);
|
|
275
275
|
const path = at.pathname;
|
|
276
276
|
// a World's own origin serves that World (and the ping and the console) and no other, nor the admin doors
|
|
277
|
+
// a site the World's twins answer, under the World's local origin (`<hostname>.<world>--<org>.localhost`): only on
|
|
278
|
+
// this machine's loopback origins, where the World's own page needs no token either
|
|
279
|
+
const site = origins && !originBase ? siteOfHost(at.hostname, byServed.keys()) : undefined;
|
|
280
|
+
if (site)
|
|
281
|
+
return byServed.get(site.world).site(request, site.site);
|
|
277
282
|
const own = origins ? worldOfHost(at.hostname, byServed.keys(), originBase) : undefined;
|
|
278
283
|
if (own === null)
|
|
279
284
|
return json({ error: `no world at ${at.host}` }, 404);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/world-host",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7",
|
|
4
4
|
"description": "The hosted remote: worlds under one URL, each holding the canonical history of a real vendor account and its sealed credential — what a local world clones from and pushes to.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"twin",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@volter/world-access": "3.0.1",
|
|
30
|
-
"@volter/world-core": "3.0.
|
|
31
|
-
"@volter/world-runtime": "3.0.
|
|
30
|
+
"@volter/world-core": "3.0.7",
|
|
31
|
+
"@volter/world-runtime": "3.0.7"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@volter/world-console": "3.0.
|
|
34
|
+
"@volter/world-console": "3.0.2"
|
|
35
35
|
},
|
|
36
36
|
"peerDependenciesMeta": {
|
|
37
37
|
"@volter/world-console": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@volter/world-console": "3.0.
|
|
42
|
+
"@volter/world-console": "3.0.2"
|
|
43
43
|
},
|
|
44
44
|
"exports": {
|
|
45
45
|
".": {
|
package/src/twins-host.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import { chmodSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
18
18
|
import { assertStateRemovable, serveHttp, stateDirName, withAncestryLock, withStateRemoval } from '@volter/world-core/runtime';
|
|
19
19
|
import { dirname, join, resolve } from 'node:path';
|
|
20
|
-
import { assertWorldStateRemovable, resolveCatalog, CONSOLE_BASE, consoleRedirect, initWorld, LocalBranches, loadWorldConfig, localWorldOrigin, mountWorld, pathOfWorld, worldOriginLabel, serveConsoleApart, worldDoorUnderConsole, TOKEN_HEADER, worldOfHost, type ConsoleMount, type MountedWorld } from '@volter/world-runtime';
|
|
20
|
+
import { assertWorldStateRemovable, resolveCatalog, CONSOLE_BASE, consoleRedirect, initWorld, LocalBranches, loadWorldConfig, localWorldOrigin, mountWorld, pathOfWorld, worldOriginLabel, serveConsoleApart, siteOfHost, worldDoorUnderConsole, TOKEN_HEADER, worldOfHost, type ConsoleMount, type MountedWorld } from '@volter/world-runtime';
|
|
21
21
|
|
|
22
22
|
import { issuerKeys, trustableIssuer, type TrustedIssuer } from '@volter/world-access';
|
|
23
23
|
|
|
@@ -239,6 +239,10 @@ export async function createWorldHost(options: WorldHostOptions): Promise<WorldH
|
|
|
239
239
|
async fetch(request) {
|
|
240
240
|
const at = new URL(request.url); const path = at.pathname;
|
|
241
241
|
// a World's own origin serves that World (and the ping and the console) and no other, nor the admin doors
|
|
242
|
+
// a site the World's twins answer, under the World's local origin (`<hostname>.<world>--<org>.localhost`): only on
|
|
243
|
+
// this machine's loopback origins, where the World's own page needs no token either
|
|
244
|
+
const site = origins && !originBase ? siteOfHost(at.hostname, byServed.keys()) : undefined;
|
|
245
|
+
if (site) return byServed.get(site.world)!.site(request, site.site);
|
|
242
246
|
const own = origins ? worldOfHost(at.hostname, byServed.keys(), originBase) : undefined;
|
|
243
247
|
if (own === null) return json({ error: `no world at ${at.host}` }, 404);
|
|
244
248
|
if (own && !pathOfWorld(path, own, CONSOLE_BASE)) return json({ error: `this origin serves ${own} only` }, 404);
|