WIP: feat(wasm): expose taildrive WebDAV server and listDrivePeers via JS bridge #10
Reference in New Issue
Block a user
Delete Branch "feat/drive-wasm-bridge"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
drive.go: implementsdrive.FileSystemForRemotewith a JS-backed streaming handler. The Go goroutine stays alive for the response duration; JS callswrite(chunk)/end()to stream the body back. Request body is streamed chunk-by-chunk viareadBodyChunk()(no full-body buffering).drive_stub.go: no-op stubs forts_omit_drivebuilds.peer.go:buildPeerAPIURLhelper extracted from the inline logic inrun().wasm_js.go: callinitDriveForRemotebeforeNewLocalBackend(SubSystem is set-once), exposesetDriveHandlerandlistDrivePeersviawireDriveJS, refactor peerAPI URL logic to usebuildPeerAPIURL.listDrivePeersmirrors nativedriveRemotesFromPeers: returns empty ifDriveAccessEnabled()is false, filters peers byPeerCapabilityTaildriveSharervia the live ACL cap map (lb.PeerCaps(addr).HasCapability()).Auth is fully handled by
handleServeDriveinpeerapi_drive.gobefore our code runs — the JS handler only receives pre-authenticated, permission-scoped requests.Test plan
GOARCH=wasm GOOS=js ./tool/go vet ./cmd/tsconnect/wasm/passesGOARCH=wasm GOOS=js ./tool/go build ./cmd/tsconnect/wasm/compiles cleanlysetDriveHandlerwired up in the JS object returned bynewIPNlistDrivePeersreturns empty array whenDriveAccessEnabled()is falsedrive:shareACL can be browsed via WebDAV from another node🤖 Generated with Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.