-
-
Notifications
You must be signed in to change notification settings - Fork 3
Web Interface Mode
Mastui includes a high-performance, built-in web terminal server that lets you run Mastui in any modern web browser without installing terminal emulators or SSH clients.
mastui --webWhen started with --web, Mastui hosts a local asynchronous HTTP/WebSocket server, opens your default web browser, and streams the interactive Textual TUI interface directly to an embedded Xterm.js terminal canvas.
# 1. Start Mastui in web mode (opens default browser at http://127.0.0.1:8000)
mastui --web
# 2. Bind to custom port
mastui --web --web-port 8080
# 3. Headless / Server mode (bind to all network interfaces without opening a local browser)
mastui --web --web-host 0.0.0.0 --web-port 8080 --no-browser| Flag | Default | Description |
|---|---|---|
--web |
False |
Enables Web Browser / WebView mode. |
--web-host <HOST> |
127.0.0.1 |
IP address to bind the web server. Use 0.0.0.0 to allow external access. |
--web-port <PORT> |
8000 |
TCP port for HTTP and WebSocket communication. |
--no-browser |
False |
Suppresses automatically launching the system web browser on startup. |
The web interface is implemented in mastui/web.py with zero external server dependencies (using Python's standard library asyncio and http.server foundations):
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Modern Web Browser / Mobile Device β
β - Xterm.js Terminal with DOM Renderer β
β - Custom Unicode 15+ Emoji Provider (π, Flags, etc.) β
β - Automatic Viewport Resize & FitAddon β
βββββββββββββββββββββββββββββ²βββββββββββββββββββββββββββββ
β WebSocket (RFC 6455)
βββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ
β Mastui Web Bridge (mastui.web) β
β - Rolling Terminal History Replay Buffer (500k chars) β
β - Asynchronous PTY / Pipe Multiplexer β
β - UTF-8 Incremental Decoder & XTermParser β
βββββββββββββββββββββββββββββ²βββββββββββββββββββββββββββββ
β PTY / Pipe Driver
βββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ
β Mastui Textual Application (mastui.app) β
β - Timelines, Compose Dialogs, Themes, Keymaps β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- RFC 6455 Compliant WebSocket Server: Lightweight, handshake-validated bidirectional communication.
- Rolling History Replay Buffer: Caches early ANSI escape sequences emitted during app initialization. When a browser connects (or reconnects after a network drop), the full screen state is replayed immediately.
-
Advanced Unicode 15+ Provider: Registers an accurate character width provider covering modern emoji planes, sparkling heart (
U+1F496), skin-tone modifiers, and Regional Indicator country flags (U+1F1E6-U+1F1FF, width 1 per symbol, 2 per flag pair) ensuring seamless cell alignment without visual gaps. -
Fallback PipeDriver: Operates both with native Unix pseudo-terminals (
pty.openpty()) and in restricted environments via bidirectional non-blocking OS pipes.
Running Mastui on a home server, Raspberry Pi, or cloud VPS allows you to access your Mastodon feeds from anywhere.
Create /etc/systemd/system/mastui-web.service:
[Unit]
Description=Mastui Web Interface
After=network.target
[Service]
Type=simple
User=youruser
WorkingDirectory=/home/youruser
ExecStart=/usr/local/bin/mastui --web --web-host 127.0.0.1 --web-port 8080 --no-browser
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.targetEnable and start the service:
sudo systemctl daemon-reload
sudo systemctl enable --now mastui-webTo expose Mastui securely over HTTPS with Let's Encrypt, configure a reverse proxy.
server {
server_name mastui.yourdomain.com;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 86400s;
proxy_send_timeout 86400s;
}
}mastui.yourdomain.com {
reverse_proxy 127.0.0.1:8080
}When accessing Mastui Web on a mobile browser or tablet:
- Responsive Viewport: The terminal canvas automatically recalculates column and row dimensions on screen orientation changes.
- On-Screen Keyboard: Tapping the terminal opens the virtual keyboard.
- Touch-Friendly Modals: Dialog buttons, language selectors, and options switches respond to touch taps.
Mastui Wiki β The fast, keyboard-driven terminal and web client for Mastodon.
GitHub Repository β’ Releases β’ Issues