Files
unkernel/js/node/devices.ts
Pooya Parsa d80c033106 net: drop the default Wisp server from the SDK
The SDK named the project's Wisp server (DEFAULT_WISP_SERVERS), and the
Node entry sent Origin: http://localhost to pass that server's allow
list (NODE_WISP_HEADERS). The server accepts only the page's origins,
so both are gone: wispBackend() takes the caller's server, and Node
sends handshake headers only when `headers` asks for them. The page
keeps wss://wisp.unkernel.dev:6680/ as its own default (web/src/net.ts).

The live Wisp test takes its server from UNKERNEL_TEST_WISP.
2026-11-27 22:24:02 +00:00

21 lines
881 B
TypeScript

// SPDX-License-Identifier: MIT
// Copyright (C) 2026 Pooya Parsa <pooya@pi0.io>
// The Node device kinds (core/devices.ts): "file" disks and "direct"
// networking over host sockets. Used by the Node platform on the caller's
// thread and by the kernel worker (worker-entry.ts).
import { coreDevices, extendDevices, type DeviceContext, type DeviceRegistry, type FileDiskSpec } from "../core/devices.ts";
import { CowDisk } from "../core/block.ts";
import { FileBase, FileDisk } from "./disk.ts";
import { directBackend } from "./net.ts";
export const nodeDevices: DeviceRegistry = extendDevices(coreDevices, {
disks: {
file: (spec: FileDiskSpec, ctx: DeviceContext) =>
spec.snapshot && !spec.readOnly ? new CowDisk(new FileBase(spec.path), { log: ctx.log }) : new FileDisk(spec.path, { readOnly: spec.readOnly }),
},
backends: {
direct: () => directBackend(),
},
});