Skip to content

Add built-in WebSocket terminal endpoint (--terminal) #234

@melvincarvalho

Description

@melvincarvalho

Summary

Add a --terminal flag that exposes a WebSocket endpoint at /.terminal for interactive shell access. Combined with an xterm.js pane, this gives pod owners a full terminal in the browser.

Implementation

~30 lines in the WebSocket handler:

import { spawn } from 'child_process'

// On WebSocket connect to /.terminal
const shell = spawn('/bin/sh', { env: process.env })
ws.on('message', data => shell.stdin.write(data))
shell.stdout.on('data', data => ws.send(data))
shell.stderr.on('data', data => ws.send(data))
shell.on('exit', () => ws.close())

Security

  • Owner-only: requires authentication (DPoP/Solid OIDC)
  • Disabled by default, opt-in via --terminal
  • Only accessible to the pod owner (ACL check)

Use case

Developers using losos as a phone OS / pod browser need shell access. Rather than installing ttyd as a separate process, JSS provides it natively. The terminal pane in nosdav/browser connects xterm.js to this endpoint.

No extra dependencies

  • xterm.js loads from CDN in the browser pane
  • Shell spawning uses Node.js built-in child_process
  • WebSocket infrastructure already exists (--notifications)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions