BPT

BptTerminalClient

The BptTerminalClient component provides an interactive web-based terminal emulator with multiple theme options (MATE Desktop, Amiga Workbench 1.3, Amiga Workbench 3.1, MS-DOS, Commodore 64). It supports multi-tab sessions, real shell access with PTY allocation, full color support, and interactive programs. In Server mode, commands execute directly on the server via process piping. In WebAssembly mode, commands are routed through a SignalR hub to the server. Use Sandbox mode for safe demo environments with a fake filesystem. Requires one line of setup in Program.cs: app.MapBptTerminalHub()

Terminal Parameters
Terminal client demo
Current Configuration
📋 [+]
<BptTerminalClient
    Height="500px"
    Shell="/bin/bash"
    Enabled="true"
    Theme="BptTerminalTheme.Light"
    Sandbox="false"
    @bind-Floating="floating"
    CollapsedMode="false"
    OnSessionCreated="OnSessionCreated"
    OnSessionClosed="OnSessionClosed"
    OnCommandExecuted="OnCommandExecuted" />

@code {
// Program.cs setup (required):
using Bpt.Components.Tools;
builder.Services.AddSignalR();
app.MapBptTerminalHub();

// Fields
private string height = "500px";
private string shell = "/bin/bash";
private bool enabled = true;
private BptTerminalTheme theme = BptTerminalTheme.Light;
private bool sandbox = false;
private bool floating = false;
private bool collapsedMode = false;

// Event handlers
private void OnSessionCreated(string sessionId)
{
    // Handle session created
}

private void OnSessionClosed(string sessionId)
{
    // Handle session closed
}

private void OnCommandExecuted(string command)
{
    // Handle command executed
}
}
Available Shells by Platform
Windows
  • powershell.exe — Windows PowerShell 5.x
  • cmd.exe — Command Prompt
Install pwsh for PowerShell 7+ (cross-platform).
macOS
  • /bin/zsh — Default shell (macOS Catalina+)
  • /bin/bash — Bourne Again Shell
PTY allocated via script for full color and interactive support.
Linux
  • /bin/bash — Default on most distros
  • /bin/sh — POSIX shell
  • /bin/zsh — Z Shell (if installed)
PTY allocated via script for full color and interactive support.

The Shell dropdown only shows shells available on the current server platform. Each new tab uses the currently selected shell.
Security Warning

BptTerminalClient provides real shell access to the server when Sandbox mode is disabled. Any user with access can execute arbitrary commands with the permissions of the application's process identity.

  • Never expose a non-sandboxed terminal to the public internet.
  • Always enable Sandbox mode for demo or public-facing deployments.
  • Place the terminal behind authentication and authorization.
  • Run the application under a least-privilege service account.
  • Use BlockedCommands as defense-in-depth only, not as a primary security measure.
  • Consider network segmentation and container isolation for production use.
Risks include: filesystem access, arbitrary process execution, network access, secret exposure, and potential privilege escalation.
Program.cs Setup

Add the following to your Program.cs to enable BptTerminalClient:

using Bpt.Components.Tools;

// SignalR is required (already added if using Blazor Server)
builder.Services.AddSignalR();

// Map the terminal hub endpoint (after MapBlazorHub)
app.MapBptTerminalHub();
The hub endpoint defaults to /bpt-terminalhub. Override with app.MapBptTerminalHub("/custom-path").
An unhandled error has occurred. Reload 🗙

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please reload the page.